uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
764fd555-0b90-4e7f-863a-aa78ac70a84b | meilleur777/Competitive_Programming | BOJ/cpp/2294.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n), dp(k+1, 1e7);
rep(i, n) cin >> a[i];
dp[0]=0;
for (int i=0; i<n; i++) {
for (int j=a[i]; j<=k; j++) {
dp[j]=min(dp[... | ALGO | 0.999976 | 4.049917 |
a9b8f77d-cceb-4d29-82ab-9b543cc53562 | dlvguo/NoobOJCollection | LeetCode/Normal/1400-1499/1405.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
string longestDiverseString(int a, int b, int c)
{
string res;
vector<pair<int, char>> arr = {{a, 'a'}, {b, 'b'}, {c, 'c'}};
while (true)
{
sort(arr.begin(), arr.end(), [](const pair<int, char> &p... | ALGO | 0.999953 | 5.135029 |
db3a80a0-ea7b-4e02-b8c4-9344f6a49abf | rupesh-dharme/LeetCode | 1379-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/1379-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-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* getTargetCopy(TreeNode* original, TreeNode* cloned, TreeNode* target) {
if (... | ALGO | 0.999854 | 5.693161 |
8d82fdb2-5226-488d-bdcd-fa2eb176968f | baileymiller/differential_wos | zombie/deps/fcpw/deps/eigen-git-mirror/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.999478 | 3.818344 |
22ce288d-4636-4b00-ad50-1eff3462755f | debadarshana/B-Tree | examples/range_queries.cpp | #include "../src/btree_simple.hpp"
#include <iostream>
#include <vector>
#include <random>
#include <algorithm>
#include <chrono>
/**
* Range Query Demonstration
*
* This program shows the power of B+ trees for range queries,
* comparing different approaches and demonstrating real-world scenarios.
*/
void print... | TEST | 0.978637 | 7.297491 |
480e63e8-dd27-41a2-870c-21e1f61dea10 | Kaminyou/MyLeetcode | cpp_solutions/493.cpp | class BIT {
private:
vector<int> tree;
public:
BIT(int size) {
tree.resize(size + 1, 0);
}
int lsb(int x) {
return x & (-x);
}
void update(int index, int value) {
while (index < tree.size()) {
tree[index] += value;
index += lsb(index);
}
... | ALGO | 0.999991 | 5.51608 |
d30afeca-946b-4f83-8279-b2e381263e7a | FairOh/android_frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/get_pred_outside.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpos = x half-pixel of (x,y) coordinates within a VOP; motion
compensated coordinates; native data type
ypos = y half-pixel of (x,y) coordinates within a VOP; motion
co... | ALGO | 0.999722 | 6.729749 |
02863886-bcbb-44df-8342-71a5622a6697 | DodgeHo/VMD_2D_cpp | Eigen/doc/snippets/Triangular_solve.cpp | Matrix3d m = Matrix3d::Zero();
m.triangularView<Eigen::Upper>().setOnes();
cout << "Here is the matrix m:\n" << m << endl;
Matrix3d n = Matrix3d::Ones();
n.triangularView<Eigen::Lower>() *= 2;
cout << "Here is the matrix n:\n" << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
... | ALGO | 0.999199 | 3.691875 |
3df38f5a-a4c3-45a8-bc3b-f0cb14820579 | ugidol/atcoder | abc315/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
string S;
cin >> S;
string T;
for(int i=0;i<(int)S.size();i++){
char c = S[i];
if ( c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ) {
continue;
}
else {
T.push_back(c);
}
}
cout << T << endl;
return 0;... | ALGO | 0.998881 | 3.363355 |
76e57f74-5c91-4dc6-91e1-e7d7174cb454 | LauZyHou/AlgorithmTemplate | 背包/分组背包-一维化.cpp | #include <iostream>
using namespace std;
/*
https://www.acwing.com/problem/content/description/9/
ֻҪÿѡһ߲ѡ
*/
const int N = 110;
// iĵjƷ
int v[N][N], w[N][N];
// iƷжٸ
int s[N];
// һάdp
int f[N];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i ++) {
scanf("%d", s + i);
for (in... | ALGO | 0.999986 | 3.599825 |
8f13aeb6-5359-46c6-aec7-4f4b9ec7776a | brad-mengchi/asplos_2021_ae | benchmarks/src/cuda/proxy-apps-doe/comd/utils/cheby.cpp | #include "cheby.h"
// Based on the OCL version
//different call signature than the regular version
static void eamInterpolateDerivlocal(real_t r,
real_t* values,
int n_values,
real_t *range,
real_t *value1,
real_t *f1)
{
int i1;
int i;
real_t gi, gi1;
// using different data struct here
real... | ALGO | 0.99986 | 4.67551 |
241b33ec-4e52-4038-a88c-65ffe37bc86c | sarvex/leetcode-c-sharp | solution/0700-0799/0729.My Calendar I/Solution.cpp | class MyCalendar {
public:
map<int, int> m;
MyCalendar() {
}
bool book(int start, int end) {
++m[start];
--m[end];
int s = 0;
for (auto& [k, v] : m) {
s += v;
if (s > 1) {
--m[start];
++m[end];
retu... | ALGO | 0.999949 | 6.191501 |
c09ed9f1-d000-472e-a65f-48207055afb1 | AshkenSC/Programming-Practice | PAT/PAT_B1080.cpp | // PAT B1080
/*
STL mapȥidַҵѧϢ
mapֵΪ(string, int)(ѧidλ)
ÿУȼmapǷиѧ
ûĿԭĿϢ
ϺҪ㡢
mapʹã
map<string, int> idMap;
ԪأidMap.insert(pair<string, int>(name, 123));
жijkeyֵǷmap setIJ=1=0idMap.count(idString)
ѧַȡλãֱӰ鷽ʽȡֵ idMap[idString]
*/
#include <cmath>
#include <vector>
#include <map>
#include <iostream>
#include <algor... | ALGO | 0.998653 | 4.075478 |
d6bd2fbe-4afb-4e7d-a87c-6b80236c31c7 | SHIVAAYgod/POTD | GFGPOTD-main/OCT 23 22/potdgfg.cpp | vector <int> max_of_subarrays(int *arr, int n, int k)
{
vector<int> ans;
deque<int> dq;
for(int i=0;i<n;i++)
{
if(!dq.empty() and dq.front()==i-k) dq.pop_front();
while(!dq.empty() and arr[dq.back()]<=arr[i])
{
dq.pop_back();
... | ALGO | 0.999936 | 5.140039 |
3957c08e-ad8c-44a1-aada-7593170ad700 | mt2522577/TranMelvin_CSC5_40717 | Hmwk/Assignment6/Gaddis_8thEd_Ch7_Q3/main.cpp | /*
* File: main.cpp
* Author: Melvin Tran
* Created on February 9, 2015, 8:12 PM
*/
//System Libraries
#include <iostream>
#include <string>
using namespace std;
//User Libraries
//Global Constants
//Function Prototype
//Execution Begins Here!!!
int main(int argc, char** argv) {
string names[5];
int sales... | ALGO | 0.927228 | 4.595377 |
1ede3022-2a86-4d6c-8e9f-8348c2f793d7 | TrDieux18/C_PTIT | C03025_thuannto.cpp | #include<stdio.h>
#include<math.h>
int nt(int n)
{
if(n < 2)
{
return 0;
}
for(int i =2; i <= sqrt(n);i++)
{
if( n% i ==0)
{
return 0;
}
}
return 1;
}
int so(int n)
{
while( n >0)
{
int so = n%10;
if(so !=2 && so != 3 && so != 5 && so != 7)
{
return 0;
}
n /= 10;
}
return 1;
}
int... | ALGO | 0.999734 | 3.980113 |
19df6239-f1e6-4563-9ec7-86b038385360 | LeeHann/algorithm | Baekjoon/11866_요세푸스 문제 0_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
queue<int> q;
int n, k; cin >> n >> k;
int cnt = 0;
for(int i=1; i<=n; i++) q.push(i);
cout << "<";
while(!q.empty())
{
for(int i=0; i<k-1; i++)
{
q.push(q.front());
q.pop(... | ALGO | 0.999977 | 3.41663 |
a0671c6a-e91e-4fe8-bf91-68b2acea0b5f | sshockwave/Online-Judge-Solutions | EZOJ/Contests/1324/C.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
T i=0;char c;
while(!isdigit(c=getchar())&&c!='-');
bool flag=c=='-';
flag?(c=getchar()):0;
... | ALGO | 0.999972 | 4.35444 |
2b36035b-fe1b-4263-827e-58c419e0de0b | 1170300619/leedcode | 二叉树/110.平衡二叉树.cpp | /*
* @lc app=leetcode.cn id=110 lang=cpp
*
* [110] 平衡二叉树
*/
// @lc code=start
/**
* 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), ri... | ALGO | 0.999861 | 6.887262 |
50262c43-9433-4345-9cfd-3b61b4c71349 | 7ANJ0I2407/Competitive-Coding-Codeforces | B_Upscaling.cpp | #include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include <deque>
//#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pp pop_back
#define ll long long
#define ld long double
#define int long long
#define pair pair<int,int>
typedef v... | ALGO | 0.999434 | 3.627685 |
90a85599-28a1-4144-b653-5dcc0cc214ae | Jaechan-So/ps-public | problems/leetcode/0000/2.cpp | // 2. Add Two Numbers
// https://leetcode.com/problems/add-two-numbers/
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {
public:
ListNode *addTwoNumbers(Li... | ALGO | 0.999636 | 7.192487 |
758aedc3-4c86-49a0-afd0-781282fd05dc | yanedwar/PX4_SITL_664 | src/modules/mc_att_control/mc_att_control_main.cpp | /**
* @file mc_att_control_main.cpp
* Multicopter attitude controller.
*
* @author Lorenz Meier <<EMAIL>>
* @author Anton Babushkin <<EMAIL>>
* @author Sander Smeets <<EMAIL>>
* @author Matthias Grob <<EMAIL>>
* @author Beat Küng <<EMAIL>>
*
*/
#include "mc_att_control.hpp"
#include <drivers/drv_hrt.h>
#i... | TOOL | 0.917185 | 6.190248 |
82f3735b-372e-4905-94ae-2b760635cdd5 | joshua-dgeang/Thesis_code | thirdYear/December_17/two_Asset/3.changingScale/cs_s1_v10/code/Hermite.cpp | #include "Hermite.hpp"
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
Hermite :: Hermite (double mean, double std):Demand_mu(mean),Demand_sigma(std){
pi = 3.14159265359;
double xi_initial[9] = {-3.19099,-2.26658,-1.46855,-0.723551,0,0.723551,1.46855,2.26658,3.19099};
x_vec.res... | ALGO | 0.997192 | 4.997444 |
6f03ca20-b7ff-4bb5-87d7-baed4f5642bd | adityanjr/code-DS-ALGO | Dynamic Programing/subset sum to target.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define db(x) cout <<#x<<": "<<x<<'\n';
const int N = 100005;
int32_t main()
{
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.ti... | ALGO | 0.999987 | 3.824585 |
aacd8bfa-d943-40aa-bfc1-2676662edc1d | ren-rens/Data-Structures-And-Algorithms-24-25 | practicum/pract_09/K-th Largest Element in a Stream/Solution.cpp | class KthLargest {
public:
std::priority_queue<int, std::vector<int>, std::greater<>> pq;
int k;
KthLargest(int k, vector<int>& nums) : k(k) {
for(auto& num : nums){
pq.push(num);
}
while(pq.size() > k){
pq.pop();
}
}
int add(int val) {... | ALGO | 0.99998 | 6.033023 |
b40ef6af-81cc-4c02-a738-0a29a117737a | suiyoubi/GodotWithIMapLibrary | thirdparty/bullet/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp | #include "btSdfCollisionShape.h"
#include "btMiniSDF.h"
#include "LinearMath/btAabbUtil2.h"
struct btSdfCollisionShapeInternalData
{
btVector3 m_localScaling;
btScalar m_margin;
btMiniSDF m_sdf;
btSdfCollisionShapeInternalData()
: m_localScaling(1, 1, 1),
m_margin(0)
{
}
};
bool btSdfCollisionShape::init... | ALGO | 0.957177 | 6.863312 |
15aa49ed-f8d2-4dc2-8814-64f0f1bd517d | rodsan05/EDA | VSCode/concierto/conciertoOptimizado.cpp | //Rodrigo Sánchez Torres
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
bool esValida(const vector<vector<bool>>& consentimientos, const vector<int>& sol, int k){
if(k == 0) return true;
return consentimientos[sol[k]][sol[k-1]];
}
// La tupla solución: [0,... | ALGO | 0.999856 | 5.038836 |
005e6819-24f6-4974-8baf-c1862c707f2e | Goodenough-hub/CPP-learn | 第一部分:C++语言程序设计/codes/Chapter-01/导学:商品价格.cpp | #include<iostream>
using namespace std;
int main()
{
const double price1 = 25.5, price2 = 10.3, price3 = 12.5;
double total = 0;
int number1 = 0, number2 = 0, number3 = 0;
cout << "Ʒ۸Ϊ" << price1 << ";" << price2 << ";" << price3 << "\n";
cout << "ÿ" << endl;
cin >> number1 >> number2 >> number3;
total = n... | TOOL | 0.905974 | 3.830805 |
dac122e5-42fb-46f4-bd0d-da9bcb69d86c | HaelC/LeetCode | C++/88. Merge Sorted Array/sol.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
vector<int> result;
int p1 = 0, p2 = 0;
while (p1 < m && p2 < n) {
if (nums1[p1] > nums2[p2]) {
result.push_back(nums2[p2++]);
}
else {
... | ALGO | 0.999981 | 5.524344 |
d711dc60-7562-488f-b611-bb079564d845 | benhamin36/Project_2 | IdAutomaton.cpp | //
// Created by bigbe on 9/19/2022.
//
#include "IdAutomaton.h"
void IdAutomaton::S0(const std::string& input) {
soFar = "";
if (isalpha(input[index])) {
soFar += input[index];
inputRead = 1;
index = 1;
S1(input);
}
else {
Serr();
}
}
void IdAutomaton::S1(... | ALGO | 0.878624 | 4.013813 |
187b374e-0c61-47c7-ba5b-38f171fb2591 | sk-pku/OJ | 9push/Yogurt factory.cpp | #include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<set>
//#define INT_MAX 2147483647
using namespace std;
struct day {
int cost, delivery, no;
}d[10010];
int main() {
... | ALGO | 0.999511 | 3.170008 |
f72ca606-66e7-4c46-a96b-8b7c2ca5bbce | jacobeverist/opaque | src/modules/alphashape/boost_1_53_0/libs/numeric/odeint/examples/solar_system.cpp | #include <iostream>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
#include "point_type.hpp"
//[ container_type_definition
// we simulate 5 planets and the sun
const size_t n = 6;
typedef point< double , 3 > point_type;
typedef boost::array< point_type , n > container_type;
typedef boost::array< dou... | ALGO | 0.999512 | 5.856215 |
830fe521-1caa-448f-8e0b-26a2b6ffebd6 | jk-jung/problem-solving | codeforces/Codeforces Round 80x/R807_div2_B.cpp | #include <cstring>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <set>
#include <map>
#include <array>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<i... | ALGO | 0.999777 | 4.768323 |
556b3768-f392-40ad-896e-266de6fe1693 | HalfGuarder/HIY_SGA_Unreal | HIY_Algorithm_Game/WINAPI_Algorithm/Algorithm/DP(3).cpp | #include <iostream>
#include <Windows.h>
#include <algorithm>
#include <vector>
#include <unordered_map>
using namespace std;
// Enchant
// Nŭ ȭ
// +1, +2, +3
int N = 0; // 100000
// +1 +1 +1
// +1 +2
// +2 +1
// +3
// ... result = 4
vector<int> enchantV = { 1, 2, 3 };
vector<int> cache = vector<int>(100001, -1);
... | ALGO | 0.999949 | 3.366133 |
b7a37708-04c7-4295-b62b-a0e73065b2d9 | DenialRiver1434/USACO-Study | 0-USACO/b-Silver/2019J-P2.cpp | #define pb push_back
#define mt make_tuple
#define is insert
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int N, area, perimeter, color = 0;
int perimeters[1000000];
int grid[1000][1000];
char a;
void flood(int x, int y) {
if(x < 0 || y < 0 || x == N || y == N) {
perimeter ++;
return;
}
i... | ALGO | 0.999543 | 4.150533 |
62d0267f-2f14-4bbb-adf3-57bbf0fa4346 | AxelArrieta75/roadmap-retos-programacion | Roadmap/02 - FUNCIONES Y ALCANCE/c++/carlosguariglia.cpp | /*
# #02 FUNCIONES Y ALCANCE
> #### Dificultad: Fácil | Publicación: 08/01/24 | Corrección: 15/01/24
* EJERCICIO:
* - Crea ejemplos de funciones básicas que representen las diferentes
* posibilidades del lenguaje:
* Sin parámetros ni retorno, con uno o varios parámetros, con retorno...
* - Comprueba si puedes... | TOOL | 0.976473 | 5.807847 |
79cdea33-e66e-45e2-a4a2-94c741158864 | gourav-kadyan/Code | Easy/Reach the Nth point/reach-the-nth-point.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int mod = 1000000007;
int solve(int n, vector<int> &dp){
if(n <= 1){
return 1;
}
if(dp[n] != -1){
return dp[n];
}
dp[n] =... | ALGO | 0.999959 | 5.997277 |
f977fb6f-d524-4ae8-9d62-9fad2e03a108 | syedtawqeer/cse_university | 3rd Semester/C++/Project _ Abdul Bari/72-Question-Fn-Linear-Search-.cpp | #include <iostream>
using namespace std;
int bin_search(int a[], int s, int key)
{
for (int i = 0; i < s; i++)
{
if (key == a[i])
{
cout << "Found at index " << i + 1 << endl;
return 0; // the program will end once it has returned the value.
}
}
cout <... | ALGO | 0.998736 | 4.743236 |
67becc30-fd14-4de2-b1d6-b0b1912ad648 | fireice-uk/xmr-stak | xmrstak/backend/amd/OclCryptonightR_gen.cpp | #include <cstring>
#include <mutex>
#include <sstream>
#include <string>
#include <thread>
#include "xmrstak/backend/amd/OclCryptonightR_gen.hpp"
#include "xmrstak/backend/cpu/crypto/variant4_random_math.h"
#include "xmrstak/cpputil/read_write_lock.h"
#include "xmrstak/misc/console.hpp"
#include <chrono>
#include <io... | TOOL | 0.950584 | 3.781886 |
4e40c1cf-3cb7-4441-abed-877f039b482e | diepbp/SlicingCBMC | goto-instrument/accelerate/disjunctive_polynomial_acceleration.cpp | #include <iostream>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include <algorithm>
#include <ctime>
#include <goto-programs/goto_program.h>
#include <goto-programs/wp.h>
#include <goto-programs/remove_skip.h>
#include <goto-programs/goto_functions.h>
#include <goto-symex/goto_symex.h>
#includ... | ALGO | 0.99958 | 5.184947 |
68dad249-8a91-42fc-a1ec-70eef0d1845f | alexandraback/datacollection | solutions_2453486_1/C++/Milrivel/1.cpp | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
char board[5][5];
bool check(int player) {
char patten;
if (player == 1) {
patten = 'X';... | ALGO | 0.999952 | 4.314129 |
c5e4acda-f029-478f-89b0-b5aebfc86b44 | ishandutta2007/codeforces | trivialman/normal/1105/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define PB push_back
#define MP make_pair
#define PII pair<int, int>
typedef long long LL;
const LL P = 998244353;
const int INF = 0x3fffffff;
const int N = 200010;
mt19937 rng(chrono:... | ALGO | 0.999987 | 3.727783 |
b11a7e21-a19e-49e3-83a8-ebd588b51998 | TAHabib0012/Code-Chef | Buying_Game.cpp | /*............Bismillahir Rahmanir Raheem...............*/
#include <bits/stdc++.h>
using namespace std;
#define Tahmid ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define LL long long int
#define ULL unsigned long long
#define endl '\n'
#define mem(v, x) memset(v, x, sizeof(v))
#define ceilin... | ALGO | 0.99999 | 4.878203 |
f9997799-9a9a-452a-a8b4-84f3e16ffcbe | anandi111/Cpp-Phase-Project | Phase-5/7.cpp | //7. Ajay has to find Fibonacci Series upto given number to
//successfully pass in Maths examination. Help him by
//designing a UDF in C++.
#include<iostream>
using namespace std;
void f_s()
{
int n,d,sum=0,i,n1=0,n2=1,n3;
cout<<endl<<" Enter Number: ";
cin>>n;
cout<<endl<<"-----------------------------------... | ALGO | 0.999205 | 4.117049 |
089c0b85-b498-434c-8e86-dbd903cb4ceb | L1r0gn/code_Share | C/Algorithum_Problem_Set/SCNUCPC/2025SCNUCPC/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll x, ll y)
{
if (y == 0)
{
return x;
}
else
{
return gcd(y, x % y);
}
}
ll egcd(ll a, ll b, ll &x, ll &y)
{
if (b == 0)
{
x = 1;
y = 0;
return a;
}
ll d = egcd(b, a... | ALGO | 0.999571 | 3.99919 |
4b3dbb0a-7b6d-44ad-af21-1421958e44fe | dobrypd/LatteCompiler | src/kernel/latte.cpp | /*
* Author: Piotr Dobrowolski
* <EMAIL>
*
*/
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include "Absyn.H"
#include "ParserManager.h"
#include "ASTChecker.h"
#include "ErrorHandler.h"
#include "FunctionLoader.h"
#include "ReturnsChecker.h"
#include "ASCreator.h"
using std::cerr;
using std::cout;
... | TOOL | 0.910679 | 4.899934 |
88675e35-2844-412a-917e-60daa313a989 | Rohansunwar5/DSA-sheet | LinkedList/InsertionInLL.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
public:
int data;
Node *next;
public:
Node(int data1, Node *next1)
{
data = data1;
next = next1;
}
public:
Node(int data1)
{
data = data1;
next = nullptr;
}
};
Node *convertArr2LL(vector<int> arr)
{
Node *head = new Node(a... | ALGO | 0.999974 | 4.59516 |
89c0bd43-b785-4685-a9bb-7f4fb7d1d8c7 | hzfsls/leetcode-supercrawl | data/0002.add-two-numbers/code_snippets/sol.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.9998 | 6.390635 |
52f91420-9889-4b0e-a4f7-a1fde5b33130 | maulahaz/flt-kamsya | 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 |
76380b57-ffcc-4d58-bf0f-beea9789acf9 | rbunpat/posn-camp2 | onsite/01/birthday2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int i, j, sum = 0;
char ch;
for (i = 1; i < 32; i *= 2)
{
int co;
co = 0;
for (j = 1; j < 32; j++)
if ((j & i) == i)
{
cout << setw(3) << j;
co++;
if (co % 5 == 0)... | ALGO | 0.992563 | 3.272188 |
79b08d86-c691-458b-a151-340d414238b8 | DrFriedParts/Neuro-Sand-Cube | src/engine/normal.cpp | #include "engine.h"
struct normalgroup
{
vec pos;
int flat, normals, tnormals;
normalgroup() : flat(0), normals(-1), tnormals(-1) {}
normalgroup(const vec &pos) : pos(pos), flat(0), normals(-1), tnormals(-1) {}
};
static inline bool htcmp(const vec &v, const normalgroup &n) { return v == n.pos; }
s... | ALGO | 0.999247 | 4.906117 |
b301c237-91ee-4117-8b4a-89789d6c69fb | jevinskie/llvm-project-embedded-library-in-process | libc/src/stdbit/stdc_leading_ones_uc.cpp | #include "src/stdbit/stdc_leading_ones_uc.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(unsigned, stdc_leading_ones_uc, (unsigned char value)) {
return static_cast<unsigned>(cpp::countl_one(value))... | ALGO | 0.938479 | 6.536096 |
8833e6d5-7ba9-4d26-b191-b7923bbcecd0 | sccluisx/tests | seecer/repo_ver/SEECER/ext/seqan/demos/tutorial/pairwise_sequence_alignment/alignment_banded.cpp | //![main]
#include <iostream>
#include <seqan/align.h>
using namespace seqan;
int main()
{
typedef String<char> TSequence; // sequence type
typedef Align<TSequence, ArrayGaps> TAlign; // align type
TSequence seq1 = "CDFGHC";
TSequence seq2 = "CDEFGAHC";
TAlign align;
resi... | ALGO | 0.965518 | 4.093584 |
dc3cc9c2-5bb7-4f86-9300-0c0d119e412b | ComputerScientist-01/100-Days-Of-DSA | Binary Trees/lowest-common-ancestor.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <stack>
using namespace std;
class TreeNode {
public:
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) {
val = x;
left = nullptr;
right = nul... | ALGO | 0.999994 | 6.161817 |
92b29c9d-ee06-456f-a116-96e7a8568e40 | zhucd1998/slam2_18 | Thirdparty/g2o/g2o/core/sparse_optimizer.cpp | #include "sparse_optimizer.h"
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <cassert>
#include <algorithm>
#include "estimate_propagator.h"
#include "optimization_algorithm.h"
#include "batch_stats.h"
#include "hyper_graph_action.h"
#include "robust_kernel.h"
#include "../st... | ALGO | 0.999667 | 6.977527 |
51d553d3-c3b5-4846-b67a-ebd55bea0c85 | lamia185/codeforces_codes | 61A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
char str1[101],str2[101],str3[101];
int i,j,k=0,l,m;
cin>>str1>>str2;
l=strlen(str1);
for(i=0;i<l;i++){
if(str1[i]==str2[i]){
str3[k]='0';
k++;
}
else{
str3[k]='1';
k++;
}
}
str3[k]='\0';
puts(str3);
}
| ALGO | 0.999989 | 3.663638 |
b9c19ae8-7dfa-4e9e-b4a1-bfbcc5804cf1 | comzyh/ICPCcode | POJ/3623.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int N;
char str[30009],ans[30009];
inline int check(int a,int b)
{
while (str[a]==str[b] && a<b)
{
a++;
b--;
}
return str[a]<str[b];
}
int main()
{
scanf("%d",&N);
for (int i=1;i<=N;i++)
scanf("%s",str+i);
int l=1,r=N;
ans[N]='\... | ALGO | 0.999901 | 3.384697 |
bdd69f87-6bf2-4b7a-aca8-50c4dd85e4a5 | debugster/UVa | uva-154.cpp | #include <bits/stdc++.h>
using namespace std;
/* typedef starts */
typedef long long ll;
typedef unsigned long long ull;
/* typedef ends */
/* macro starts */
#define PI acos(-1.0)
/* macro ends */
/* function starts */
/// calculates n-th (0-based) Gray Code
template<typename dataType>
dataType nthGrayCode(da... | ALGO | 0.999619 | 3.855919 |
9db6cf93-a61c-498d-9127-969f8236f985 | nirjhorJU/Data-Structure-and-Algorithms | Graph Theory/Directed MST (Zhu liu).cpp | // LOJ-1380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=1e3+5;
struct edge
{
ll x,y,w;
};
vector<edge>e;
ll vis[N],id[N],in[N],pre[N],INF=LLONG_MAX;
ll ZhuLiu(ll root,ll n,ll m)
{
ll res=0;
while(true)
{
for(ll i=0; i<n; i++) in[i]... | ALGO | 0.999965 | 3.94435 |
193fdfe4-16c6-4920-93c1-ecca33832b6b | ritty27/Algorithm | BOJ/Bronze/BOJ_2438.cpp | #include <stdio.h>
int main() {
int A;
scanf("%d", &A);
for (int i=0;i<A;i++) {
for (int j=0;j<=i;j++) {
printf("*");
}
printf("\n");
}
}
| ALGO | 0.999939 | 3.664674 |
3bc6557c-58c7-4fa2-95c1-8197d2fc1b1d | CoderVerma/CB_FUNDAMENTAL | string/string_max_ch.cpp | #include<iostream>
using namespace std;
int main()
{
string s;
cin>>s;
int freq[100]={0};
for(unsigned int i=0;i<s.length();i++)
{
freq[s[i]-'A']++;
}
int maxv=0;
char maxch;
for(unsigned int i=0;i<100;i++)
{
if(freq[i]!=0)
{
if(freq[i]>maxv)... | ALGO | 0.999745 | 3.903279 |
116894b7-5f10-4afa-a10a-b6ce19dcf804 | wabiverse/UnrealEngineOldArchived | Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingOperators/Private/MeshSpaceDeformerOps/BendMeshOp.cpp | #include "Async/ParallelFor.h"
#include "DynamicMesh/DynamicMeshAttributeSet.h"
using namespace UE::Geometry;
//Bends along the Y-axis
void FBendMeshOp::CalculateResult(FProgressCancel* Progress)
{
FMeshSpaceDeformerOp::CalculateResult(Progress);
if (!OriginalMesh || (Progress && Progress->Cancelled()))
{
retur... | TOOL | 0.982502 | 7.035745 |
e4ae3643-a6bb-420c-9141-f16a52c0f561 | walkerlinrtc/TestingProblems | 字符串类/5.最长回文子串.cpp | /*************************************************************************
> File Name: 5.最长回文子串.cpp
> Author: CatalinChao
> Mail: <EMAIL>
> Created Time: 一 2/27 19:52:44 2023
************************************************************************/
#include <iostream>
#include <string>
#include <ve... | ALGO | 0.999795 | 5.181499 |
8ed39886-e775-4455-9960-230700969e66 | insubkim/Problem_Solving | Programmers/Lv0/주사위 게임 2.cpp | #include <string>
#include <vector>
using namespace std;
/*
세 숫자가 모두 다르다면 a + b + c 점을 얻습니다.
세 숫자 중 어느 두 숫자는 같고 나머지 다른 숫자는 다르다면 (a + b + c) × (a2 + b2 + c2 )점을 얻습니다.
세 숫자가 모두 같다면 (a + b + c) × (a2 + b2 + c2 ) × (a3 + b3 + c3 )
*/
int solution(int a, int b, int c) {
if (a != b && b != c && a != c){
retur... | ALGO | 0.999478 | 4.960306 |
0a5115bc-473e-42a1-ac4b-c7835d3f2c2e | ifradK/Competitive-Programming-Solutions | C++ Programs/Three Indices.cpp | #include<iostream>
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
using namespace std;
int main()
{
fastio;
long long t,n,i;
cin>>t;
while(t--)
{
cin>>n;
long long a[n],num,temp,temp1,temp2;
bool flag1=f... | ALGO | 0.999826 | 3.142666 |
6e0e0f1a-9f71-4572-b70a-e6c43c0c8d3c | KhadijaHasnain/some-c-code- | main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
class Date {
public:
Date() : day(0), month(0), year(0) {}
Date(int day, int month, int year) : day(day), month(month), year(year) {}
Date(const std::string& date_str) {
std::istringstream ss(date_str);
char delimite... | ALGO | 0.982742 | 5.936574 |
94d9506f-e8ac-4608-95a9-7e94cdd272d3 | ishandutta2007/codeforces | irkstepanov/normal/1626/B.cpp | #include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef double ld;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//ifstream cin("input.... | ALGO | 0.99994 | 5.163706 |
bc2119af-767d-4829-8dec-7b2e21af47f2 | harinyoo/BAEKJOON | StepByStep/C++/Step 07/4673.cpp | #include <iostream>
using namespace std;
int d_func(int n) {
int y = 0;
int result = n;
while(n != 0){
y = n%10;
result += y;
n /= 10;
}
return result;
}
int main() {
int self_num[10000];
int i;
for(i=0; i<10000; i++) self_num[i] = 1;
for(i=0; i<10000; i++) ... | ALGO | 0.999616 | 4.025153 |
d699e699-3385-45f9-9676-0aa27c28b980 | bhaumikmaan/grind-75 | Solutions/24. Contains Duplicate/sol.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
map<int,int> m ;
for(auto i:nums)
{
m[i]++ ;
}
for(auto i:m)
{
if(i.second > 1)
{
return true ;
}
}
return false ;
... | ALGO | 0.999848 | 5.766268 |
6d8cd42f-c92e-4c08-b669-2d28334c09cb | dwiegreffe/RNApuzzler | src/RNAforester/src/rna_algebra.cpp | #include "rna_algebra.h"
Score::Score(Options &options)
: isAffine_(options.has(Options::Affine)),
isLocal_(options.has(Options::LocalSimilarity)),
isDistance_(options.has(Options::CalculateDistance)),
isRIBOSUM_(options.has(Options::RIBOSUMScore)),
bp_rep_score_(0),
bp_indel_score_(0),
bp_indel_op... | TOOL | 0.909962 | 5.711874 |
853fcf27-f002-4de9-bdaf-bb3933b7dd39 | ishandutta2007/codeforces | geniucos/normal/497/E.cpp | #include<cstdio>
#include<bitset>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;
int nr, K, mod, ans[33], v[70];
long long N;
struct matrix
{
int a[33][33];
matrix () {memset (a, 0, size... | ALGO | 0.999959 | 4.031995 |
dba2e59c-d674-42d8-954b-5f5cba411441 | iamlvv/Some-basic-stuff-about-C- | temp2.cpp | Node* InsertNode(Node* root, T value)
{
if (!root)
{
Node* temp = new Node(value);
temp->pLeft = nullptr;
temp->pRight = nullptr;
return temp;
}
if (value > root->value)
{
root->pRight = InsertNode(root->pRight, valu... | ALGO | 0.999957 | 4.898285 |
05fe3bde-d13b-4845-9230-1a1cf4f86c62 | NVIDIA/cuopt | cpp/src/dual_simplex/vector_math.cpp | #include <dual_simplex/pinned_host_allocator.hpp>
#include <dual_simplex/types.hpp>
#include <dual_simplex/vector_math.hpp>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <vector>
namespace cuopt::linear_programming::dual_simplex {
template <typename i_t, typename f_t, typename Allocator>
f_t vector_... | ALGO | 0.993286 | 7.037465 |
e129d811-b809-4fc3-a0ac-c7680d5bf172 | DolbyLaboratories/aosp-platform-frameworks-native | libs/utils/BasicHashtable.cpp | #define LOG_TAG "BasicHashtable"
#include <math.h>
#include <utils/Log.h>
#include <utils/BasicHashtable.h>
#include <utils/misc.h>
namespace android {
BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor,
size_t minimumInitialCapacity, float loadFactor) :
mBucketSize(e... | ALGO | 0.896423 | 6.56045 |
d5edb18a-8494-43e7-92c6-7bab7ceb6ea8 | AryanB1/Algorithm | main.cpp | //preprocessors that are needed
#include "connector.h"
#include <iostream>
#include <string>
//Declaring main function
int main() {
std::string input;
std::string message;
std::string d_message;
//Creating a while true loop to ensure that I get a valid input
while(true) {
std::cout << "Pleas... | TOOL | 0.865561 | 3.467178 |
45e8c349-099d-4f14-990f-efd4786b5a09 | WiseCow/algorithm | BOJ/모든 순열.cpp | #include<iostream>
using namespace std;
int N;
void dfs(int now, int jari,int map[10],bool visit[10])
{
if (jari == N + 1)
{
for (int i = 1; i <= N; i++)
{
printf("%d ", map[i]);
}
printf("\n");
}
else
{
for (int i = 1; i <= N; i++)
{
if (!visit[i])
{
map[jari] = i;
visit[i] = 1;
... | ALGO | 0.999966 | 4.056295 |
b4d81349-a4a3-4801-88ae-a9a90b0b7bf3 | Raj-Devo/My-DSA-Projects | recursionAndBacktracking/countdig.cpp | #include <iostream>
using namespace std;
void countDig( int n , int& count)
{
if( n == 0)
return;
if(n)
count++;
int val = n/10;
countDig(val , count);
}
int main(int argc, char const *argv[])
{
int n , count = 0;
cout <<"Enter the number : ";
cin >> n;
countDig(n , count);
... | ALGO | 0.999922 | 4.231429 |
065925b1-64e3-45a5-a893-6b81524ca2a0 | Tanbir-Hasan-247/competitive-programming | Card_Game.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sort(a) sort(a.begin(), a.end())
#define sortDis(a) sort(a.begin(), a.end(), greater<int>())
#define ll long long
#define YES "YES\n"
#define NO "NO\n"
#define ... | ALGO | 0.999834 | 4.65365 |
97810730-8944-43ff-ba0f-a8b5653fda28 | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0100-0199/190A.cpp | #include <cstdio>
int main(){
long n(0), m(0); scanf("%ld %ld", &n, &m);
if(n == 0 && m > 0){puts("Impossible");}
else{
long minSum = (n < m) ? m : n;
long maxSum = n; if(m > 0){maxSum += m - 1;}
printf("%ld %ld", minSum, maxSum);
}
return 0;
} | ALGO | 0.998924 | 3.535512 |
c869c325-13a2-450f-ae24-9b5600b7ddce | bsidio/hacktoberfest2020 | guessing game/gg.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int num, ran, att = 3;
int lowest = 1, highest = 10;
int range = (highest - lowest) + 1;
while (true)
{
ran = lowest + rand() % range;
while (att > 0)
{
cout << "Enter Your guess between 1 t... | TOOL | 0.908027 | 3.092137 |
56563a46-bca4-4170-b964-55f70b6e2a5a | deepakco1924/dyanmic-programming-good-questions | coinCombination2.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define triple pair<pair<int,int>,int>
#define MOD 1000000007
#d... | ALGO | 0.999984 | 4.71472 |
dcb85295-1387-4843-bbb7-19e3fe1eeb24 | rbruno95/codeforces-ladders | < 1300/060-DZY_loves_chessboard.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<string> tab(n);
for(int i=0;i<n;++i)
cin >> tab[i];
for(int i=0;i<n;++i)
{
for(int j=0;j<m;++j)
cout << ((tab[i][j] == '.') ? (((i + j) & 1) ? 'W' : 'B') : tab[i][j]);
... | ALGO | 0.999699 | 3.6922 |
914c937e-a5fe-4390-a369-a2c800f9a5e8 | CKCat/android2.3.3 | frameworks/base/media/libstagefright/codecs/aacdec/get_sbr_stopfreq.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#ifdef AAC_PLUS
#include "get_sbr_stopfreq.h"
/*----------------------------------------------------------------------------
; MACROS
; Define mod... | ALGO | 0.998811 | 5.607489 |
bc2b92be-f510-4c75-a419-48f625c3ecf9 | alejandro61299/Physics | Physics2_class3 - handout/Box2D/Box2D/Dynamics/Joints/b2FrictionJoint.cpp | #include <Box2D/Dynamics/Joints/b2FrictionJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i + rx j)
//... | ALGO | 0.986139 | 7.568802 |
b4a29f57-ab9c-4ff4-a010-1965e1b55ca7 | artiam99/GeeksforGeeks | 10 Dynamic Programming/1 Basic Problems/24 Max Subset with no Pair Divisible by K.cpp | #include<bits/stdc++.h>
using namespace std;
int MaximumSubset(vector<int> &a,int n,int k)
{
vector<int> dp(k);
for(auto i:a)
dp[i%k]++;
if(k%2==0)
dp[k/2]=min(dp[k/2],1);
int res=min(dp[0],1);
for(int i=1;i<=k/2;i++)
res+=max(dp[i],dp[k-i]);
return res;
}
signed main()
{
vector<int> a={3, 7, 2, 9, ... | ALGO | 0.999907 | 4.464552 |
399e6709-56d3-4d2d-8ea5-896b2a91c651 | Sailanarmo/boost | libs/compute/example/host_sort.cpp | #include <iostream>
#include <vector>
#include <boost/spirit/include/karma.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/sort.hpp>
namespace compute = boost::compute;
namespace karma = boost::spirit::karma;
int rand_int()
{
return rand() % 100;
}
// this example demonstrates how to... | ALGO | 0.999699 | 5.783236 |
11c6fc2e-f83d-4951-bc56-4f76623aac61 | KryptoCrash/cf | doublenot.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
const ll maxn = (ll)pow(2, 10);
ll inv(ll val) {
if (val == 0) return 1;
ll x = log2(val) + 1;
for (ll i = 0; i < x; i++) val = (val ^ (1 << i));
return val;
}
void solve() {
ll ... | ALGO | 0.999652 | 4.828281 |
3b7716df-bbdc-4c88-873a-e3adc1ad6d98 | old-yan/leetcode-solutions | leetcode_solutions/leetcode_1100/1071/1071.cpp | #include "utils.h"
class Solution {
bool check(string&s,string&p){
for(int i=0;i<s.size();i++){
if(s[i]!=p[i%p.size()])return false;
}
return true;
}
public:
string gcdOfStrings(string str1, string str2) {
for(int l=min(str1.size(),str2.size());l;l--){
... | ALGO | 0.999905 | 5.76275 |
ff1f51e5-8df7-4d7f-9073-6bd5dd07b04c | islamshaheb/Codeforce_Problem_Solve | A. SwapSort.cpp | #include<bits/stdc++.h>
using namespace std;
#define fr(m,n)for(int i=m; i<n; i++)
#define fr1(k,l)for(int j=k; j<l; j++)
main()
{
//freopen("input.txt","r",stdin);
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int n;
cin>>n;
int a[n];
int b[n];
fr(0,n)
{
cin>>a[i];b[i]=a[i];
}
sort(b,b+n);
i... | ALGO | 0.999938 | 3.202801 |
1b56798f-49ad-48dc-af4c-819a179c3bc4 | fansuregrin/HPLSP-Study-Notes | code/ch-14/deadlock.cpp | /**
* @file deadlock.cpp
* @author
* @date 2024-03-15
* @brief 按不同顺序访问互斥锁导致死锁
*/
#include <pthread.h> // pthread_*
#include <unistd.h> // sleep
#include <cstdio> // printf
#include <cerrno> // errno
int a = 0;
int b = 0;
pthread_mutex_t mutex_a;
pthread_mutex_t mutex_b;
void* another(void * arg) {
pthr... | ALGO | 0.894158 | 4.58445 |
8aa5159d-47fe-427d-ae3f-38e5179912b2 | dummyhacker99/Codes | Codeforces/405A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin>>n;
ll arr[n];
for(ll i = 0; i < n; i++){
cin>>arr[i];
}
sort(arr, arr+n);
for(... | ALGO | 0.999807 | 4.468429 |
98217ae7-e8d8-4953-bcff-83641675dc2a | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6366_19.cpp | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long f = 1, ans = 0;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
ans = ans * 10 + c - '0';
c = getchar();
}
return f * ans;
}
long long N,... | ALGO | 0.999957 | 4.380585 |
c1a51f9b-22c6-4883-b788-8beff60c15c1 | ghts2110/competitive_programing | uva/Goldbach’s Conjecture (II)/Goldbachs_Conjecture.cpp | #include <iostream>
using namespace std;
int main(){
int t;
while(1){
cin >> t;
if(t == 0){
break;
}
int cont = 0;
bool isPrime = true;
for(int i = 2; i <= t/2; i++){
isPrime = true;
for(int j = 2; j * j <= i; j++){
... | ALGO | 0.999886 | 4.316803 |
20b6937a-f04c-4585-8edf-bce2527ae87c | twairgroup/wondercoin | src/rest.cpp | #include "chain.h"
#include "chainparams.h"
#include "core_io.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "validation.h"
#include "httpserver.h"
#include "rpc/blockchain.h"
#include "rpc/server.h"
#include "streams.h"
#include "sync.h"
#include "txmempool.h"
#include "utilstrencodings.... | WEB | 0.940636 | 4.05193 |
147cfb5f-ec6a-418c-aeae-995848e3ec71 | ituacm/ITU-ACM-AlgoTeam | Regular-Question-Answers/ugly-number.cpp | // Author: Ahmet Furkan Kavraz
// Question Link: https://leetcode.com/problems/ugly-number/
class Solution {
public:
bool isUgly(int n) {
// the number should be positive as written in the question
if (n <= 0)
return false;
// remove the part of factors of 2, 3 and 5
wh... | ALGO | 0.999903 | 6.044871 |
b029bab4-b3b3-492b-a6d7-4bbeb986cc76 | Zadid13/CodeForces | 282A.cpp | #include <bits/stdc++.h>
using namespace std;
#define optimize() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
int main()
{
optimize();
int t, x = 0;
;
cin >> t;
while (t--)
{
string s;
cin >> s;
... | ALGO | 0.999924 | 4.71914 |
f0d74132-5474-4aa4-b5fd-b9864a891692 | Baha-Bouazizi/LeetCode | 0264-ugly-number-ii/0264-ugly-number-ii.cpp | class Solution {
public:
int nthUglyNumber(int n) {
set<long> uglyNumbersSet; // Set to store potential ugly numbers
uglyNumbersSet.insert(1); // Start with 1, the first ugly number
long currentUgly = 1;
for (int i = 0; i < n; i++) {
currentUgly =
*ugly... | ALGO | 0.999985 | 6.702019 |
80587780-7e98-4f7b-b26b-afad5a43eb11 | sarvex/leetcode-vala | solution/1800-1899/1820.Maximum Number of Accepted Invitations/Solution.cpp | class Solution {
public:
int maximumInvitations(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
bool vis[210];
int match[210];
memset(match, -1, sizeof match);
int ans = 0;
function<bool(int)> find = [&](int i) -> bool {
for (int j = ... | ALGO | 0.999993 | 6.424701 |
3ad2e24d-8d8d-4610-a47c-67113c682b49 | Altu-Bitu/Altu-Bitu-study | 0921 - brute force/1436.cpp | //
// Created by banya on 2021-09-26.
//
#include <string>
#include <iostream>
using namespace std;
int endNumber(int n){
int cnt = 0;
for(int i =666;;i++){
string s = to_string(i);
if(s.find("666")!=s.npos )//
cnt++;
if(cnt ==n)
return i;
}
}
int main(){
... | ALGO | 0.93504 | 4.239086 |
74bcfa5c-9e88-4870-a44b-1bfbcb5fc4a7 | Jbernardiss/codeStylometryResearch | data/dataset-v4/Um_nik/Um_nik-a1-2022-worldFinals.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | ALGO | 0.999731 | 4.750661 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.