uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f707f54e-a356-45bd-9bcd-a63d00a9fc29 | voronoi-coder/Templates | 04_variadic_templates/foldtraverse.cpp | //
// Created by zhaojunhe on 2018/9/30.
//
#include <iostream>
struct Node {
int value;
Node *left;
Node *right;
Node(int i = 0) : value(i), left(nullptr), right(nullptr) {
}
};
auto left = &Node::left;
auto right = &Node::right;
template<typename T, typename... TP>
Node *traverse(T np, TP...... | ALGO | 0.999926 | 4.767233 |
fd15f259-3984-419f-9da8-981a81971324 | ankan1811/Competitive-Programming-Ultimate-Sheet-Solutions | PrefixSum3.cpp | /*A prime number is a positive number, which is divisible by exactly two different integers. A digit prime
is a prime number whose sum of digits is also prime. For example the prime number 41 is a digit prime
because 4 + 1 = 5 and 5 is a prime number. 17 is not a digit prime because 1 + 7 = 8, and 8 is not
a prime numb... | ALGO | 0.99958 | 5.176542 |
c3c389e3-02c3-482c-a390-63abd23bf225 | ishandutta2007/codeforces | intothenight/normal/1516/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(ios::badbit | ios::failbit);
auto __solve_tc = [&](int __tc_num){
int n;
cin >> n;
vector<int> a(n + 1);
for(auto i = 0; i < n; ++ i){
int x;
cin >> x;
a[i + 1] = a[i] ^ x;
}
if(!a[n]){
c... | ALGO | 0.999994 | 4.221128 |
0af28e18-1f8a-4ff2-99cf-b38d9507d3dd | s-rifat/Competitve-Programming | CODEFORCES/Codeforces Round #659 (Div. 2)/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
#define pb push_back
char change(char c)
{
if(c=='a')
return 'b';
return 'a';
}
int main()
{
FAST
ll t,n;
cin>>t;
while(t--)
{
cin>>n;
ll a... | ALGO | 0.999861 | 3.408542 |
e5f89f45-b1a3-40c4-b0a4-37ac1e10ca23 | jerry0339/Study_Note | Algorithm/PS_library/Tree/TreeDiameter.cpp | // 트리의 지름
// -> 노드 사이의 거리중 가장 긴 거리
#include<bits/stdc++.h>
using namespace std;
int N, maxdist = 0, root;
vector<pair<int,int>> adj[100001]{};
int parent[100001]{};
void dfs(int now, int par, int d){
parent[now] = par;
if(d > maxdist) {
maxdist = d;
root = now;
}
for(int i=0; i<adj[... | ALGO | 0.999907 | 4.269872 |
0f7c7ed2-66f6-4eb3-acec-ad475a073bd4 | f12-mou/Light-OJ-Solutions | DP/LOJ-1180.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define endl '\n'
int n, m;
int arr1[105], arr2[105];
int midNow;
int dp[105][105][105];
int func2(int pos, int task1, int task2)
{
if (task1 == 0 && task2 == 0)
{
return dp[pos][task1][task2] = 1;
}
if (pos == n + 1)
{
... | ALGO | 0.999977 | 4.527703 |
84d44882-4183-4428-befb-8834dd1b7e35 | nootbookkv9/notebook_ | 02_Daily_Note/02_CS_Master/Level_0/Section_3_Problam_Solving/02_Solving_Problams_/02_Palindrome_String.cpp | // Chack if string is Palindrome String
/* Pseudo Code
// Examples
// level || ava
// avva || noon
// ---------------------------------------------------------------------------
word = // Enter any word
Is_Palindrome = Ture
for i = 0; i < word.length / 2; i++ :
if word[i] != word[ word.length - 1 - i] // if fi... | ALGO | 0.997261 | 4.767318 |
3ad51ddb-4c1e-4c7b-acf9-b3bcaba5a389 | Kuluum/StantfordAlgos | GreedyMsmDP/week4/Source.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
ifstream myfile ("knapsack_big.txt");
if (!myfile.is_open()) {
return 1;
}
string line;
getline(myfile, line);
istringstream iss(line);
vector<string> tokens{ ... | ALGO | 0.999911 | 4.09209 |
bded1836-dc9f-464a-b304-e4b74478e02c | fudoge/Problem_Solving | 2645-pass-the-pillow/2645-pass-the-pillow.cpp | class Solution {
public:
int passThePillow(int n, int time) {
int N = 2 * (n-1), x = time % N;
return 1+(x < n? x : N-x);
}
}; | ALGO | 0.999992 | 5.936247 |
259090f3-3a64-4b58-b11a-16436f802e71 | eth-sri/deepg | code/abstraction/abstraction.cpp | #include "gurobi_c++.h"
#include "abstraction/abstraction.h"
#include "utils/polyhedra_optimizer.h"
#include "utils/constants.h"
#include <future>
#include <utility>
#include <thread>
#include <chrono>
LipschitzFunction getLipschitzFunction(
const Image &img,
const Pixel<double> &pixel,
const H... | ALGO | 0.999786 | 7.041747 |
2909e2be-f5c4-46f8-8fcd-84ed3e60a546 | AfzalHossan-2005021/Codeforces_Contest | Div3/957/G_Ultra_Meow.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define endl "\n"
const int mod = 1e9 + 7;
int mod_inv(int a){
int b = mod - 2;
int res = 1;
while(b){
if(b & 1) res = (res * 1LL * a) % mod;
a = (a * 1LL * a) % mod;
b >>= 1;
}
retur... | ALGO | 0.99995 | 5.094299 |
a079cdf1-e0fa-484e-9c14-a244c3ce0952 | iksanov/algorithms_data-structures_OOP | Simple algorithms/Sorting algorihms (work with any type)/generateRandomArray.cpp | #include <algorithm>
#include <time.h>
#include "generateRandomArray.h"
int random(int from, int to)
{
srand(time(0));
int tmp = from + rand() % (to - from + 1);
return tmp;
}
void generateArray(int* array, int length)
{
for (int i = 0; i < length; i++) array[i] = i;
}
void randomizeArray(int* array, int length)
{... | TOOL | 0.915113 | 4.033913 |
15a234a0-fae0-4d24-aab7-afc6d288f642 | codemonkeyricky/lc | 2432.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <cmath>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
... | ALGO | 0.999577 | 5.293149 |
de93cbba-fa96-4425-b2a6-0488dcecc8de | Suikaba/procon-solved | AOJ/0300-0349/0341-Repeated_Spell.cpp |
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0341
#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 + 7;
int main() {
string t, b;
cin >> t >> b;
const int n = t.size(), m = b.size();
vector<int> dp(m + 1);
dp[0] = 1;
for(int i = 0; i < n; ++i) {
v... | ALGO | 0.999996 | 5.547972 |
fc809888-5263-4b33-9c15-06923d1a7708 | olegdatskiv/eolymp | 10.cpp | #include <iostream>
using namespace std;
int main() {
long int n;
cin >> n;
double s = 0;
long int result, m = 0, k;
k = n;
if (n != 0) {
do {
s += 1.0 / k;
m++;
k--;
} while (s <= 0.5);
m--;
result = n - m;
cout << result;
}
else
{
cout << 0;
}
return 0;
} | ALGO | 0.99988 | 3.134483 |
308b2cdb-59db-469a-8979-4049abbc98bb | otavioon/COLA-2022-Tools | datasets/src/optz/poj_s/1/24_1030.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
int num[101] = {0};
void fun()
{
int temp = 0, j = 100;
do
{
if (num[j] < 5)
{
num[j] = num[j] * 2 + temp;
temp = 0;
}
else
{
num[j] = num[j] * 2 - 10 + temp;
temp = 1;
}
... | ALGO | 0.999865 | 3.340351 |
202aee4a-0813-4191-bac3-02b7db0eee9c | coidx/SPIRV-Tools | source/reduce/structured_loop_to_selection_reduction_opportunity.cpp | #include "source/reduce/structured_loop_to_selection_reduction_opportunity.h"
#include "source/opt/aggressive_dead_code_elim_pass.h"
#include "source/opt/ir_context.h"
#include "source/reduce/reduction_util.h"
namespace spvtools {
namespace reduce {
namespace {
const uint32_t kMergeNodeIndex = 0;
} // namespace
bo... | ALGO | 0.963996 | 5.736826 |
85fc2959-1472-4218-ae6e-a3b99746c01c | pingchungchang/CP | b116.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int t;
int dp[1000000] = {};
void solve(){
int arr[n] = {};
memset(dp,0,sizeof(dp));
int sum = 0;
for(int i = 0;i<n;i++){
cin>>arr[i];
sum += arr[i];
}
if((sum&1)){
cout<<"No\n";
return;
}
sum /=2;
for(int i = 0;i<n;i++){
for(int j = sum;j>=arr[i]... | ALGO | 0.99987 | 3.465825 |
63300b8f-cd51-4daf-b287-8182257ecbc0 | piyaal/competitive | C. Registration system.cpp | #include<bits/stdc++.h>
using namespace std;
map<string,int> m;
main()
{
int n;
string s;
cin>>n;
while(cin>>s)
{
if(m[s]>0)
cout<<s<<m[s]<<endl;
else cout<<"OK"<<endl;
m[s]++;
}
}
| ALGO | 0.999238 | 4.049001 |
a1ed22cf-95d5-4b09-828a-75127d2f15a2 | nzkim1234/BOOK_Cpp_Programming | C++ Chapter7 problems/6/6.cpp | #include <iostream>
using namespace std;
class Matrix {
int x[4];
public:
Matrix(int a=0, int b=0, int c=0, int d=0) {
x[0] = a;
x[1] = b;
x[2] = c;
x[3] = d;
}
void show() {
cout << "Matrix = { " << x[0] << " " << x[1] << " " << x[2] << " " << x[3] << " }" << endl;
}
Matrix operator+(Matrix a) {
Mat... | ALGO | 0.947974 | 4.042423 |
07ab52aa-f6da-42e5-be93-6f5d9d203e5a | NguyenMinhThuan24112001/Data_structures_and_Algorithms_PTIT | to hop so co tong bang X.cpp | #include<bits/stdc++.h>
using namespace std;
int n,s,a[100];
vector< vector<int> > res;
vector<int>v;
void Try(int i,int sum ,vector<int>v){
if(sum==s){
res.push_back(v);
return;
}
for(int j=i;j<n;j++ ){
if(sum+a[j]<=s){
v.push_back(a[j]);
Try(j,sum+a[j],v);
v.pop_back();
}
}
}
int main (){
ios_b... | ALGO | 0.999585 | 3.649417 |
e856c7c4-6561-4b1c-8b47-d0a06a753e86 | Damorgal/Numerical-Methods | Tarea-4_ecuacionPoisson/ecuacion_poisson/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define k 0.5
#define a 0.0
#define b 5.0
double *calcula_d(double *x, double dx, int n);
double* resuelve_tridiagonal(double* d1, double* d2, double* d3, double* d, int n);
void calcula_error(double* fiv, double* x, int n);
double* discretizacion(double dx, in... | ALGO | 0.999763 | 3.899471 |
1d1a0a8b-097a-4cd0-9261-8d6fc3381f83 | Mohitbagul/Leetcode-POTD | 8-string-to-integer-atoi/string-to-integer-atoi.cpp | class Solution {
public:
long long num=0,flag=0,mark=0;
int find_num(string s,int i){
if(i==s.length()){
if(num>=INT_MAX){
if(flag==0)
return INT_MAX;
else
{
if(num==2147483647){
... | ALGO | 0.999759 | 4.429889 |
f0df5de6-d62b-459f-a52c-664e1b00728e | ACM-TOMS/CALGO | 1027/Original-Submission/Src/ext/sgtelib/src/Surrogate_Ensemble_Stat.cpp | /*-------------------------------------------------------------------------------------*/
/* sgtelib - A surrogate model library for derivative-free optimization */
/* Version 2.0.2 */
/* ... | ALGO | 0.993078 | 5.796544 |
0b5e356c-75d1-48e6-94a5-f341a20c0615 | GuacheSuede/MSSubmission1234567890 | submission/sma/boost_1_69_0/libs/compute/perf/perf_bolt_exclusive_scan.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <bolt/cl/scan.h>
#include <bolt/cl/copy.h>
#include <bolt/cl/device_vector.h>
#include "perf.hpp"
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
bolt::cl::control ctrl = bo... | ALGO | 0.903811 | 3.964213 |
d7381c45-ac0b-41e6-b4bd-1473455684e1 | vidsinghal/Cornucopia | HashEnabledLLVM/llvm/utils/TableGen/CTagsEmitter.cpp | #include "llvm/Support/SourceMgr.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include <algorithm>
#include <string>
#include <vector>
using namespace llvm;
#define DEBUG_TYPE "ctags-emitter"
namespace {
class Tag {
private:
const std::string *Id;
S... | TOOL | 0.871811 | 7.570799 |
d5f1b590-3354-41e2-9116-efd1f7e74214 | skrunchdtech/codingprojects | CS 251 (copy)/Assignment 4d/Composite_Multiply_Node.cpp | #if !defined (_Composite_Multiply_Node_CPP)
#define _Composite_Multiply_Node_CPP
template <typename T>
Composite_Multiply_Node<T>::Composite_Multiply_Node
(Component_Node<T> *left,Component_Node<T> *right)
: Composite_Binary_Node<T>(left, right)// You fill in here.
{
}
template <typename T>
Composite_Multiply_... | TOOL | 0.902579 | 6.006225 |
6a63c703-fa22-42c0-bc1f-b5abc6cfbee1 | ishandutta2007/codeforces | littlebeetle/normal/1133/C.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
const int N=200002;
int n,m,i,a[N],l,r;
int main(){
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",a+i);
sort(a+1,a+n+1);
for(l=r=1;r<=n;r++){
while(a[l]<a[r]-5)
l++;
m=max(m,r-l+1);
}
printf("%d",m);
} | ALGO | 0.999953 | 3.628218 |
b648df99-6585-4eec-a37e-af95fa766d0c | p1x31/problem-set | 100-125/116a.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
int a,b,c,s;
int main() {
cin>>a;
while (cin>>a>>b) {
c += b - a;
if (c > s)
s = c;
}
cout<<s;
} | ALGO | 0.998721 | 3.042544 |
42bd0101-06d4-4f4d-81e7-39903d03efcb | drgulevich/tdcdft-omxc | src/td.cpp | #include <armadillo>
#include "tdcdft-omxc/gs.hpp"
#include "tdcdft-omxc/hartree.hpp"
#include "tdcdft-omxc/mesh.hpp"
#include "tdcdft-omxc/systems.hpp"
#include "tdcdft-omxc/xc.hpp"
namespace tdcdft {
/**
* Convert the potential to Kohn-Sham basis given by REAL orbitals.
* The potential matrix in real space is gi... | ALGO | 0.997344 | 5.826311 |
ca77c455-4a98-424a-9308-e1bba718ee6d | BuvanShangar/Data-Structures | BalancedParantheses.cpp | /*
Given an expression string exp, write a program to examine whether the pairs and the orders of “{“, “}”,
“(“, “)”, “[“, “]” are correct in exp.
*/
#include <bits/stdc++.h>
using namespace std;
bool isBalanced(string);
bool isBalanced(string expr)
{
stack<int> st;
int size = expr.length();
for(int i=0;... | ALGO | 0.999658 | 5.95148 |
14ac57a7-f411-4f14-b43a-916083d2c49d | LokeshBolisetty/DSA | Striver/Dynamic Programming/JobSchedulingProblem.cpp | #include<iostream>
#include<vector>
using namespace std;
#include<algorithm>
bool compareJobs(const vector<int> &v1, const vector<int> &v2){
if(v1[1]!=v2[1])return v2[1]<v1[1]; // Sorting in descending order of deadlines
return v2[0]<v1[0]; //sorting in decreasing order of profits
}
int jobScheduling(vector<v... | ALGO | 0.999955 | 5.843084 |
714b3b31-a947-4668-ade8-d141ee286933 | lucianbc/University | GraphTheory/Code/Lab6/CuplajMaxim/main.cpp | #include <iostream>
#include <vector>
#include <list>
#include <unordered_map>
#include <fstream>
#include <queue>
#include <cmath>
typedef std::pair<int, int> muchie;
using namespace std;
ostream&operator<<(ostream& out, vector<int> v) {
for(auto a : v) {
cout<<a<<" ";
}
// cout<<endl;
return... | ALGO | 0.999211 | 4.337237 |
6a7829c8-758f-4af3-b9e3-cba81e8eae9b | lja3723/study_book-ModernCppIntro_win32 | 출판사 예제 파일/chapter2/PenApp/App1-2/CoinMoneyApp.cpp | //=========================================================
// 1-2
// 1-1 Ŵ
// Ʈ
//=========================================================
#include <iostream>
#include <memory> // 1, shared_ptr
using std::shared_ptr;
using std::cout; using std::endl;
struct CoinMoney {
int c50;
int c100;
int c500;
};... | TOOL | 0.85367 | 5.248609 |
b014065a-1f01-4d7e-9289-2c347dac05f4 | AryanTapre/data-structures | ADT_Data_Structures/Update/HashMap & Tries/01TrieCreation.cpp | #include<unordered_map>
#include<iostream>
using namespace std;
class Trie {
public:
char data;
bool isTerminal;
unordered_map<char,Trie*> child;
Trie(char _data) : data(_data) {
isTerminal = false;
}
};
void insert(Trie* root, string word) {
i... | ALGO | 0.999711 | 4.672793 |
86bc18cf-f6b1-4ab7-bf82-3e36090653fe | raincross7/code-similarity | codes/train_code/problem321/problem321_484.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF (9e18)
#define EPS (1e-6)
#define debug(...) do{\
cerr<... | ALGO | 0.999989 | 4.063131 |
84906256-0577-4e8b-b761-f3af48964db6 | ishandutta2007/codeforces | sirrembocodina/normal/855/B.cpp | #include <algorithm>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cstring>
#include <memory>
#include <string>
#include <vector>
#include <cstdio>
#include <ctime>
#include <set>
#include <iostream>
using namespace std;
#define fs first
#define sc second
#define forn(i, n) for (int i = 0; i < (i... | ALGO | 0.999839 | 3.614802 |
c5c1ee18-1e4d-43e2-80fd-54bf845f372d | amemoia/PodstawyProgramowaniaCPP | LAB/powtorzenie-kolos1/zadania powtorzeniowe/11.cpp | /*
Napisz program, który pobiera od użytkownika dwie liczby całkowite dodatnie n i m.
Następnie program ma generować i wyświetlać na ekranie pseudolosowe zdanie,
które ma być zbudowane z n słów a każde słowo ma być zbudowane z co najwyżej m znaków.
W słowach mają się pojawiać, z równym prawdopodobieństw... | TOOL | 0.986527 | 5.054139 |
7ebd980f-403c-4e86-a942-5ef20b9aa65a | yutanoma/surface-filling-curve-flows | modules/src/surface_path_evolution.cpp | #include "modules/surface_path_evolution.h"
#include "modules/get_tangent_basis.h"
#include "modules/check_intersection.h"
#include "modules/connect_surface_points.h"
#include "modules/remesh_curve_on_surface.h"
#include <chrono>
namespace modules {
const int max_iters = 100;
const double shrink = .8;
std::tuple<
... | ALGO | 0.999476 | 3.913071 |
525cacdd-ad01-4785-b341-56f59587518f | WeGo-Robotics/limo_gazebo | robot_localization/src/ukf.cpp | #include "robot_localization/ukf.h"
#include "robot_localization/filter_common.h"
#include <angles/angles.h>
#include <assert.h>
#include <Eigen/Cholesky>
#include <vector>
namespace RobotLocalization
{
Ukf::Ukf(std::vector<double> args) :
FilterBase(), // Must initialize filter base!
uncorrected_(true)
... | ALGO | 0.99273 | 7.589775 |
ba2ee18f-f589-4473-83d8-a3d7a3bcc8ce | lampaDario1543/advent-of-code-2024 | 001/p2/main.cpp | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int getOcc(vector <int>, int);
int main(){
vector<int> v1;
vector<int> v2;
fstream in;
in.open("input.txt", ios::in);
int n,n2;
while(in >> n >> n2){
v1.push_back(n);
v2.push_back(n2);
}
in.c... | ALGO | 0.999449 | 3.569778 |
83792506-9c2d-4915-9cd9-6c110dd72635 | ZachVec/PAT-Advanced | #1015 Reversible Primes.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
bool isPrime(int num){
if(num < 2) return false;
for(unsigned i = 2, upper = sqrt(num); i <= upper; ++i) {
if(num % i == 0) return false;
}
return true;
}
int revInRadix(int n, int radix){
int ... | ALGO | 0.999757 | 4.389059 |
a5076eb7-b57e-40ce-987c-62caa39d17fa | liuq901/code | ZJ/zj_a_263.cpp | #include <cstdio>
#include <cstdlib>
const int a[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool leap(int x)
{
if (x%400==0)
return(true);
if (x%100==0)
return(false);
return(x%4==0);
}
int calc(int y,int m,int d)
{
int ret=d;
for (int i=0;i<y;i++)
ret+=365+leap(i);
for (... | ALGO | 0.999965 | 4.059256 |
31ff4a87-8df8-4d3e-8314-1ae8799abf5f | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/cgal/examples/QP_solver/print_first_lp.cpp | #include <iostream>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// program type
typedef CGAL::Quadratic_program<int> Program;
int main() {
// by default, we have a nonnegative QP with Ax <= b
Program lp (CGAL::SMALLER, true, 0, false, 0);
// now set the non-default entries: 0 <-> x, 1 <-> y
l... | ALGO | 0.92176 | 4.273794 |
ec8b1c3e-899a-4cde-86e7-87638b6b196f | ADmitri42/2FieldSpatGame | games/cpp/spatgame.cpp | #include "spatgame.h"
#include <cmath>
#include <iostream>
#include <numeric>
#include <random>
/*
* initialize game field with vector for densities
*
* size - length of field
* _b - initial payoff parameter
*/
AbstractSpatialGame::AbstractSpatialGame(size_t size, double _b1, double _b2, double _lam, double _mu, ... | ALGO | 0.999883 | 4.569014 |
9e57ae91-12ee-43d9-9ad4-5c91cd90ac28 | haribo841/Cpp-challenges | ConsoleApplication1/059 Length of Number.cpp | //Create a function that takes a number n and returns its length.
#include "059 Length of Number.h"
int Length(int n) {
int count = 0;
while (n > 0)
{
n /= 10;
count++;
}
return count;
} | TOOL | 0.995647 | 5.449978 |
c1d9d6d6-0589-43f7-a5d0-fecc122853c6 | SNU-ARC/flashneuron | aten/src/ATen/native/Activation.cpp | #include <ATen/native/Activation.h>
#include <ATen/ATen.h>
#include <ATen/CPUApplyUtils.h>
#include <ATen/Dispatch.h>
#include <ATen/NativeFunctions.h>
#include <ATen/native/TensorIterator.h>
#include <ATen/Parallel.h>
#include <ATen/core/DistributionsHelper.h>
namespace at { namespace native {
static const double S... | ALGO | 0.893516 | 7.061035 |
830921b7-7062-4067-a1d3-d8aafa181fa0 | IsratJahan09/Hackerrank_problem | Flipping bits.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
unsigned n;
cin>>n;
cout<<~n<<endl;
}
return 0;
}
| ALGO | 0.998505 | 4.525885 |
5c9edb19-6cd1-4c16-9501-6ccc79189201 | graindb/graindb-demonstration | src/optimizer/expression_heuristics.cpp | #include "duckdb/optimizer/expression_heuristics.hpp"
#include "duckdb/planner/expression/list.hpp"
using namespace duckdb;
using namespace std;
unique_ptr<LogicalOperator> ExpressionHeuristics::Rewrite(unique_ptr<LogicalOperator> op) {
VisitOperator(*op);
return op;
}
void ExpressionHeuristics::VisitOperator(Logi... | ALGO | 0.954446 | 7.131999 |
c70ad200-2003-4c8f-abd0-b05515bcbab6 | nguyentheson24052004vy/tuan_thu2 | c++/2_4.cpp | #include <iostream>
#include <vector>
using namespace std;
// Hàm Selection Sort
void selectionSort(vector<int>& arr) {
int n = arr.size();
for (int i = 0; i < n - 1; i++) {
// Tìm chỉ số của phần tử nhỏ nhất trong [i..n-1]
int minIndex = i;
for (int j = i + 1; j < n; j++) {
... | ALGO | 0.999974 | 5.230259 |
436b90cc-8c8f-47b6-9fe5-f0142282b4f2 | ORNL/TASMANIAN | SparseGrids/tsgGridGlobal.cpp | #ifndef __TASMANIAN_SPARSE_GRID_GLOBAL_CPP
#define __TASMANIAN_SPARSE_GRID_GLOBAL_CPP
#include "tsgGridGlobal.hpp"
#include "tsgTPLWrappers.hpp"
namespace TasGrid{
template<bool iomode> void GridGlobal::write(std::ostream &os) const{
if (iomode == mode_ascii){ os << std::scientific; os.precision(17); }
IO::w... | TOOL | 0.888962 | 3.579763 |
c553f19e-c6bb-4137-9a6f-db566dab4de6 | kei1107/algorithm | problems/yukicoder/No0302.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<c... | ALGO | 0.999197 | 3.531581 |
77f49c2b-c89f-41b4-a06b-388a2d3ed950 | chad-source/limap-test | limap-test/third-party/libigl/include/igl/pso.cpp | #include "pso.h"
#include <cassert>
#include <Eigen/StdVector>
#include <vector>
#include <iostream>
template <
typename Scalar,
typename DerivedX,
typename DerivedLB,
typename DerivedUB>
IGL_INLINE Scalar igl::pso(
const std::function< Scalar (DerivedX &) > f,
const Eigen::MatrixBase<DerivedLB> & LB,
... | ALGO | 0.999803 | 6.353269 |
67c0a3b8-2b71-4902-aafb-f3f2d73b0a6a | RetZitra/DSA-Practice-Problems | 1370-count-number-of-nice-subarrays/count-number-of-nice-subarrays.cpp | class Solution {
public:
int numberOfSubarrays(vector<int>& nums, int k) {
int n=nums.size();
// int cnt=0;
//generating all the subarrays brute-force TC=0(n)
// for(int i=0;i<n;i++){
// int oddcount=0;
// for(int j=i;j<n;j++){
// if(nums[j]%2!... | ALGO | 0.999997 | 5.670872 |
9f1d1155-de7b-4991-b674-8134af60a0c6 | cliqz-oss/browser-f | mozilla-release/netwerk/streamconv/converters/nsUnknownDecoder.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include "nsUnknownDecoder.h"
#include "nsIPipe.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsMimeTypes.h"
#include "nsIPrefBranch.h"
#include "nsCRT.h"
#include "nsIMIMEService.h"
#include "nsIDivertableChanne... | TOOL | 0.851656 | 7.611466 |
91142ba3-8fa2-4317-84db-a2fcdeca0f97 | paramonovaanna/Algorithms-and-Data-Structures | Number theory/degree_and_mod.cpp | #pragma GCC optimize("O3")
#include <iostream>
#include <algorithm>
#include <random>
#include <unordered_map>
#include <vector>
const int N = 100100 * 2;
std::mt19937 gen(12345);
void process(int dx, std::unordered_map<int, int> &used, int n, const std::vector<int> &numbers) {
if (used[dx]) {
return;
}
us... | ALGO | 0.999953 | 4.160151 |
01b26531-cde2-4385-8958-aee793baf345 | naziikk/Algorithms | alg&d_s-contest6/P2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
class DSU {
std::vector<int> parent;
std::vector<int> rank;
public:
explicit DSU(int n) {
parent.resize(n);
rank.resize(n, 1);
for (int i = 0; i < n; i++) {
parent[i] = i;
}
... | ALGO | 0.999983 | 5.306908 |
4e077fb4-8acb-4e0a-ade9-aff0ae2cd225 | xinxinchu/2023aaia2 | week16/week16-3a.cpp | #include <stdio.h>
int main()
{
int n,ten=1;
scanf("%d",&n);
while(n > 0)
{
int now = n%10;
printf("%d ",now*ten);
n = n / 10;
ten = ten * 10;
}
}
| ALGO | 0.999941 | 3.607744 |
1705f963-44be-40ef-932f-a3046188d6ec | adityamittal13/USACO-Silver-Problems | Additional Problems/Sorting1_3.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int x = 4;
int y = 9;
int n= 10;
int arr[10] = {36, 9, 2191, 66, 3, 4, -18, 876, 156, 12};
int index;
int r;
for (int i = x; i < y; i++) {
index = i;
for (int j = i+1; j < y; j++) {
if (arr[i... | ALGO | 0.999877 | 3.363758 |
12cb357d-c4ed-4d6b-b789-2241162b6170 | Coders-Assemble/Sanket-Jagtap-DSA | Arrays/Arrays Problems/LC442-Find_All_Duplicates_in_an_Array.cpp | #include <iostream>
#include <vector>
using namespace std;
// TC => O(n)
// SC => O(1)
class Solution
{
public:
vector<int> findDuplicates(vector<int> &nums)
{
int n = nums.size();
vector<int> ans;
for (int i = 0; i < n; i++)
{
int num = abs(nums[i]);
... | ALGO | 0.999923 | 5.653481 |
61ab99e3-3879-45b7-b74d-ed3620d4c855 | CleytonSvitor/SO_IMD_2022 | processos.cpp | #include <iostream>
#include <chrono>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "Matriz.cpp"
#include <math.h>
using namespace std;
int calculaElemento(Matriz* m1, Matriz* m2, int linha, int... | ALGO | 0.998861 | 3.856972 |
88be6409-a6c2-4059-8192-0a773fd12804 | hunter-heidenreich/lammps_flare_etc | lib/linalg/zpptrf.cpp | #ifdef __cplusplus
extern "C" {
#endif
#include "lmp_f2c.h"
static integer c__1 = 1;
static doublereal c_b16 = -1.;
int zpptrf_(char *uplo, integer *n, doublecomplex *ap, integer *info, ftnlen uplo_len)
{
integer i__1, i__2, i__3;
doublereal d__1;
doublecomplex z__1;
double sqrt(doublereal);
integer... | ALGO | 0.999684 | 3.925698 |
9b71de92-a55a-4007-b4f7-ac65e8b8f49c | anlsys/llvm-project | mlir/lib/Dialect/X86Vector/Transforms/AVXTranspose.cpp | #include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/Dialect/X86Vector/Transforms.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/... | TOOL | 0.907122 | 6.767563 |
c16d6207-c32d-42b3-81da-2966979ab536 | RoBorregos/Soccer-Lightweight-2025 | src/demoStriker.cpp | #include "motors.h"
#include "BNO.h"
#include <Arduino.h>
#include "IRRing.h"
#include "PID.h"
#include "constants.h"
#include "PixyCam.h"
#include "Photo.h"
#include "Ultrasonic.h"
uint8_t j = 1;
bool isCorrecting = false;
int setpoint = 0;
float kBallFollowOffsetBack = 1.2;
float kBallFollowOffsetSide = 1.0;
float... | TOOL | 0.945597 | 4.040981 |
f6387506-b27e-47bf-8e77-26ed2269fd3f | Phoe-nix-89/LeetCode-Solution | Kth_smallest.cpp | #include<bits/stdc++.h>
using namespace std;
/* https://www.geeksforgeeks.org/problems/kth-smallest-element5635/1 */
class Solution {
public:
// arr : given array
// k : find kth smallest element and return using this function
int kthSmallest(vector<int> &arr, int k) {
// code here
int m... | ALGO | 0.999967 | 5.37379 |
f4f6ebb0-96d6-4982-ab3d-896315dd8354 | Pooh1223/Online-Judge | Tioj/Tioj1663.cpp | #include <cstdio>
int main(){
int t,a,b;
while(~scanf("%d%d%d",&t,&a,&b)){
if(t == 1){
printf("%d\n",a + b);
} else if(t == 2){
printf("%d\n",a - b);
} else if(t == 3){
printf("%d\n",a * b);
} else {
printf("%d\n",a % b);
}
}
} | ALGO | 0.999076 | 3.55785 |
e71e7370-521e-404a-8897-35485671409b | yuri2078/yuri | c++/cslg/中位数.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int x;
cin >> x;
vector<int> v(x, 0);
for (int i = 0; i < x;i++){
cin >> v[i];
}
sort(v.begin(), v.end());
if(x%2){
cout << v[x / 2] << endl;
}else if ((v[x / 2 - 1] + v[x / 2])... | ALGO | 0.999864 | 4.110214 |
12790619-8c2f-43f3-a989-b1b0981edb7b | nisan24/XPSC_Batch_04 | Problems/Week_04/Day - 02/B_Rock_and_Lever.cpp | // #include <bits/stdc++.h>
// using namespace std;
// #define ll long long int
// #define nl "\n"
// #define nnl cout << "\n"
// int main(int argc, char const *argv[])
// {
// int t;
// cin >> t;
// while (t--)
// {
// int n;
// cin >> n;
// vector<int> ar(n);
// for (i... | ALGO | 0.998624 | 4.884949 |
38dfc00c-16e3-422f-abba-60ee77d980ac | jac0bwang/cpp | Effective-Cpp/Second_Edition/item35/example1.cpp | class Person {};
class Student : public Person {};
void dance(const Person& p); // anyone can dance
void study(const Student& s); // only students study
int main()
{
Person p; // p is a Person
Student s; // s is a Student
dance(p); ... | ALGO | 0.98338 | 4.250677 |
5e87dd14-68f6-49d2-89a5-c5b41ca15307 | raincross7/code-similarity | codes/train_code/problem063/problem063_166.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = (ll)1e9+7;
const double PI = 3.141592653589793238463;
const int MAXN = 1000005;
int n;
ll cnt[MAXN];
ll arr[MAXN];
ll vis[MAXN];
... | ALGO | 0.99969 | 4.102331 |
c68b6d80-c3f2-4789-b862-f7452ee2df70 | Sbugart/CEMCodes-365 | Easy/AtCoder-ABC386A/A-Full_House_02.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> card(4);
for(auto& c : card) cin >> c;
sort(card.begin(), card.end());
int quant1 = 0, aux1 = card[0], quant2 = 0, aux2 = card[3];
int flag = 0;
for(auto& c : card){
if(aux1 == c) quant1++;
else if(aux2 == c) ... | ALGO | 0.999987 | 3.868489 |
3bb9da07-1645-4cde-aae1-58b83b23401b | xuzhaocheng/PAT | src/1081.Rational Sum.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <math.h>
#include <stack>
#include "stdlib.h"
using namespace std;
/*
** 通分相加
** 注意点:求gcd的时候判断a,b是否为0,是否为正数。
** 输出的时候整数和小数部分的符号。
*/
long long gcd(long long a, long long b) {
if (a == 0 || b == 0) return 1;
... | ALGO | 0.999174 | 4.512993 |
1eabe231-00fb-4cb0-90e3-66dc4c030d66 | ishandutta2007/codeforces | dmitrygrigorev/normal/1270/D.cpp | #include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
int main(){
#ifdef LOCAL
//freopen("B_input.txt", "r", stdin);
//freopen("B_output.txt", "w", stdout);
#endif
ios_ba... | ALGO | 0.999849 | 3.199547 |
ea5e6e01-13ab-43f2-9afb-f1d702fd0cae | UM-ARM-Lab/Traversability-Based-Contact-Space-Planner | traversability_cpp_utility/src/ContactRegion.cpp | #include "Utilities.hpp"
bool ContactRegion::isInsideContactRegion(Translation3D point)
{
return euclideanDistance3D(position_, point) <= radius_;
}
bool ContactRegion::isInsideContactRegion(Translation2D point)
{
return euclideanDistance2D(projected_position_, point) <= radius_;
} | ALGO | 0.99128 | 5.181609 |
90f30e5d-fead-45f9-a330-d13baa8db1d1 | ivanradanov/rodinia | opencl/nn/utils.cpp | #include <stdio.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include "utils.h"
static bool usingImages = true;
//! A wrapper for malloc that checks the return value
void* alloc(size_t size) {
void* ptr = NULL;
ptr = malloc(size);
if(ptr == NULL) {
perror("malloc");
e... | TOOL | 0.959641 | 4.805696 |
a625dc20-5f79-47d3-a8f9-006b5494166c | KwanWaiPang/CMax-SLAM-comment | thirdparty/basalt-headers/thirdparty/eigen/bench/dense_solvers.cpp | #include <iostream>
#include "BenchTimer.h"
#include <Eigen/Dense>
#include <map>
#include <vector>
#include <string>
#include <sstream>
using namespace Eigen;
std::map<std::string,Array<float,1,8,DontAlign|RowMajor> > results;
std::vector<std::string> labels;
std::vector<Array2i> sizes;
template<typename Solver,type... | TOOL | 0.998654 | 6.328718 |
7d359085-76d8-4f32-94ce-6b7773a9e415 | a-ikoma/RAMPA_simulation | RAMPA_sim/ConsoleApplication1/DDCGraph.cpp | #include "DDCGraph.h"
using namespace std;
const long long INF = 1LL << 60;
DDCGraph::DDCGraph(std::string filename, double gensui, double initFeromon, int allocPolicy) {//コンストラクタ
allocatePolicy = allocPolicy;
file = filename;
string graphName = "";
initialFeromon = initFeromon;
decreaseRate = ge... | ALGO | 0.948049 | 3.134348 |
31ab7ec0-2c78-4226-8794-a3995ea907b9 | ReinSwanSD/Programming-in-C-plus-plus | Recursion/HWPrograms/forHW2/HW2P1_search/binsearch.cpp | using namespace std;
#include <iostream>
// CS311 YOSHII FALL21
// The Algorithm is in Notes-4A so copy and paste it here!!!!!
// On Empress, control-rightclick will bring up the paste option.
// NEVER delete my comments!!!
//--------------------------------------------
// CS311 HW2P1 Binary Search
// Name: Reinier Swa... | ALGO | 0.999755 | 5.835572 |
d91ac27f-11a3-41bc-9457-b1c50f969ab9 | taoonehacker/MayBeNotToday | E-Book/剑指Offer第二版/Source code/64_Accumulate/Accumulate.cpp | //==================================================================
// ָOfferԹپͱ⡷
// ߣκ
//==================================================================
// 641+2++n
// Ŀ1+2++nҪʹó˳forwhileifelseswitchcase
// ȹؼּж䣨A?B:C
#include <cstdio>
// ====================һ====================
class Temp
{
public:
Temp()... | ALGO | 0.999817 | 3.972125 |
6b5f0b7e-98ed-436d-a2bf-058228405d97 | ishandutta2007/codeforces | hyperbolic/normal/1556/B.cpp | #include <stdio.h>
#include <vector>
#define MAX (long long int)1e16
int x[100010];
std::vector<int> V1,V2;
int abs(int k)
{
return k>0?k:-k;
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
V1.clear();
V2.clear();
int a;
scanf("%d",&a);
for(int i=1;i<=a;i++) scanf("%d",&x[i]);
for(int i=1;i<=a;i++... | ALGO | 0.999809 | 3.687509 |
d4790333-b2e2-40bb-aa50-23db5b1d1b61 | lchakma201232/cp_codes | I_-_Coloring_a_Tree.cpp | #include <bits/stdc++.h>
#if 0
#define HOME
#endif
#ifndef ONLINE_JUDGE
#define dbgA2(A, n, m) {cout<<"-->"<<#A<<"=\n";for(int i = 0; i < n; i++){for(int j = 0; j < m; j++){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<"-->"<<#A<<"=(";for(int i = 0; i < n; i++)cout<<A[i]<<" ";cout<<")\n";... | ALGO | 0.999793 | 3.963355 |
2b87461d-b91c-4816-957c-f858e3a5012c | ishandutta2007/codeforces | theoneyouwant/normal/1118/F1.cpp | //By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;whi... | ALGO | 0.999005 | 4.154302 |
c3cf5499-b456-4187-b676-8f518302b9b5 | jenirfs/Algoritmos-1 | Funções/parametros1.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
void media(int x, int y, float &m)
{
m = sqrt(x*y);
}
int main()
{
int n1;
int n2;
float med; // media
cin >> n1 >> n2;
media(n1, n2, med);
cout << fixed << setprecision(2);
cout << "Media: " << med... | ALGO | 0.999607 | 4.273555 |
f309d7e6-1b7a-411b-9e0d-9d9b2cf0ff61 | ravynsoft/ravynos | contrib/llvm-project/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp | #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"... | TOOL | 0.957293 | 7.736413 |
7974d545-6699-4ed5-b7e5-c795ed868394 | mikepyne/Trilobytes | src/Effectors/EffectorFilterMouth.cpp | #include "EffectorFilterMouth.h"
#include "EntityContainerInterface.h"
#include "Swimmer.h"
#include <QPainter>
EffectorFilterMouth::EffectorFilterMouth(const std::shared_ptr<NeuralNetwork>& network, const std::shared_ptr<NeuralNetworkConnector>& inputConnections, Swimmer& owner)
: Effector(network, inputConnect... | TOOL | 0.898556 | 5.765759 |
2856efc8-546a-4d61-bbe6-b1375e86c748 | alexandraback/datacollection | solutions_6404600001200128_1/C++/Floz/Mushroom Monster.cpp | #include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int a[1010];
int main(){
int T;
freopen("1.in","r",stdin);
freopen("1.out","w",stdout);
scanf("%d",&T);
for (int _=1;_<=T;_++) {
printf("Case #%d: ",_);
int n;
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%d",a+... | ALGO | 0.999634 | 3.442745 |
8bdb8c6f-f787-4c58-8ce5-f50220c998bb | minhle27/AlgorithmPractice | Vault/Leetcode/875.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using iii = tuple<int, int, int>;
#define PB push_back
#define MP make_pair
#define LSOne(S) ((S) & -(S))
#define sz(x) int((x).size())
#define all(x) be... | ALGO | 0.999925 | 5.210559 |
6685a669-de5c-4485-b1a5-34abd30d1c4a | zhaolinger9902/leetcode-solutions | cpp/0617-merge-two-binary-trees.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.999985 | 6.120975 |
3bec5407-6d29-45b4-95bb-c3b112b9625a | erichung9060/Competitive_Programming_Template | Data Structure/DSU/dsu.cpp | struct DSU {
// vector<set<int>> elements;
vector<int> dsu, dsusz;
int group;
DSU(int n) {
// elements.resize(n+1);
dsu.resize(n + 1);
dsusz.resize(n + 1);
group = n;
for (int i = 1; i <= n; i++) {
dsu[i] = i;
dsusz[i] = 1;
// ... | ALGO | 0.998692 | 3.960885 |
2d5f1153-0a94-44f9-a85f-b018928d110d | Coach-Academy/Fall-1-2024 | Level 1/CPU - Regular - L1 - C107/Practice G1/Week 04/F.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n, k;
cin >> n >> k;
int a[n];
int b[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999986 | 3.261198 |
d05fde04-a432-4e57-b886-aca4cd777476 | guider/Snorlax | leetcode/linked-list/142-Linked-List-Cycle-II.cpp |
#include <map>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
/*
* 给定一个链表,判断其是否存在环节点,若存在,返回环节点,否则返回 NULL
*
x a y b... | ALGO | 0.99994 | 5.316206 |
d2d8582b-249e-4eec-928b-d23036f5fd1d | elizabeth-suehr/LIGGGHTS_CFDRC | lib/atc/Quadrature.cpp | #include "Quadrature.h"
#include <cmath>
#include "ATC_Error.h"
using namespace std;
namespace ATC {
Quadrature * Quadrature::myInstance_ = NULL;
// -----------------------------------------------------------------
// instance()
// -----------------------------------------------------------------
Quadrature * Quadr... | ALGO | 0.946795 | 4.91172 |
66270ed8-142e-4f79-b505-e989ccf1f829 | xodn0802/codetree-TILs | 240201/특정 규칙에 따른 숫자 출력/output-numbers-according-to-specific-rule.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int cnt = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < i; j++){
cout << " ";
}
for(int j = 0; j < n - i; j++){
cnt++;
cout << cnt << " ";
if(cnt >= 9){
... | ALGO | 0.999903 | 3.698458 |
f22d8f9f-c790-49f6-a22a-603ded31ac1a | plutoned1/steal-source | DiaGuard/Diamorphinepacker/Source/string.cpp | #include "../DiamorphineGuard.h"
INT RG_strcmp(LPCSTR p1, LPCSTR p2)
{
LPCSTR s1 = p1;
LPCSTR s2 = p2;
CHAR c1, c2;
do
{
c1 = *s1++;
c2 = *s2++;
if (c1 == '\0')
return c1 - c2;
} while (c1 == c2);
return c1 - c2;
}
LPSTR RG_strcat(LPSTR s1, LPCSTR s2)
{
LPSTR cp = s1;
while (*cp != '\0')
cp++;
wh... | TOOL | 0.876157 | 4.513341 |
8639c0f8-d77e-42ef-a439-3ba96ef58a1d | koniecsveta/zpro2018-19 | cv12 Ukazatele - priklady/cv12_u2_riesenie.cpp | /**
* C program to reverse an array using pointers
*/
#include <stdio.h>
#define MAX_SIZE 100
/* deklaracia funkcie */
void printArr(int *arr, int size);
int main()
{
int arr[MAX_SIZE];
int size;
int *left = arr; // Pointer na arr[0]
int *right;
// nacitanie velkosti pola
printf("Enter s... | ALGO | 0.99685 | 4.920828 |
8c9d3f70-a6fc-47d1-8296-1411c15d2d3e | DivOnYT/ExercicesCpp | Exercices/Exercice29.cpp | #include <iostream>
using namespace std;
template <typename T, size_t N>
void triInsertion(T (&tableau)[N]){
for (size_t i=0;i<N-1;i++) {
T elementCourant = tableau[i];
int j = i - 1;
while (j >= 0 and tableau[j]>elementCourant) {
tableau[j+1] = tableau[j];
j--;
... | ALGO | 0.999548 | 3.885129 |
a4041dd1-39fa-42dd-9203-b63590873698 | raincross7/code-similarity | codes/train_code/problem264/problem264_333.cpp | // Date: 2020-05-31
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout... | ALGO | 0.999959 | 3.575242 |
3ba877f5-380d-437f-b492-b8edd57a05dd | djr111/Robot_Explorer_of_unknown_space_with_LiDAR_ROS_and_TurtleBot3 | ros_autonomous_slam/src/functions.cpp | #include "functions.h"
// rdm class, for gentaring random flot numbers
rdm::rdm() {i=time(0);}
float rdm::randomize() { i=i+1; srand (i); return float(rand())/float(RAND_MAX);}
//Norm function
float Norm(std::vector<float> x1,std::vector<float> x2)
{
return pow( (pow((x2[0]-x1[0]),2)+pow((x2[1]-x1[1]),2)) ,0.5);
}... | ALGO | 0.99958 | 4.713412 |
8ff7f99f-3a46-475c-8753-d0ab3b0e92f5 | Jocelyn811/paper | 图形学/旋转作业/txx_3D/txx_3D/glm-0.9.8.4/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/ulp.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#include <ctime>
#include <cstdio>
#includ... | TEST | 0.971462 | 6.186262 |
5c13631e-56b8-40c3-b5dc-cdad08a83a2c | Deepanshu-Sharma-18/leethub | 0005-longest-palindromic-substring/0005-longest-palindromic-substring.cpp | class Solution {
public:
string longestPalindrome(string s) {
int start = 0, maxLen = 1;
for (int i = 0; i < s.size(); i++) {
// Odd length
int l = i, r = i;
while (l >= 0 && r < s.size() && s[l] == s[r]) {
if (r - l + 1 > maxLen) {
... | ALGO | 0.999969 | 6.405266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.