uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
892b71ed-caef-4cc3-8876-a64554e19320 | Patel7Manav/Leetcode-Solutions | 875-koko-eating-bananas/875-koko-eating-bananas.cpp | class Solution {
public:
int issafe(vector<int>a,int h,int mi)
{
int c=0;
int n=a.size();
for(int i=0;i<n;i++)
{
c+=ceil(double(a[i])/mi);
if(c>h)
return 0;
}
return 1;
}
int minEatingSpeed(vector<int>& piles, int h)... | ALGO | 0.999937 | 5.515671 |
692d3715-3649-4bd0-90ed-d5d234197b33 | Sandarach151/Airplane_Boarding_Simulation | IMMC_Section.cpp | #include <bits/stdc++.h>
#include <ctime>
using namespace std;
class Passenger{
public:
int row; //1 - 23
int col; // 1 - 6
int pos;
int bag;
};
int main(){
srand(time(0));
int x = 23;
int y = 6; //fixed
int maxBag = 2;
int up1 = 0; //fixed
int up2 = 0; //fi... | ALGO | 0.992551 | 3.762802 |
16affe89-e6a4-44c6-9c79-d9f9d30a5b35 | kenwu890831/LeetCode | LeetCode_ 2364. Count Number of Bad Pairs.cpp | class Solution {
public:
long long countBadPairs(vector<int>& nums) {
long long good = 0 ;
long long n = nums.size() ;
unordered_map< int, int > temp ;
for ( int i = 0 ; i < n ; i++ ) {
int k = nums[i] - i ;
good += temp[k] ;//check same
temp[k]++... | ALGO | 0.999958 | 5.418954 |
b3954be4-baaf-42a3-aafd-d20cd5452141 | Fernandez-17/01_Funciones | multiplicacion.cpp | #include <iostream>
using namespace std;
int calcular_producto(int a, int b){
if (b==1){
return a;
}else{
return a + calcular_producto(a,b-1);
}
}
int main ( ){
int multiplicador , multiplicando, producto;
cout <<" BIENVENIDO AL PROGRAMA DE CALCULO DE UN PRODUCTO " << endl;
cout <<"Multiplicando: ... | ALGO | 0.996034 | 3.740991 |
079fad8b-132e-4375-be1a-68f4e5c6fc7f | valleyceo/code_journal | 1. Problems/c. Array/1_Plus_One.cpp | // Plus One
/*
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.
The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.
You may assume the integer does not contain any leading zero, exc... | ALGO | 0.99941 | 7.066952 |
291c8afa-ebd2-48a8-9ecf-846670340cd6 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_881_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 110000;
int n, m, x, y, z;
int fa[maxn], rk[maxn];
bool vis[maxn];
int find(int x) {
if (fa[x] == x) return fa[x];
int tx = fa[x];
fa[x] = find(fa[x]);
rk[x] = (rk[x] + rk[tx] + 1) & 1;
return fa[x];
}
long long powmod(... | ALGO | 0.999982 | 4.275427 |
6be3a3e2-1a10-43ee-bc4d-b5f18d81d425 | ZKW465/algorithm | 打印稿/数学/数学工具箱/质因数分解,素数检验.cpp | i64 mul(i64 a, i64 b, i64 m) {
return static_cast<__int128>(a) * b % m;
}
i64 power(i64 a, i64 b, i64 m) {
i64 res = 1 % m;
for (; b; b >>= 1, a = mul(a, a, m))
if (b & 1)
res = mul(res, a, m);
return res;
}
/**
* 算法:Miller_Rabin_Test
* 作用:在long long范围内快速判断质数
* 时间复杂度:O(log^3(n))
... | ALGO | 0.999966 | 3.851349 |
d4b86c3c-9e0d-4eb5-8d14-b9d274f2f40e | chirayu-sharma-07/my_leetcode_solutions | 0059-spiral-matrix-ii/0059-spiral-matrix-ii.cpp | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> result;
result.resize(n);
for(int e=0;e<n;e++){
result[e].reserve(n);
}
int matrix[n][n];
int top=0;
int bottom=n-1;
int left=0;
int right=bott... | ALGO | 0.999972 | 6.260019 |
48a115c2-397c-4b51-8782-c67768d8fdd5 | momalab/e3 | tutorials/bench/bit/speck/main.cpp | #include <iostream>
#include <vector>
#include "e3int.h"
#include "timer.h"
#include "e3key.h"
template<class T> inline std::string de(T x) { return e3::decrypt<T>(x); }
#ifndef SZ
#define SZ 8
#endif
#define N_ROUNDS 11
using namespace std;
using SecureInt = TypeUint<SZ>;
using SecureBool = TypeBool;
//#define ... | ALGO | 0.999703 | 3.279663 |
0020d8ce-eec6-42de-8b73-dd2c693fa8a6 | uiseongsang/codingTest | programmers/lv1/폰켓몬.cpp | #include <bits/stdc++.h>
using namespace std;
int solution(vector<int> nums)
{
int _size = nums.size()/2;
int answer = 0;
unordered_set<int> _set;
for(int it : nums) _set.insert(it);
if(_size < _set.size()) answer = _size;
else answer = _set.size();
return answer;
} | ALGO | 0.999244 | 5.128988 |
a5363ee3-19f6-49a0-ac32-7caf31b55528 | shreejitverma/SDE-Interview-Prep | LeetCode/C++/find-the-grid-of-region-average.cpp | // Time: O(m * n)
// Space: O(m * n)
// array
class Solution {
public:
vector<vector<int>> resultGrid(vector<vector<int>>& image, int threshold) {
const auto& check = [&](int i, int j) {
for (int ni = i - 1; ni <= i; ++ni) {
for (int nj = j - 1; nj <= j + 1; ++nj) {
... | ALGO | 0.999801 | 6.223752 |
433961b4-0140-4128-8ed1-0ce891775877 | bitwuzla/bitwuzla | src/preprocess/pass/elim_extract.cpp | #include "preprocess/pass/elim_extract.h"
#include <unordered_set>
#include "env.h"
#include "node/node_manager.h"
#include "node/node_ref_vector.h"
#include "node/node_utils.h"
#include "util/hash.h"
namespace bzla::preprocess::pass {
using namespace node;
/* --- PassElimExtract public ---------------------------... | ALGO | 0.978222 | 7.533265 |
887ab4e7-a05b-427d-acc3-1bfb3a5553cc | samek567/ZadaniaAlgorytmiczne | Zaprzyjaznij_Sie_Z_Algorytmami/roz18_listakontaktow100pkt.cpp | #include <iostream>
#include <vector>
using namespace std;
int n = 0, m = 0, z = 0, a_i = 0, b_i = 0, numer_spojnej = 0;
vector<vector<int>> krawedzie;
vector<int> w_jakiej_spojnej_jest;
void DFS(int v)
{
w_jakiej_spojnej_jest[v] = numer_spojnej;
for (int i = 0; i < krawedzie[v].size(); ++i)
{
if... | ALGO | 0.999977 | 4.937067 |
22917e0e-24ec-46cd-9406-1db44a55c502 | shivamEr/100DaysOfCode | Day_57/38_count_and_say.cpp |
// Problem Link : https://leetcode.com/problems/count-and-say/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
string solve(int n,string s){
if(n==0) return s;
string temp;
int cnt =1;
char ch=s[0];
for(int i=1;i<s.size();i++){
if(s[i]==ch... | ALGO | 0.999994 | 6.462973 |
8980a206-67fc-4490-b37d-12cd002ace51 | dranxer/LeetCode-Solns | minimum-score-by-changing-two-elements/Accepted/7-12-2024, 5_28_11 PM/Solution.cpp | // https://leetcode.com/problems/minimum-score-by-changing-two-elements
class Solution {
public:
int minimizeSum(vector<int>& nums) {
//1 4 7 8 5
sort(nums.begin(),nums.end());
int n=nums.size();
return min({nums[n-1]-nums[2],nums[n-3]-nums[0],nums[n-2]-nums[1]});
}
}; | ALGO | 0.999968 | 5.563198 |
f4e56481-9e09-4d04-848b-f44829ddd130 | hk-117/UVa_solves | vol 2/p260.cpp | #include<bits/stdc++.h>
using namespace std;
int dr[]={-1,-1,0,0,1,1};
int dc[]={-1,0,-1,1,0,1};
int N;
vector<string> grid;
int floodfill(int r,int c,char c1,char c2){
if(r<0||r>=N||c<0||c>=N) return 0;
if(grid[r][c]!=c1) return 0;
int ans=1;
grid[r][c]=c2;
for(int d=0;d<6;d++)
ans+=floodfill(r+dr[d],c... | ALGO | 0.999921 | 4.251813 |
829cd620-d107-46cc-981d-5f10f03c73e2 | Neaj-Morshad-101/CP-Code-Templates-and-Resources | Notes and Resources/HellBent/Zahin Bhai's Library/Ordered Multiset.cpp | #include <bits/stdtr1c++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl
using namespace std;
using namespace __gnu_pbds;
/*** Needs C++11 or C++14 ... | ALGO | 0.998763 | 3.537843 |
0d6ba0e1-8a3e-4993-82b5-42536b90498c | qpwoeirut/competitive-programming | GoogleCompetitions/HashCode2021/weight_sqrt/weight_sqrt.cpp | //solve.cpp created at 02/25/21 10:54:25
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "qpwoeirut/debug.h"
#else
#define debug
#define debug1
#define debug2
#define debug3
#endif
#define pb push_back
#define INS insert
#define FI first
#define SE second
#define sz(obj) ((int)(obj.size()))
#de... | ALGO | 0.999524 | 5.113252 |
a24e8c42-da95-4aef-b76e-f08d266fba96 | josemanuelmtz/Live-Together | proyecto_live_together/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.998321 | 6.76775 |
5173124a-3b06-4fc8-91f9-272037371a48 | b8029726Newcastle/Dissertation | Accessibility in Games - 2D/Library/PackageCache/com.unity.ide.visualstudio@2.0.11/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.954358 | 6.947423 |
29676fe6-1a4c-4d99-95e1-6569caaea0b3 | moghamry25/TicTac | oop.cpp | #include <algorithm>
#include <iostream>
#include <limits>
#include <vector>
using namespace std;
class TicTacToe {
private:
vector<vector<char>> board;
char player1;
char player2;
char currentPlayer;
bool playWithAI;
public:
TicTacToe() {
board.resize(3, vector<char>(3, ' '));
player1 = 'X';
... | ALGO | 0.992501 | 7.052293 |
3abd9760-0a81-4ae1-a1fe-812260f2dcc7 | Colderhold/CE-Domain-and-Projects | SEM 3/DS/Evaluation of Postfix.cpp | #include<stdio.h>
#include<ctype.h>
int stack[20];
int top = -1;
void push(int x)
{
stack[++top] = x;
}
int pop()
{
return stack[top--];
}
int main()
{
char exp[20];
char *e;
int n1,n2,n3,num;
printf("Enter the expression :: ");
scanf("%s",exp);
e = exp;
while(*e != '\0')
{
... | ALGO | 0.999762 | 3.671896 |
7e3d16db-0745-496f-98d3-a8d7ad189d2c | herunkang2018/Cryptography-Practices | Affine/affine.cpp | #include<stdio.h>
#include<string.h>
//
int encode(int a, int b, char * str){
int len = strlen(str);
int i;
for(i = 0; i < len; i++){
int temp = a*(str[i] - 'a') + b;
temp %= 26;
str[i] = (char)(temp + 'a');
}
}
//һ26
int aa(int a){
int i;
for(i = 0; i < 26; i++){
int temp = (i*a)%26;
if(temp == 1){... | ALGO | 0.999939 | 3.170336 |
44c81e20-5575-4dfc-820a-afdf86f2dc15 | fadilcse5bu/CSES-Problems-Solution | 4. Graph Algorithms/G. Longest Flight Route.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int dis[100005], par[100005];
vector <int> ve[100005];
void dijkstra(int x) {
priority_queue <pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
pq.push({1, x});
while(!pq.empty()) {
int node = pq.top().second;
pq.po... | ALGO | 0.999985 | 4.731399 |
c41e99fb-4943-4cdd-85c7-57f92f6972c4 | Yash-Thakare22/DSA_Uplift_Project | Assignments/Solutions/Trijal Bhardwaj/Assignment No. 16 (Stack)/Q5 - Implement Stack Using Queues.cpp | // Question Link: https://leetcode.com/problems/implement-stack-using-queues/
class MyStack {
public:
/** Initialize your data structure here. */
queue<int> q1;
queue<int> q2;
MyStack() {
q1 = {};
q2 = {};
}
/** Push element x onto stack. */
void push(int x) {
q2.... | ALGO | 0.996381 | 6.174115 |
a242389c-daf7-40ef-9663-81a0f82814c0 | JH-LEE-Dev/Problem-Solving | BOJ/Graph/28354.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <algorithm>
#include <limits>
#include <tuple>
#include <string>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
using vertex = tup... | ALGO | 0.999957 | 4.978409 |
0afa43fb-a760-4a66-92d7-c9d1146c5698 | sharath-66b6/leetcode_solution | 0139-word-break/0139-word-break.cpp | class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
int n = s.size();
// unordered_set<string> words = (wordDict)
vector<bool> dp(n+1, false);
dp[0] = true;
for(int i=1; i<=n; i++){
for(int j=0; j<i; j++){
if(dp[j] && fi... | ALGO | 0.999003 | 6.189528 |
e774170e-1fd6-4ad4-ab08-42e5bbd30cb8 | glperini/DELAUNAY | Delaunay/main_program.cpp | #include "Delaunay.hpp"
#include "TriangularMesh.hpp"
#include "HeapSort.hpp"
using namespace ProjectLibrary;
using namespace SortingLibrary;
int main()
{
TriangularMesh mesh;
//importo i punti
mesh.set_fileName("./Test2.csv");
if(!mesh.importPoints())
return 1;
//ordino i punti per x cr... | ALGO | 0.99891 | 5.405193 |
8d4fb64c-3ddc-4564-8f3f-ba2056393d72 | sakib1061/lightoj | 1112.cpp | #include <bits/stdc++.h>
using namespace std;
#define mx 100001
int arr[mx];
int tree[mx * 3];
void init(int node, int b, int e)
{
if (b == e) {
tree[node] = arr[b];
return;
}
int Left = node * 2;
int Right = node * 2 + 1;
int mid = (b + e) / 2;
init(Left, b, mid);
init(Right... | ALGO | 0.999527 | 3.72501 |
3600ce4b-2912-4d17-9454-7222867c1e85 | sahil2431/DSA | TowerOfHanoi.cpp | //Tower of Hanoi
#include <iostream>
using namespace std;
void tower(int n , char s, char h, char d) {
if(n==0) return ;
tower(n-1,s,d,h);
cout<<s<<" to "<<d<<endl;
tower(n-1,h,s,d);
return;
}
int main()
{
int n;
cout<<"Enter number of disk: ";
cin>>n;
tower(n,'A', 'B' ,'C');
return 0;
} | ALGO | 0.999673 | 4.99458 |
17a9e33c-20f2-4c1c-8b5c-79b020ab7aa7 | Awadesh365/Trees-Problems | Medium/Top View of Binary Tree/top-view-of-binary-tree.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999681 | 6.993872 |
8f37f9b7-001c-417c-954e-bdf53ba52657 | openkylin/platform_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_reorder.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_reorder.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
------------------------... | ALGO | 0.998207 | 5.55651 |
57e8ef07-7509-47d1-a407-fa596d145134 | Mrbobrowitz/android_frameworks_base_derp | media/libstagefright/codecs/amrnb/dec/src/ph_disp.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "ph_disp.h"
#include "typedef.h"
#include "basic_op.h"
#include "cnst.h"
/*------------------------------------------------------------------... | ALGO | 0.990436 | 6.517683 |
24f290a9-8c83-49b9-ae0a-9c8fb370d9a2 | adityagarg023/CodeForces-Solution | Practice/800/A - Soldier and Bananas.cpp | // File: soldier_and_bananas.cpp
// Description: Solution to calculate amount to borrow for buying bananas
// Time Complexity: O(1) as it performs constant-time operations
// Space Complexity: O(1) using only constant extra space
#include <iostream>
using namespace std;
int main() {
int costPerBanana; // Cost ... | ALGO | 0.999827 | 4.883389 |
166d54b1-f24c-45eb-b39b-b4e4980fb8e7 | appliedblockchain/k0 | cpp/src/hash/sha256_compression.cpp | #include "sha256_compression.hpp"
#include "libsnark_hash.hpp"
#include <iostream>
#include <libff/common/utils.hpp>
#include <util.h>
#include <libsnark/common/default_types/r1cs_ppzksnark_pp.hpp>
using namespace std;
//
//void k0::sha256_compress(unsigned char* input, unsigned char* output)
//{
// CSHA256 hasher;... | ALGO | 0.998471 | 4.919151 |
ac2fa704-e08d-44df-9c47-f70c354d9e4f | Snehalrajole/LP-II | BfsDfs.cpp | #include <iostream>
#include <stack>
#include <queue>
using namespace std;
// DFS function using stack
void dfs(int adj_mat[10][10], int n, int node, int visited[10]) {
cout << "DFS Traversal:\n";
stack<int> stk;
stk.push(node);
visited[node] = 1;
while (!stk.empty()) {
int i = stk.top();... | ALGO | 0.999919 | 6.873058 |
aab497ce-33b9-40a8-9cb6-7868e4cd9b75 | DELUXORUS/Graph_With_X11 | PrueferEncode.cpp | #include "PrueferEncode.h"
void PrueferEncode::search() {
if(_encode() == true) {
cout << endl << "Code Pruefer: ";
_output();
}
else
cout << endl << "The represented graph is not a tree!" << endl;
}
bool PrueferEncode::_encode() {
while(_codePruefer.size() != (_graph.get... | ALGO | 0.999502 | 3.254258 |
c5d56007-0f32-4144-aa5c-48e77e66bb50 | Noodle96/contestProgramming | AtCoder/B_Pentagon.cpp | #include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define msg(str,str2) cout << str << str2<< endl
using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli =... | ALGO | 0.999994 | 4.376718 |
c3effdef-b720-4041-81cc-93e8a97cf926 | MR-Archie/teacher_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.998733 | 6.76775 |
12a6f99e-1fbb-4221-a998-6cf050ce4924 | ElifCagla/C.Cpp_My_Codes | multidimensional_series_homework.cpp | #include <stdio.h> //standart giri k ilemlerini salayan ktphane
#include <string.h> //karakter dizileri ile almamz salayan ktphane
char cumle[200];//char tipinde cumle isminde tek boyutlu bir dizi tanmlayp bellekte ona 400 bytelk(200 karakterlik) yer ayryor
int main(){ //ana fonksiyon(programn balad yer
while(1){
... | TOOL | 0.991129 | 3.817377 |
6dc2c862-e5b2-48e9-95f9-16fdad5c6385 | Cloverii/LeetCode | 75**.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
// elements on the left of l (included) is 0,
// and those on the right of r (included) is 2;
// element between (l, i) is 1
int l = -1, r = nums.size();
int i = 0;
while(i < r) { // nums[r] = 2 (or null)
... | ALGO | 0.999791 | 6.013474 |
49fd4154-e2a9-42e5-ad8e-bd203667222d | qmarliu/LeetCode | algorithms/6-ZigZagConversion.cpp | /*
*Description:
******************
*The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: "PAHNAPLSIIGYIR"
Writ... | ALGO | 0.999989 | 5.593002 |
6adad3f0-c14e-4580-bbf4-1554a30daa2b | AditiShrivastava/COURSEWORK-IIITH | CODES/DFS.cpp | #include <iostream>
#include <list>
//#include<bits/stdc++.h>
using namespace std;
class Graph
{
int V;
list<int> *l;
public:
Graph(int v)
{
V=v;
//Array of linked lists
l=new list<int>[v];
}
void addEdge(int u,int v,bool bidir=true)
{
l[u].push_back(v);
if(bidir... | ALGO | 0.999926 | 5.066578 |
3848b2bb-5c54-49cc-aace-a887c8ecb784 | kurone02/competitive_programming | PrelimNOI2019/TASK1.cpp | #include <iostream>
#include <cstdio>
#define taskname "TEST"
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
long long s,e;
cin>>s>>e;
for(long long i=s;i<=e;i++){
long long x=i;
int d[20]={};
int sz=0;
while(x){
... | ALGO | 0.999592 | 3.672868 |
0ecbcfdc-8708-495a-b161-d198f19482e4 | bodasadallah/problem-solving | codeforces/Wratrh/main.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,s2=0,e1=0,e2=0,ans=0,l;
//cin>>n;
scanf("%d",&n);
for(int i=1;i<=n;i++){
//cin>>l;
scanf("%d",&l);
if(l==0||i==1)continue;
i-l<1? e1=1:e1=i-l;
if(e1>=s2 ){ans+=i-e1;}
else {
ans+=(i-s2);
... | ALGO | 0.999794 | 3.247772 |
5d13d8eb-9ad5-4a75-8d41-c64fbb57e173 | programming086/cocos2d-x_2.2.3 | cocos2dx/support/zip_support/ZipUtils.cpp | #include <zlib.h>
#include <assert.h>
#include <stdlib.h>
#include "ZipUtils.h"
#include "ccMacros.h"
#include "platform/CCFileUtils.h"
#include "unzip.h"
#include <map>
NS_CC_BEGIN
unsigned int ZipUtils::s_uEncryptedPvrKeyParts[4] = {0,0,0,0};
unsigned int ZipUtils::s_uEncryptionKey[1024];
bool ZipUtils::s_bEncrypt... | TOOL | 0.914315 | 6.094281 |
c914c7a7-15d4-4bbc-ae01-cc5f7eb7fcf5 | Moriyan1307/CS-5311_Hands-On | Hands On 8/quickSort.cpp | #include <iostream>
using namespace std;
#define sout(n) cout << (n)<< " ";
int partition(int arr[], int low, int high) {
int pivot = arr[high];
int i = (low - 1);
for (int j = low; j <= high - 1; j++) {
// If current element is smaller than the pivot
if (arr[j] < pivot) {
i++;... | ALGO | 0.999982 | 5.353148 |
5744bbc8-02ae-44b5-b98b-39d98a379553 | aquadrop/Face-Expression-Recognition | opencv-2.4.5/modules/contrib/src/hybridtracker.cpp | /
#include "precomp.hpp"
#include "opencv2/contrib/hybridtracker.hpp"
using namespace cv;
using namespace std;
CvHybridTrackerParams::CvHybridTrackerParams(float _ft_tracker_weight, float _ms_tracker_weight,
CvFeatureTrackerParams _ft_params,
CvMeanShiftTrackerParams _ms_params,
Cv... | ALGO | 0.999527 | 7.015963 |
499d75a5-1d4a-40a8-b39c-688dd5f17be0 | mhjmbs/competitive-programming | solutions/CSES/Graph Algorithms/Coin Collector.cpp | #include "bits/stdc++.h"
#define fastio ios::sync_with_stdio(0), cin.tie(nullptr)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using tiii = tuple<int,int,int>;
vector<vector<int>> adjacencies, inv_adjacencies;
vector<set<int>> sccs, scc_adjacencies;
vector<int> coins... | ALGO | 0.999937 | 4.700547 |
e7e5a429-8a23-46a0-bbbb-861be58ae144 | HugoAlejandro2002/ICPC | Codeforces/gym/105858/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define input freopen("in.txt", "r", stdin)
#define show(x) cout << #x << " = " << x << endl
typedef unsigned long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int main()
{
// input;
ios::sync_with_std... | ALGO | 0.999961 | 5.65388 |
4cba4785-71cd-4344-b37f-9100fb98ee00 | yangpyeong522/Algorithm_1year | a-345/a-345/a-345.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using ll = long long;
using namespace std;
int t;
int n;
ll tree[1 << 22];
ll sum;
vector<pair<ll, ll>> vc;
vector<ll> coor;
ll update(ll start, ll end, ll idx, ll node) {
if (idx < start || idx > end) {
return tree[node];
}
if (start == end) {
return... | ALGO | 0.999703 | 4.728946 |
9b070335-b923-4037-ac2e-81e93720b7b4 | MjStar24/striverCPsheet | binarySearch/02.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
int main(){
int n,k;
cin>>n>>k;
vector<int> a(n);
vector<int> b(n);
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<n;i++) cin>>b[i];
int low=0,high=2000;
while(low<=high){
... | ALGO | 0.999974 | 3.538244 |
181244d7-314b-4a68-9bdd-b0bf49c7808a | AIT-RAMI/Competitive-Programming | Coach Codes/stacknorm.cpp | #include <iostream>
#include <stack>
#include <string>
int main(int argc, const char *argv[])
{
std::stack<int> stack;
stack.push(1);
stack.push(3);
stack.push(7);
stack.push(19);
for (std::stack<int> dump = stack; !dump.empty(); dump.pop())
std::cout << dump.top() << '\n';
st... | TOOL | 0.943689 | 4.752244 |
13364a9e-937b-4991-97e1-e60d7d3f1cba | ebedkharistian/Competitive-Programming | UVA10852.cpp | #include <bitset>
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
ll _sieve_size;
bitset<10000010> bs;
vi primes;
void sieve(ll upperbound){
_sieve_size = upperbound + 1;
bs.set(); // all 1
bs[0] = bs[1] = 0;
for(ll i=2; i<= _sieve_size; ... | ALGO | 0.999837 | 4.010149 |
a88106a1-f35c-4732-ad61-626fe1a2e025 | sneharameshjadhav-22/DSA | String/isomorphic string.cpp | /*Given two strings s and t, determine if they are isomorphic.
Two strings s and t are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a chara... | ALGO | 0.999988 | 6.376423 |
aef58ca3-6d99-406c-99b2-d16c3d2702f8 | Chaaany/SSafy_15_BESTTEAM | 20240122/백준/오석호_S4_17266_어두운_굴다리.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// 17266 어두운 굴다리
// 구현
int n, m;
int p[100001] = { 0 };
cin >> n >> m;
for (int i = 0; i < m; ++i) cin >> p[i];
// 3가지 조건을 만족해야한다
// 맨 앞부터 첫번째 가로등까지의... | ALGO | 0.999905 | 3.667394 |
8898c886-2008-4c66-a660-3ddc0f501260 | Princeofsyntax/leetcode | 36-valid-sudoku/valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(std::vector<std::vector<char>>& board) {
// Create three 9x9 matrices for rows, columns, and sub-boxes respectively.
vector<vector<bool>> rowCheck(9, vector<bool>(9, false));
vector<vector<bool>> colCheck(9, vector<bool>(9, false));
vector<... | ALGO | 0.999781 | 7.511771 |
221bb4f2-a529-49f6-b32e-a2a1e46a081c | ranjeet7287/DSA-cpp | PrepSeason2/02Arrays/2SlideingWindow/ques1.cpp | // Maximum Sum SubArray of size k
#include<bits/stdc++.h>
using namespace std;
int MaxSumSubArray(int arr[],int n,int k){
int start=0,end=0,sum=0;
int maxsum=INT_MIN;
while(end<n){
sum+=arr[end];
if(end-start+1<k){
end++;
}else if(end-start+1==k){
sum=max(max... | ALGO | 0.999936 | 4.469098 |
45d88f52-c215-488e-a717-cffa967f027c | NaufalF121/New-folder | Kacau antri sembako.cpp | #include <iostream>
#include <vector>
#include <list>
using namespace std;
int main(){
int a,check;
cin >> a;
string masuk;
vector<string> antri;
for (int i = 0; i < a; i++){
cin >> check;
if (check == 2){
cin >> masuk;
antri.push_back(masuk);
}else if( check == 4){
cout << antri.back()<... | ALGO | 0.999309 | 3.836015 |
cba054de-5e6c-4bd7-a77a-4b2c3f39ef4e | tynnp/CP-Practice | UPCODER/DEL.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e6 + 5;
int n, odd, even;
int ans, sum, a[MAXN];
int32_t main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
sum += a[i];
if (a[i] & 1) odd++;
else even++;
}
if (sum & 1... | ALGO | 0.999887 | 4.521408 |
a40c14ff-aa59-4bee-a3ac-c2603ed10bd7 | sarvex/leetcode-java | solution/0200-0299/0287.Find the Duplicate Number/Solution.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
int left = 1, right = nums.size() - 1;
while (left < right) {
int mid = (left + right) >> 1;
int cnt = 0;
for (int& v : nums)
if (v <= mid)
++cnt;
if (c... | ALGO | 0.999974 | 6.157046 |
2cdc5450-4e3e-44a8-93e0-6185e4a28b8f | hang245141253/HZOJ | C++11/204.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
// 动态申请二维数组
int** arr = new int*[n];
for (int i = 0; i < n; i++) {
arr[i] = new int[n];
}
// 输入二维数组
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> arr[i][j];
}
}
// 输出二维数组
for (int i = 0; i < n; i++) ... | ALGO | 0.9996 | 3.019282 |
cd910fc7-7063-462a-83d5-66730c4cfe34 | AbhijeetJ-512/LeetCode | Easy/Q0069.cpp | #include<iostream>
using namespace std;
class Solution {
public:
int mySqrt(int x) {
if(x == 0 || x == 1) return x;
double ans = x/2;
for(int i=0;i<20;i++)
{
ans = 0.5*(ans + (x/ans));
}
return static_cast<int> (ans);
}
};
| ALGO | 0.999793 | 4.499619 |
a7d2782b-1704-4b10-b2f0-7ba74569770d | bozoslav/CSES-Solutions | Introductory Problems/Trailing Zeros.cpp | #include <iostream>
using namespace std;
int findTrailingZeros(int n)
{
if (n < 0)
return -1;
int count = 0;
for (int i = 5; n / i >= 1; i *= 5)
count += n / i;
return count;
}
int main()
{
int n;
cin >> n;
cout << findTrailingZeros(n);
return 0;
} | ALGO | 0.999897 | 5.722027 |
c15afb09-0534-4b84-b649-b4c7bf83e5e3 | shivanshsanoria1/LeetcodeSolutions | CPP [1001-1500]/1023.camelcase_matching [1].cpp | class Solution {
public:
vector<bool> camelMatch(vector<string>& queries, string pattern) {
vector<bool> ans;
for(string& query: queries)
{
bool include = true;
int i=0;
for(char ch: query)
{
if(i < pattern.length() && ch == p... | ALGO | 0.998293 | 6.242501 |
0a78aac9-536b-448b-b15a-9747a75b7ec4 | littleblus/cpp-learning | 剑指offer专项突破/095.最长公共子序列/test.cpp | #include <string>
#include <vector>
using namespace std;
class Solution {
public:
int longestCommonSubsequence(string text1, string text2) {
// f(i, j) = f(i-1, j-1) + 1 s1[i] == s2[j]
// f(i, j) = max{f(i, j-1), f(i-1, j)} s1[i] != s2[j]
vector<vector<int>> dp(text1.size() + ... | ALGO | 0.999793 | 6.03282 |
c0985b5b-ce30-472f-8278-552298f02f8a | Utkarsh-Dyundi/Competitive-Programming | Angry_Cyborg.cpp | #include<bits/stdc++.h>
using namespace std;
#define tr(c,it) for(typeof(c.begin()) it=c.begin();it!=c.end();++it)
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define itor(c) typeof(c.begin())
#define ll long long
#define vi vector<int>
#define si set<int>
#define msi multiset<int>
#define ii pair<int,int>... | ALGO | 0.999918 | 3.364087 |
4b9f43c2-5fa0-4331-b765-368097357061 | hjiang13/LLMs-in-IR | POJ-104/71/2341.cpp | #include <iostream>
using namespace std;
int is_leap_year(int n);
int main()
{
int n;
int y, m1, m2;
int days[] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
;
int i, j, sum = 0;
cin >> "%d", &n);
for (i=0; i<n; i++) {
cin >> "%d %d %d", &y, &m1, &m2);
sum = 0;
if (is_leap_year(y)) /* if leap year */
days[1] = ... | ALGO | 0.999982 | 3.595423 |
5e5d8763-8202-4a8a-b3f5-b2e8ce1dbcc9 | ishandutta2007/codeforces | ynycoding/normal/1290/F.cpp | #include <cstdio>
#include <algorithm>
#define x first
#define y second
using std::pair;
const int N=6, MOD=998244353;
inline int mval(int x) { return x>=MOD?x-MOD:x; }
inline int fix(int x) { return mval(x+MOD); }
inline void inc(int &x, int a) { x=mval(x+a); }
inline void dec(int &x, int a) { x=fix(x-a); }
inline int... | ALGO | 0.999963 | 4.040141 |
14663358-65f2-4437-a52f-39df6487a8cc | Qdriving/Swin-TransformerV2-in-PP | deploy/cpp/src/cls_config.cpp | #include <include/cls_config.h>
namespace PaddleClas {
std::vector<std::string> ClsConfig::split(const std::string &str,
const std::string &delim) {
std::vector<std::string> res;
if ("" == str)
return res;
char *strs = new char[str.length() + 1];
std::strcpy(strs,... | TOOL | 0.898572 | 6.089087 |
8a9b1665-17e6-4c9d-8999-79e45d57c973 | LeeBumSeok/file-processing | BST/20171664_BST.cpp | #include <iostream>
using namespace std;
struct Node
{
int key;
Node *left;
Node *right;
};
class binarysearchtree
{
public:
Node *root = NULL;
Node *getNode();
Node *maxNode(Node *);
Node *minNode(Node *);
void insertBST(Node *&, int);
void inorderBST(Node *);
void deleteBST(... | ALGO | 0.999986 | 5.123667 |
047cbd59-3cfd-410e-a611-f84013fcfa52 | hfhongzy/CodeForOI | zroi-1496.cpp | #include <bits/stdc++.h>
#define pb push_back
#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;
typedef long long ll;
const int N = 2e5 + 10;
const int M = 194256;
const ll mod = 2002100820040527;
inline ll add(ll a, ll b) {
return a + b >= mod ?... | ALGO | 0.999961 | 3.827353 |
fd69f43a-b45f-486b-9831-770b92960a4a | ZYY1995/leetcode | 669. Trim a Binary Search Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* trimBST(TreeNode* root, int L, int R) {
if (root == NULL)
return ... | ALGO | 0.999986 | 6.340975 |
d1423fd5-df9a-48b9-a66a-ce1fff3e15d8 | masoudbehzadinasab/Trilinos_12_11 | packages/rol/example/parabolic-control/example_02.cpp | /*! \file example_02.cpp
\brief Shows how to solve a linear-quadratic parabolic control problem
with bound constraints.
*/
#include "ROL_Algorithm.hpp"
#include "ROL_TrustRegionStep.hpp"
#include "ROL_PrimalDualActiveSetStep.hpp"
#include "ROL_StatusTest.hpp"
#include "ROL_Types.hpp"
#include "Teuchos... | ALGO | 0.999776 | 5.772449 |
6b9762ad-bff0-4d2c-bdd0-67085430f436 | rusuraluca/dsa-highschool | culegere45/8. subprograme/6.cpp | #include <iostream>
using namespace std;
int x[105], n, y, p[105], np;
int cmmdc(int a, int b){
if(b == 0) return a;
return cmmdc(b, a%b);
}
int prime(int n, int y, int x[], int p[], int &np){
int c;
np = 0;
for(int i=1; i<=n; i++){
if(cmmdc(x[i], y) == 1){
np++;
... | ALGO | 0.99993 | 3.380855 |
e179c8e3-8192-471a-a2c4-4f0a7fb6b761 | andeplane/AtomifyVisionPro | LAMMPS/src/KSPACE/pair_lj_charmm_coul_long.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include "pair_lj_charmm_coul_long.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "... | ALGO | 0.999624 | 6.367332 |
4dbe42f9-ec5b-434b-a1de-98d5f95a3a13 | Khushi-Mattu/competitive-programming | vpropel/simple_tetris.cpp | /*
The game of tetris involves blocks of various colours dropping on top of each other If four blocks of the same colour are stacked on top of each other then they disappear, otherwise the height of the tower keeps on growing. You will be given two queries:
Type 1: Add a block of given colour on the tetris stack.
Ty... | ALGO | 0.993616 | 5.081242 |
1f4210b8-110a-4d0c-9c7a-647a3ba882b8 | withseungryu/Algorithms | BackJoon/Dynamic Programming/2213.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<vector<int>> arr;
vector<vector<int>> arr2;
vector<int> weight;
vector<vector<int>> dp;
vector<bool> visited;
int N;
vector<int> res1;
vector<int> res2;
void setTree(int root) {
for (int i = 0; i < arr[root].size(); ++i) {
in... | ALGO | 0.999968 | 4.102775 |
5b9507f6-b2c5-41b1-927d-e600dad67ecb | Ehmurad/lab4 | 3rd lab b1.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
for(int i=1000; i<10000; i++)
{
int a=0,b=0,c=0,d=0;
a=i/1000;
b=i/100%10;
c=i%100/10;
d=i%10;
if(pow(a,4)+pow(b,4)+pow(c,4)+pow(d,4) == i)
{
cout << i << endl;
}
}
}
| ALGO | 0.999427 | 4.04725 |
b2956ead-8e7a-4505-9f61-80bac0c46ddd | JamesTheZ/VersaPipe | basicversion/reyesPipeCUDA/common_code/vecs.cpp | #include "vecs.h"
// 4D
vec4f operator+(const vec4f& v1, const vec4f &v2)
{
return vec4f(v1.peekx()+v2.peekx(),
v1.peeky()+v2.peeky(),
v1.peekz()+v2.peekz(),
v1.peekw()+v2.peekw());
}
vec4f operator-(const vec4f& v1, const vec4f &v2)
{
return vec4f(v1.peekx()-v2.peekx(),
... | TOOL | 0.935852 | 5.944813 |
fbef04cc-25da-473e-bfbc-eff94a052056 | rxi-prakharvrm/Self-Study | DSA/02_Rohit_Negi_DSA/Classwork/day_51/printNto1Even.cpp | #include <iostream>
using namespace std;
void printNto1(int n) {
if(n == 0) {
return;
}
cout << n << " ";
printNto1(n-2);
}
int main() {
// given that n is even
int n = 14;
printNto1(n);
return 0;
} | ALGO | 0.999726 | 4.835357 |
dd56ba7c-a6b8-4f31-9885-805633d5e218 | chai2010/opencv | opencv110/cxcore/src/cxmatmul.cpp | #include "_cxcore.h"
/****************************************************************************************\
* cvGEMM *
\****************************************************************************************/
icvBLAS_GEMM_32f_t icvBL... | ALGO | 0.876396 | 6.227934 |
0661c717-0c06-42d1-9983-c44944013251 | dorameme/KOI- | 수학/KOI1037약수bronze1.cpp | /*
start:14:06
end:14:15
시간복잡도:O(N)
공간복잡도:O(N)
풀이: 정렬한 뒤 제일 큰값과 제일 작은값을 곱해준다. 그것이 답이된다.
*/
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
int N;
int num;
vector <int> v;
cin>>N;
for(int i=0;i<N;i++){
cin>>num;
v.push_back(num);
}
s... | ALGO | 0.999951 | 5.353648 |
5b735726-39d3-41e9-97af-b7b3c1120a42 | naivvve/Computer_Graphics | 朱硕_20201060338/平时作业/work_10/work_10_1.cpp | #include <windows.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* Set initial size of the display window. */
GLsizei winWidth = 500, winHeight = 500;
/* Set limits for the rectangular area in complex plane. */
GLfloat xComplexMin = -2.00, xComplexMax = 0.50;
GLfloat yComplexMin =... | ALGO | 0.995822 | 5.846916 |
2e421d9d-e0dd-4937-a8c7-71c25855ef18 | berrzebb/boost | libs/numeric/ublas/test/test_inplace_solve.cpp | #include <iostream>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
#include "utils.hpp"
namespace ublas = boost::numeric::ublas;
static const dou... | TEST | 0.937451 | 6.130279 |
083406ed-423a-4aab-9de7-c60ca969e7b1 | omagdy7/competitive-programming | codechef/validTriangles/validTriangles.cpp | #include<bits/stdc++.h>
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt;
cin >> tt;
while(tt--){
int a, b, c;
cin >> a >> b >> c;
cout << (a + b + c == 180 ? "YES" : "NO") << '\n';
}
}
| ALGO | 0.999808 | 4.404871 |
36a534f6-9a6f-4251-a21c-bde71066b495 | halogenOS/android_packages_apps_OTAUpdates | jni/boost_1_57_0/libs/math/example/neg_binomial_sample_sizes.cpp | // neg_binomial_sample_sizes.cpp
#include <boost/math/distributions/negative_binomial.hpp>
using boost::math::negative_binomial;
// Default RealType is double so this permits use of:
double find_minimum_number_of_trials(
double k, // number of failures (events), k >= 0.
double p, // fraction of trails for whi... | ALGO | 0.998119 | 7.394742 |
f8cfa7ba-27d8-4a5c-9fcb-c0ac6ad5ff0a | devhysterical/LeetCode_300BCTN | ArrayPartition/561.cpp | /**
* @file 561.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2024-04-06
*
* @copyright Copyright (c) 2024
* @link https://leetcode.com/problems/array-partition/description/
* Time Complexity: O(nlogn)
* Space Complexity: O(1)
*/
class Solution
{
public:
int arrayPairSum(vector<int> &n... | ALGO | 0.999816 | 6.277021 |
a1dc65d1-9bb0-4a15-b37c-bad531634aaf | ishandutta2007/codeforces | sonechko/normal/796/C.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 11;
#define pb push_back
int a[N],ms;
vector<int> v[N];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin>>n;
ms=-INT_MAX;
for (int i=1; i<=n; i++)
{
cin>>a[i];
ms=max(ms,a[i]);
}
... | ALGO | 0.999985 | 3.779607 |
e6192645-2fe2-479b-af4e-40b072741c22 | raincross7/code-similarity | codes/train_code/problem394/problem394_129.cpp | #include <cstdio>
#include <cctype>
int main() {
int n[26] = { 0 };
char c;
while (scanf("%c", &c) != EOF)
n[(int)tolower(c) - 97]++;
c = 97;
for (int i = 0; i < 26; i++)
printf("%c : %d\n", c + i, n[i]);
} | ALGO | 0.991885 | 3.83177 |
5456d38e-123c-43b5-8db4-bc9d573f859e | Buzzou/Data_Structure | 数据结构(李春葆)/数据结构教程上机指导/数据结构上机指导-源程序/实验题6/exp6-2.cpp | //ļ:exp6-2.cpp
#include <stdio.h>
#define M 4
#define N 4
void MinMax(int A[M][N])
{ int i,j;
bool have=false;
int min[M],max[N];
for (i=0;i<M;i++) //ÿеСֵԪ,min[0..M-1]֮
{
min[i]=A[i][0];
for (j=1;j<N;j++)
if (A[i][j]<min[i])
min[i]=A[i][j];
}
for (j=0;j<N;j++) //ÿеֵԪ,max[0..N-1]֮
{ max[j]=A[0][j];
... | ALGO | 0.999656 | 3.092753 |
78fdd352-c400-44d3-86a2-776e1115f437 | Sayak-Bhunia/imp_dsa_oncampus | accenture/cf 110A lucky number using the number of lucky digits.cpp | #include <bits/stdc++.h>
#define lint long long
using namespace std;
int helper(int n) {
bool f = false;
if(n == 0) f = true;
while(n != 0) {
if(n%10 != 7 && n%10 != 4) f = true;
n /= 10;
}
if(!f) cout << "alsmost lucky" <<endl;
else cout << "not almost lucky" <<endl;
}
int mai... | ALGO | 0.999243 | 3.837229 |
c242c5da-e188-4096-b08e-a71ed30bad58 | anas2204/ParallelSierpinskiTetrahedrons | ConsoleApplication4/ConsoleApplication4/Source.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <string.h>
#include <assert.h>
#include <CL/cl.h>
#define MAX_SOURCE 0x100000
cl_platform_id platformid=NULL;
cl_device_id deviceid=NULL;
cl_uint ret_numdevices,ret_numplatforms;
cl_int ret;
cl_context context;
cl_command_queue... | ALGO | 0.922404 | 3.559235 |
472293e6-9d79-48ae-9f3c-f8db75e55168 | KazumaMurao/spoj | c++/LASTDIG/LASTDIG.cpp | #include <iostream>
using namespace std;
int resarray[10][4] =
{{0, 0, 0, 0},
{1, 1, 1, 1},
{2, 4, 8, 6},
{3, 9, 7, 1},
{4, 6, 4, 6},
{5, 5, 5, 5},
{6, 6, 6, 6},
{7, 9, 3, 1},
{8, 4, 2, 6},
{9, 1, 9, 1}};
void solve(int A, int B) {
if (B == 0) {
cout << 1 << endl;
return;
}
cout << resarray[A... | ALGO | 0.999722 | 4.745612 |
7c6e6f1c-ba1b-49cc-9afb-882701485f3a | Shubham-js/Codes | bst_flatten.cpp | #include<bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node*left;
node*right;
node(int d) {
data = d;
left = NULL;
right = NULL;
}
};
node* insertInBST(node*root, int d)
{
if (root == NULL)
{
return new node(d);
}
if (d <= root->data)
{
root->left = insertInBST(root->left, d);
... | ALGO | 0.999987 | 4.390215 |
e170f1e4-38e8-436c-9959-97d3c4957bbf | Seann0425/LeetCode | finished/1037. Valid Boomerang.cpp | #include <bits/stdc++.h>
using namespace std;
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) {
}
};
struct TreeNode {
int val;
TreeNode *left;
... | ALGO | 0.999811 | 5.463759 |
51facd69-6ca6-4c6d-a253-fc5dfea2f6de | QbitQuantum/Basics | Исходники/CoreNode.cpp | void CoreNode::look(const Vector& target, const Vector& up) {
Vector zaxis = (target - position_).unit();
Vector xaxis = (up.cross(zaxis)).unit();
Vector yaxis = (zaxis.cross(xaxis)).unit();
rotation(Quaternion(xaxis, yaxis, zaxis));
} | TOOL | 0.926442 | 5.398476 |
af2463b4-f2d4-4f84-821b-ee6fe3397977 | khalidKE/Algorithms | radix_sort.cpp | #include <iostream>
using namespace std;
int getMax(int arr[], int size) {
int max = arr[0];
for(int i = 1; i < size; i++)
if(arr[i] > max) max = arr[i];
return max;
}
void countingSort(int arr[], int size, int exp) {
int output[size], count[10] = {0};
for(int i = 0; i < size; i++) count[... | ALGO | 0.99993 | 6.51947 |
b0ddb242-8345-46ef-8cb0-980ee6a8a75d | ishandutta2007/codeforces | wailydest/normal/1623/B.cpp | #include <cstdio>
const int N = 1000;
int t, n, l[N], r[N];
void run(int ll, int rr)
{
if (ll > rr) return;
for (int i = ll; i <= rr; ++i) {
bool ok = i == ll, ok1 = i == rr;
for (int j = 0; j < n; ++j) {
if (l[j] == ll && r[j] == i - 1) ok = 1;
if (l[j] == i + 1 && r[j] == rr) ok1 = 1;
}
if (ok && o... | ALGO | 0.999676 | 3.54222 |
70486a55-ddce-45a2-8eed-1bbebb0a275a | krishna4040/DSA | gfg_practice/arrays/safe_position.cpp | /*There are n people standing in a circle (numbered clockwise 1 to n) waiting to be executed.
The counting begins at point 1 in the circle and proceeds around the circle in a fixed direction (clockwise).
In each step, a certain number of people are skipped and the next person is executed. The elimination proceeds arou... | ALGO | 0.999969 | 3.695046 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.