uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f0db4ff0-9118-484e-b465-975045f20483 | geekboxzone/lollipop_frameworks_av | media/libstagefright/codecs/amrnb/common/src/weight_a.cpp | /*
Pathname: ./audio/gsm-amr/c/src/weight_a.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Put file into template and first pass at optimization.
Description: Made changes based on comments from the review meeting. Used
pointers instead of inde... | ALGO | 0.999577 | 6.017359 |
19873dfa-3a30-4971-bb36-22d8d0ac1577 | ssjjitt/OAIP2sem | lab16_v11/lab16_v11.cpp | // Ввести массивы А и В. В массив С перенести элементы массива А с нечетным значением и элементы массива В с четным значением.
// Массив С отсортировать по возрастанию, используя алгоритмы сортировок: сортировка Шелла, сортировка Хоара.
#include <iostream>
using namespace std;
void ShellSort(int mass[], int n)
{
in... | ALGO | 0.999827 | 3.826663 |
4a90c7bc-e69a-4cfa-89bc-e80ce58a970a | SmridhiSoni/CRUD-Operations | myproject/src/components/ST2PA/ST2PA/binarySearch.cpp | #include <iostream>
using namespace std;
int BinarySearch(int arr[],int n,int k){
int mid,left=0,right=n-1;
if(right>=left){
mid=left+(right-left)/2;
if(arr[mid]==k){
return mid;
}
else if(arr[mid]>k){
return left=mid-1;
}
else{
return ri... | ALGO | 0.999878 | 5.370994 |
a162113c-179e-4848-835f-b132a93a4648 | namo02268/Kikurage | include/glm/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.999026 | 3.60046 |
601b6b0e-90b4-4e34-9db6-8442462ff2d5 | kaiumallimon/cpp-codes | practice/word.cpp | #include<bits/stdc++.h>
#include <cctype>
using namespace std;
int countUpper(string s){
int len=s.size();
int count=0;
for(int i=0;i<len;i++){
if(isupper(s[i])){
count++;
}
}
return count;
}
int countLower(string s){
int len=s.size();
int count=0;
for(... | ALGO | 0.999878 | 5.558411 |
1b28aea4-1667-4848-aefd-c3abcdad31e0 | Shr3yash/CP | Arr&Str/LargestSubArrWSumX.cpp | class Solution{
public:
int maxLen(vector<int>&A, int n)
{
unordered_map<int, int> sumap;
int csum=0;
int maxl=0;
for(int i=0; i<n; i++){
csum+=A[i];
if(csum==0)maxl=i+1;
else{
if(sumap.find(csum)!=sumap.end()){
... | ALGO | 0.999935 | 5.641879 |
9c5d013a-082a-4e59-82f9-22cabc36325d | jesuswr/cp-codes-and-problems | D.good_substrings.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, p... | ALGO | 0.999711 | 4.086517 |
7ac69b06-e4de-4cb4-b539-322d88541a74 | FazleRabbeBipul/LeetCode-Ace-Coding-Interview-75-Qs | 238. Product of Array Except Self.cpp | #include <bits/stdc++.h>
using namespace std;
// 238. Product of Array Except Self
// O(n)
class Solution
{
public:
vector<int> productExceptSelf(vector<int> &nums)
{
int n = nums.size();
vector<int> ans(n, 1);
for (int i = 0, res = 1; i < n; res *= nums[i], i++)
ans[i] *= r... | ALGO | 0.999983 | 5.865754 |
ff707c7d-9015-4a89-bb1b-121d0f07697d | Ma-jia/LC | p1352.cpp | //
// Created by m'j'x on 2025/2/26.
//
#include <iostream>
#include <vector>
using namespace std;
// 定义深度优先搜索(DFS)函数,用于计算每个员工对应的动态规划值
void dfs(int u, vector<vector<int>> &children, vector<int> &r, vector<vector<int>> &dp) {
// 遍历当前员工的所有子员工(直接下属),递归处理子员工
for (int v: children[u]) {
dfs(v, children, r, ... | ALGO | 0.99998 | 5.282553 |
ffac7fad-71f8-4f22-b44a-34ead1e93796 | lokidre/cognit | tests/math/opt/lsm_secant_research.cpp | #include "../common/common.h"
#include "../common/load.h"
#include <cognit/mat/vector.cxx>
#include <cognit/mat/vector/io.cxx>
#include <cognit/mat/opt/lsm.cxx>
#include <cognit/mat/matrix.cxx>
#include <cognit/mat/matrix/inv.cxx>
#include <vector>
apl::ABuffer<double> x_data, y_data ;
int n ;
//
// define the func... | ALGO | 0.999593 | 4.982387 |
ce6fd0bb-8529-45db-8d71-a2ec043c2a53 | Shorya1835/Kactl | stress-tests/geometry/CircleLine.cpp | #include "../utilities/template.h"
#include "../utilities/randGeo.h"
#include "../../content/geometry/lineDistance.h"
#include "../../content/geometry/CircleLine.h"
typedef Point<double> P;
int main() {
{
auto res = circleLine(P(0, 0), 1, P(-1, -1), P(1, 1));
assert(res.size() == 2);
assert((res[1]-P(sqrt(2)/2... | TEST | 0.992212 | 5.500437 |
0182cb80-1ba2-4a9c-a317-5f3e56393ea4 | Precipitating/AdventOfCode | 2016/part 2/Source.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
fstream file; file.open("input.txt");
string finalCode;
string line;
int grid[3][3] = { 0 };
grid[0][0] = 1; grid[0][1] = 2; grid[0][2] = 3;
grid[1][0] = 4; grid[1][1] = 5; grid[1][2] = 6;
grid[2][0] =... | ALGO | 0.999639 | 4.590969 |
3c23c2ff-3084-4e9f-a77f-92db96998d28 | TajwarSaiyeed/problem-solving-codechef-leetcode-codechef | 3-7-2024/A. Catch the Coin.cpp | /*
Author: Tajwar Saiyeed
Date: 2024-07-03 07:48:48
File: A. Catch the Coin.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;
template <typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_ta... | ALGO | 0.999347 | 5.651302 |
ab60d63f-42c5-4a31-9d75-88a70b32c3ff | lbenc135/Cpp_codes | Drzavno_practice/Trie/main.cpp | #include <cstdio>
using namespace std;
struct node {
bool isEnd=false;
node* child[26]={0};
};
int n;
void add(node *n, char *c)
{
char l=*c-'a';
if(n->child[l]==NULL)
n->child[l]=new node;
if(*(c+1)=='\0')
{
n->isEnd=1;
return;
}
add(n->child[l], c+1);
}
boo... | ALGO | 0.999933 | 3.934859 |
cd3050d5-749a-446a-b030-973891c49107 | akshat-fsociety/CodeChef-Solutions | Codechef-Practice/FCTRL2.cpp | // Small factorials
#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
cpp_int Factorial(int number)
{
cpp_int num = 1;
for (int i = 1; i <= number; i++)
num = num * i;
return num;
}
int main(){
ios :: sync_with_std... | ALGO | 0.999926 | 5.740444 |
38427dfc-ba05-4796-82e4-68035fda44b9 | felipeorrico/CS16X | CS161/Assignment 3/without array/Assignment3.cpp | /******************************************************************************
* Program: Assignment3.cpp
* Author: Felipe Orrico Scognamiglio
* Description: Nim game with 2 players and 1 winner. Game generates random numbers for each pile between 1 and 10.
* Inputs: A,B,C for the piles and 1,2,3 for amount.
* Ou... | ALGO | 0.994782 | 3.662752 |
f2122b21-085e-4d72-9b0f-2b5a9801cc5b | udawat04/Leetcode_problems | 728-self-dividing-numbers/self-dividing-numbers.cpp | class Solution {
public:
int counter(int n) {
int count = 0;
while (n) {
count++;
n /= 10;
}
return count;
}
vector<int> selfDividingNumbers(int left, int right) {
vector<int> result;
int digit, count = 0, count1 = 0;
for (int i... | ALGO | 0.99989 | 5.965001 |
3a56e42f-216d-46ac-8096-87e4b9860454 | zhouyong64/academiccoder | oss/eblearn_1.2_r2631/tools/libeblearntools/src/configuration.cpp | #include <cstdlib>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <vector>
#include <stdio.h>
#include <limits>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "string_utils.h"
#include "tools_util... | TOOL | 0.856371 | 4.306211 |
1bc7daa2-b986-49fe-ad18-d636b54b8cb4 | aphrim/codeforces-workspace | completed/1400/soldier-and-cards.cpp | /*
ID: gregper1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {for(auto &x : a) out << x << ' ... | ALGO | 0.999811 | 3.721892 |
ffa36203-951a-413f-bcc7-23941319aa29 | AnasJadoon31/DSA-in-CPP | modules/unique_array_value.cpp | //
// Created by AnasJ on 16/07/2025.
//
#include "unique_array_value.h"
#include <iostream>
void unique_array_value(int const arr[], int const arr_size)
{
int unique_count = 0;
for (int i = 0; i < arr_size; i++)
{
bool is_unique = true;
for (int j = 0; j < arr_size; j++)
{
... | ALGO | 0.995555 | 5.974124 |
b0acc707-6386-4515-a691-0066c6426ae2 | Project-3T/external_libcxx | test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter> && CopyConstructible<Compare>
// void
// make_heap(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <memory>
#include <random>
#includ... | TEST | 0.988202 | 5.925251 |
5a6a4ce9-b3fa-4123-b20e-97d3eb4092ee | TaRun1369/CP---forces-and-cses | F_Graph_Without_Long_Directed_Paths.cpp |
#include<bits/stdc++.h>
using namespace std;
long long n = 2e5 +5;
vector<long long> col(n,-1);
vector<bool> vis(n);
vector<vector<long long>> adj(n);
bool dfs(long long node ){
vis[node] = 1;
for(auto it : adj[node]){
if(col[it] == col[node]) return false;
else if(!vis[it])
{
... | ALGO | 0.999995 | 4.009454 |
00bce66b-e05d-4b9d-b9ff-31e98709a8b3 | Lucarts/laboratorio1_UTN | U2-decision/test.cpp | #include <iostream>
using namespace std;
#include <cstdlib>
int main () {
int number;
cout << "Insert your number";
cout << endl;
cin >> number;
if (number > 0)
{
cout << "el numero ingresado es positivo";
}
else
{
if (number < 0)
{
cout << "el numero ingresado es negativo";
... | TOOL | 0.881267 | 3.008337 |
aae24f2b-6027-4dca-b7a0-9f3e9b13dd36 | alexandraback/datacollection | solutions_5738606668808192_1/C++/vlecomte/c.cpp | #include <iostream>
#include <cstdio>
#include <bitset>
using namespace std;
typedef long long ll;
#define MARGIN 14
ll ipow(ll b, int n) {
ll res = 1;
for (int i=0; i<n; i++)
res *= b;
return res;
}
int main()
{
int dummy, num;
cin >> dummy >> dummy >> num;
cout << "Case #1:" << endl... | ALGO | 0.999089 | 3.119284 |
b6a7a680-e3fa-4d63-82c4-ee65800d7be6 | wenqiangwangsustech/FP16-LSRK | Theorem/src/src_willimson_con/src_con_med_fp/run.cpp | #include "header.h"
void modelChecking( PARAMS params )
{
int thisRank;
MPI_Barrier( MPI_COMM_WORLD );
MPI_Comm_rank( MPI_COMM_WORLD, &thisRank );
if ( params.useMultiSource && params.useSingleSource )
{
params.useMultiSource = 0;
if ( 0 == thisRank )
printf( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!... | ALGO | 0.999419 | 4.922368 |
0df6609f-a969-48aa-8e2b-72d60f30ae5b | minhvpham/Competitive_Programing | lqdoj/trau.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<long long , long long>
#define vi vector<int>
#define vpii vector<pii>
#define SZ(x) ((int)(x.size()))
#define fi first
#define se second
#define IN(x,y) ((y).find((x... | ALGO | 0.999977 | 4.955865 |
8308cdbe-fdf9-4f60-8e11-56ffa2839dc7 | tuhinbc/online_judge_solutions | 1138.cpp | ////loj 1138 c++
//#include<stdio.h>
//#include<iostream>
//#include<stdlib.h>
//#include<set>
//#include<map>
//#include<algorithm>
//#include<stack>
//#include<math.h>
//using namespace std;
//int nofzero(double n)
//{
// int t=0;
//
// while(n>4){
// n=n/5;
// t+=floor(n);
// }
// return t;... | ALGO | 0.998797 | 3.650865 |
2b19c0c8-6f11-48a2-9929-551b37da1cc2 | refugecoin/refugecoin | src/rpcmining.cpp | #include "rpcserver.h"
#include "chainparams.h"
#include "init.h"
#include "net.h"
#include "main.h"
#include "miner.h"
#ifdef ENABLE_WALLET
#include "db.h"
#include "wallet.h"
#endif
#include <stdint.h>
#include "json/json_spirit_utils.h"
#include "json/json_spirit_value.h"
using namespace json_spirit;
using namespa... | WEB | 0.963327 | 6.239144 |
af1f807a-f3a1-418e-81a8-9dbc063cc295 | CommanderAsdasd/asdasd_modules | src/MentalClockDivider.cpp | ///////////////////////////////////////////////////
//
// Clock Divider VCV Module
// Based on autodafe's clock divider but code cleaned up and extra outputs added.
//
// Strum 2017
//
///////////////////////////////////////////////////
#include "mental.hpp"
#include "dsp/digital.hpp"
//////////////////////////... | TOOL | 0.901107 | 6.172569 |
f155dd43-71da-40cc-8935-62e443f0e454 | prashar32/Striver-DSA-Sheet-Solutions | Dynamic Programming Part-II/Partition_Equal_Subset_Sum.cpp | // Question Name - Partition Equal Subset Sum
// Question Link - https://leetcode.com/problems/partition-equal-subset-sum/
// Solution Link - https://leetcode.com/submissions/detail/696563918/
#include <bits/stdc++.h>
using namespace std;
bool canPartition(vector<int>& nums) {
int MaximumSUM = accumulate(nums.be... | ALGO | 0.999943 | 5.879504 |
7571a941-bd8b-4377-9937-ed83e87f4e8c | Shubh08am/Leetcode_DSA_Problems-Solutions | 38. Count and Say.cpp | class Solution {
public:
string solve(int n){
if(n==1) return "1" ;
string curr = solve(n-1) ;
//cout<<n<<" "<<curr<<"\n";
string res = "" ;
for(int i=0;i<curr.size();i++){
char ch = curr[i] ;
int occur = 1 ;
//count occurence -> like... | ALGO | 0.999997 | 6.906301 |
6a7af3e2-5967-43b0-be9b-e206da2e3ff9 | Mohit067/CPP | Loops/While/reverseNumber.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter a nUmber : ";
cin>>n;
int reverse = 0;
while(n>0){
reverse *= 10;
int lastDigit = n%10;
reverse += lastDigit;
n = n/10;
}
cout<<reverse;
} | ALGO | 0.999863 | 4.30342 |
2f7da562-fdff-44a9-85a6-ef7470fc62f9 | shivgupta198922/CodeForces-Master-in-cpp | 1617A.cpp | /*
~ Author : @tridib_2003
*/
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_orde... | ALGO | 0.999973 | 5.364316 |
9cce5332-fe82-4445-b7fb-50c0234debde | Synaptic-rayan/CODEFORCES | AmbitiousKid.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for(int i = 0; i < n; i++){
cin >> arr[i];
}
int minOps = 0;
bool zeroFound = false;
int smallestAbsValue = abs(arr[0]);
for(int i = 0; i < n; i++... | ALGO | 0.99985 | 4.536298 |
0b56d10b-9548-448d-b647-8511f5b78d91 | allcre/cpp-practice | cboj/evens.cpp | #include <iostream> // this works idk what cboj is on
using namespace std;
#include <cmath>
int main() {
int n;
int y = 0;
cin >> n;
for (int i = 2; i < n; i += 2) {
int digits = int(log10(i) + 1);
int arr[digits];
int x = 0;
for (int l = 0; l < digits; l++) {
... | ALGO | 0.999632 | 4.337862 |
d6f6c646-5589-4df7-8eeb-f4d1344511cc | bioexcel/bioexcel-code-releases | GROMACS/gromacs-2019-beta1/src/gromacs/linearalgebra/gmx_lapack/slaswp.cpp | #include "../gmx_lapack.h"
/* LAPACK */
void
F77_FUNC(slaswp,SLASWP)(int *n,
float *a,
int *lda,
int *k1,
int *k2,
int *ipiv,
int *incx)
{
int ix0,i1,i2,inc,n32;
int ix,i,j,ip,k;
float temp;
if(*incx>0) {
ix0 = *k1 - 1;
i1 = *k1 - 1;
i2 = *k2;
inc = 1;
} else if(*incx<0) {
ix0 = *i... | ALGO | 0.999646 | 3.027686 |
07920e89-1d11-4b0a-b4ef-d70ca70b7ad6 | algorithm004-05/algorithm004-05 | Week 2/id_425/LeetCode_22_425.cpp | /*
* @lc app=leetcode.cn id=22 lang=cpp
*
* [22] 括号生成
*
* https://leetcode-cn.com/problems/generate-parentheses/description/
*
* algorithms
* Medium (72.07%)
* Likes: 581
* Dislikes: 0
* Total Accepted: 49.1K
* Total Submissions: 68K
* Testcase Example: '3'
*
* 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并... | ALGO | 0.999461 | 6.13629 |
c325e0c6-26d4-4635-adbc-6179f1f2df2b | HuaHenry/LeetCode_Exe | 23.合并K个升序链表_20240524/code.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:
struct status {
... | ALGO | 0.999919 | 5.898072 |
93dcbaec-3c5a-4d9e-ad99-58c89de50eb0 | oliverchen5285/cpp_rep | Euler/euler76.cpp | #include <iostream>
using namespace std;
int ways(int total, int max, int count){
if(total == 0 && count >= 2){
return 1;
}
if(total < 0){
return 0;
}
int ans = 0;
for(int i = 1; i <= max; ++i){
ans += ways(total - i, i, count + 1);
}
return ans;
}
int main(){
cout << ways(100, 100, 0) <... | ALGO | 0.99993 | 4.205715 |
a5b49906-da47-4777-bf6c-99f8aa2173b7 | ethoshomo/codding-challenges | Leetcode/0168-Excel-Sheet-Column-Title.cpp | /* 168. Excel Sheet Column Title
Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Input: columnNumber = 1
Output: "A"
Example 2:
Input: columnNumber = 28
Output: "AB"
Example 3:
Inp... | ALGO | 0.998273 | 5.664123 |
71a5634c-5717-4b60-9b49-e8f5ac80ae0c | Hyp3R0d/AlgorithmCompetition | 字符串/前缀 后缀 序列 回文/前缀 前缀函数 AC自动机/LC2781.cpp | #include<bits/extc++.h>
using i8 = signed char;
using u8 = unsigned char;
using i16 = signed short int;
using u16 = unsigned short int;
using i32 = signed int;
using u32 = unsigned int;
using f32 = float;
using i64 = signed long long;
using u64 = unsigned long long;
using f64 = double;
using i128 = __int128_t;
using u... | ALGO | 0.999847 | 5.42302 |
286a62cb-2ea9-4391-8ede-dcd634db632d | nirmalkumarnikam/DATA-STRUCTURES-AND-ALGORITHMS | Stack/Stock span problem.cpp | Input:
N = 7, price[] = [100 80 60 70 60 75 85]
Output:
1 1 1 2 1 4 6
Explanation:
Traversing the given input span
100 is greater than equal to 100 and there are no more elements behind it so the span is 1,
80 is greater than equal to 80 and smaller than 100 so the span is 1,
60 is greater than equal to 60 and smalle... | ALGO | 0.99997 | 6.100564 |
3d64ac8f-0454-4b52-9e49-4a57884541bf | ParthLokhande/SE1_DSA | Assignment 12.cpp | #include <iostream>
using namespace std;
class Fib{
int f,a,b,n;
int fib[50],fib1[50];
public:
void accept();
void fibSeries();
void fibSearch();
};
void Fib :: accept(){
cout << "\nHow many Numbers do you want to Enter?";
cin >> n;
cout << "\nNow enter the Numbers one by one:\n";
for(int i=1;i<=n;i++)
ci... | ALGO | 0.999708 | 3.724232 |
330f9ca1-621a-4d1a-9dd0-5e5c5a1d9eed | mahmoudabozied4/CSES-Solutions | Introductory Problems/Palindrome Reorder.cpp | #include <bits/stdc++.h>
// علمكم الله ما ينفعكم و نفعكم بما تعلمتم و زادكم علما
// وَأَن لَّيْسَ لِلْإِنسَانِ إِلَّا مَا سَعَىٰ، وَأَنَّ سَعْيَهُ سَوْفَ يُرَىٰ
using namespace std;
#define ll long long
#define int long long
#define ull unsigned long long
#define lol long long int
#define endl '\n'
#define elif else if... | ALGO | 0.999998 | 4.658512 |
6bc4a4a3-988a-4291-80cf-0e34e6fd4f2a | sarvex/leetcode-c-sharp | solution/2000-2099/2078.Two Furthest Houses With Different Colors/Solution.cpp | class Solution {
public:
int maxDistance(vector<int>& colors) {
int n = colors.size();
if (colors[0] != colors[n - 1]) return n - 1;
int i = 0, j = n;
while (colors[++i] == colors[0])
;
while (colors[--j] == colors[0])
;
return max(n - i - 1, j... | ALGO | 0.999123 | 5.670956 |
6159b021-204f-4cdb-ba0d-6483dc93dd81 | sachinchauhan84/pythonproblem | Pattern 3.cpp | #include<iostream>
using namespace std;
int main(){
int row , col , n = 4;
for(int row=1;row<=n;row++)
{
cout<<" ";
for(int col=1;col<=n;col++)
{
cout<<"1"<<" ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.998942 | 3.163025 |
66dc91a6-90fd-433f-8a64-8df502275b79 | lxx1884896/newcoder_jianzhi_offer | 360_browser/删除链表中重复的结点.cpp | /*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
*/
class Solution {//讲道理,没有看太懂。。。。。。。。。。。。。。。。。
public: //1->2->3->4->5,pHead 指向的是val为1的结点
ListNode* deleteDuplication(ListNode* pHead)
{ if (pHead == NULL) {
return NULL;
}
L... | ALGO | 0.999997 | 4.740749 |
fb85ddf3-ac1a-4fef-8c39-3049be0f136e | kecin25/Kevin-UTD | COSC-Projects/Class-Work/CS-1337-Fall-2020/Projects/Project 4/main.cpp | // Made by: Kevin Boudreaux
// COSC-1337002
// 11/19/2020
// this code is used to find the derivative of functions that are basic trigs and or just X's
// this is the first time Classes was used and are used to show an understanding of how classes work in C++
#include <iostream>
#include <string>
#include "LList.h"
#in... | TOOL | 0.973839 | 3.314482 |
1c774956-b1af-4d50-a0b7-7581558d8780 | Jaycelation/CPP-PTIT | String and application/CPP0334.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
long long sum = 0;
for (int i = 0; i < s.size(); ++i) {
if (!isdigit(s[i]))
s[i] = ' ';
}
stringstream ss(s);
string token;
while(ss >> token) {
sum += stoi(token);
}
cou... | ALGO | 0.998359 | 4.729839 |
5363bbdd-30e2-4ccf-851d-c42f9e52486b | hh00ff/My-LeetCode-solutions | LC0021_MergeTwoSortedLists.cpp | //
// Created by hfq on 19-5-16.
//
#include <iostream>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
if(l1 == nullptr && l2 == nullptr) {
return nullptr;
... | ALGO | 0.999738 | 5.573404 |
81b4f970-1307-4134-bf48-5f1e04cf9b76 | friendlyarm/android_external_skia | experimental/Intersection/TriangleUtilities.cpp | #include "TriangleUtilities.h"
// http://www.blackpawn.com/texts/pointinpoly/default.html
bool pointInTriangle(const Triangle& triangle, const _Point& pt) {
// Compute vectors
_Vector v0 = triangle[2] - triangle[0];
_Vector v1 = triangle[1] - triangle[0];
_Vector v2 = pt - triangle[0];
// Compute dot prod... | ALGO | 0.965662 | 7.570864 |
25190056-956b-442b-a273-6b68a6339d36 | swyoo1121/C-CPP | baekjoon/7576.cpp | #include <iostream>
#include <queue>
#include <cstring>
#define MAX_SIZE 1000 + 1
using namespace std;
struct tomato {
int y, x;
};
queue<tomato> q;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0 , -1 };
int n, m, result = 0;
int graph[MAX_SIZE][MAX_SIZE];
bool IsInside(int ny, int nx) {
retur... | ALGO | 0.999913 | 3.91551 |
3841fd5e-3fda-4106-92aa-12f66755b6ec | mspjapan/procon | aoj/cpp/aoj_intro/number theory/aoj_ntl_1_d.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
void eulur(int n);
int main(){
int n;
cin >> n;
eulur(n);
}
void eulur(int n){
double p,ans;
vector<int> v;
vector<int>::iterator ite;
ans = n;
for(int i=2;i<=sqrt((double)ans);){
if(n%i==0){
i... | ALGO | 0.999884 | 3.478494 |
25e7e96e-26d6-43d9-bb8a-d743e5e0b345 | KMsojib/Competitive-Programming | Codeforces/E_Count (2).cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
fast_io;
int t=1; //cin>>t;
while(t--){
string s; cin>>s;
ll sum =0;
for(int i=0;i<s.size();i++){
sum+=s[i]-'0';
}... | ALGO | 0.999186 | 4.072919 |
64802219-a0e5-4c97-ac0b-25cee2b0d47c | koldka/SIA | TP/4/sia_td4/src/path_mats.cpp | #include "integrator.h"
#include "scene.h"
#include "material.h"
#include "areaLight.h"
class PathMats : public Integrator
{
public:
PathMats(const PropertyList &props) {
m_maxRecursion = props.getInteger("maxRecursion",4);
m_IS = props.getBoolean("IS", false);
}
Color3f Li(const Scene *sc... | ALGO | 0.989686 | 5.296647 |
40aac30d-af07-4f03-adf5-2befa9359e02 | kabirgoyal26/D-S-A | 1878-check-if-array-is-sorted-and-rotated/1878-check-if-array-is-sorted-and-rotated.cpp | class Solution {
public:
bool check(vector<int>& nums) {
const int n = nums.size();
int rotates = 0;
for (int i = 0; i < n; ++i)
if (nums[i] > nums[(i + 1) % n] && ++rotates > 1)
return false;
return true;
}
}; | ALGO | 0.999945 | 5.761154 |
1a5d3e49-0eaa-4aba-a555-0d70ba9cc77b | amanocha/iw_fall2022 | pin3.7/source/tools/SimpleExamples/regval_app.cpp | #if defined(TARGET_WINDOWS)
# include <Windows.h>
# define EXPORT_SYM __declspec( dllexport )
#else
# define EXPORT_SYM
#endif
// Empty function - this is simply a placeholder for the tool to start printing register values.
extern "C" EXPORT_SYM void Start()
{
// do nothing
}
// Empty function - this is simply a ... | TOOL | 0.911212 | 5.111436 |
1014b47b-bb77-4ffc-bed4-380ba6461c52 | csienslab/icLibFuzzer | lldb/test/API/python_api/module_section/c.cpp | int c_function(int input) {
return input * 3;
}
| TOOL | 0.856942 | 3.536473 |
d78d34c6-ba1c-4538-8301-ee96709727ba | marekpetrik/craam2 | include/eigen3/bench/benchmarkSlice.cpp | // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 10000
#endif
#ifndef SCALAR
#define SCALAR float
#endif
int main(int argc, char *argv[])
{
typedef Matrix<SCALAR, Eigen::Dynam... | TOOL | 0.863422 | 3.688043 |
21916669-9bc6-4e51-b067-67aea6f83f79 | CrBillman/LAMMPS | USER-SMD/compute_smd_triangle_mesh_vertices.cpp | #include <string.h>
#include "compute_smd_triangle_mesh_vertices.h"
#include "atom.h"
#include "update.h"
#include "modify.h"
#include "comm.h"
#include "force.h"
#include "memory.h"
#include "error.h"
#include "pair.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Eigen/Eigen... | TOOL | 0.983665 | 4.937832 |
b39ddeb4-057f-4195-9fa6-3748765fb010 | Dup4/competitive-programming | BZOJ/3040/e.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INFLL 0x3f3f3f3f3f3f3f3f
const int N = 1e6 + 10, M = 1e7 + 10;
int n, m, T, rxa, rxc, rya, ryc, rp;
struct Graph {
struct node {
int to, nx, w;
node() {}
node(int to, int nx, int w) : to(to), nx(nx), w(w) {}
} a[M... | ALGO | 0.999946 | 3.685902 |
ac6bb28a-8799-4ae0-bd4a-7f8b1fa16b99 | fcbruce/algorithm-game | code/CF/Coder-Strike 2014/final/C.cpp | #include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<cctype>
#include<cmath>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define sqr(x) ((x)*(x))
#define LL long long
#define INF 0x3f3f3f3f
#define PI 3.141... | ALGO | 0.999973 | 3.041719 |
37744214-54b0-4d57-933b-280650b3b76e | TechEducationPlusPlus/Resources | presentations/C++/Loops/Demo/do-while-example.cpp | #include <iostream>
using namespace std;
int main()
{
int cnt = 0, num;
do
{
cin >> num;
if (num % 2 == 0 and num > 0) cnt++;
}
while (num >= 0);
cout << cnt << endl;
return 0;
}
| ALGO | 0.999598 | 3.975198 |
37b47d24-7659-453c-b531-6f45a0713e31 | s610v/projectCpp | main.cpp | #include <iostream>
#include <random>
#include <ctime>
#include <fstream>
#include <string>
#include <cstdlib>
#include "search.h"
#include "IntFunction.h"
#include "Interpolate.h"
using namespace std;
// Cutpoint method declaration
void CM(double F[], IntFunction integ, int index);
int main() {
IntFunction integ... | ALGO | 0.999662 | 4.63935 |
53107260-6da1-4d79-aa46-bc04cec78fdd | ankittkp/Competitive-Programming | Mathematical/absolute.cpp |
#include <bits/stdc++.h>
using namespace std;
int absolute(int I);
int main() {
int T; // number of testcases
cin >> T; // input number of testcases
while (T--) {
int I;
cin >> I;
cout << absolute(I) << endl; // print the output
}
return 0;
}// } Driver Code Ends
// U... | ALGO | 0.996959 | 4.957887 |
588e7dee-bfe7-4f83-bed0-91418a43dadb | kailasspawar/DS-ALGO-PROGRAMS | Algorithms/DP/MaximumSumIncSubseq.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int maxSumIS(int arr[],int n)
{
int msis[n];
int i,j;
for(i = 0;i<n;i++)
msis[i] = arr[i];
for(i = 1;i<n;i++)
for(j = 0;j<i;j++)
if(arr[i] > arr[j] && msis[i] < msis[j] + arr[i])
msis[i] = msis[j] + arr[i];
return *max_element(m... | ALGO | 0.999973 | 4.734516 |
ad88a6b6-2a9f-46eb-8357-0458790e27f7 | HyeongJun02/STUDY-Operating-System | Study 1/test.cpp | /* parser.c-단순 산술식에 대한 구문 분석기 시스템 */
#include <stdio.h>
#include <ctype.h>
extern int nextToken;
extern FILE* in_fp;
/* 토큰 코드들 */
#define INT_LIT 10
#define IDENT 11
#define ASSIGN_OP 20
#define ADD_OP 21
#define SUB_OP 22
#define MULT_OP 23
#define DIV_OP 24
#define LEFT_PAREN 25
#define RIGHT_PAREN 26
/* 함수선언 */
v... | ALGO | 0.996729 | 3.703511 |
fbdd0a5d-6af4-499d-9e3e-1bb24b6eaf48 | mnokno/Marlin | main.cpp | #include <iostream>
#include "position.h"
#include "search.h"
#include "transposition_table.h"
#include "precalculated_data.h"
#include "zobrist_hashing.h"
int main() {
std::cout << "Hello, World!" << std::endl;
engine::ZobristHashing::initHashes();
engine::PrecalculatedData::init();
engine::Transposi... | ALGO | 0.974609 | 3.811913 |
0823345c-938d-4eb9-a39a-cbb9cc968c67 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/DoctorChef_20200706135729.cpp | #include<bits/stdc++.h>
#include<thread>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<unordered_map>
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.ti... | ALGO | 0.999963 | 3.866174 |
eb2d44ec-6c58-4e41-b1ef-337df023bd90 | himanshirawat/Cpp | pattern/pattern18.cpp | //29 March 2023
// Pattern
// A
// BC
// DEF
#include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
char ch = 'A';
int row = 1;
while(row<=n){
int col = 1;
while (col<= row)
{
cout << ch;
ch++;
col++;
}
cout... | ALGO | 0.999336 | 4.05181 |
1e1a9004-8364-49fe-aa02-a288eb64d990 | epeasang/manhattan | Manhatan_ocl.cpp | #include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <string.h>
#include <CL/cl.h>
void initialize(int *m,int t,int maximo)
{
int i;
for(i=0;i<t*t;i++)
{
m[i] =(int) (((1.*rand())/RAND_MAX)*maximo);
}
}
void escribir(int *m, int t){
int i, j;
for (i = 0; i < t; ... | ALGO | 0.986973 | 3.4993 |
349c4b83-64c7-4311-975f-09bbd68ecc3b | inoueshinichi/Learn_HowToOpenCV | LocalFeatures/fast_keypoint.cpp | /**
* @file fast_corner_detector.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2023-02-09
*
* @copyright Copyright (c) 2023
*
*/
#include <test_utils.hpp>
#include <opencv2/opencv.hpp>
// スルー画像の取り込み処理
CV_DEFINE_PROCESSFRAME
int main(int argc, char **argv)
{
try
{
// FAST
... | ALGO | 0.948065 | 6.452058 |
0a456fcd-9283-4c51-bf32-4017c2a960d9 | walnia/walnia | 3、4/实验四4.9/4.2.3.cpp | #include<iostream>
using namespace std;
int main() {
int c,n;
cin >> n;
int* a = new int[n];
for (int i = 0; i <= n-1; i++) {
cin >> a[i];
}
for (int j = 0; j <= n-1; j++) {
for (int i = 0; i <= n-1 - j; i++) {
if (a[i + 1] > a[i]) {
c = a[i];
a[i] = a[i + 1];
a[i + 1] = c;
}
}
}
for (in... | ALGO | 0.999942 | 3.198195 |
ab548980-0522-4a7e-9ccb-55e6556bf0f8 | tuanlinh1234/gotravel_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.998859 | 6.785645 |
bb5e2dee-6e4f-4055-8144-b3acc2a88547 | mit-biomimetics/Cheetah-Software | common/src/Collision/CollisionPlane.cpp | /*!
* @file CollisionPlane.cpp
* @brief Collision logic for an infinite plane
*
* Simplest collision, used for floor and global bounding box
*/
#include "Collision/CollisionPlane.h"
/*!
* check whether the contact happens or not
* cp_frame let you know which direction is normal (z) and which directions are
* ... | ALGO | 0.975117 | 5.26762 |
64dff2d8-defb-4ee6-b835-ff6204cebb44 | idarraga/mafalda | mafalda_framework/OctoAlignment/OctoAlignment.cpp | #ifndef __OctoAlignment_cpp
#define __OctoAlignment_cpp
#include "OctoAlignment.h"
#include "MAFTools.h"
using namespace MSG;
ClassImp(OctoAlignment)
OctoAlignment::OctoAlignment(){
}
void OctoAlignment::Init(){
Log << MSG::INFO << "Init function !" << endreq;
//getMyTree()->Branch("distanceToCenter", &m_dist... | ALGO | 0.877139 | 5.41161 |
6e0a9924-ef9d-480e-9463-22c367a86bb4 | xmyqsh/leetcode2016 | 313_super-ugly-number.cpp | class Solution {
public:
int nthSuperUglyNumber(int n, vector<int>& primes) {
vector<int> f(n, 1);
auto cmp = [](const tuple<int, int, int>& p1, const tuple<int, int, int>& p2) {
return get<0>(p1) > get<0>(p2);
};
priority_queue<tuple<int, int, int>, vector<tuple<int, int... | ALGO | 0.999997 | 5.984758 |
50ed8e51-735d-4747-a2cc-ead28f415fbd | ksdkamesh99/Code-Monker | LeetCode/#1137.cpp | class Solution {
public:
int fibnoci(int n,vector<int>&v){
if(v[n]==-1){
v[n]=fibnoci(n-1,v)+fibnoci(n-2,v)+fibnoci(n-3,v);
}
return v[n];
}
int tribonacci(int n) {
vector<int> v(1000,-1);
v[0]=0;
v[1]=1;
... | ALGO | 0.999985 | 6.022676 |
3883aa61-f2c5-4fd1-b6ef-ca5eec51a001 | GraphicsCGJ/coding | cpp/acm/BFS_DFS/12851_g4.cpp | #include <iostream>
#include <queue>
using namespace std;
#define MX 200001
typedef pair<int,int> P1;
int N, K;
int dp[100001];
int main(void) {
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> N >> K;
fill(dp, dp+100001, MX);
// dp[0] = 0;
queue<P1> q;
q.push(P1(N,0));
int cn... | ALGO | 0.99952 | 3.904681 |
f3c9e287-9cbe-4d1f-b14e-3a7e63b64e13 | Jialin/ICPC | Archive/Leetcode/S/step-by-step-directions-from-a-binary-tree-node-to-another.cpp | // First batch includes
#include "common/include.h"
#include "common/macros.h"
#include "debug/debug_declare.h"
#include "leetcode/binary_tree_macros.h"
#include "leetcode/linked_list_macros.h"
#include "leetcode/binary_tree.h"
#include "leetcode/linked_list.h"
#include "leetcode/parse.h"
// Last include
#include "d... | ALGO | 0.999975 | 6.664017 |
78949022-0d4c-47fb-acc8-acf91b0d4372 | Liuqianqian007/learncs | data_structure/201119_binary_tree.cpp | /*************************************************************************
> File Name: binary_tree.cpp
> Author: liuqian
> Mail:
> Created Time: Thu 19 Nov 2020 07:26:43 PM CST
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//二叉树
... | ALGO | 0.999797 | 4.430362 |
48e55eac-9232-4d44-88f1-9a0dc0465afa | JamesQAQ/Coding-Practices | ZeroJudge/Solutions/a104. 排序/2016-04-21_2764711.cpp | #include <stdio.h>
#include <iostream>
using std::swap;
#define MAX 10000
int a[MAX];
void quicksort(int a[], int l, int r){
if (l >= r)
return;
int pivot = a[l], pos = l;
for (int i = r; i > pos; i--){
if (a[i] < pivot){
swap(a[pos + 1], a[i]);
pos++;
... | ALGO | 0.999857 | 3.460794 |
b3098b2c-f38e-49c4-8162-2f0b85926af5 | univerdvfu/forMaksimDolbaed | RSA_Simple.cpp | #include<iostream>
#include<vector>
#include <string>
#include<cmath>
#include <typeinfo>
bool Simple_num(int a);
int RSA_keys(int p1, int q1);
int RSA_crypt(int test2, int e1, int n1);
int RSA_De_crypt(int test2, int d1, int n1);
int main()
{
double l=108;
double ol=5;
double g=300;
double lol = pow(l, ol);
lol = po... | ALGO | 0.999748 | 3.76472 |
05dc4c32-517e-402a-a372-87763b15cdfe | SiumNobo/Cplusplus | Examprac.cpp | #include<iostream>
using namespace std;
class circle
{
private:
float radius;
public:
circle(float radius)
{
this->radius=radius;
}
void setradius(float radius)
{
this->radius=radius;
}
int getradius()
{
return radius;
}
virtual void Area(float radius... | TOOL | 0.961058 | 5.019861 |
7fd1d86f-8ccd-4c56-98a3-22994fb03ee8 | naxocist/POSN-IPST | IPST/oct_2024/noninteractive/o67_oct_orderstatistics_tree_policy.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> s;
int q; cin >> q;
whi... | ALGO | 0.997694 | 4.73669 |
bd6ae499-4cb3-4128-b61e-5b913d719698 | Priyanshu4650/Daily-Problems-LeetCode | 1050-construct-binary-search-tree-from-preorder-traversal/construct-binary-search-tree-from-preorder-traversal.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.999996 | 6.65138 |
8d1bd22e-48a7-42ca-bba0-929407abb078 | AseemBaranwal/grind-169 | Day 9/572.subtree-of-another-tree.cpp | // @before-stub-for-debug-begin
#include <string>
#include <vector>
#include "commoncppproblem572.h"
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode id=572 lang=cpp
*
* [572] Subtree of Another Tree
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* ... | ALGO | 0.999872 | 7.166021 |
fe8830bd-51e3-4303-889e-05b242252836 | ishandutta2007/codeforces | el_sanchez/normal/913/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define forab(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define sz(c) int((c).size())
#define all(c) (c).begin(), (c).end()
#define mp(x, y) make_pair(x, y)
#... | ALGO | 0.999988 | 3.747439 |
92b7c3c4-7c33-448c-a711-cd2ae95608c1 | Nghaiz/CodePTIT_CPP | CPP0111.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int check (string s){
for (int i = 1; s[i] != '\0'; i++){
int d1 = s[i] - '0', d2 = s[i - 1] - '0';
if (abs(d1 - d2) != 1) return 0;
}
return 1;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.t... | ALGO | 0.999932 | 5.194829 |
70e0b651-0568-4f60-ab0e-767b017946b2 | itstepP12814/Lutsevich_Cpp | HW C_++ 23 Overload ++ - - [ ]/23 Class dinamic Array [],=,+,-,++,- - .cpp | /*Создайте класс динамического массива, в котором реализована проверка выхода за границы массива.
Перегрузите операторы: [ ], =, +, -,++ (добавление элемента в конец массива), -- (удаление элемента из конца массива). */
#include <iostream>
using namespace std;
class Array {
int *Ar;
size_t si... | TOOL | 0.873678 | 4.898886 |
8f97da71-226b-4fca-9ab6-3eaf5bf041d9 | GungCheoul/CppAlgorithm | CppAlgorithm/UseOfStack/2504.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
int main() {
string S;
cin >> S;
stack<char> B;
int tmp = 1;
int result = 0;
bool fail = false;
for (int i = 0; i < S.size(); i++) {
if (S[i] == '(') {
B.push(S[i]);
tmp *= 2;
... | ALGO | 0.99974 | 4.008714 |
b5313977-8acc-4c9d-b67a-1c0b514ef60f | dnyaneshwar-lohar/Data-Structure | 8Strings/s133.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(int argc, char const *argv[])
{
char A[] = "WELCOME";
for (int i = 0; A[i]!='\0'; i++)
{
if (A[i]>='a' && A[i]<='z')
{
A[i] = A[i] - 32;
}
else if (A[i]>='A' && A[i]<='Z')
... | ALGO | 0.982489 | 3.872411 |
651ac220-0fec-4989-a537-b4a643a77ca6 | KattoRan/applied_algorithms | TINHOC/duongdi/Gritical_path.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e4+7;
const int maxm=1e5+7;
const int oo=1e9+7;
int nv[maxn],n,m,deg[maxn],num;
int trc[maxn];
long long d[maxn];
typedef pair<int,int> ii;
vector <ii> a[maxn];
void numbering(){
queue<int> q;
int num;
for(int i=1;i<=n;i++)
if(deg[i]==0) q.push(i... | ALGO | 0.99999 | 4.762816 |
f15d0bf5-e69e-40ee-9ab8-8ba7c2814bf1 | arnob444/CP_04 | Week4/Day4/DullOperation.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long int
#define ON(n,k) ((n)|(1<<k))
#define OFF(n,k) ((n)& ~(1<<k))
#define isON(n,k) ((n)>>(k) & 1)
#define flip(n,k) ((1<<k)^n)
void solve()
{
int n;
cin >> n;
cout << n << " " << n - 1 << endl;
}... | ALGO | 0.999573 | 4.667089 |
26f5fbd9-6389-4d56-8d2a-4305bc1fdfd4 | varung18/C-Cpp-brothers | CodeChef/Assignment 1/Phase II/SVIT Assignment 1/primarilitytests.cpp | // https://www.codechef.com/submit/PRB01
#include <iostream>
using namespace std;
int main ()
{
int t;
cin>>t;
while (t--)
{
int num;
cin>>num;
int i;
for (i = 2; i < num; i++)
{
if (num%i==0)
{break;}
}
if (i!=num)
... | ALGO | 0.999824 | 4.77351 |
da74fdd9-1206-4321-b402-c055319b0964 | Firzh/simple-library | building-program/hash-table_collision-handling.cpp | #include <iostream>
#include <windows.h>
#include <iomanip>
#include <conio.h>
#include <string>
using namespace std;
const int HASH_SIZE = 10;
struct Admin {
int id;
string username;
string password;
Admin* next;
};
string passwordMask() {
string password;
char ch;
ch = _getch();
... | TOOL | 0.943037 | 4.308822 |
c61e50ef-dc36-4062-8dbe-db3f0157101a | fengchiyiya/C- | 下一个排列.cpp | //整数数组的一个排列就是将其所有成员以序列或线性顺序排列。
//例如,arr=[1,2,3],以下这些都可以视作arr的排列:[1,2,3],[1,3,2],[3,1,2],[2,3,1]
//整数数组的下一个排列是指整数的下一个字典序更大的排列。
//例如arr[1,2,3]的下一个排列是[1,3,2]
//必须原地修改,找出nums的下一个排列
#include <vector>
using namespace std;
/*两遍扫描法
我们希望下一个数比当前数大,这样才满足“下一个排列”的定义。因此只需要将后面的大数与前面的小数交换
我们还希望下一个数增加的幅度尽可能的小,我们需要
1.在尽可能靠右的低位进行交换,需要从后向... | ALGO | 0.99999 | 5.029052 |
c25a9149-5004-4fbe-a1d6-e85ecbc0c35c | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p03735/p03735_num7_parsed.cpp | #include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> bags(N);
for (int i = 0; i < N; i++) {
cin >> bags[i].first >> bags[i].second;
}
sort(bags.begin(), bags.end());
int R_max = nume... | ALGO | 0.999105 | 5.268918 |
55c31439-3189-47c0-846a-fb40a24af994 | Rasel457/Competitive_Programming | Ternary Search/IsThisJEE.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define PI... | ALGO | 0.99942 | 3.954659 |
e84ec22d-5279-4f68-a917-78ecd8e53a31 | srele96/sk-experiments | cpp/experiments/algorithms/src/palindrome_partition.cpp | #include <bits/stdc++.h>
using namespace std;
namespace kindOfBacktrackingThroughParameterVector {
class Solution {
public:
vector<vector<string>> partition(string s) {
function<bool(const string&)> pal = [&](const string& str) {
int i = 0, j = str.length() - 1;
while (i < j) {
if (str.at(i... | ALGO | 0.99997 | 6.459359 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.