uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
bd6ab831-bdfb-48a0-90a7-8c53ec4cd55d | linzhangdaren/CPlusPlus_Learning | HeiMaAi/76.cpp | #include <iostream>
using namespace std;
int main()
{
int *parr1 = new int[10]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
cout << "parr1: ";
for (int i = 0; i < 10; i++)
{
cout << parr1[i] << " ";
}
cout << endl;
int *parr2 = new int[8];
int offset = 0;
for (int i = 0; i < 10; i++)
... | ALGO | 0.994798 | 3.778584 |
76003b6a-563e-42b9-bb14-4b793d90a0b3 | aritra741/Competitive-Programming | Codeforces/PlanningTheExpedition.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
int arr[m];
map <int, int> mp;
for(int i=0;i<m;i++)
{
int p;
cin>>p;
mp[p]++;
}
}
| ALGO | 0.999898 | 3.097525 |
ddc5bbfa-ff3c-4b53-9e9a-dff63d35d053 | Richard-Quayson/ICP_Project_2 | Node.cpp | /**
* Description:
* this file implements methods defined in the Node.h file
*
* @author Richard Quayson
*/
#include "Node.h"
Node::Node(int state, Node *parent, double path_cost) {
this->state = state;
this->parent = parent;
this->pathCost = path_cost;
}
Node::Node(int state) {
this->state = st... | ALGO | 0.886582 | 5.360574 |
396f860a-8dd5-45db-a021-73162c50d55c | SamerBenMim/Competitive-Programming | Dynamic programming/MEDIUM - 397. Integer Replacement.cpp | class Solution {
public:
map<int,int> mp;
long solve(long n){
if(mp[n]!=0)return mp[n];
if(n==1) return 0;
if(n%2 == 0) return mp[n]= 1+solve(n/2);
return mp[n]= 1+ min(solve(n-1),solve(n+1) );
}
int integerReplacement(int n) {
return solve(n);
}
};
| ALGO | 0.999994 | 6.157426 |
d4328838-f49b-4d7f-ae00-2af035aba1fe | ErikkJs/csgod | c++/learnings/graphics/3480/7/lab7.cpp | //modified by:
//date:
//
//3480 Computer Graphics
//lab7.cpp
//Author: Gordon Griesel
//Date: 2017
//This is a perspective ray tracer.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xutil.h>
//Variable types... | TOOL | 0.864783 | 4.110167 |
ca5dfa39-5d04-4828-b310-dab6e98b97e5 | cxlove/ACM_ICPC | Contest/AHU_6th/onsite/670.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
using namespace std;
const int MOD = 1000000007;
const int N = 1025;
int n , m;
int c[N][N] , a[N] , b[N] , d[N];
int main () {
#ifndef ONLINE_JUDGE
// freopen ("input.txt" , "r" , stdin... | ALGO | 0.999754 | 3.064168 |
b93830d7-3382-40b5-81b8-21f070d4c582 | ishandutta2007/codeforces | normie28/normal/1303/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1010;
int n,a,b,i,j,m,c,d,k,t,t1,used[26];
vector<int> keys;
void done()
{
... | ALGO | 0.999987 | 3.710095 |
d5a900f2-fb64-4eaa-886f-755c5f181c6e | kamilszymczak1/my_solutions | poi/XXIV/reprezentacje_roznicowe.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
const long long MAX_N = 1e9 + 7;
long long r(vector<long long>&a) {
int n = a.size();
vector<bool>appear(n * (n - 1) / 2 + 10, false);
for(int i = 0; i < n; i++) {
for(int j = i + 1; j < n; j++) {
... | ALGO | 0.999942 | 3.626436 |
b70cbe33-c30d-4a47-99c6-9fcdb0f03f6d | TusharChauhan09/DSA-cpp | Algorithms/Dynamic Programing/Foundation/Fibonacci_Recursion_Memoization.cpp | #include<vector>
#include<iostream>
using namespace std;
int dp_fibo(int n,vector<int>&dp){
if(n<=1) return n;
if(dp[n]!=-1) return dp[n];
dp[n] = dp_fibo(n-1,dp) + dp_fibo(n-2,dp);
return dp[n];
}
int fibo(int n){
vector<int>dp(n+1,-1);
return dp_fibo(n,dp);
}
int main(){
int n;
cout<<... | ALGO | 0.999987 | 5.059968 |
8e136c7e-d060-4367-99cb-fb6829dda09c | biswajitmaharana2016/CppCode | Rainer_Grimm/source/readWriteVolatile.cpp | #include <iostream>
#include <thread>
volatile int x= 0;
volatile int y= 0;
void writing(){
x= 2000;
y= 11;
}
void reading(){
std::cout << "y: " << y << " ";
std::cout << "x: " << x << std::endl;
}
int main(){
std::thread thread1(writing);
std::thread thread2(reading);
thread1.join();
thread2.join(... | TOOL | 0.908174 | 4.868573 |
38eb307e-be60-4fa0-9eec-6d9220231cda | katrinafyi/madeline | src/lib/hexgrid.cpp | #include "hexgrid.h"
// Forward declarations
namespace hex {
Hex hex_add(Hex a, Hex b) { return Hex(a.q + b.q, a.r + b.r, a.s + b.s); }
Hex hex_subtract(Hex a, Hex b) { return Hex(a.q - b.q, a.r - b.r, a.s - b.s); }
Hex hex_scale(Hex a, int k) { return Hex(a.q * k, a.r * k, a.s * k); }
Hex hex_rotate_left(Hex a) {... | ALGO | 0.99024 | 6.967759 |
f6d9ce2b-6b51-4c43-a5de-4e71cfcb0aff | borhansahed/cp | phase-1/practice-2/sorting.cpp | #include <iostream>
using namespace std;
void solve(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
int max = i;
for (int j = i + 1; j < n; j++)
{
if (arr[max] > arr[j])
{
max = j;
}
}
if (i != max)
{
... | ALGO | 0.999974 | 5.29415 |
e2f4a8db-7139-4b3d-936d-122b56dbf1f6 | Mr-Poseidon/CFile | AcWing/1023买书(完全背包).cpp | #include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int a[4]={10,20,50,100};//ļ۸
int f[N];//f[i]άǮΪiʱɹķ
int m;
int main()
{
cin>>m;
f[0]=1;//ǮΪ0ʱҲһַ
for(int i=0;i<4;i++)//
for(int j=a[i];j<=m;j++)//ǮȫŻǰ
f[j]=f[j]+f[j-a[i]];//ķܺ
cout<<f[m];
... | ALGO | 0.999802 | 3.630161 |
c1ae147a-1825-4e60-997e-c43e23b6733a | HyeonJunSong/Baekjoon | 백준_3 Gold/16117_실버런.cpp | #include <iostream>
#include <vector>
using namespace std;
int N, M;
vector<vector<int>> board;
vector<vector<int>> memo;
int getAns(int I, int J){
if(J == M) return 0;
int ans = 0;
if(I > 0){
if(memo[I - 1][J + 1] == -1)
memo[I - 1][J + 1] = getAns(I - 1, J + 1);
ans = max(ans, memo[I - 1][J + ... | ALGO | 0.99997 | 4.086171 |
ef26d6ea-53f7-4a69-bdff-96c028cf84fc | ishandutta2007/codeforces | tonyjjw/normal/472/A.cpp | //*
#include<stdio.h>
#pragma warning(disable:4996)
int N;
int main(){
// freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
scanf("%d",&N);
if(N&1){
printf("%d %d",9,N-9);
}
else{
printf("%d %d",4,N-4);
}
return 0;
}
//*/ | ALGO | 0.999477 | 3.436873 |
c22eafb4-b7f7-45ff-82db-9f0820120816 | ishandutta2007/codeforces | cheetose/normal/1661/A.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c... | ALGO | 0.999983 | 4.456941 |
c3d4b8a9-3cdd-4caa-9668-1b3c7a86998c | Xingfush/LeetCode-Notes | Ceetcode/二叉树/MirrorBTree.cpp |
/* 使用栈完成中序遍历 */
void MirroInBFS(TreeNode* root)
{
if(root==nullptr)
return;
stack<TreeNode *> nstack;
TreeNode *node = root;
while(node!=nullptr ||!nstack.empty())
{
while(node!=nullptr)
{
nstack.push(node);
node=node->left;
}
if(!nstack.empty())
{
node = nstack.top();
if(node->left!=... | ALGO | 0.999935 | 3.797394 |
42c0e532-687a-41ac-bdb6-0f4420ff3dde | EdimarJunior/CompositionalTioco | symbolrt/CVC4/src/util/sampler.cpp | /********************* */
#include "util/sampler.h"
#include "base/check.h"
#include "util/bitvector.h"
namespace CVC4 {
BitVector Sampler::pickBvUniform(unsigned sz)
{
Random& rnd = Random::getRandom();
std::stringstream ss;
for (unsigned i = 0; i < sz;... | ALGO | 0.97607 | 5.937751 |
3a1d18e6-bb7c-4d21-961f-72a2f951e571 | bensmooth/ledBoard | life/BoardState.cpp | #include <random>
#include "BoardState.h"
#include "Exception.h"
using namespace std;
namespace Pix
{
inline uint32_t AlwaysPositiveModulo(int32_t a, int32_t b)
{
return (a % b + b) % b;
}
BoardState::BoardState()
{
}
BoardState::~BoardState()
{
}
void BoardState::FromImage(const IImage& image, Color deadColor)
... | ALGO | 0.943293 | 6.323314 |
53b9b8a6-a562-488c-aabf-9028875e1971 | duartega/Data-Structures---CS315 | lab01/exercise01.cpp | // Author: Gabriel Duarte
// Class: Cs315
// Date: 1/23-2018
// Teacher: Dr. Ravikumar
#include <iostream>
using namespace std;
int f(int n);
int main ()
{
cout << f(4) << endl;
return 0;
}
int f(int n)
{
if (n == 1)
return 1;
else
return f(n - 3) + n;
}
| ALGO | 0.99946 | 4.781804 |
3af74021-c131-4a4c-aa47-433f25ffcef4 | egemenberk/Ceng-Homeworks | Ceng477-Computer-Graphics/Ceng477-Hw2/source/cpp/hw2_math_ops.cpp | #include <cstdio>
#include <cmath>
#include "hw2_math_ops.h"
#define ABS(a) ((a)>0?(a):-1*(a))
/*
* Calculate cross product of vec3 a, vec3 b and return resulting vec3.
*/
Vec3 crossProductVec3(Vec3 a, Vec3 b) {
Vec3 result;
result.x = a.y * b.z - b.y * a.z;
result.y = b.x * a.z - a.x * b.z;
result.... | ALGO | 0.993267 | 5.089527 |
2f5a6905-dfc5-4ff8-b8a6-8833e38a179b | electricalArt/SomeOldCppProjects | VasilievAN_Programmirovanie_na_c++/chapter3_pointers-arrays-references/3.q10_two-dim_filling-top-to-down.cpp | /*
* =====================================================================================
*
* Filename: 3.q10_two-dim_filling-top-to-down.cpp
*
* Description: creates an array and fills it in columns with user input
*
* Version: 1.0
* Created: 05/22/20 18:22:59
* Revision: non... | ALGO | 0.984275 | 3.95098 |
b63eddee-b73e-43bf-9e67-6d093a00346e | krf/kdevplatform | language/duchain/stringhelpers.cpp | #include "stringhelpers.h"
#include "safetycounter.h"
#include <QString>
#include <QStringList>
#include <interfaces/icore.h>
#include <interfaces/ilanguagecontroller.h>
#include <interfaces/icompletionsettings.h>
namespace KDevelop
{
class ParamIteratorPrivate
{
public:
QString m_prefix;
QString m_source;
QSt... | TOOL | 0.928488 | 6.57441 |
f5b9026f-0977-4896-9f1e-cd616c34575d | yash-pratap-singh/fjf | 900-1000/42_Odd_Grasshoper.cpp | #include <iostream>
#include <vector>
#include <map>
#include <climits>
#include <algorithm>
#include <math.h>
#include <queue>
#include <stack>
#define pb push_back
#define vi vector<int>
#define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
ll x, n;
cin... | ALGO | 0.999542 | 4.189087 |
5676477e-8356-4c10-b966-ed1b4fd011ec | mimingucci/Algorithm | Contest/AtCoder Beginner Contest 394/e.cpp | /*
* author: mimingucci
* created: [Sat] Feb 22, 2025 19:36:29
*/
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int INF = int(1) << 62;
const int MAXN = 1e6;
const int MOD = 998244353; // 1e9+7
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
cha... | ALGO | 0.999861 | 4.5926 |
77631878-98b1-4fa2-b598-e000a96afb75 | PTNhatHa/Nam-2-ki-2 | DHMT/Lab10/BT4.cpp | //#include <GL/glut.h>
//#include <cmath>
//const int WIDTH = 600;
//const int HEIGHT = 500;
//const int MAX_ITER = 1000;
//
//int is_in_mandelbrot(float real, float imag)
//{
// float z_real = 0, z_imag = 0;
// for (int i = 0; i < MAX_ITER; i++)
// {
// float z_real_new = z_real*z_real - z_imag*z_ima... | ALGO | 0.980071 | 4.085333 |
cefd86f8-8401-4f91-afd2-7db99ba8319e | ritwickoo1/Coding-ninja-data-structure-cpp | Graph 1/HasPath-DFS.cpp | #include <iostream>
#include<queue>
using namespace std;
bool hasPath(int **edges, int v,int v1,int v2, bool *visited){
if(edges[v1][v2]==1){
return true;
}
visited[v1] = true;
bool res = false;
for(int i = 0 ; i < v; i++){
if(!visited[i] && edges[v1][i]==1)
res = hasPath(edges,v,i,v2,visited... | ALGO | 0.999912 | 4.886415 |
d46cdeaf-6b68-41f0-bfd9-8310a821e1e3 | gaeun6883/2021.mentoring | 0120.백준1935.후위 표기식2.cpp | //mentoring 120. 2022.2.7
//stack
#include <iostream>
#include <stack>
#include <string>
#define MAX 30
using namespace std;
stack<double> s;
void calc(char op, double x, double y);
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, alpha_to_num[MAX] = { 0, };
string str;
cin >> n;
cin >> str;
for (int... | ALGO | 0.997568 | 4.084859 |
3b29b8d6-2190-49d7-9f65-1b1263414b67 | ancient-dna/variogramr | src/dist.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::depends(RcppParallel)]]
#include <RcppParallel.h>
using namespace RcppParallel;
struct Distance : public Worker {
// p x n matrix of observed data
const RMatrix<double> y;
// n x n unnormalized distance matrix
RMatrix<double> q;
... | ALGO | 0.999681 | 5.907546 |
a7c641e5-17ce-4b34-8eb0-baf5c2bcf12f | nazibur175/C- | D_Absolute_Sorting.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define test int t; cin>>t; while(t--)
void solve(){
test{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
int x=0;
for(int i=0;i<n-1;i++){
i... | ALGO | 0.999781 | 4.517142 |
31ef099b-7dd9-4f79-83cb-f62823dd120a | anindyaspaul/competitive-programming | codeforces/318A - Even Odds.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef unsigned long long ULL;
int main()
{
ULL k, n, odd, even;
cin >> n >> k;
odd = ( n & 1 ) ? n/2 + 1 : n/2;
even = n / 2;
if( k <= odd )
cout << 2 * ( k - 1 ) + 1 << endl;
else
cout << 2 * (... | ALGO | 0.999758 | 3.455921 |
74e5fea2-aceb-4fde-9c05-a116b8798088 | ishandutta2007/codeforces | pickupwin/normal/980/E.cpp | #include <iostream>
using namespace std;
const int MAXN=1000111;
int N, K;
int Cnt;
struct Vert{
int FE;
bool Co;
int Dep;
int Pre[21];
} V[MAXN];
struct Edge{
int x, y, next;
} E[MAXN<<1];
int Ecnt;
void addE(int a, int b){
++Ecnt;
E[Ecnt].x=a;E[Ecnt].y=b;E[Ecnt].next=V[a].FE;V[a].FE=Ecnt;
}
void DFS(in... | ALGO | 0.999978 | 3.689695 |
b46f807f-729e-4243-8e72-3d929df9f472 | vbonnici/grafe-sim | analysis/data/p02267/s179774423.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <vector>
using namespace std;
struct pond {
int startPos;
int volume;
};
int main() {
int n, q;
cin >> n;
int s[n];
for(int i = 0; i < n; i++){
cin >> s[i];
}
cin >> q;
int t[q];
for(in... | ALGO | 0.999745 | 4.284881 |
53e62484-a81b-47d9-82fc-18470dd954c8 | somdats/nausicaa_devl | nauiscaa_application/nausicaa_vs/Calibration/detect_3d_marker.cpp | #include "detect_3d_marker.h"
#include "vcg_mesh.h"
#include <vcg/complex/allocate.h>
#include <vcg/space/fitting3.h>
#include <vcg/math/histogram.h>
#include <vcg/space/intersection3.h>
#include <wrap/io_trimesh/export.h>
// #define PRINTOUT_DEBUG
float EDGE_QUAD = 0.99;
void _save_points(std::vector<vcg::Point3f> ... | ALGO | 0.992007 | 5.087458 |
de6fd71d-17d4-479e-a9c9-f47e19d753a2 | kanaygupta/Implementation-of-algorithms-and-data-structures | basic_merge_quick_linklisy_stri_mal_etc/quick3.cpp | #include<iostream>
#include<vector>
using namespace std;
int partition(int* arr,int l, int r);
void swap(int* arr,int l,int r);
void quicksort(int* arr,int l,int r,int n)
{
if(l>=r)return ;
int pivot=partition(arr,l,r);
quicksort(arr,l,pivot-1,n);
quicksort(arr,pivot+1,r,n);
}
int partition(int* arr,int l, int r... | ALGO | 0.999992 | 4.494569 |
06bc06a0-f724-44aa-b7c4-c385091af809 | HardikIsACoder/myStack | decimalToBinary.cpp | #include<bits/stdc++.h>
using namespace std;
int decimalToBinary(int n){
int x=1;
int ans=0;
while(x<=n){
x*=2;
}
x/=2;
while(x>0){
int lastDigit=n/x;
n-=lastDigit*x;
x/=2;
ans=ans*10+lastDigit;
}
return ans;
}
int main(){
int n;
cin>>n;
... | ALGO | 0.999972 | 5.387244 |
a3c29cdc-e5ce-4a5e-b84a-62d11cd1887a | Wulnut/Learning-only | C++only/Leetcode/70.爬楼梯.cpp | /*
* @lc app=leetcode.cn id=70 lang=cpp
*
* [70] 爬楼梯
*/
#include <vector>
// @lc code=start
class Solution {
public:
int climbStairs(int n) {
vector<int> dp(n + 1, 1);
for (int i = 2; i <=n; ++ i) {
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
};
// @lc code... | ALGO | 0.999882 | 6.201503 |
fc3c7250-d93e-4eb3-a38a-d11973b16df7 | uday18git/DSA | c++/2.array/medium/9_merge_two_sorted_arrays.cpp | // brute force approach is to use extra space and
// two pointer approach
// one pointer at one array and other at another one
// one by one insert in the answer array
// tc O(n+m) sc O(n+m)
// tougher variation is to not use any extra answer array and
// rearrange in sorted order in the same 2 arrays
// so soluti... | ALGO | 0.999853 | 5.095482 |
25ba4c00-cac9-4c3a-8774-9f2138b4a55d | Talkative-Banana/AdventOfCode | Day7_b.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <utility>
using namespace std;
bool func(int idx, long long f, long long n, long long elem, vector<long long>& Vec){
// BaseCase
if(idx == n) return f == elem;
bool... | ALGO | 0.999231 | 3.935083 |
bca3e134-8372-45b2-8865-bf55ebee6f7d | mdmasudrana271/cp | Week 13/Day-3/A_Alice_and_Books.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define mod 1000000007
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a / gcd(a, b) * b)
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using pbds = tree<T, null_type... | ALGO | 0.99985 | 4.640921 |
ac82865e-228c-45a3-abf9-e26cb9f827a4 | avendramini/leetcode | solved_problems/0235-lowest-common-ancestor-of-a-binary-search-tree/solution.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:
vector<vector<TreeNode*> > v;
void dfs(TreeNode* root, TreeNode* p, TreeNode* q,vector<Tre... | ALGO | 0.999984 | 5.697885 |
f27fd4db-2b63-4b69-9013-dd608ee4a796 | bytefairy0/code24by7 | 1st-Sem/selectionsort.cpp | // Lets try selection sort by iterative case
#include <iostream>
using namespace std;
//Two swap two numbers
void swap(int &a, int &b);
void selectionSort(int arr[], int n){
/*Selection sort selects a key and say it minimum
it check the next key, if its less, now is is minimum,
then it moves the minimum to... | ALGO | 0.999989 | 5.469007 |
ca314344-9747-4713-b1bf-a3ef2c07084d | fdaPDE/fdaPDE-R | src/de.cpp | #include <RcppEigen.h>
// [[Rcpp::depends(RcppEigen)]]
#include "../inst/include/de.h"
namespace fdapde {
namespace r {
// clang-format on
#define fe_de_elliptic_rcpp_interface(LocalDim, EmbedDim) \
method("fit" , &de_elliptic<LocalDim, Embed... | ALGO | 0.889966 | 6.082206 |
7ce4b7ee-cfd6-4d12-acf3-3d776047ea5f | viroulep/CosetSolver444 | coset_test.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include "coset.h"
void pack_unpack(){
std::cout << "coset_test: unpacking and packing gives the same coordinate... ";
cubepos cp;
coset c;
int testok = 1;
for (unsigned int coord=0; coord<COSET_N_RAW_COORD; coord++) {
c.unpack(cp, coord);
unsigned int... | TEST | 0.980004 | 5.236084 |
cb806e2e-350e-47bb-8976-bc7946a3ae20 | marwansallam88/4-DOF-SCARA-Robot-for-Laser-Engraving | Control/Marlin-2.0.x/buildroot/share/PlatformIO/variants/MARLIN_F103Vx/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, //D0
PA_1, //D1
PA_2, //D2
PA_3, //D3
PA_4, //D4
PA_5, //D5
PA_6, //D6
PA_7, //D7
PA_8, //D8
PA_9, //D9
PA_10, //D10
PA_11, //D11
PA_12, //D12
PA_13, //D... | CONFIG | 0.88018 | 3.751779 |
36f5cd84-33e1-4a06-b1d0-bd95f1e36f1a | Pedro-Mendes/competitiveProgramming | uva/uva116p11634.cpp | /* https://uva.onlinejudge.org/external/116/p11634.pdf */
#include<bits/stdc++.h>
using namespace std;
std::map<int, int> usedNumbah;
int main(){
int x, c=0;
bool cycle = true;
cin >> x;
while(x != 0){
c = 0;
cycle = true;
usedNumbah.clear();
usedNumbah[x] = 1;
c = 1;
while(cycle){
x *= x;
x /=... | ALGO | 0.999511 | 3.521894 |
b1585b7f-443b-4524-a310-5307c8ebefdb | Nati892/road_flutter_textbox | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
d2e4c837-f777-40bb-a138-e5095c2af80f | yjkim0306/baekjoon | #16430.cpp | // 제리와 톰
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b;
cin >> a >> b;
cout << b - a << " " << b << "\n";
return 0;
} | ALGO | 0.99964 | 4.125794 |
69588bb8-8852-469f-bcda-c09c967b608b | AbhishekKumarSinha/problem-solving | array-hashing.cpp | #include"array-hashing.h"
#include<unordered_set>
#include<unordered_map>
const bool print_debug = false;
ArrayHashing::ArrayHashing()
{
}
ArrayHashing::~ArrayHashing()
{
}
/*
Question:
Given an integer array nums,
return true if any value appears at least twice in the array,
and return false if every element is... | ALGO | 0.938707 | 4.401393 |
2428bcfe-3b7f-4857-a131-9a08fc6ad1d6 | chat1891/LEETCODE | interval/732_MyCalendarIII.cpp | #include <map>
/*
- log time to the timeline
- add one event at start
- remove event at end
- iterate the timeline again to get max number of events
time: O(N^2)
- each event, update two points in timeline O(log n)
- traverse diff in O(N)
Space O(N)
*/
//https://www.youtube.com/watch?v=tReqj-t0rq0
class MyCalendar... | ALGO | 0.999705 | 6.419639 |
2941c755-bfab-4d29-96ea-cb6165beac00 | Dyk-srv/FinalFunctions | Main.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <algorithm>
//
template <typename T>
void print_arr(T arr[], const int length) {
std::cout << '[';
for (int i = 0; i < length; i++)
std::cout << arr[i] << ", ";
std::cout << "\b\b]\n";
}
//
template <typename T>
void fill_arr(T arr[], const i... | TOOL | 0.995678 | 3.176322 |
2730fa89-ab8e-45d4-a017-d451d7214722 | skandavc18/logic_detector | backend/CDataset/coinChange/coinChange_21.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
vector<int> dp(amount+1,INT_MAX-1);
dp[0]=0;
for(int i=1;i<=coins.size();i++)
{
for(int j=1;j<=amount;j++)
{
if(coins[i-1]<=j)
{
... | ALGO | 0.999959 | 5.980363 |
0996136a-899f-48b6-9655-e1c1b31cac21 | xhaktmchl/Algorithm_study | Sejong Algorithm Training/[세종대 알고리즘 트레이닝 Level07.5 03번 O] 다중조건일때 처리하기 [난이도 : 3].cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
using namespace std;
/*
[세종대 알고리즘 트레이닝 Level07.5 03번 O] 다중조건일때 처리하기 [난이도 : 3]
문제:
접근:
풀이:
시간복잡도: O()=
*/
char a[10];
int cnt = 0;
void input() {
for (int i = 0; i < 2; i++) {
cin >> a[i];
if (a[i] >= 'A' && a[i] <= 'Z') { cnt++; }
}
}
vo... | ALGO | 0.998558 | 3.892943 |
998b0b59-ec3c-4ecc-9b64-58bd8eb1b401 | mkscoin/mkscoin | src/hash.cpp | #include <hash.h>
#include <crypto/common.h>
#include <crypto/hmac_sha512.h>
inline uint32_t ROTL32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
{
// The following is MurmurHash3 (x86_32), see http:... | ALGO | 0.998496 | 7.051342 |
48099ad5-017d-4df4-a444-b2f6b344264b | ishandutta2007/codeforces | 4et_llpuyhbljl/normal/1337/B.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<string>
using namespace std;
const int Y = 100100;
long long arr[Y];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
long long x, n, m;
bool res = false;
cin ... | ALGO | 0.999473 | 3.899073 |
a449dbe7-5d20-4d0a-8b06-8ad61f9e7ec5 | AI1379/OILearning | Practices/Search/loj10022-ac.cpp | #include <cstdio>
int t, k, l, q[10];
long long n, m, ord[100];
long long max(long long x, long long y) { return x > y ? x : y; }
long long gcd(long long x, long long y) {
return x % y == 0 ? y : gcd(y, x % y);
}
bool dfs(long long a, long long b, int remain, long long min) {
bool flag = false;
if (a < 0) return... | ALGO | 0.99996 | 3.171887 |
f369cfbb-f247-4441-a2b4-076f7de36311 | RomualdRousseau/Arduino | libraries/FastLED/src/noise.cpp | #define FASTLED_INTERNAL
#include "FastLED.h"
#include <string.h>
FASTLED_NAMESPACE_BEGIN
#define P(x) FL_PGM_READ_BYTE_NEAR(p + x)
FL_PROGMEM static uint8_t const p[] = {
151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225,
140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 1... | ALGO | 0.991016 | 5.949927 |
ab1a0a91-c5cd-4d18-aee3-4deacd2f5702 | ujjwalprakash17/Striver-A2Z-DSA-Series-Solutions | 16 Dynamic Programming/04 DP on Strings/04_LongestPalindromicSubsequence.cpp | #include <bits/stdc++.h>
using namespace std;
// int solution(int ind1, int ind2, string &s, vector<vector<int>> &dp)
// {
// if (ind1 > ind2)
// return 0;
// if (ind1 == ind2)
// return 1;
// if (dp[ind1][ind2] != -1)
// return dp[ind1][ind2];
// // match case
// if (s[ind1... | ALGO | 0.999979 | 5.697396 |
c74bee10-bd51-433a-b747-cfdc88b71b51 | PacktPublishing/C-Plus-Plus-20-Mastery---Pure-and-Unfiltered | Ranges/UsingRanges/UsingRanges/main.cpp | #include <algorithm>
#include <random>
#include <vector>
#include <iostream>
#include <format>
#include <ranges>
template<typename Container>
void Print(Container &&container, std::string_view message = "", char separator=' ') {
std::cout << std::format("{:<12}: [", message) ;
for(const auto &element : container) {
... | TOOL | 0.98241 | 5.166724 |
8067cff0-a429-4488-9f1e-60518ee346c5 | kwakjames5/USC_CSCI_104_FALL2020 | Repositories/prestudy-2020/005_Remove_Duplicates_026/remove_duplicates_class.cpp | #include "remove_duplicates_class.h"
#include <iostream>
// g++ -g -Wall -std=c++11 name.cpp -o name
Solution::Solution()
{
}
int Solution::removeDuplicates(int nums[], int size, std::vector<int>& updatedNums)
{
// Also keeps track of position
int length = 0;
for(int i = 0; i < size; i++)
{
// The first ele... | ALGO | 0.999319 | 6.189765 |
57065eda-82f5-4804-956e-166c76d44257 | SwaggyTyrion/CADAC | example/ADS6/tvc.cpp | ///////////////////////////////////////////////////////////////////////////////
//FILE: 'tvc.cpp'
//Contains 'tvc' module of class 'Missile'
//
//030608 Created by Peter H Zipfel
///////////////////////////////////////////////////////////////////////////////
#include "class_hierarchy.hpp"
using namespace std;
//////... | ALGO | 0.880351 | 3.489997 |
5d2c08ef-9436-4e7b-b7e1-f34937f1609f | aadyrajput/Leetcode_submissions | 0013-roman-to-integer/0013-roman-to-integer.cpp | class Solution {
public:
int romanToInt(string s) {
map<char,int> m;
m['I']=1; m['X']=10; m['V']=5; m['L']=50;
m['C']=100; m['D']=500; m['M']=1000;
int ans=0; int prev=0;
for(int i=s.size()-1; i>=0; i--){
int x=m[s[i]];
if(prev>x) ans-=x;
e... | ALGO | 0.999817 | 6.148343 |
dce7069f-6df9-4c9f-a469-ae935d91410c | ssd122100/Cpp-Practice | practice week 1 phitron/Distinct Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,c=1;
cin>>n;
vector<int> a;
a.resize(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
}
// int minn;
// for(int i=0;i<n;i++)
// {
// for(int j=i+1;j<n;j++)
// {
// if(a[i]>a[j])
// {
// ... | ALGO | 0.999973 | 3.558 |
e83e59bc-6e47-4f26-a7de-c5311f592092 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/minimum-time-takes-to-reach-destination-without-drowning-Solution2.minimumSeconds/177893_+Info.cpp | int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_one(b);
BN_zero(c);
if (BN_mod_exp(d, a, b, c, ctx)) {
fprintf(stderr, "BN_mod_exp with zero modulus succee... | TEST | 0.999674 | 3.191721 |
396b3250-b040-460e-a0d1-646de4fb14dd | sahilb8/codechef | Challenge/EOEO.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
unsigned long long ts,t,c,p,pos,zeroCount;
cin>>t;
while(t--)
{
c=0;
cin>>ts;
if(ts%2!=0)
{
c=ts/2;
}
else
{
zeroCount=0;
std::string binary = std::bits... | ALGO | 0.999679 | 3.932546 |
00919a41-3bf6-45ba-a21a-07a9013285a5 | bDekaru/ClassicDereth | Source/crc.cpp |
#include <StdAfx.h>
#include "crc.h"
uint32_t GetMagicNumber(BYTE *pbBuf, WORD wSize, BOOL fIncludeSize)
{
uint32_t dwCS = 0;
int i;
//if ( fIncludeSize ) // PRE_TOD only
dwCS += wSize << 16;
for (i = 0; i < (wSize >> 2); ++i)
dwCS += ((uint32_t *)pbBuf)[i];
int iShift = 3;
for (i = (i << 2); i < wSize; +... | TOOL | 0.859818 | 4.93895 |
45e093d9-b773-41e3-b64b-cb1000f7dcca | ishandutta2007/codeforces | kevinyang/normal/1760/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int>arr(n+1);
vector<int>a(n+1);
vector<int>b(n+1);
for(int i = 1; i<=n; i++){
cin >> arr[i];
}
for(int i = 2; i<=n; i+... | ALGO | 0.999988 | 4.311801 |
3f7b397e-e192-47a6-8bdd-fa32f5ca246f | evelyn-plee/leetcode | 150_EvaluateReversePolishNotation/solution1.cpp | class Solution{
public:
int evalRPN(vector<string>& tokens) {
stack<int> nums;
for(auto t : tokens){
if(isdigit(t[0]) || t.length() > 1) nums.push(stoi(t));
else{
int x2 = nums.top(); nums.pop();
int x1 = nums.top(); nums.pop();
... | ALGO | 0.999918 | 6.308122 |
7992c81e-5098-4d06-9206-b4652e67a6bf | comaxy/algorithmls | maxSubSum/maxSubSum2.cpp | #include <vector>
/**
* Quadratic maximum contiguous subsequence sum algorithm.
*/
int maxSubSum2(const std::vector<int>& a)
{
int maxSum = 0;
for (int i = 0; i < a.size(); ++i)
{
int thisSum = 0;
for (int j = i; j < a.size(); ++j)
{
thisSum += a[j];
if (thisSum > maxSum)
{
maxSum = thisSum;
... | ALGO | 0.999778 | 6.002432 |
95298fd6-e32b-4fb5-9e89-7bc6fb8119c3 | ishandutta2007/codeforces | danya090699/normal/1051/G.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int sz=2e5+10;
vector <int> fen[2][sz*2];
int que(vector <int> &fe, int p)
{
int re=0;
while(p>=0)
{
re+=fe[p], p=(p&(p+1))-1;
}
return re;
}
void cha(vector <int> &fe, int p, int va)
{
while(p<fe.size())
{
... | ALGO | 0.999651 | 3.649147 |
e1225d1b-63cf-415d-b58b-20147a8923da | Raushanahir/leetcode | 76-minimum-window-substring/minimum-window-substring.cpp | class Solution {
public:
string minWindow(string s, string t) {
unordered_map<char,int>mp;
int n=s.size();
if(t.size()>n) return "";
for(auto it:t){
mp[it]++;
}
int i=0 , j=0;
int flag=0;
int ans=INT_MAX, ind=0;
while(j<... | ALGO | 0.999991 | 6.463585 |
0339f6b7-3f5a-4d37-856d-6d4bf8e54a86 | atubo/leetcode | 102.cpp | #include <vector>
#include <queue>
#include <utility>
#include <iostream>
using namespace std;
#define DEBUG 0
#if DEBUG
#include "BinaryTree.h"
#endif
class Solution {
public:
vector<vector<int> > levelOrder(TreeNode *root) {
vector<vector<int> > result;
if (!root) return result;
queue<pa... | ALGO | 0.999982 | 6.146554 |
66d4ce9a-0b4e-4196-a65e-14006d83ba8b | ishandutta2007/codeforces | rama_pang/normal/1593/C.cpp | #include <bits/stdc++.h>
using namespace std;
void Main() {
int N, K;
cin >> N >> K;
vector<int> X(K);
for (int i = 0; i < K; i++) {
cin >> X[i];
X[i] = N - X[i];
}
sort(begin(X), end(X));
int ans = 0;
int sum = 0;
for (auto x : X) {
if (sum + x < N) {
sum += x;
ans += 1;
... | ALGO | 0.99996 | 4.815252 |
ad172d29-5a7f-4b52-84de-d6d5ec9fe099 | profornnan/Problem-Solving | BOJ/분할 정복/2263-트리의 순회.cpp | #include <iostream>
#include <vector>
using namespace std;
int N;
vector<int> inorder;
vector<int> inorderIdx;
vector<int> postorder;
void solve(int inLeft, int inRight, int postLeft, int postRight) {
if (inLeft > inRight || postLeft > postRight)
return;
int root = postorder[postRight];
cout << root << ' ';
i... | ALGO | 0.999991 | 4.569381 |
c0287f9a-5cc8-4619-89d3-756be3e8931e | Nazardo/adventofcode2020 | day7/day7.cpp | #include <iostream>
#include <regex>
#include <stack>
#include <unordered_map>
#include <unordered_set>
long recursive_visit(std::unordered_map<std::string, std::unordered_map<std::string, int>> graph, std::string name) {
auto it = graph.find(name);
if (it == graph.end()) {
return 1;
}
long result = 0;
for (aut... | ALGO | 0.999058 | 5.547964 |
60cad309-4981-49b0-97ae-e05989ebcb0a | the-sukhsingh/C---Lab | Linked-List/Search.cpp | #include<iostream>
using namespace std;
typedef struct node
{
int info;
node* link;
} node;
void search(node* start, int item)
{
node* ptr = start;
while (ptr != NULL)
{
if (item == (ptr->info))
{
cout<<"The location is "<<ptr<<endl;
return;
}
... | ALGO | 0.999882 | 3.61474 |
59061e20-80f6-4ecc-a608-df9f6f949dbc | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc018/E/3371269.cpp | #include<cstdio>
#include<algorithm>
#define MOD 1000000007
#define MAXN 2000006
using namespace std;
long long fac[MAXN],inv[MAXN],ans;
int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;
long long C(int m,int n)
{
return (fac[n]*inv[m]%MOD)*inv[n-m]%MOD;
}
long long ksm(long long a,long long b)
{
if(!b) return 1;
long long n... | ALGO | 0.999981 | 4.059846 |
01de3028-e44f-4939-b170-1a9109fe00c8 | rain150403/coding | 1006_10number_of1.cpp | /*
时间限制:1秒 空间限制:32768K
题目描述
输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。
*/
//运行时间:1ms, 占用内存:500K
class Solution {
public:
int NumberOf1(int n) {
int count = 0;
while(n){
++count;
n = (n-1) & n;
}
return count;
}
};
| ALGO | 0.999876 | 5.374168 |
8c51f431-2519-4d3b-a81c-82b8ac7b1f36 | RyanPioneer/Codeforces | Codeforces Round 640 (Div. 4)/C. K-th Not Divisible by n.cpp | /**
* Source: is.gd/lLHxYl
* Date: 2024/4/13
* Time:
* Space:
* Skill:
* Constraints:
*
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <tuple>
#include <stack>
#include <bitset>
#include <function... | ALGO | 0.999817 | 4.264479 |
ff3a4cf5-a7b9-43b7-bdb5-349c273fc306 | Kartikey-Kabdwal/LeetCode-Solutions-by-Kartikey | 662-maximum-width-of-binary-tree/662-maximum-width-of-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.999888 | 6.11515 |
f47ee450-c7a7-4b28-8d8f-e0152d0b0376 | YoshidaChihiro/GraduationProject_ship | 自作ライブラリ/Project1/Quaternion.cpp | #include "Quaternion.h"
#include<cmath>
//w肵āANH[^jI쐬
Quaternion quaternion(float x, float y, float z, float w)
{
Quaternion result{ x, y, z, w };
return result;
}
//Cӂ̎܂̉]̎w肩NH[^jI쐬
Quaternion quaternion(const Vector3 & v, float angle)
{
float _sin = sin(angle / 2.0f);
return quaternion(_sin * v.x, _sin * v.y, _... | ALGO | 0.981766 | 4.852947 |
8b0f6aab-46c6-40c1-8069-2d4fc81c0427 | adamga/ghdemoreponov18 | D3D/D3D12Raytracing/src/D3D12RaytracingRealTimeDenoisedAmbientOcclusion/SampleCore/PBRTParser/PBRTParser.cpp | //
// Based on DuosRenderer [9/2018]
// https://github.com/wallisc/DuosRenderer/tree/DXRRenderer/PBRTParser
//
#include "stdafx.h"
#include "PBRTParser.h"
#include "PlyParser.h"
using namespace SceneParser;
using namespace std;
#define DISABLE_CAMERA_TRANSFORMS
namespace PBRTParser
{
PBRTParser::PBRTParser()
... | TOOL | 0.944092 | 5.827326 |
5ccce4d3-68df-4a02-acd1-71118ebaa653 | opencv/opencv | samples/cpp/intersectExample.cpp | /*
* Author: Steve Nicholson
*
* A program that illustrates intersectConvexConvex in various scenarios
*/
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
using namespace std;
// Create a vector of points describing a rectangle with the given corners
static vector<Point> makeRect... | ALGO | 0.998999 | 6.692533 |
480570ee-29fa-4b95-817c-cefb798887aa | appinho/SAPathPlanningControl | PathPlanning/src/Eigen-3.3/unsupported/doc/examples/BVH_Example.cpp | #include <Eigen/StdVector>
#include <unsupported/Eigen/BVH>
#include <iostream>
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
namespace Eigen {
Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
}
struct PointPointMinimizer //how to compute squa... | ALGO | 0.99978 | 6.502348 |
64000402-e428-49e3-b238-328a81a39585 | 0x26c9b3/HaoTran2504 | C,C++/String/string/string51.cpp | //Bài 51. Strong Password
#include<bits-stdc++.h>
using namespace std;
//Hàm minimumNumber đếm số lượng ký tự, số, chữ hoa, chữ thường và đặt biến cnt[4] để lưu tổng số từng loại
//Nếu mà cnt[i]=0 tức là chưa có loại này, cần ans++
//Nếu tổng số ký tự + ans < 6 thì min(ans với 6 - n - ans)
//Hàm ltrim và rtrim xoá khoả... | ALGO | 0.998879 | 4.472787 |
b8c3e952-599a-4ec9-acaf-2bd928dc11db | fafa1899/BuildCppDependency | Source/boost-1.86.0/libs/spirit/example/x3/calc/calc6.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// Yet another calculator example! This time, we will compile to a simple
// virtual machine. This is actually one of the very first Spirit example
// circa 2000. Now, it's ported to Spirit2 (and X3).
//
// [ JDG Sometime 2000 ] ... | ALGO | 0.99856 | 7.614224 |
4414abe1-3bdb-4260-87e1-05c2ddee02c3 | Rajbirsakib/Codeforces_Solution | 710A - Strange Table.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long t,n,m,x;
cin>>t;
while(t--){
cin>>n>>m>>x;
long long row=x%n;
if(row==0) row=n;
long long col=(x+n-1)/n;
cout<<(row-1)*m+col<<endl;
}
return 0;
}
| ALGO | 0.999943 | 3.739425 |
22e4121c-8662-4aeb-8877-c03530a0cb72 | AvishkaWeebadde/cpp-practice | codeforces/horseShoe.cpp | #include <iostream>
using namespace std;
int main()
{
int count{0};
int n[4];
for(int i = 0; i < 4; i++)
{
cin >> n[i];
}
for(int i = 0; i < 4; i++)
{
for(int j = i + 1; j < 4; j++)
{
if(n[i] == n[j])
{
n[j] = -1;
... | ALGO | 0.999081 | 4.141305 |
3044e2f8-0184-44e8-ac57-f7bb07b38e4f | q-eldar/algorithms-and-data-structures | Greedy/activity_scheduling.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> start{10, 12, 20};
vector<int> finish{20, 25, 30};
sort(begin(finish), end(finish));
int count = 1;
int fin = finish[0];
for(int i = 1; i < finish.size(); i++) {
if (start[i] >= fin) {
fin... | ALGO | 0.998451 | 4.761759 |
6af518c0-5a22-4de1-8345-f4a853f34fc1 | Mohamedhesham61/QR-Code-Scanner-Generator-Flutter-Dart | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
20f29491-2607-47d2-a588-9cc9e14aa3b0 | tonyssmirnov1993/cpp-search-server | search-server/Спринт#1/Тема1#Базовые алгоритмы/Урок4#Алгоритмы sort и reverse/main_4(1).cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<pair<int, string>> kandidaty;//сначала возраст (для сортировки)
int count;
cin >> count;
for (int i = 0; i < count; ++i) {
string name;
int age;
cin >> name >> ... | ALGO | 0.999839 | 5.276711 |
882739a8-e63a-4d30-b9b1-bedc8228635c | Ruoye-W/GeneticTools | GeneticToolkit/GASolver/src/GASolver.cpp | #include "GASolver.hpp"
GASolver::GASolver(const int& numvars,const int& popsize,const double& mutate){
if( numvars <= 0 )
throw "GASolver needs more than one variable to minimize";
this->Population = std::vector<Gene>(numvars,Gene(popsize));
this->RandomDistribution = "normal";
this->FitVals.reserve(popsize);
... | ALGO | 0.988997 | 5.474327 |
df798204-b372-4f56-a440-e2bf615aaec1 | YunusMertKok/DSA2_MAJOR_ASSIGNMENT | 12-problem.cpp | #include<bits/stdc++.h>
using namespace std;
int numberSequence(int m, int n) {
vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
int mod = 1e9+7;
for (int i = 1; i <= m; i++) {
dp[1][i] = i;
}
for (int i = 2; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = (d... | ALGO | 0.999991 | 5.979093 |
aeaf86ff-2d73-4bf9-8c76-96cbee5831fb | ishandutta2007/codeforces | xlk/normal/1353/D.cpp | #include <bits/stdc++.h>
using namespace std;
pair<int, int> a[200020];
int z[200020];
void gao(int l, int r)
{
if (l > r)
{
return;
}
int m = (l + r) / 2;
a[m].first = l - r;
a[m].second = m;
gao(l, m - 1);
gao(m + 1, r);
}
int main()
{
int t, n;
cin >> t;
for (int tt = 0; tt < t; tt++)
{
cin >> n;
g... | ALGO | 0.999828 | 3.957187 |
15240199-e0de-4708-8a11-b60131a0817b | ishandutta2007/codeforces | aqt/normal/1398/F.cpp |
// Problem : F. Controversial Rounds
// Contest : Codeforces - Educational Codeforces Round 93 (Rated for Div. 2)
// URL : https://codeforces.com/problemset/problem/1398/F
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using na... | ALGO | 0.999993 | 3.586382 |
194eb8aa-7ce5-44b4-b92d-a62b4a855569 | zs0510/Huawei-ICT2023 | src/1. 初赛代码及数据/初赛代码备份/main_88010268.cpp | #include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <fstream>
#include <queue>
#include <algorithm>
#include <ctime>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <random>
using namespace std;
const int edges_add_max = 20000;// 可以增加的最大边数
struct Edge {
... | ALGO | 0.999179 | 4.507911 |
dfe832e9-8980-451b-8b23-a95a3f1d0ae5 | prathampithalia/CP | LeetCode/Bottom View of Binary Tree.cpp | class Solution {
public:
vector <int> bottomView(Node* root) {
// Your Code Here
map<int, int> mp;
queue<pair<Node*, int>> q;
q.push({ root , 0 });
while (!q.empty()) {
auto it = q.front().first;
auto lvl = q.front().second;
mp[lvl] = it->... | ALGO | 0.999993 | 6.189926 |
aa81b3e7-5822-4a28-8a0f-9c1709772e1d | 77Arafat383/Previous-contest-problem | C_Kevin_and_Puzzle.cpp | //**************BISMILLAHIR RAHMANIR RAHIM****************
//*******************Md Yeasin Arafat****************
#include<bits/stdc++.h>
using namespace std;
#define check cout<<'?'<<endl;
#define ll long long
#define Judge(x) x==0 ? cout<<"NO\n" : cout<<"YES\n";
#define judge(x) x==0 ? cout<<"No\n" : ... | ALGO | 0.999979 | 4.07366 |
2197373d-ad7e-490b-8724-c173a1f4c075 | paranshu-singhal/CompetetiveCoding | HackerEarth/checkarr.cpp | #include<bits/stdc++.h>
#define len 105
typedef double fl;
int main(){
fl min(fl,fl,fl);
int t;
std::cin>>t;
while(t--){
fl a,b,c;
std::cin>>a;
std::cin>>b;
std::cin>>c;
fl mn=min(a,b,c);
printf("%.1f \n",mn/2);
}
}
fl min(fl a,fl b,fl c){
return (a<=b and a<=c)?a:(b<=a and b<=c)?b:c;
}
| ALGO | 0.999743 | 3.973092 |
eaa16b8d-1d49-4ae3-905d-3bd80517ce26 | Sean10/Algorithm_code | thread_pool/examples/basic_usage.cpp | #include <chrono>
#include <iostream>
#include <random>
#include <string>
#include "thread_pool/thread_pool.hpp"
// 模拟耗时计算任务
int compute_task(int input) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(100, 500);
// 模拟计算延迟
std::this_thread::sleep_for(std::ch... | TOOL | 0.955556 | 5.383985 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.