uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
dcfbe056-6c3c-437e-a06c-4785928411f7 | Rage-Fox/GeeksforGeeks | Easy/Find the Highest number/find-the-highest-number.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int findPeakElement(vector<int>& a){
// Code here.
return *max_element(a.begin(),a.end());
}
};
//{ Driver Code Starts.
int main(){
int T;
cin >> T;
while(T--)
{
... | ALGO | 0.99992 | 5.297328 |
b86389b1-3174-46fe-aa9d-17fe9bc0fd95 | ankan-ekansh/Competitive-Programming | Spoj List/MKEQUAL.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t--){
int n;
... | ALGO | 0.999924 | 3.42 |
13318ecb-d1cf-4f77-968f-cb5e85a18ece | kunj-bhuva/Codeforces | July-2023/16-Sunday/1848b.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> diff(vector<int>a,vector<int>b,int n)
{
vector<int> res;
for(int i=0;i<n;i++)
{
int a1=a[i]-b[i];
if(a1>=0)res[i]=a1;
else res[i]=-1*a1;
}
return res;
}
int main()
{
int t;
cin>>t;
while(t)
{... | ALGO | 0.999884 | 3.301151 |
1ec6f643-1f09-4969-a7ab-23f3b4c700c0 | sanzid007/Leet-Code-Problems | pascal triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> res;
for(int i = 0; i < numRows; i++) {
res.push_back(vector<int>(i+1,1));
for(int j = 1; j < i; j++)
res[i][j] = res[i-1][j-1] + res[i-1][j];
}
return res... | ALGO | 0.99989 | 5.532632 |
059a85b2-8b09-4dcc-9edd-d65b47fe2f51 | minkyoe/Algorithm | Baekjoon/2565_전깃줄.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<pair<int,int>> vt;
int N; // 전깃줄 개수
int lis[101];
int lower_bound(int start, int end, int target) {
int mid;
while (end - start > 0) {
mid = (start + end) / 2;
if (lis[mid] < target) start = mid + 1;
... | ALGO | 0.999954 | 4.289454 |
ae9a8604-2604-47ee-a069-12cec7422122 | sanjaykaswan/Codeforces_codes | B-Gift fixing.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t,n;
cin>>t;
for (int i = 0; i < t; i++)
{
vector<int>va;
vector<int>vb;
cin>>n;
long long int mina = pow(10,10);
long long int minb = pow(10,10);
long long int a,b,ans = 0;
for (int j ... | ALGO | 0.999975 | 3.710363 |
be63ba8d-f3eb-46d1-85df-d40e3175cd20 | HeavensExperience-Staging/bootable_recovery | otautil/rangeset.cpp | #include "otautil/rangeset.h"
#include <limits.h>
#include <stddef.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
RangeSet::RangeSet(std::vect... | TOOL | 0.90322 | 7.494637 |
ad833ac6-cb14-4765-8e12-f8e872736ad0 | liamabcxyz/Cpp_Improvement | LeetCode/Category_String/RansomNote/2.cpp | class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
int ra[26]={0},rm[26]={0};
for(int i=0;i<ransomNote.size();i++) ra[ransomNote[i]-'a']++;
for(int i=0;i<magazine.size();i++) rm[magazine[i]-'a']++;
for(int i=0;i<26;i++)
if(ra[i]>rm[i])
... | ALGO | 0.999929 | 6.247456 |
9131f687-c27b-4a57-b09f-b41547d2d6db | jhs10507/Cording-Test | 프로그래머스/0/120817. 배열의 평균값/배열의 평균값.cpp | #include <string>
#include <vector>
#include <numeric>
using namespace std;
double solution(vector<int> numbers) {
double answer = 0;
double sum = accumulate(numbers.begin(), numbers.end(), 0.0);
answer = sum / numbers.size();
return answer;
} | ALGO | 0.992629 | 4.592445 |
b27e0e9b-851f-49de-8395-5a243fd51139 | Santiago25k/Analista-Funcional-de-Sistemas | C++/CPP/tiktok/ej_promedio1.cpp | //!Algoritmo que reciba como entrada tres numeros enteros e indique como salida el promedio de ellos.
#include <iostream>
using namespace std;
int main () {
int num1, num2, num3;
cout << "Ingresa el primer numero para calcular el promedio " << endl;
cin >> num1;
cout << "Ingresa el segundo numero pa... | ALGO | 0.944513 | 3.78862 |
6a8d7d0f-d716-406c-9cab-83ae23d51115 | K-gmx/Roxy | Code/LuoGu/蓝桥/P8647 [蓝桥杯 2017 省 AB] 分巧克力.cpp | #include<bits/stdc++.h>
#define ll long long
#define N 100000+10
using namespace std;
const int INF=0x3f3f3f3f;
int cnt=0;
int n,k;
int a[N][3];
bool check(int x){
cnt=0;
for(int i=1;i<=n;i++){
cnt+=(a[i][1]/x)*(a[i][2]/x);
}
if(cnt>=k) return true;
return false;
}
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++)... | ALGO | 0.999978 | 4.118366 |
37538f38-9c8d-446e-ae7b-bc461a56c651 | alexdimitrov18/SDP-personal | Дървета/6traversals.cpp | #include <iostream>
#include <queue>
using namespace std;
struct BSTNode
{
char data;
BSTNode *left, *right;
};
void insertNode(BSTNode *& t, char x)
{
if (t==nullptr)
{
t=new BSTNode;
t->data=x;
t->left=t->right=nullptr;
}
else if (x != t->data)
{
if(x<t->d... | ALGO | 0.999942 | 4.924165 |
94ca303f-6312-4b9c-bc8f-fc999a3d4fb0 | wkdnffla3/Practice_C | Practice/flower_road_14620.cpp | #include<iostream>
using namespace std;
int price[10][10] = { 0 };
int map[10][10] = { 0 };
int total_price = 3000;
int temp_price = 0;
int N;
int m_i[5] = { 0, 0,1,0,-1 };
int m_j[5] = { 0,-1,0,1,0 };
typedef struct P {
int i, j;
}P;
P p1, p2, p3;
bool p1b, p2b, p3b;
void proc() {
p1b = p2b = p3b = false;
for (in... | ALGO | 0.999629 | 3.290877 |
eed5c7fd-b62f-42db-b98f-ad80fdb6ef40 | VedantParanjape/gem5 | src/systemc/tests/systemc/datatypes/fx/arith_big/add_big.cpp | /*****************************************************************************
add_big.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | ALGO | 0.926216 | 5.821183 |
84e7f16b-c0e8-4b6d-a7ca-542d721568fd | panthghoniya/cpp-DSA | day-6/pdf -1/2.cpp | #include<iostream>
using namespace std;
int main(){
int x = 10, y = 1;
while (x >= y)
{
cout << x << " ";
x--;
}
} | ALGO | 0.999415 | 3.617334 |
11bf9d47-01b7-4171-9c96-bbc15109ce1a | cwang588/algorithms | dabiao.cpp | #include<bits/stdc++.h>
using namespace std;
long long c[50][50];
void init()
{
for(int i=0;i<=20;++i)
c[i][0]=1;
for(int i=1;i<=20;++i)
for(int j=1;j<=i;++j)
c[i][j]=c[i-1][j]+c[i-1][j-1];
}
long long ans[25][25];
int main()
{
init();
for(int n=2;n<=20;++n)
for(int k=2;k<n;++k)
for(int i=1;i<=ceil((dou... | ALGO | 0.999959 | 3.062646 |
c4027af0-09e3-4083-be74-6d9b73f8bdc0 | MaitreyaLimkar/PhySim-Framework-SoSe2024 | physsim/2_stability/main.cpp | #include "physsim_window.hpp"
#include "simulation.hpp"
using namespace vislab;
namespace physsim
{
/**
* @brief Stores parameters of a spring.
*/
struct Spring
{
/**
* @brief Stiffness constant.
*/
double stiffness;
/**
* @brief Rest length of... | ALGO | 0.913029 | 6.165027 |
1bce9c3f-7800-4c58-a192-b1d7a0c4c347 | youtube/cobalt | buildtools/third_party/libc++/trunk/test/libcxx/algorithms/partial_sort_stability.pass.cpp | // <algorithm>
// Test std::partial_sort stability randomization
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>
#include <cassert>
#include <functional>
#include <iterator>
#include <vector>
#include "test_macros.h"
struct My... | TEST | 0.962528 | 7.196834 |
85913064-16d5-48c6-9a22-35fcdfb61c1b | hmwang2002/Algorithm-Learning | leetcode/leetcode-45.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int jump(vector<int> &nums)
{
int ans = 0;
int end = 0; // 能跳的区间终点
int maxPos = 0;
for (int i = 0; i < nums.size() - 1; i++)
{
maxPos = max(maxPos, nums[i] + i);
if (i == end)... | ALGO | 0.99998 | 5.067365 |
b3d73590-2465-4a97-b758-656446429223 | hitesh11tahiliani/DSA-Leetcode | Aggressive Cows - GFG/aggressive-cows.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
bool isPossible(vector<int> &stalls, int k, int mid, int n){
int cowCount =1;
int lastPos = stalls[0];
for(int ... | ALGO | 0.999991 | 6.002577 |
9981a7c8-1240-48bf-98f2-b9410f1874b7 | rdowavic/OldQuadTree | node.cpp | #include "node.h"
#include <iostream>
Link::Link() {
new (&node) std::unique_ptr<Node>(nullptr);
}
Link::~Link() {}
Node::Node() {}
int Node::currentUsage = 0;
int Node::maxUsage = 0;
void* operator new(size_t size) {
// the user made a new node so pls record it
currentUsage++;
// do a max check
... | ALGO | 0.985069 | 3.931956 |
b1b72adb-a0df-432a-8b20-5ff94a673a99 | dfantonio/UFRGS-ENG04475 | forninho/Core/lib/tempo/tempo.cpp | #include <stdio.h>
void formataTempo(char *str, int tempoSegundos) {
int horas, minutos;
horas = tempoSegundos / 3600;
minutos = (tempoSegundos % 3600) / 60;
sprintf(str, "%02d:%02d", horas, minutos);
}
bool passouIntervalo(uint32_t *tempoAntigo, uint32_t tempoAtual, int intervalo) {
if ((tempoAtual - *te... | TOOL | 0.871029 | 4.527025 |
e747f0f5-cef5-453f-9aa2-db83c8e93645 | LHS-11/Algorithm | 프로그래머스/level3/여행경로.cpp | #include <bits/stdc++.h>
using namespace std;
multimap<string, string> mtp; // 경로 표시
map<string, int> mp; // 경로 숫자로 변환
int vis[10004][10004];
vector<string> answer;
vector<string> ans;
void dfs(string cur, int sz)
{
if (answer.size() == sz)
{
if (!ans.size())
ans = answer;
... | ALGO | 0.999903 | 5.88262 |
61be3407-6755-4e06-80a1-feef49cae477 | sarvex/leetcode-s | solution/2600-2699/2651.Calculate Delayed Arrival Time/Solution.cpp | class Solution {
public:
int findDelayedArrivalTime(int arrivalTime, int delayedTime) {
return (arrivalTime + delayedTime) % 24;
}
}; | ALGO | 0.999035 | 5.90597 |
0869c492-75ca-49df-8b0a-e196e0d1bb4b | sarvex/leetcode-io | solution/2300-2399/2347.Best Poker Hand/Solution.cpp | class Solution {
public:
string bestHand(vector<int>& ranks, vector<char>& suits) {
bool flush = true;
for (int i = 1; i < 5 && flush; ++i) {
flush = suits[i] == suits[i - 1];
}
if (flush) {
return "Flush";
}
int cnt[14]{};
bool pair = ... | ALGO | 0.999837 | 6.191286 |
6c631c47-4aee-4c83-8f4e-380a700ff323 | Synismusist/VsWorld | src/XLimitJIAutotuner.cpp | #include "plugin.hpp"
#include <array>
#include <vector>
struct XLimitJIAutotuner : Module {
enum ParamId {
POW2_PARAM,
POW3_PARAM,
POW5_PARAM,
POW7_PARAM,
POW11_PARAM,
POW13_PARAM,
POW17_PARAM,
POW19_PARAM,
REMAP_PARAM,
PARAMS_LEN
};
enum InputId {
VOCT_INPUT,
INPUTS_LEN
};
enum OutputId... | TOOL | 0.894793 | 5.342193 |
99026ec4-4086-43e8-ab05-d7bd1898603a | TanveerShahriar/XPSC | Week 3/Day 2/A_yes_or_yes.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while (t--)
{
string n;
cin >> n;
if((n[0] == 'Y' || n[0] == 'y') && (n[1] == 'E' || n[1] == 'e') && (n[2] == 'S' || n[2] == 's'))
{
cout<<"YES";
}
else cout<<"NO";
... | ALGO | 0.985038 | 3.978709 |
4fb88944-5b7d-4730-8624-6d7e21d62e35 | devgtv/allexercisesonthebeecrowd | ex1160.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int PA, PB;
double G1, G2;
cin >> PA >> PB >> G1 >> G2;
int anos = 0;
while (PA <= PB && anos <= 100) {
PA += static_cast<int>(PA * (G1 / 100));
... | ALGO | 0.99594 | 3.989456 |
6306b337-2745-414a-8741-b843e16b93ff | FbStatsQuant/Black-Scholes-Option-Pricer | main.cpp | #include <iostream>
#include <iomanip>
#include "EuropeanOption.h"
int main() {
EuropeanOption opt(100.0, 100.0, 0.05, 1.0, 0.2); // ATM call/put
std::cout << std::fixed << std::setprecision(4);
std::cout << "European Call Price: " << opt.priceCall() << std::endl;
std::cout << "European Put Price: "... | ALGO | 0.89777 | 7.277831 |
73d334cf-a0e7-4787-93f8-3b31f1dcb189 | argaghulamahmad/zxing-wasm | core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <zxing/pdf417/decoder/ec/ErrorCorrection.h>
#include <zxing/pdf417/decoder/ec/ModulusPoly.h>
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
using std::vector;
using zxing::Ref;
using zxing::ArrayRef;
using zxing::pdf417::decoder::ec::Er... | ALGO | 0.999632 | 6.060442 |
cf55238e-591c-4555-a60a-486d38062819 | wenchilo/Leetcode | Array/long_comm_pre.cpp | #include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
class Solution{
public:
string longestCommonPrefix(vector<string>& strs){
bool flag = 1;
char ch;
int index = 0, min_length;
string longest;
if(strs.size() == 0)
return "";
while(1){... | ALGO | 0.998365 | 4.119545 |
b9e9920d-fad4-4e5a-9ea2-aaacda612f10 | ishandutta2007/codeforces | lzr_010506/normal/388/D.cpp | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
const int N = 35;
int f[N][2][N], k,a[N],n,ans;
int main()
{
scanf("%d",&k);
k ++;
for(; k; k >>= 1) a[++ n] = k & 1;
f[n][0][0] = 1;
for(int i = n; i; i --)
for(int j = 0; j < 2; j ++)
for(int k = 0; k < n; k ++)
{... | ALGO | 0.99998 | 3.851163 |
00081964-37e1-411a-a01c-d4fcbe968615 | shivachaudhary46/DSA-Journey | book_allocation_problems/binary_search_monotonic_rotated_array.cpp | #include<iostream>
#include<vector>
using namespace std;
int getPivot(int nums[], int start, int end){
int s = start;
int e = end;
int mid = s+(e-s)/2;
while(s<e){
if(nums[mid]>=nums[0]){
s = mid+1;
}else{
e = mid;
}
... | ALGO | 0.999972 | 4.716669 |
551c2568-effc-4794-89dd-c7ebbe6a6f44 | uniericuni/leetcode | 376_Wiggle_Subsequence.cpp | #include<algorithm>
class Solution {
public:
int wiggleMaxLength(vector<int>& nums) {
if(nums.size()==0)
return 0;
int count = 1, flag = 0, prev = nums[0], ans = 0;
for(int i=0; i<nums.size(); i++){
if(prev>nums[i] && flag>=0){
fl... | ALGO | 0.999986 | 5.455573 |
2924f6f3-3ead-4886-aefb-9fd110d024dc | daegwang/problem-solving | acmicpc.net/Mathematics/1978.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
int main()
{
freopen("input.txt", "r", stdin);
int n;
int sieve[1001];
memset(sieve, -1, sizeof(sieve));
sieve[1] = 0;
for(int i=2; i<=100... | ALGO | 0.999844 | 3.763682 |
cbbb4f43-a399-4fcf-931d-b8d812147436 | nodejs/worker | deps/icu-small/source/common/bytestriebuilder.cpp | #include "unicode/utypes.h"
#include "unicode/bytestrie.h"
#include "unicode/bytestriebuilder.h"
#include "unicode/stringpiece.h"
#include "charstr.h"
#include "cmemory.h"
#include "uhash.h"
#include "uarrsort.h"
#include "uassert.h"
#include "ustr_imp.h"
U_NAMESPACE_BEGIN
/*
* Note: This builder implementation stor... | TOOL | 0.959 | 7.581193 |
108d0bcb-e53b-4599-b951-1a308137d075 | TylerBrock/books | C++ Primer Plus/listings/functor.cpp | // functor.cpp -- using a functor
#include <iostream>
#include <list>
#include <iterator>
#include <algorithm>
template <class T> // functor class defines operator()()
class TooBig
{
private:
T cutoff;
public:
TooBig(const T & t) : cutoff(t) {}
bool operator()(const T & v) { return v >... | TOOL | 0.980789 | 6.146173 |
45b0ba58-4ac8-45df-b72e-99b8aa5a07b0 | MCInversion/LSWMeshFlow | src/pmp/algorithms/Parameterization.cpp | #include "pmp/algorithms/Parameterization.h"
#include <cmath>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include "pmp/algorithms/DifferentialGeometry.h"
namespace pmp {
Parameterization::Parameterization(SurfaceMesh& mesh) : mesh_(mesh)
{
bool has_boundary = false;
for (auto v : mesh_.vertices())
... | ALGO | 0.998881 | 6.984313 |
e086f020-bd1d-4f87-a8ca-98ee11231ca2 | gaurav7906/leetcode-solutions | 0003-longest-substring-without-repeating-characters/0003-longest-substring-without-repeating-characters.cpp | #include <unordered_map>
#include <iostream>
using namespace std;
class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_map<char, int> mp;
int maxi = 0; // Maximum length of substring without repetition
int j = 0; // Left pointer of the window
int n = s.lengt... | ALGO | 0.999918 | 5.97132 |
a06ac2fc-bf01-415f-b108-cf0bc69cf5ab | muschellij2/FSL6.0.0 | extras/include/boost/libs/spirit/workbench/qi/keywords.cpp | #define FUSION_MAX_VECTOR_SIZE 50
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_LIST_SIZE 50
#define BOOST_MPL_LIMIT_VECTOR_SIZE 50
#include "../measure.hpp"
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#i... | TOOL | 0.895775 | 7.519102 |
704c8230-4c3d-4327-b055-6a44d405be41 | Ido-Sobol/Arduino-Elevator | src/main.cpp | #include <Arduino.h>
const int pin = A1;
const int forward = 6;
const int back = 5;
const int powerPin = 9;
const int potentiometerPin = A3;
double target = 9.8;
// Constants for the PID control
const float kP = 60;
const float kI = 0.5;
const float kD = 7;
// Variables to store the error values and integral
float er... | ALGO | 0.985608 | 5.246665 |
810bc495-747c-4309-9149-3ad577e59403 | manav-yb/LeetCode | Backtracking/Prob2ballsSameDistinctColor.cpp | #include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <random>
using namespace std;
#define vi vector<int>
class Solution{
long long valid_ways, total_ways, total;
int C[7][7];
public:
void backtracking(int idx, int currCount, int k1, int k2,double p, vi ... | ALGO | 0.998863 | 4.245857 |
1ba3a68d-d472-4191-b567-c86405ea785e | Lohmal/CheckCardNumber | CardNumber/CardNumber.cpp | #include <iostream>
#include <conio.h>
#include <string>
using namespace std;
void Errors(string a, int* c);
int Num1(string num);
int Num2(string num);
int main()
{
string cardNumber;
int passed,count = 0;
while (true)
{
cout << "Card number : ";
cin >> cardNumber;
Errors(cardNumber, &count);
if (count ==... | ALGO | 0.987186 | 3.731657 |
db8c021e-0ed3-4e4a-b606-526f53224745 | Nayandeep1431/Leetcode-Solutions | Recursion and Backtracking/Sudoku Solver.cpp | class Solution {
public:
bool valid(vector<vector<char>>&board , int row , int col , char ch){
for(int i =0 ; i< 9 ; i++){
if(board[row][i] == ch)
return false ;
if(board[i][col] == ch)
return false ;
if(board[3*(row / 3) + i / 3][3*(col /... | ALGO | 0.99947 | 6.688691 |
ae0dd2d7-eaef-4b35-a468-69efd7c7a495 | kalwaniya/ALGORITHM-CODE | ALGORITHM /allpairshortestpath.cpp | #include <iostream>
using namespace std;
void floyds(int b[][10],int n)
{
int i, j, k;
for (k = 0; k < n; k++)
{
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
if ((b[i][k] * b[k][j] != 0) && (i != j))
{
... | ALGO | 0.999961 | 3.746284 |
06088442-2861-4e68-859b-4a61f6f094e3 | sanyinchen/algorithm | cpp/leetcode/part1/Is_subsequence_392.cpp | //
// Created by sanyinchen on 2020/4/9.
//
#include <iostream>
using namespace std;
class Solution {
public:
bool isSubsequence(string s, string t) {
int sum = 0;
for (int i = 0, j = 0; i < s.length() && j < t.length(); j++) {
char s_char = s[i];
char t_char = t[j];
... | ALGO | 0.99978 | 6.222558 |
2e00a1b4-ce21-41ae-9714-0fc031a26205 | Kerr1291/cpp_game_engine | engine/ko_framework/Box2D/Collision/b2Distance.cpp | #include <Box2D/Collision/b2Distance.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
int3... | ALGO | 0.999949 | 3.500086 |
7a1ca62b-c08b-4dbf-a541-a36cf8756fc3 | Alereds/CapriHPC | OpenMP_ComputeNormals/compute_normals.cpp | #include <iostream>
#include <omp.h>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <chrono>
#include <cmath>
#include <errno.h>
using namespace std;
class vector3
{
public:
float x, y, z;
vector3(float xx, float yy, float zz)
{
x = xx;
y = yy;
z = zz;... | ALGO | 0.999129 | 4.494211 |
2835cb17-523c-423f-8225-e7cb4f92696e | raincross7/code-similarity | codes/train_code/problem423/problem423_278.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
int main(){
ll n,m;cin>>n>>m;
if(n==1||m==1){
if(n==1&&m==1)return cout<<1,0;
ll x=max(n,m);
cout<<max(ll(0),x-2);
}else cout<<max((n*m)-2*(n+m)+4,ll(0));
} | ALGO | 0.999957 | 3.065367 |
fc24ad83-f410-4af4-a277-00b121066cfa | raincross7/code-similarity | codes/train_code/problem346/problem346_422.cpp | #include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
//https://atcoder.jp/contests/abc176/tasks/abc176_e
vector<pair<int,int>> row, col;
set<pair<int,int>> bombs;
int main() {
int r, c, m, a, b; scanf("%d %d %d", &r, &c, &m);
row.resize(r + 1); col.resize(c + 1);
for(int i=0; i<=... | ALGO | 0.999643 | 4.322093 |
43cf80c3-d422-4845-887a-89103369f0b6 | lorderikstark0/leetcode | weeklycontest196/5453.cpp | #include <bits/stdc++.h>
using namespace std;
int getLastMoment(int n ,vector<int>& left,vector<int>& right){
int leftSize=left.size();
int rightSize=right.size();
}
int main(){
int n ;
cin >> n ;
vector<int> left;
vector<int> right;
int h;
cin >> h;
while(h--){
int a;
cin >>a ;
left.push_back(a);
}... | ALGO | 0.999915 | 3.257109 |
186362ac-a508-46aa-909d-9dc43a25d30f | ajoydas/UVa-Problem-Solve | traffic volume.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ms0(a) memset(a,0,sizeof(a))
#define msn(a,n) memset(a,n,sizeof(a))
#define until(i,n) for(__typeof(n)i=0;i<n;i++)
#define For(i,n) for(__typeof(n)i=1;i<=n;i++)
#define init(i,a,n) for(i=0;i<n;i++)a[i]=i
#define inf INT_MAX
#define ll long long
... | ALGO | 0.998805 | 3.315381 |
a9c7a997-9445-488e-94ae-25c7bf72c27e | FasiIkom/book-tracker-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.9988 | 6.76073 |
39e408e9-f478-4dac-bba7-0569282955f8 | Keyu-He/Enhancing-Debugging-Skills-of-LLMs-with-Prompt-Engineering | solutions_correct/algorithms/J/Jump Game VI/Jump Game VI.cpp | #define pii pair<int, int>
class Solution {
public:
int maxResult(vector<int>& nums, int k)
{
int n=nums.size();
int score[n];
priority_queue<pii> pq;
for(int i=n-1 ; i>=0 ; i--)
{
while(pq.size() && pq.top().second>i+k)
pq.pop();
... | ALGO | 0.999966 | 5.13339 |
a51a0b60-59b0-40c9-90b7-884fbf79c89d | MustangYM/ShelbyObfuscator | libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp | // <algorithm>
// template<InputIterator Iter, Callable<auto, Iter::reference> Function>
// requires CopyConstructible<Function>
// constexpr Function // constexpr after C++17
// for_each(Iter first, Iter last, Function f);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_itera... | TEST | 0.97049 | 7.128823 |
b9207ab8-a20f-42f1-8091-f5fc429caa36 | NadiaTamayo15/BrainFoodChallenge | brainfoodchalleng/lib/python3.9/site-packages/prophet/stan_model/cmdstan-2.33.1/stan/lib/stan_math/lib/tbb_2020.3/src/perf/fibonacci_impl_tbb.cpp | #include <cstdio>
#include <cstdlib>
#include "tbb/task_scheduler_init.h"
#include "tbb/task.h"
#include "tbb/tick_count.h"
extern long CutOff;
long SerialFib( const long n ) {
if( n<2 )
return n;
else
return SerialFib(n-1)+SerialFib(n-2);
}
struct FibContinuation: public tbb::task {
lon... | ALGO | 0.999197 | 4.705167 |
e2b30c23-9f43-428b-98a7-dd64439710ea | devCharlieP/PS_Baekjoon | 18290/소스.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n, m, k;
vector <vector<int>> vec(11, vector<int>(11));
vector <vector<int>> ch(11, vector<int>(11));
vector <vector<int>> vec_empty(11, vector<int>(11));
vector <int> dx = { 0, 0, -1, 1};
vector <int> dy = { 1, -1, 0, 0};
int maxi = ... | ALGO | 0.999722 | 4.012979 |
0543a8a1-7ce1-44e3-b302-dff31b0f6517 | harsh085/CompetitiveProgramming | fast.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define inf 1000000000
#define f(i,a,b) for(int i=a; i<b; i++)
#define endl "\n"
// const int mod=1e9+7;
void solve(){
cout<<10%3;
}
int main(){
ios_base::sync_with_stdio(false);
cin... | ALGO | 0.999242 | 3.817859 |
511ac6ab-d065-4b6c-8aea-c97d8d0dad94 | mostconst/graphics-problems | utils/math_util.cpp | #include "math_util.h"
#include "glm/fwd.hpp"
#include "glm/vec4.hpp"
#include <glm/gtc/matrix_transform.hpp>
namespace math_utils
{
glm::mat4 rowMajorMatrix(glm::vec4 row1, glm::vec4 row2, glm::vec4 row3, glm::vec4 row4)
{
return glm::transpose(glm::mat4(row1, row2, row3, row4));
}
glm::mat4 perspective(float... | TOOL | 0.990856 | 6.391939 |
d5d66f19-064b-4d13-853f-f9c04e59423f | YUXUANCHENG/Leetcode | 217_duplicate/hash.cpp | #include <vector>
#include <unordered_set>
class Solution {
public:
bool containsDuplicate(std::vector<int>& nums) {
bool result = false;
std::unordered_set<int> set;
for (int num : nums)
{
auto find_result = set.find(num);
if (find_result == set.end())
... | ALGO | 0.999367 | 5.850375 |
076d64ee-524b-4356-a22e-ddf6d7d7ecc0 | HandsomeLuoyang/alalgorithm_2024 | leetcode/42-trapping-rain-water.cpp | /**
* Created by leiyang on 2024/4/10 14:34
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int trap(vector<int> &height) {
int ans = 0;
stack<int> stk;
for(int i = 0;i < height.size();i++){
while(!stk.empty() && height[i] > height[stk.top()]){
... | ALGO | 0.999955 | 6.673781 |
7eb895ca-5b50-44c5-a1bc-b873cc907c5e | xieyangyuyue/Code-Capriccio | 哈希表/isAnagram.cpp | #include <iostream>
#include <string>
bool isAnagram(std::string s, std::string t) {
int record[26] = {0};
int length = s.size();
for (int i = 0; i < length; i++) {
// 并不需要记住字符a的ASCII,只要求出一个相对数值就可以了
record[s[i] - 'a']++;
}
for (int i = 0; i < length; i++) {
record[t[i] - 'a']--;
}
for (int i = 0; i < 26; ... | ALGO | 0.999623 | 5.004348 |
f931636a-bf65-4363-be83-5b0db6ee43e2 | Runarok/GeeksForGeeks-solutions | Difficulty: Easy/Reverse First K elements of Queue/reverse-first-k-elements-of-queue.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
vector<int> inputLine() {
string str;
getline(cin, str);
stringstream ss(str);
int num;
vector<int> res;
while (ss >> num) {
res.push_back(num);
}
return res;
}
// } Driver Code En... | ALGO | 0.999092 | 5.604724 |
a33590a7-48f6-4a53-a55e-223f7124e240 | Mus-42/cpp_labs | labs/lab12/task5.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <vector>
// Lab 12 Task 5
int main() {
constexpr const char* input_file = "data/lab12_Task5_inputs.txt";
std::ifstream f(input_file);
if (!f.is_open() || f.bad()) {
std::cout << "can't open `"... | ALGO | 0.998638 | 4.829359 |
8fdbba29-d391-4766-86c2-91390fef412f | unyieldingGlacier/coding-exercises | median-finder.cpp | /* LC 295
* Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.
* Examples:
* [2,3,4] , the median is 3
* [2,3], the median is (2 + 3) / 2 = 2.5
* Design a data structure that supports the following tw... | ALGO | 0.999997 | 6.52655 |
ebbaa5cc-dcb6-4f8b-9b94-10d7f32ed138 | golu088/math | 18-Programming-4kids/13_7.cpp | #include<iostream>
using namespace std;
bool is_lower(string str) {
for (int i = 0; i < (int)str.size(); ++i) {
bool lower = 'a' <= str[i] && str[i] <= 'z';
if (!lower)
return false;
}
return true;
}
int main() {
cout << is_lower("abc") << "\n";
cout << is_lower("aBC") << "\n";
return 0;
}
| ALGO | 0.998739 | 4.615391 |
0da19502-5ce3-4e9f-92d9-50e85dbdb84c | s1s1ty/UVA-problem-solution-with-CPP-code | UVA AC CODE/ac code/12834 - Extreme Terror.cpp | /* Shaonty Dutta
Bangladesh University
*/
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <list>
using namespace std;
#d... | ALGO | 0.999964 | 3.484751 |
387f6d7f-d585-429a-aba4-cc7a9aa1f55f | RaymRaym/Codeforces | cpp/1950A.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
int a, b, c;
cin >> a >> b >> c;
if (a < b && b < c) {
cout << "STAIR" << "\n";
} else if (a < b && b > c) {
cout << "PEAK" << "\n";
} else {
cout ... | ALGO | 0.999914 | 4.134302 |
86265cff-ecc8-4394-9eea-1f60bee89a22 | mwy3055/Algorithm-codes | baekjoon/cpp/c++/1516_slow.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n, enter[501], need[501], complete[501];
set<int> graph[501];
void getinput()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> need[i];
int pre;
cin >> pre;
while (pre != -1)
{
... | ALGO | 0.999978 | 4.260625 |
db441903-7e7a-4b63-af72-5cd878892363 | yashwardhan-gautam/cp | 580C.cpp | #include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#... | ALGO | 0.999857 | 4.453444 |
0916254e-7cdb-4045-96eb-dc9395bf2324 | nhatch/slam | slam_utils.cpp |
#include <unistd.h>
#include <Eigen/Core>
#include <Eigen/LU>
#include "print_results.h"
#include "slam_utils.h"
#include "utils.h"
#include "graph.h"
#include "graphics.h"
#include "world.h"
#include "constants.h"
using namespace NavSim;
values toVector(const trajectory_t &traj, const points_t &r) {
int T = (int)... | ALGO | 0.967469 | 3.981554 |
651236aa-252b-4088-b1a5-9d5e276e6e5c | Rob1Ham/btc-core-miniscript | src/test/fuzz/miniscript.cpp | #include <core_io.h>
#include <hash.h>
#include <key.h>
#include <script/miniscript.h>
#include <script/script.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <util/strencodings.h>
namespace {
//! Some pre-computed data for more efficient string roundtrips... | TEST | 0.89667 | 3.656265 |
03004af1-277d-41e7-82ac-fef31e73b08d | Dananjay996/DSA | Leetcode/Medium/lowestCommonAncestor.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(!root) r... | ALGO | 0.999978 | 6.146601 |
e005595d-3f95-4983-bb4b-36ddaa9bd0cb | andinira17/Praktikum-8- | Guided2_DLLC_19051397029.cpp | #include <iostream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
typedef struct node
{
int data;
node* next;
node* prev;
}*list;
list head;
list tail;
int batas;
void initData()
{
head = NULL;
tail = NULL;
}
int cekHead()
{
return (head == NULL) ? 1 : 0;
}
void tampilList()... | ALGO | 0.997498 | 3.633981 |
46e4fab2-84e8-489a-8c79-9472d9255694 | n22dcdk069/adfasf | Chapter6/Challenges/bai23.cpp | #include <iostream>
#include <fstream>
// Function prototype for checking if a number is prime
bool isPrime(int number);
int main() {
// Open the file for writing
std::ofstream outfile("prime_numbers.txt");
// Check and store prime numbers from 1 through 100 in the file
for (int i = 1; i <= 100; ++i)... | ALGO | 0.955852 | 5.87914 |
4d2f05a9-7a97-4d30-bf10-b1217cd118de | sahushivam/InterviewBitAcademy | Pramp_Interview_Solution/DecryptMessage.cpp | #include <iostream>
#include <string>
using namespace std;
string decrypt( const string& word )
{
int n=word.size(); string decrypt="";
if(n==0) return decrypt;
if(word[0]!='a') decrypt+=(char)(word[0]-1);
else decrypt+="z";
int prev=word[0];
for(int i=1;i<n;i++)
{
int curr=word[i];
curr-=pr... | ALGO | 0.999852 | 3.881404 |
60cec271-bf3c-47f9-a913-3d429bfb0cf9 | pankajharer/DSA | Recursion/PowerOptimal.cpp | #include<iostream>
using namespace std;
int Power(int a,int b)
{
if(b==0)
return 1;
if(b==1)
return a;
int ans=Power(a,b/2);
if(b&1)
{
return a*ans*ans;
}
else
{
return ans*ans;
}
}
int main()
{
int a=2,b=10;
cout<<""<<Power(a,b);
} | ALGO | 0.999876 | 4.294599 |
25092125-ad09-4f35-ba85-6d3902de73aa | vaudaine/Comparing_embeddings | Snap/snap-exp/cascades-dev/devGraph_v1.2.cpp | #include "stdafx.h"
/*
* Version 1.2 : Graph based algorithm for finding cascasdes.
* This version only finds the top cascades. Uses an inline
* modified binary search.
*/
int main(int argc,char* argv[]) {
TTableContext Context;
Schema TimeS;
TimeS.Add(TPair<TStr,TAttrType>("Source",atInt));
TimeS.Add(TPai... | ALGO | 0.999765 | 4.786175 |
a1280a6d-6336-4ac6-a23c-1513a3d0fced | dimicorn/mipt_dump | 3_cpp_oop/seminar3/biportite.cpp | #include <iostream>
#include <vector>
enum class NodeState {kNotSeen, kSeen, kVisited};
bool DepthFirstSearch(int vertex, const std::vector<std::vector<int>>& edges,
std::vector<NodeState>& states, std::vector<int>& colors) {
bool is_bipartite = true;
for (int next : edges[vertex]) {
... | ALGO | 0.999964 | 5.872536 |
373d3e11-a585-4311-8682-d13b9981b2a0 | Striver-3110/Array | countInversion.cpp | #include <iostream>
#include <vector>
using namespace std;
void combine(long long *arr, int l, int mid, int r, long long &inversions) {
int n1 = mid - l + 1;
int n2 = r - mid;
vector<int> L(n1);
vector<int> R(n2);
for (int i = 0; i < n1; i++) {
L[i] = arr[i + l];
}
for (int i = 0... | ALGO | 0.999966 | 5.379515 |
db2ef2d2-14a3-40ab-bf89-f48326d70871 | hbthanh5802/CTDL-GT | CHUYEN_DOI_DANH_SACH_KE_SANG_DANH_SACH_CANH.cpp | #include<bits/stdc++.h>
using namespace std;
vector <pair<int, int>> edge; // Danh sach canh
void Processing(int n){
for(int i = 1; i <= n; i++){
string s; getline(cin, s);
int num;
stringstream ss(s);
while(ss >> num){
if(num > i){
edge.push_back({i, num... | ALGO | 0.984492 | 3.695272 |
0c18fa24-dfc5-4250-8ee3-587cf2186f53 | SaberDa/LeetCode | C++/439-ternaryExpressionParser.cpp | #include <iostream>
#include <string>
using namespace std;
string parseTernary(string str) {
while (str.size() > 1) {
int pos = str.find_last_of('?');
str = str.substr(0, pos - 1) + ((str[pos - 1] == 'T') ? str[pos + 1] : str[pos + 3]) + str.substr(pos + 4);
}
return str;
} | ALGO | 0.996896 | 4.287707 |
eb978fb4-b2e1-4fb8-a9dd-30ae4f123687 | Thanh-Fourteen/FHD_Ver3_Buoi3 | C1.cpp | #include <stdio.h>
int main() {
int q;
scanf("%d", &q);
while (q--) {
int a;
scanf("%d", &a);
// Divide by 2 until odd or equals 2
while (a > 2 && a % 2 == 0)
a /= 2;
int flag = 0;
for (int i = 2;i < a; ++i)
if (a % i == 0){
flag = 1;
break;
... | ALGO | 0.999808 | 4.911269 |
516f84de-34ee-40c6-86e8-7d9a41a49c4c | MazherIqbal84/coriolis | flute/src/3.1/neighbors.cpp | #include <assert.h>
#include <string.h>
#include <stdlib.h>
#include "global.h"
#include "err.h"
#include "dist.h"
namespace Flute {
long octant
(
Point from,
Point to
);
static Point* _pt;
/***************************************************************************/
/*
For efficiency purposes auxili... | ALGO | 0.999834 | 6.288244 |
99e5b63f-4f7f-48a3-9b88-e940319ba7f4 | arash16/prayers | UVA/vol-114/11420.cpp | /*
>>~~ UVa Online Judge ACM Problem Solution ~~<<
ID: 11420
Name: Chest of Drawers
Problem: https://onlinejudge.org/external/114/11420.pdf
Language: C++
Author: Arash Shakery
Email: <EMAIL>
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);
... | ALGO | 0.999093 | 4.137444 |
172f0a29-aa82-4449-a6ab-cc3456755ab7 | Seungchan0325/baekjoon | solutions/22306_0.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100'005;
int N, Q, par[MAXN], c[MAXN], removed[MAXN], group[MAXN];
set<int> g[MAXN];
vector<map<int, int>> col;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> N >> Q;
for(int i = 2; i <= N; i++) {
... | ALGO | 0.999903 | 4.080328 |
d2d213b6-fdce-461c-86a7-ca9bc0cfafa1 | LauZyHou/Algorithm-To-Practice | 剑指Offer注解/9.cpp | #include<bits/stdc++.h>
using namespace std;
//Ͷ
template <typename T> class CQueue {
public:
CQueue(void);
~CQueue(void);
//ڶĩβһԪ
void appendTail(const T& node);
//ڶͷɾһԪ
T deleteHead();
private:
//ṩSTLջ
stack<T> stack1;
stack<T> stack2;
};
//캯
template <typename T> CQueue<T>::CQueue(void) {
}
... | ALGO | 0.978286 | 4.415736 |
bbc63fa7-720b-49dc-8cfd-f9fbf9ca0f85 | AndreyShchur/Coursera_Cpp_Red | week5/merge_sort_3.cpp | #include "test_runner.h"
#include <algorithm>
#include <memory>
#include <vector>
using namespace std;
template <typename RandomIt>
void MergeSort(RandomIt range_begin, RandomIt range_end)
{
// Напишите реализацию функции,
// не копируя сортируемые элементы
const auto range_size = range_end - range_begin;... | TEST | 0.995515 | 5.915843 |
8e4d1522-6830-4ec5-b067-0b2611eda08b | AI1379/OILearning | Practices/DC/P1902BFSVer.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAXM = 1000;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
int n, m;
int p[MAXN][MAXM];
struct node {
pair<int, int> point;
int p;
bool operator<(const node &b) const { return p > b.p; }
};
node mknode(int x, int y)... | ALGO | 0.999933 | 3.861299 |
acb57d4b-cedd-47d0-b2e9-ee34ce6821a7 | likeabhityagi0700/PLACEMENT-PREPRATION-MODULE- | DAT 11 Combinations.cpp | // combinations.cpp leetcode solution
class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<vector<int>> out;
vector<int>comb;
combination(out,comb,n,k,1);
return out;
}
void combination(vector<vector<int>>& out,vector <int>comb, int n,int k,int m)
{
if(co... | ALGO | 0.998911 | 5.942709 |
fd437bad-77a9-45b2-a6cf-27d2993c3588 | batyrrasulov/OOP | main/main/main.cpp | //
// main.cpp
// main
//
// Created by Batyr Rasulov on 1/12/23.
//
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
vector<int> v;
//Add elements to the vector
for (int i = 0; i < 10; i++) {
v.push_back(i);
}
// Print the ... | ALGO | 0.967114 | 4.845269 |
e14718f9-943d-4f2e-a903-8f61cfbfddd8 | sarvex/leetcode-haxe | solution/0400-0499/0496.Next Greater Element I/Solution.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
stack<int> stk;
unordered_map<int, int> m;
for (int& v : nums2) {
while (!stk.empty() && stk.top() < v) {
m[stk.top()] = v;
stk.pop();
}
... | ALGO | 0.999987 | 6.044958 |
0c4bd210-a407-428e-a817-fe0c50711898 | Abs1201/Coding_Test | CSES2/Intro/twoKnights.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxT=1e4;
ll n;
int main(void){
cin >> n;
ll ans;
for(int i=1; i<=n; i++){
ll s=i*i, s2=0;
ans=s*(s-1)/2;
if(i>2){
s2=(i-1)*(i-2)*4;
}
ans-=s2;
cout << ans << endl;
... | ALGO | 0.999762 | 3.853705 |
d68536aa-cf76-4b50-9779-0614cfda8640 | HermanChen/Rockchip_4.1_release_libstagefright | 4.1_jb_release/libstagefright/codecs/m4v_h263/enc/src/sad_halfpel.cpp | /* contains
Int HalfPel1_SAD_MB(UChar *ref,UChar *blk,Int dmin,Int width,Int ih,Int jh)
Int HalfPel2_SAD_MB(UChar *ref,UChar *blk,Int dmin,Int width)
Int HalfPel1_SAD_Blk(UChar *ref,UChar *blk,Int dmin,Int width,Int ih,Int jh)
Int HalfPel2_SAD_Blk(UChar *ref,UChar *blk,Int dmin,Int width)
Int SAD_MB_HalfPel_C(UChar *r... | ALGO | 0.999599 | 4.611544 |
df78e631-534d-4202-9d9c-c0e2a326b25d | TakibYeasar/Yeasar_Leetcode_problem_solving | Hash Table/leetcode_13.cpp |
// Problem Link ====>>https://leetcode.com/problems/roman-to-integer/description/
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
class Solution
{
public:
int romanToInt(string s)
{
unordered_map<char, int> roman_numeral_map = {
{'I', 1},
{'... | ALGO | 0.999902 | 7.215941 |
bd17bf95-a060-4609-8e10-bdc6429debba | Aryan-kamal/Leetcode-submissions | 2170-count-number-of-maximum-bitwise-or-subsets/2170-count-number-of-maximum-bitwise-or-subsets.cpp | class Solution {
public:
// O(2^n)
int countSubsets(int idx, int currOr, vector<int>& nums, int maxOr,
vector<vector<int>>& t) {
if (idx == nums.size()) {
if (currOr == maxOr)
return t[idx][currOr] = 1; // Found one subset
return t[idx][currOr... | ALGO | 0.999981 | 6.144475 |
779a17f3-6425-4dfc-9002-38e89632c5a2 | Jitisha-khede/leetcode | daily problems/august/264_Ugly_Number_II.cpp | class Solution {
public:
int nthUglyNumber(int n) {
set<long> st;
int i=0;
long c=1;
st.insert(1);
while(i<n){
c = *st.begin();
st.erase(st.begin());
st.insert(c*2);
st.insert(c*3);
st.insert(c*5);
i++... | ALGO | 0.999993 | 5.846807 |
c71fe46d-5a09-4778-9ace-1f998df73720 | gauravkumarjha442/Leetcode | leetcode/131. Palindrome Partitioning/s2.cpp | // OJ: https://leetcode.com/problems/palindrome-partitioning
// Author: github.com/lzl124631x
// Time: O(2^N)
// Space: O(N^2)
// Ref: https://discuss.leetcode.com/topic/37756/java-dp-dfs-solution
class Solution {
private:
vector<vector<bool>> dp;
vector<vector<string>> ans;
vector<string> tmp;
void dfs(string ... | ALGO | 0.999869 | 6.542602 |
24567f30-0689-4539-9a20-d2b0debf440e | sha-shanks/DSA_Lab_Sem3 | assign_1/3_insertAtPosition.cpp | #include <iostream>
using namespace std;
class Node{
public:
int value;
Node* next;
};
void insertAtPosition(Node* head, int newValue, int position=6){
if(position < 0){
cout << "Invalid position!" << endl;
return;
}
Node* newNode = new Node();
newNode->value = newValue;
... | ALGO | 0.999574 | 4.832816 |
6b6fc1b8-2b39-49f7-aead-667e07a4a4ca | gabriel-lando/INF01203-Estruturas_de_Dados | Atividades de Aula/09-10-17/Pilha.cpp | #include "Pilha.h"
struct TPtPilha{
TipoInfo dado;
struct TPtPilha *elo;
};
TipoPilha* InicializaPilha (void)
{
return NULL;
}
int PilhaVazia (TipoPilha *Topo)
{
if (Topo==NULL)
return 1;
else
return 0;
}
void ImprimirPilha (TipoPilha *Topo)
{
TipoPilha *ptaux;
i... | ALGO | 0.980356 | 4.24488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.