uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2f03ce59-b955-47e5-a7ed-ba723f4b62bb | ashishu8888/SDE-Journey---Leetcode | 0763-partition-labels/0763-partition-labels.cpp | class Solution {
public:
vector<int> partitionLabels(string s) {
int n = s.size();
vector<int> v;
map<char,int> m;
string a = "";
for(int i=0;i<s.size();i++)
{
m[s[i]] = i;
}
int x = 0;
int minP=-1,lp=0,l=0;
... | ALGO | 0.999843 | 6.187184 |
8560b636-e466-43bb-b752-631806a0deb2 | ishandutta2007/codeforces | ei133333/normal/1278/D.cpp | #include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10... | ALGO | 0.999997 | 4.496124 |
f7199baf-5cf3-411c-8808-34d12e563018 | hjiang13/LLMs-in-IR | POJ-104/34/1818.cpp | #include <iostream>
using namespace std;
int main(){
int i,j,n;
int sz[100];
cin >> "%d",&n);
for(i=0; i<100; i++){
sz[0]=n;
if(sz[i]==1){
break;
}
else if(sz[i]%2!=0){
sz[i+1]=sz[i]*3+1;
cout << "%d*3+1=%d\n",sz[i],sz[i+1]);
}
else if(sz[i]%2==0){
sz[i+1]=sz[i]/2;
cout << "%d/2=%d\n",sz[i],sz[i+1]);
}
}
cout << "End")... | ALGO | 0.999823 | 3.235169 |
ca12aa6c-0eb4-4e8d-a5d3-fd551d4e6db4 | educatedpolarbear/MyContest | 3/B.cpp | #include <bits/stdc++.h>
using namespace std;
long long C[1000001];
long long M = 1e9;
void Ready()
{
C[0] = 1;
for (int i = 1; i < 1000001; i++)
{
C[i] = i * C[i - 1];
while(C[i] % 10 == 0) C[i] /= 10;
C[i] %= M;
}
}
int main()
{
Ready();
int T;
cin >> T;
while(T--)
{
long long a;
cin >> a;
printf... | ALGO | 0.999334 | 4.645555 |
d71dfa82-3138-4324-b0ff-c911c2f7da76 | SuyKat/SPOJ | addrev.cpp | #include <iostream>
using namespace std;
int reverse(int x){
int res = 0;
while(x>0){
res = res*10 + x%10;
x = x/10;
}
return res;
}
int main(){
int n, m, times, z;
cin >> times;
while(times--){
cin >> n >> m;
... | ALGO | 0.999881 | 5.011652 |
35595a5d-c83d-4ef9-835a-244ab75f1b67 | 23f2002007/leetcode | solution/2500-2599/2560.House Robber IV/Solution.cpp | class Solution {
public:
int minCapability(vector<int>& nums, int k) {
auto f = [&](int x) {
int cnt = 0, j = -2;
for (int i = 0; i < nums.size(); ++i) {
if (nums[i] > x || i == j + 1) {
continue;
}
++cnt;
... | ALGO | 0.999985 | 5.859591 |
00043934-ee35-4e59-8e6b-e4feaccce797 | Chribela/Self_Driving_car | project_11_path_planning/src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_accessors.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf m(2,2);
// assign some values coefficient by coefficient
m(0,0) = 1.0; m(0,1) = 2.0;
m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0);
// print values to standard output
cout << m << endl << endl;
... | ALGO | 0.92466 | 3.536336 |
f6a43e7a-b09f-42aa-9d2a-8f7462803cbc | M-Awwab-Khan/Competitive-Programming | uva-bender.cpp | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vi vector<int>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define mii map<int, int>
#define si set<int>
#defi... | ALGO | 0.999886 | 3.835421 |
bc66c74e-1939-449d-98b2-5b4c397a7620 | Tianxin964/tx_cpp | HZOJ/OJ_381.cpp | /*************************************************************************
> File Name: OJ_381.cpp
> Author: tianxin
> Mail:
> Created Time: 2021年03月14日 星期日 21时56分56秒
************************************************************************/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue... | ALGO | 0.998281 | 3.679059 |
90833243-e2c6-42c8-8e20-d41d72ed9443 | stormbreaker07/CodingQuestions | problem set 5/hackerearth_june_circuit2.cpp | #include <bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{long long int n,k,x;
cin>>x;
for(int i=0;i<x;i++)
{cin>>n>>k;
if(n%(k+1)==0)
{cout<<"Dishant"<<endl;}
else
{cout<<"Arpa"<<endl;}
}
return 0;
}
| ALGO | 0.99956 | 3.54676 |
7c417634-5684-4611-955f-c29f36c55961 | Purilainen/realiaikagrafiikkaohjelmointi | realaikgrafHarj/realaikgrafHarj/Source.cpp | #include <vector>
#include <iostream>
#include <math.h>
template<class T> class vector_T
{
public:
vector_T(int n)
{
values.resize(n);
for (auto i : values)
{
i = 0.0;
}
initialSize = n;
}
vector_T(int n, T &v)
{
values.resize(n);
for (int i = 0; i < n; i++)
{
values[i] = v[i];
}
init... | ALGO | 0.996423 | 3.741213 |
11320d38-22a1-4339-9878-8f27bc99e80d | matthiascy/MoteurDeJeux | src/Engine/Thirdparty/bullet3/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp | #include "btConvexPlaneCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
#include "BulletC... | ALGO | 0.999323 | 7.499608 |
0b38df5e-8146-46ad-ae51-fae16dac54e4 | MOEA-LAB/Swarm-Control-Task-based-on-ZJU-Swarm-Formation | src/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/phase_oscillator_ensemble.cpp | #include <iostream>
#include <utility>
#include <boost/numeric/odeint.hpp>
#ifndef M_PI //not there on windows
#define M_PI 3.141592653589793 //...
#endif
#include <boost/random.hpp>
using namespace std;
using namespace boost::numeric::odeint;
//[ phase_oscillator_ensemble_system_function
typedef vector< double > ... | ALGO | 0.999655 | 6.161011 |
80283983-d3be-4ba3-8a89-2d7394040551 | nitinrathodsvnit/LeetCode | Diagonal Traversal of Binary Tree - GFG/diagonal-traversal-of-binary-tree.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999827 | 6.027075 |
bef3dc8f-5672-4118-929b-da0e763c4286 | withtahmid/cp | NSUPS/2023-04-07_[Individual]_Individual_1/P.cpp | /**
*
* Author: withtahmid
* Created: 2023-04-07 10:00:13
*
* */
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include <debug.h>
#else
#define debug(...)
#endif
#define endl '\n'
#define pb push_back
#define all(v) v.begin(),v.end()
#define sp(n) fixed << setprecision(n)
#define len(v) (i... | ALGO | 0.99959 | 4.910686 |
0a0e2268-7214-4ef4-afb8-6ff7fd5b3c82 | trantuananh-123/CTDL-GT | DSA04002.cpp | #include<iostream>
#include<sstream>
#include<cstring>
#include<algorithm>
#define m 1000000007
using namespace std;
long long exp(long long x, long long n){
if(n == 1) return x;
long long t = exp(x, n/2);
if(n % 2 == 0) return t % m * t % m;
return t % m * t % m * x % m;
}
int main(){
int t;
... | ALGO | 0.999649 | 4.328558 |
9e76874a-f004-40c7-b92e-9b36c4eb8f09 | Cyb3rGhoul/LeetCode | 3396-valid-word/valid-word.cpp | class Solution {
public:
bool isValid(string s) {
int n = s.length();
if(n<3) return false;
bool isVal1 = false;//digit
bool isVal4 = false; //alphabet
bool isVal2 = false; //vovwel;
bool isVal3 = false; //3 consonents
string vow = "aeiouAEIOU";
for(... | ALGO | 0.99933 | 5.818308 |
0c4a8cfe-9b5f-45d7-984f-98efab54cb6b | mk28r/Code- | Blocktower.cpp |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define nline "\n"
#define ff first
#define ss second
#define pb push_back
#define int long long
#define fl(i,k,n) ... | ALGO | 0.999838 | 4.450473 |
f478ce22-afe0-4222-a594-94fa3200191d | filip-strelec/Marlin-cr10-v2 | src/gcode/bedlevel/abl/G29.cpp | /**
* G29.cpp - Auto Bed Leveling
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_ABL_NOT_UBL
#include "../../gcode.h"
#include "../../../feature/bedlevel/bedlevel.h"
#include "../../../module/motion.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/probe.h"
#... | ALGO | 0.968996 | 7.746077 |
a614c459-4d94-45e9-a440-cfe350f88a68 | Slimshady913/advanced | eigen-3.4.0/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.99966 | 4.188929 |
ac919cfe-93a8-4b21-bcec-731a161f623c | jgomezselles/aoc_2020 | Day13/Part1/main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
std::pair<size_t, std::vector<size_t>> read_notes()
{
std::ifstream input("input.txt");
if (!input)
{
std::cerr << "Cannot open the input.txt" << std::endl;
return {};
}
std... | ALGO | 0.998017 | 5.549346 |
76222abf-34a1-4c6f-aeca-f2e67911ba87 | LostKnowledge33/practice | 프로그래머스/unrated/181187. 두 원 사이의 정수 쌍/두 원 사이의 정수 쌍.cpp | #include <string>
#include <vector>
#include <cmath>
using namespace std;
long long solution(int r1, int r2) {
long long answer = 0;
for (int i = 1; i < r2; ++i)
{
int out = 0, in = 0;
out = (int)floor(sqrt(pow(r2, 2) - pow(i, 2)));
if(i < r1)
in = (int)ceil... | ALGO | 0.999683 | 3.756647 |
514d9011-eff5-445d-919b-f0c2a497a547 | BerntMaier/C_dersleri | C dersi 2/Sayı Karşılaştıran/Sayı Karşılaştıran.cpp | #include <stdio.h>
#include <conio.h>
#include <locale.h>
//Trke karakter iin " #include <locale.h> " ktphanesi daha sonra da setlocale(LC_ALL,"Turkish"); yazlr.
int main(void) {
setlocale(LC_ALL,"German");
float a,b,c,d,enb;
printf("Bitte ergnzen Sie die Graden:\n");
printf("1.sayi= ");
scanf("%f",&a);
printf("2... | ALGO | 0.954784 | 3.145465 |
75358bb2-7089-434e-8214-11ed601ee589 | noobie7/CodeBank | Codeforces/Educational Upsolve grind (1400 - 1400)/J.cpp | /*
"An anomaly, I'm Muhammad Ali
Cause I know one day I'm gonna be the"
- Greatest, Eminem
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typ... | ALGO | 0.999871 | 4.210841 |
21d40d4c-92c0-47dc-9127-77c00ba6e3c5 | Iwaide/AtCoder | abc401/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { ... | ALGO | 0.996518 | 3.454836 |
ecc4cce7-681a-4d1c-918f-425e90c0754d | yashparmar15/Cpp-Codes | Sum_of_All_Odd_Length_Subarrays.cpp | /*Given an array of positive integers arr, calculate the sum of all possible odd-length subarrays.
A subarray is a contiguous subsequence of the array.
Return the sum of all odd-length subarrays of arr.
Example 1:
Input: arr = [1,4,2,5,3]
Output: 58
Explanation: The odd-length subarrays of arr and their sums are:
[... | ALGO | 0.999913 | 5.75772 |
a2b637a4-da57-4bd9-8a93-b3d2e5d63399 | sinian666/codes_102_3 | cpp_副本13/chapter_backtracking/preorder_traversal_iii_template.cpp | /**
* File: preorder_traversal_iii_template.cpp
* Created Time: 2023-04-16
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 判断当前状态是否为解 */
bool isSolution(vector<TreeNode *> &state) {
return !state.empty() && state.back()->val == 7;
}
/* 记录解 */
void recordSolution(vector<TreeNode *> &state, ve... | ALGO | 0.999962 | 5.798366 |
7835f72b-d61f-400b-bbf2-3fd1fbda16f5 | Z-Xiong/LightTrack-ncnn | include/vulkan/vk_layer_utils.cpp | #include "vk_layer_utils.h"
#include <string.h>
#include <string>
#include <vector>
#include "vulkan/vulkan.h"
#include "vk_layer_config.h"
static const uint8_t kUtF8OneByteCode = 0xC0;
static const uint8_t kUtF8OneByteMask = 0xE0;
static const uint8_t kUtF8TwoByteCode = 0xE0;
static const uint8_t kUtF8TwoByteMask =... | TOOL | 0.960474 | 6.741815 |
67e9319f-dbaf-4ed4-a3d2-05ec0a1ebf67 | jaredramey/Math_Knight | Math_Knight/Math_Knight/Mat4x4.cpp | #include "Math_Knight.h"
namespace MK
{
#pragma region Constructors
//Default constructor that inits a 4x4 Matrix with all values set to 0.
Mat4x4::Mat4x4()
{
entries.zeroZero = 0.0f;
entries.zeroOne = 0.0f;
entries.zeroTwo = 0.0f;
entries.zeroThree = 0.0f;
entries.oneZero = 0.0f;
entries.oneOne = 0.0f;... | ALGO | 0.96588 | 3.542836 |
90bd0e53-1d76-4f5c-b2f6-37d8b4acc8f9 | Mufassir-Chowdhury/Exercism | cpp/pangram/pangram.cpp | #include "pangram.h"
namespace pangram {
bool is_pangram(std::string const& sentence){
std::unordered_set<char> letters_in_sentence;
for(unsigned char letter: sentence)
letters_in_sentence.insert( tolower( letter ) );
std::string alphabet = "abcdefghijklmnopqrstuvwxyz";
for(auto letter: ... | ALGO | 0.892061 | 5.99228 |
4ef31bfc-4cdf-4eb5-97ab-e548611dd194 | Sifum/C-plus-plus-Learn | 第二十二章lambda表达式/一元谓词对应的lambda表达式.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <list>
using namespace std;
//c++11支持
int main()
{
vector<int> vecNums;
vecNums.push_back(25);
vecNums.push_back(101);
vecNums.push_back(2011);
vecNums.push_back(-50);
int iEvenNum = find_if(vecNums.cbegin(), vecNums.cend(), [](con... | ALGO | 0.989815 | 4.829271 |
a03e8dc3-46cd-4852-97df-159a9e821038 | ishandutta2007/codeforces | ecnerwala/normal/294/C.cpp | /*
LANG: C++
ID: he.andr1
PROG: C
*/
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<cstring>
#include<cassert>
#include<stack>
#include<list>
#include<cstdio>
#include<numeric>
#include<complex>
#include<string>
#include<map>
using namespace std;
#def... | ALGO | 0.999964 | 3.950114 |
ecf55871-5170-4cdf-a42d-e3e77dada5c7 | NkOffiCiAL07/Leetcode | 226-invert-binary-tree/226-invert-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999981 | 6.507576 |
2db87bf3-89e9-4949-b7ee-bd428fa07c45 | mathbioleiden/Tissue-Simulation-Toolkit | src/cellular_potts/cell.cpp | #include <fstream>
#include <list>
#include <stdio.h>
#include <vector>
#ifndef __APPLE__
#include <malloc.h>
#endif
#include "cell.hpp"
#include "dish.hpp"
#include "parameter.hpp"
#include "sticky.hpp"
#define HASHCOLNUM 255
extern Parameter par;
int **Cell::J = 0;
int Cell::amount = 0;
int Cell::capacity = 0;
int... | ALGO | 0.911408 | 3.599089 |
62a280c4-57e8-47c0-abe2-75935d32dd1c | ArpitSachan/Data-Structure-Questions | Sorting/Kth Smallest element.cpp | #include <iostream>
using namespace std;
#define loop(x, i, n) for(int x=i;x<n;x++)
int partition(int a[], int l, int h, int n){
int i=l-1;
int pivot=rand()%(h-l+1)+l;
swap(a[pivot], a[h]);
pivot=h;
loop(j, l, h){
if(a[j]<a[pivot])
{
i++;
swap(a[j], a... | ALGO | 0.999986 | 4.434304 |
31fbcca6-7f5f-4663-b8aa-c2cb3cdd055f | bakachanbaby/CODE_C- | Re-arrang Array 13.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t, n, m, a[1000001], b[1000001], c[1000001];
void nhap(){
cin>>n>>m;
for(ll i = 0; i < n; i++)
cin>>a[i];
for(ll i = 0; i < m; i++)
cin>>b[i];
}
void in(){
sort(a, a+n);
ll x = a[0]-1;
for(ll i = 0; i < m; i+... | ALGO | 0.999993 | 3.344711 |
55fa9b73-dad3-4794-82e9-cb88e4d65210 | kangqi-ni/sensor-fusion-for-localization-learning | assignments/07-filtering-basic/src/lidar_localization/src/models/kalman_filter/kalman_filter.cpp | #include "lidar_localization/models/kalman_filter/kalman_filter.hpp"
// SVD for observability analysis:
#include <string>
#include <vector>
#include <Eigen/SVD>
#include "lidar_localization/tools/CSVWriter.hpp"
#include "lidar_localization/global_defination/global_defination.h"
#include "glog/logging.h"
namespace... | ALGO | 0.952249 | 6.762307 |
82c71fc4-37ef-4152-80b8-0cf86986935a | ronaldtisa/xrigm-master | src/crypto/cn/CryptoNight_x86_vaes.cpp | #include "CryptoNight_x86_vaes.h"
#include "CryptoNight_monero.h"
#include "CryptoNight.h"
#ifdef __GNUC__
# include <x86intrin.h>
#if !defined(__clang__) && !defined(__ICC) && __GNUC__ < 10
static inline __m256i
__attribute__((__always_inline__))
_mm256_loadu2_m128i(const __m128i* const hiaddr, const __m128i* con... | ALGO | 0.989974 | 6.325495 |
dfea2588-a9ce-4a5f-9c52-8bec28c4a58f | nikida23/INJGraph | LW3/task21/lighting_technique.cpp |
#include <limits.h>
#include <string.h>
#include "lighting_technique.h"
#include "util.h"
static const char* pVS = " \n\
#version 330 \n\
... | TOOL | 0.962954 | 4.181634 |
4c38a573-80ef-43ed-a70d-c38dc3de2e5b | NucleaPeon/qt5-sle | qtwebkit/Source/ThirdParty/ANGLE/src/compiler/IntermTraverse.cpp | #include "compiler/intermediate.h"
//
// Traverse the intermediate representation tree, and
// call a node type specific function for each node.
// Done recursively through the member function Traverse().
// Node types can be skipped if their function to call is 0,
// but their subtree will still be traversed.
// Node... | TOOL | 0.964165 | 6.0574 |
b89c4b22-9af1-4913-981e-135250eed239 | Manhddm/GTVT | Nam1/Giai tich so/giaigandungtrongDSTT.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main
#define elif else if
#define fix_(x) setprecision(x)<<fixed
#define TIME (1.0*clock())/CLOCKS_PER_SEC
double a[100][100],b[100][100];
void out(double a[][100],int n){
for(int i=0;i<n;i++){
for (int j=0;j<=n;j++){
... | ALGO | 0.999954 | 3.467128 |
7f88e416-6c5c-4471-a347-9959c45003c1 | singh7priyanshu/love_babbar_450_solutions | others/leetcode/392. Is Subsequence.cpp | /*
392. Is Subsequence
Given two strings s and t, return true if s is a subsequence of t,
or false otherwise.
A subsequence of a string is a new string that is formed from the
original string by deleting some (can be none) of the characters
without disturbing the relative positions of the remaining characters.
(i... | ALGO | 0.999875 | 6.281224 |
db266414-c68b-471e-833f-cf6fccc805ad | Akshitguptaa/cp | cp/2075A.cpp | //// AKSHIT - template ////
#include <bits/stdc++.h>
// #include<chrono>
#include<unordered_set>
using namespace std;
typedef long long int int64;
typedef unsigned long long int uint64;
#define int long long
#define endl "\n"
#define INF LLONG_MAX
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#... | ALGO | 0.999806 | 4.491601 |
600d3459-a2a2-441e-b899-5a8f31cc7b0d | dhruvchauhan2405/Daily_Problems | Members/Dhruv Singh Chauhan/Completed Codes/392. Is Subsequence/sol.cpp | class Solution {
public:
bool isSubsequence(string s, string t) {
int index=0;
int last=t.length()-1;
int count =0;
while(index<=last){
char ch = s[count];
if(t[index]==ch){
count++;
}
index++;
... | ALGO | 0.999862 | 6.392915 |
0128a2ea-f9cf-4d41-b25d-731220a72a40 | ishandutta2007/codeforces | hitonanode/normal/1616/H.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#inclu... | ALGO | 0.99997 | 5.28686 |
13c43666-c41a-4362-a8ea-c95d37cbf4cd | siyuekoo/Cplusplus | productRandomLetter.cpp | #include<iostream>
#include<ctime>
#include<string>
using namespace std;
const int NUMBER_OF_LETTERS=26;
const int NUMBER_OF_RANDOM_LETTERS=100;
void createArray(char[]);
void displayArray(const char[]);
void countLetters(const char[],int[]);
void displayCounts(const int[]);
int main()
{
char chars[NUMBER_OF_RANDOM... | ALGO | 0.852334 | 3.905731 |
76f816e2-25c0-4d54-b9e5-578932495e3f | jakewoodard/Portfolio | School/CS102/mlab6.cpp | #include <iostream>
using namespace std;
int main () {
int YYYY1;
int DD1;
int MM1;
int YYYY2;
int DD2;
int MM2;
int YYYY;
int DD;
int MM;
int value1;
int value2;
int value;
cout << "Enter start date: ";
cin >> YYYY1 >> MM1 >> DD1;
cout << "Enter end date: ";
cin >> YYYY2 >> MM2 >> DD2;
cout << "Enter date: ";
cin >... | ALGO | 0.942632 | 3.495465 |
799d6f5b-2e03-49ea-adea-9f6d401bcd9f | penguin72487/programing | cf/R903/d.cpp | #include<bits/stdc++.h>
using namespace std;
// Function to perform prime factorization
map<int, int> primeFactorization(int n) {
map<int, int> factors;
for(int i = 2; i*i <= n; i++) {
while(n % i == 0) {
factors[i]++;
n /= i;
}
}
if(n > 1) {
factors[n]++... | ALGO | 0.999877 | 5.479266 |
907518cb-99ad-41a9-965d-dd23205fa755 | yijie21/Neural-Radiosity-Falcor | dependencies/tinyexr/deps/ZFP/examples/diffusion.cpp | // forward Euler finite difference solution to the heat equation on a 2D grid
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#ifdef WITHOUT_COMPRESSION
#include "array2d.h"
#else
#include "zfparray2.h"
using namespace zfp;
#endif
int main(int a... | ALGO | 0.99997 | 5.78712 |
c48101f6-d1a0-4129-96c5-b2b5486d4b10 | sabanzolj/Tehnike_programiranja2022 | T3/Z4/main.cpp | #include <cmath>
#include <deque>
#include <iostream>
std::deque<int> IzdvojiElemente(std::deque<int> Niz, bool Parnost) {
std::deque<int> Parni;
std::deque<int> Neparni;
for (int x : Niz) {
int broj = x;
int S = 0;
if (broj < 0) {
S += broj % 10;
broj = broj / 10;
broj = broj * ... | ALGO | 0.999488 | 5.07139 |
a1eb9027-682c-45e9-ae19-7911104aaf72 | Aryan030204/C | program_to_check_whether_a_number_can_be_expressed_as_sum_of_two_prime_numbers.cpp | #include <stdio.h>
int checkPrime(int n);
int main() {
int n, i, j = 0;
printf("Enter a positive integer: ");
scanf("%d", &n);
for (i = 2; i <= n / 2; ++i) {
// condition for i to be a prime number
if (checkPrime(i) == 1) {
// condition for n-i to be a prime number
if (checkPrime(n - i) == ... | ALGO | 0.999777 | 4.632387 |
80860071-f99f-4287-9f9e-b95dfaaeaf44 | ttamx/Competitive-Programming | codeforces/1799A.cpp | #include<bits/stdc++.h>
using namespace std;
void runcase(){
int n,m;
cin >> n >> m;
vector<int> ans(n+1,-1);
vector<bool> vis(m);
int l=n;
for(int i=1;i<=m;i++){
int p;
cin >> p;
p-=n;
if(!vis[p])if(l>0)ans[l--]=i;
vis[p]=true;
}
for(int i=1;i<=... | ALGO | 0.999953 | 4.266948 |
007d232c-ce73-4399-806e-5c332bc49821 | R-Escher/LeetCodeSolutions | 135-candy.cpp | // Difficulty: Hard
/*
There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.
You are giving candies to these children subjected to the following requirements:
Each child must have at least one candy.
Children with a higher rating get more candies tha... | ALGO | 1 | 7.081287 |
bf618d9e-6377-43e5-865d-cd4475bfa500 | CogViEN/DSA- | 9. Quy hoạch động/Bài 23. Xâu con đối xứng dài nhất/solve.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dp[1005][1005], ans = 0;
int main(){
string s; cin >> s;
int n = s.size();
s = " " + s;
//bai toan con co so
for(int i = 1; i <= n; i++){
dp[i][i] = 1;
}
for(int len = 2; len <= n; len++){
// duyet cac ... | ALGO | 0.999906 | 3.589598 |
df2c6c70-6234-4c45-9d25-78d8c6171405 | moinulshaon/Light-OJ | vol11/1104__completed/1104.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <iostream>
#include <queue>
using namespace std;
typedef long long LL;
#define PB push_back
#define FRO freopen("in.txt","r",stdin);
#define CLR(arr) memset( (arr),0... | ALGO | 0.999705 | 3.487154 |
f14118cf-33d8-4e76-99d2-a45f310b9120 | abhiXsliet/Solved-DSA-Problems | Leetcode Daily Challenge/026-August-2025/021-count-submatrices-with-all-ones.cpp | // https://leetcode.com/problems/count-submatrices-with-all-ones/
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
int getSubMatricesCnt1D(vector<int> &arr) {
int countSubMat = 0, consec = 0;
for (int &val : arr) {
if (!val) consec = 0;
else consec +=... | ALGO | 0.999989 | 6.7077 |
fa8fdb9f-6380-40a3-9197-7e1a27c8f99f | LukasBanana/LLGL | examples/Cpp/ExampleBase/FileUtils.cpp | #include "FileUtils.h"
#include <fstream>
#include <LLGL/Platform/Platform.h>
#include <LLGL/Log.h>
#include <LLGL/Utils/ForRange.h>
#include <algorithm>
#include <string.h>
#if defined LLGL_OS_IOS
# include "iOS/AppUtils.h"
#elif defined LLGL_OS_MACOS
# include "macOS/AppUtils.h"
#elif defined LLGL_OS_ANDROID
# ... | TOOL | 0.897207 | 7.052719 |
388a4db1-cb4d-4203-b83c-b592b0dc692e | Chetansbandurkar/DSA_PRACTICE | TREE/104. Maximum Depth of Binary Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99815 | 6.367003 |
cb63e3c1-44e0-4c71-9667-338427ee6837 | hashfx/DSA | algorithms/CPlusPlus/Searching/exponential-search.cpp | /*
Exponential search involves two steps, first to find the range within
which the element is found and searching inside that range using
binary search.
*/
#include <iostream>
#include <vector>
int binary_search(std::vector<int> arr, int item, int low, int high){
int mid;
while(low <= high){
mid = low + (high - l... | ALGO | 0.999987 | 5.886167 |
7471535e-e4d5-4524-975c-b43720e8ccf4 | Just-Andy404/SecondHM_8.05.2024 | ConsoleApplication2/ConsoleApplication2.cpp | /*
Создать абстрактный базовый класс с виртуальной
функцией - площадь. Создать производные классы: прямоугольник, круг, прямоугольный треугольник,
трапеция со своими функциями площади. Для проверки определить массив ссылок на абстрактный класс,
которым присваиваются адреса различных объектов.
*/
#include <iostream>
#i... | TOOL | 0.974212 | 4.259049 |
524bd27a-5e9e-49ce-8eef-e3337166aadf | ccutjiangxiong/MY-learningcode | nowcode/2025年夏第九届河北工业大学程序设计校赛/舍入.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define rem(i, a, b) for (int i = (a); i >= (b); i--)
#define ran(l, r) uniform_int_distribution<decltype(l)>(l, r)(rng)
#define ranf(l, r) uniform_real_distribution<decltype(l)>(l, r)(rng)
#define lbt(a) __builtin_ctz(a)
#define cnt1(a) __b... | ALGO | 0.999757 | 3.764507 |
5f8a4302-2713-4fe4-9ec1-e368c1e1efba | trinhminhtriet/leetcode | solutions/2000-2099/2070.most-beautiful-item-for-each-query/Solution.cpp | class Solution {
public:
vector<int> maximumBeauty(vector<vector<int>>& items, vector<int>& queries) {
sort(items.begin(), items.end());
int n = items.size();
int m = queries.size();
vector<int> idx(m);
iota(idx.begin(), idx.end(), 0);
sort(idx.begin(), idx.end(), [&]... | ALGO | 0.999974 | 5.98024 |
e95fb58f-86ce-4317-be56-0a3b604546f7 | ishandutta2007/codeforces | nfssdq/normal/268/A.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <locale>
#include <vector>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#in... | ALGO | 0.999573 | 3.241306 |
963b4aa2-20de-4bb1-b42e-92d2414b4e14 | kuno4n/TopCoder | src/604-div1-550/FoxConnection.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sy... | ALGO | 0.999433 | 4.508793 |
ec3d9408-b6ae-4187-9940-72bf71dbb4a3 | ishandutta2007/codeforces | monogon/normal/1485/E.cpp |
#include <bits/stdc++.h>
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
... | ALGO | 0.999725 | 3.889166 |
06dd46b4-35a3-4346-8b05-96df81f89e62 | sarvex/leetcode-wren | solution/2300-2399/2379.Minimum Recolors to Get K Consecutive Black Blocks/Solution.cpp | class Solution {
public:
int minimumRecolors(string blocks, int k) {
int cnt = count(blocks.begin(), blocks.begin() + k, 'W');
int ans = cnt;
for (int i = k; i < blocks.size(); ++i) {
cnt += blocks[i] == 'W';
cnt -= blocks[i - k] == 'W';
ans = min(ans, cnt... | ALGO | 0.999896 | 5.575593 |
c400b0e4-1389-4b90-be36-82da44f09d12 | JThanat/Algorithm | cable.cpp | #include<stdio.h>
#include<queue>
#include<vector>
using namespace std;
typedef pair<int,int> pairInt;
int cost[1005][1005];
int mst[1005];
int d[1005];
int p[1005];
bool lessThan(int a , int b) {
if(a < 0) return false;
else if(b < 0) return true;
return a < b ? true : false;
}
int main() {
int n;
... | ALGO | 0.999949 | 3.415167 |
f1abeea5-eb73-4add-b8ce-487e54ff8687 | lammps/lammps | src/KOKKOS/pair_coul_dsf_kokkos.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Stan Moore (SNL)
------------------------------------------------------------------------- */
#include "pair_coul_dsf_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "ewald_const.... | ALGO | 0.996142 | 6.597016 |
b2cd6799-2347-41b7-9be6-e0ad4d01e355 | D1abol1cal/firebasefluttercodelab | 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.9988 | 6.76073 |
12759798-47ae-4297-8f12-464c8c0f62f4 | gamekit-developers/gamekit | Dependencies/Source/Detour/Source/DetourNode.cpp | #include "DetourNode.h"
#include <string.h>
static const unsigned short DT_NULL_IDX = 0xffff;
//////////////////////////////////////////////////////////////////////////////////////////
dtNodePool::dtNodePool(int maxNodes, int hashSize) :
m_nodes(0),
m_first(0),
m_next(0),
m_maxNodes(maxNodes),
m_hashSize(hashSi... | ALGO | 0.941734 | 5.331523 |
874a9e56-5cf2-4ca5-93ec-663491c5172e | harxh11/DSA-cpp | DSA/8. Graphs/Topo Sort/Course Schedule.cpp | class Solution {
public:
vector<int> findOrder(int n, vector<vector<int>>& prerequisites) {
vector<int> adj[n];
for(int i=0;i<prerequisites.size();i++){
int u = prerequisites[i][0];
int v = prerequisites[i][1];
adj[u].push_back(v);
}
vector<int> ... | ALGO | 0.999998 | 6.440223 |
b2f4fa32-f783-4f46-bc1d-00723cfdbd35 | prakharkhare999/LeetCode | 1814. Count Nice Pairs in an Array.cpp | class Solution {
public:
int M = 1e9+7;
int reverse(int num) {
int rev = 0;
while(num > 0) {
int rem = num%10;
rev = rev*10 + rem;
num /= 10;
}
return rev;
}
int countNicePairs(vector<int>& nums) {
int n =... | ALGO | 0.999971 | 6.22611 |
c98c2777-153a-40d8-97ef-9c0ca98ec485 | DimitarSht/Informatics_10A_2024_2025 | Grade_09/Term_01/Седмица_17_2D_масиви_упр2_15_01_2024/task02_previousFile.cpp | #include<iostream>
using namespace std;
/*
2. Даден е масив с размери M x N и
цялото число K (1 < K < N).
Да се изведат елементите от K-я
стълб на дадената матрица и тяхната сума.
*/
int main()
{
int M,N,K;
int sum=0;
cin>>M>>N>>K;
int masiv[M][N];
for (int i=0;i<M;i++)
{
for (int k=0;... | ALGO | 0.999723 | 3.078856 |
986d3c3f-ffb4-4f83-bdf3-de908038d6fa | llenroc/CP | DS/cpp/trie/trie.cpp | #include<bits/stdc++.h>
using namespace std;
class TrieNode {
public:
bool leaf;
int ref;
unordered_map<char, TrieNode*> keys;
TrieNode(): ref(0), leaf(false), keys({}){}
};
class Trie {
private:
TrieNode* root;
bool deleteRecursively(string &s, int idx, TrieNode* parent) {
if(idx == s... | ALGO | 0.999478 | 5.365302 |
77e4b2d5-d8df-4323-ba6a-d0c59aed8211 | 2008Terry/RCJ | ESPmove/lstmSonar.cpp | #include "lstmSonar.h"
// 加载权重
const double* weights[] = {
weight_0_sonar, // 输入权重
weight_1_sonar, // 隐藏权重
weight_2_sonar, // 偏置
weight_3_sonar, // 输出权重
weight_4_sonar // 输出偏置
};
// 初始化隐藏状态和细胞状态
double hidden_state[hidden_size] = {0.0f};
double cell_state[hidden_size] = {0.0f};
double output... | ALGO | 0.999 | 5.014709 |
767191c9-8600-4b67-ae22-d9cd8630564c | murad034/All-Code-Semister | HACKEREARTH/Algorithm/Finding Pairs.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int k=1;k<=t;k++)
{
int arr[10000];
int n;
cin>>n;
for(int i=1;i<=n;i++)
cin>>arr[i];
int sum=0;
for(int i=1;i<=n;i++)
{
for(int j=i;j<=n;j++)
... | ALGO | 0.999845 | 3.631905 |
315c9a38-fdfa-4dbf-abef-c7cd3a7ee6e7 | Vishal45718/RiscV_assembler | Rconvert.cpp | #include<iostream>
#include<string>
#include"commalgo.hh"
std::string Rconvert(std::string s,int line_counter)
{
//std::cout<<s<<std::endl;
std::string hex;
std::string temp,inst,rs2 = " ",rs1 = " ",rd = " ";
std::string binary,opcode,funct3,funct7;
unsigned int i = 0,k = 0;
while (i <= ... | ALGO | 0.967429 | 3.417538 |
ba62b060-227e-4d96-8ff2-5c1cf6e15f35 | layman89gsu/Codeforces_Problems | abcequalN.cpp | /********Start of Template*******/
/***In The Name Of God***/
/****Better three hours too soon than a minute too late.****/
#define ONLINE_JUDGE
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define db(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<... | ALGO | 0.999943 | 4.167642 |
859b776e-8126-4d8d-a573-655fe0040dc9 | Pudv95/My_Space | Competitive Programming/Starter97/Caesar_Cipher.cpp | /*
*_* Solution By Paras *_*
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define umi unordered_map<int, int>
const ll MOD = 1e9 + 7;
/*
FUNCTIONS
*/
// nCr
int NCR[1000][1000];
int nCr(int n, int r)
{
if (n == r)
return NCR[n][r] = 1;
if (r == 0)... | ALGO | 0.999941 | 5.771642 |
caa9d344-8b03-478a-8d91-150af30b3cd3 | EmergentOrder/clmagma | testing/testing_zgetrf.cpp | /*
-- clMAGMA (version 1.1.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date January 2014
@precisions normal z -> c d s
@author Mark Gates
*/
// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#inc... | ALGO | 0.994603 | 6.327159 |
0d6b31ba-a965-49b5-9056-869c1413ab38 | Jomias/ATBMTT | Cpp/MODULO/PrimitiveRoot.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int power(int a, int m, int n) {
int b = 1;
a %= n;
while (m > 0) {
if (m & 1) {
b = (b * a) % n;
}
m >>= 1;
a = (a * a) % n;
}
return b;
}
int phi(int n) {
int res = n;
for (int... | ALGO | 0.999675 | 4.661631 |
f0e34035-033d-4878-8d05-9a6954e1892e | ishandutta2007/codeforces | gmusya/normal/1307/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
const ll MOD = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, m;
cin >> n >> m;
vector <ll> s(n + 1);
for (ll i = 1; i <= n; i++)
cin >> s[i];
vector <vector <ll>> cows(n + 1);
for (l... | ALGO | 0.999988 | 3.734637 |
f6fbf887-29e1-42d6-8b63-d7c1ea161922 | SiddheshKukade/leetcode-solutions | Heap Sort - GFG/heap-sort.cpp | //{ Driver Code Starts
// C++ program for implementation of Heap Sort
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// The functions should be written in a way that array become sorted
// in increasing order when heapSort() is called.
class Solution
{
public:
//Heapify function to mainta... | ALGO | 0.999959 | 6.057347 |
1c47fdcc-3d78-4b64-9db9-0abba1511954 | merlin86/TeamPlanets | bots/dual_team/main.cpp | #include <cstdlib>
#include <algorithm>
#include "map.hpp"
using namespace std;
using namespace team_planets;
bool is_owned_by_a_team(const vector<player_id>& team, const Planet& planet) {
auto it = find(team.begin(), team.end(), planet.current_owner());
return it != end(team);
}
int main(int argc, char* argv[])... | ALGO | 0.9952 | 4.460733 |
b837a904-19ff-4ba1-948c-047bf5d71ad5 | HansOersted/Autonomous_PID_controller | control/mpc_lateral_controller/src/vehicle_model/vehicle_model_bicycle_kinematics.cpp | #include "mpc_lateral_controller/vehicle_model/vehicle_model_bicycle_kinematics.hpp"
#include <cmath>
namespace autoware::motion::control::mpc_lateral_controller
{
KinematicsBicycleModel::KinematicsBicycleModel(
const double wheelbase, const double steer_lim, const double steer_tau)
: VehicleModelInterface(/* dim_x... | ALGO | 0.994665 | 6.887865 |
f4cf78d7-593e-4098-94a7-b1fd3e01f50c | ThePunisher569/fake_data_generator | 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.9988 | 6.76073 |
c7c705bc-c2d1-4b2f-9fda-040df7195b18 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/cmap/divide_conquer/test/4d7d0fa4-1c80-4e21-9651-2e922b46ec00.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;
struct punct
{
punct(int x = 0, int y = 0)
{
this->x = x;
this->y = y;
}
int x, y;
};
bool cmp_x(const punct &a, const punct &b)
{
if(... | ALGO | 0.999511 | 4.489974 |
2e1c122c-ca1f-45fb-8093-e5db13abdfb0 | atiabjobayer/Codes | OJ/URI/uri_1071.cpp | // Unsolved
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int x,y,sum=0;
cin >> x >> y;
int a = min(x,y);
int b = max(a,b);
if(a%2==0)
a++;
for(int i=a;i<=b;i= i+2){
cout << i << endl;
sum = sum + i;
}
cout << "-----... | ALGO | 0.999893 | 3.822712 |
d078920a-5c32-4bfd-ac6c-26c41c7a6508 | HumanHyeon/Algorithm_Book | archive/SeHyeon/20.06.15 matter.cpp | //This problem is good at STACK
#include <iostream>
#define UNDO "../"
#define CUR "./"
using namespace std;
string pwd(string input) {
string output, tmp = "", beforeSave = "";
output = '/';
bool calc = false;
for (int i = 1; input[i] != NULL; i++) {
tmp += input[i];
if (input[i] == '/') calc = true;
... | ALGO | 0.978939 | 4.133984 |
0c490a0c-6eee-46ff-888c-2323c7913aa8 | Marion-Anyango/binary-tree- | binary tree node pre order transversal.cpp | #include <iostream>
#include <vector>
using namespace std;
// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} // Constructor
};
class Solution {
public:
// Function to perform preorder traver... | ALGO | 0.999995 | 7.067224 |
ccde2510-589c-4024-837b-6f46f2053ba2 | cyruscyliu/videzzo-llvm-project | clang/lib/Format/UsingDeclarationsSorter.cpp | #include "UsingDeclarationsSorter.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Regex.h"
#include <algorithm>
#define DEBUG_TYPE "using-declarations-sorter"
namespace clang {
namespace format {
namespace {
// The order of using declaration is defined as follows:
// Split the strings by "::" and discard... | TOOL | 0.983773 | 5.855832 |
46b73c95-20f7-4ec0-afad-1cd523435dc0 | mononokehime14/Leetcode | c++/array/rotate/rotateImage.cpp | #include <vector>
using namespace std;
/**
* 48. Rotate Image
* 通常来说我碰到旋转的题目是选水平再对角线, 走两次这种操作, 这样写起来是方便一点
* 但是1 pass的方法就是四个点互换. n = 4, [0][1] - > [1][3], [1][3] -> [3][2]...这样转
* 这个loop不是很好写, ij是头一个点的坐标, 比如上个例子就是01, 这里ij最好用offset来理解
* 我们可以发现随着我们向右向下推进, 有一些点是已经换完了的, 实际上这是一种罗圈向内的循环方式
* i实际上代表着对角线上的一个点, 从ii开始, 到n-i... | ALGO | 0.999959 | 6.086947 |
b752a1ee-22ef-44bc-ade0-12a7d2dd8db3 | gaoneto/maratona | Codechef/retpo.cpp | #include <bits/stdc++.h>
using namespace std;
int solve(int x, int y) {
if(!y) return (x&1) ? 2*x+1 : 2*x;
return (y&1) ? 2*y-1 : 2*y;
}
int main() {
int t, x, y;
scanf("%d", &t);
while(t--) {
scanf("%d %d", &x, &y);
if(x<0) x=-x;
if(y<0) y=-y;
printf("%d\n", 2*min(x, y)+solve(x-min(x, y),... | ALGO | 0.999983 | 4.405999 |
5f297115-1ba8-4c38-8195-60d523270b6d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_136_19.cpp | #include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int N = 1000005;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int t, i, j, k;
t = 1;
while (t--) {
long long int a, b, c;
cin >> a >> b >> c;
long long int lo ... | ALGO | 0.999917 | 3.923343 |
68b9b796-92da-44f4-8c96-2605cadb8937 | prachibarnwal/cpp_codes | 60.) stone paper scissors.cpp | //stone paper scissors;
#include<iostream>
#include<string.h>
#include <cstdlib>
using namespace std;
int main()
{
char name[50],ch[10];
int round,pscore = 0,cscore=0,n,i;
char arr[3][10] = {"stone","paper","scissor"};
cout<<"Enter Player's Name : ";
cin>>name;
cout<<"Rules for the Game : "<<endl;
cout<<"-----... | ALGO | 0.998726 | 3.181156 |
39348c3f-a780-4795-bf0d-245ab3e9c5ed | mnishiguchi/cpp_notebook | cs1/chap2_programming_exercises/_19_change_in_pennies/_19_change_in_pennies/main.cpp | /* === ANALYSIS ===
// constants
const int QUARTER_IN_PENNIES = 25;
const int DIME_IN_PENNIES = 10;
const int NICKEL_IN_PENNIES = 5 ;
// variables
int numQuarters, numDimes, numNickels, numPennies, totalValueInPennies;
// assignment statement
cin >> numQuarters;
cin >> numDimes;
cin >> numNickels;
... | ALGO | 0.997589 | 5.65433 |
ead8ecbd-b3dd-4dfc-9479-bb9e724b2877 | 00chestnut/C-- | Preprocessing/macroFunctions.cpp | #include <iostream>
#define PI 3.14159 // Define a constant
#define SQUARE(x) ((x) * (x)) // Define a macro function
int main() {
std::cout << "PI: " << PI << std::endl;
std::cout << "Square of 5: " << SQUARE(5) << std::endl; // Expands to (5 * 5)
return 0;
}
| TOOL | 0.887016 | 4.892904 |
f63d7510-1ae1-4b52-9fa1-c8ba854c7788 | joshualass/CP | Solutions/Default/consecutivesumriddle.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t; cin >> t;
while(t-->0) {
ll n; cin >> n;
if(n < 0) {
cout << n << " " << (n * -1) - 1 << '\n';
} else if(n == 0) {
co... | ALGO | 0.999758 | 4.259415 |
428b1b73-c121-4555-b69b-ac60b7a11ad0 | DeshAcharjee/Competitive-Programming | IOI/IOI2009_Raisins.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX = 51;
int dp[MX][MX][MX][MX];
int p[MX][MX];
int calc_dp(int l1, int r1, int l2, int r2) {
if (l1 == r1 && l2 == r2) return 0;
if (dp[l1][r1][l2][r2]) return dp[l1][r1][l2][r2];
int mn = 1e9;
for (int i = l1; i < r1; i++) {
mn = min(m... | ALGO | 0.999941 | 3.406269 |
6fa92552-5f7f-4ca7-8fd2-ae9f5689327d | fabbrito/AdventOfCode | AOC_2023/src/D18_Lavaduct_Lagoon/Solution18.cpp | #include "pch.h"
#include "Solution18.h"
namespace AoC2023_D18 {
using namespace std;
// --------------------------- Types ----------------------------------
// (x,y) coordinates -> x = row, y = col
typedef struct pos_t {
long long x = 0, y = 0;
bool operator==(const pos_t& rhs) const { return x == rhs.x &&... | ALGO | 0.993541 | 5.995302 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.