uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
22c8ae08-1419-4056-8827-5456b6af3b22 | Guru-180188/C_P_P_Programms | day2_4.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
cout<<n<<endl;
if(n>0){
cout<<"it's a positive value"<<endl;
}
else{
if(n<0){
cout<<"negative value"<<endl;
}
else{
cout<<"n is zero"<<endl;
}
}
}
| ALGO | 0.999502 | 3.780965 |
9656cffe-399d-467e-8ecf-952d9e331c18 | triccsr/KeyKG | src/double.cpp | #include "def.hpp"
#include <cmath>
bool double_le(double a,double b){
return a+eps<b;
}
bool double_ge(double a,double b){
return b+eps<a;
}
bool double_eq(double a,double b){
return fabs(a-b)<eps;
} | TOOL | 0.875017 | 3.209633 |
1e8235b1-6bda-488a-9ba4-c5a6af49952e | yzzupgo/MFTCG | Data/abc170_b/aditya2000/wa/14307989.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x, y; cin>>x>>y;
int b = (y-2*x)/2;
int a = (y-4*b)/2;
int c = (y-2*x)/2;
if(a+b==x && a==c )cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
| ALGO | 0.999926 | 3.073297 |
b8026cc6-17fb-4486-8011-b5a1cd772550 | vietan32/Algorithms | divide-and-conquer/uva_10567_helping_Fill_Bates.cpp | /* Uva 10567 - Password. [https://onlinejudge.org/external/105/10567.pdf]
* Key: binary search (use STL lower_bound(), upper_bound())
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MAX 130
using namespace std;
int main() {
string s, q;
vector<int> v[MAX];
int t;
... | ALGO | 0.999836 | 4.406123 |
d0405e48-b6e8-451d-9a02-e731f44d4a22 | ishandutta2007/codeforces | ohweonfire/normal/338/C.cpp | // This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using ... | ALGO | 0.999984 | 3.193631 |
85df141e-38ff-45da-9bd0-3da18a00948d | ishandutta2007/codeforces | tob123/normal/1081/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef tuple<int,int,int> ti;
const int n = 1e5+10;
int N, M, K, res;
int X[n];
vector<ti> E;
int D[n];
int sz[n], cmp[n];
int find(int x){
if(cmp[x] != x)
cmp[x] = find(cmp[x]);
return cmp[x];
}
void merge(int a, int b){
sz[find(b)] += sz[find(a)];
cmp[fi... | ALGO | 0.999986 | 4.316391 |
1a32f156-abbc-4185-a1d9-6f7974bd1588 | TatoNaranjo/Codeforces-Solutions | Codeforces Round 881 (Div. 3)/B. Long Long.cpp | #include <bits/stdc++.h>
#define f(i,a,b) for(int i = a; i<b; i++)
#define ll long long
#define v(a,b) vector<a> b
using namespace std;
int main(){
int t = 0; cin>>t;
while(t--){
int l; cin>>l;
v(int,vec);
f(i,0,l){
int x; cin>>x;
vec.push_back(x);
}
int a = 0;
int b = 0;
int count... | ALGO | 0.999936 | 3.749167 |
7b4698d1-1625-4e25-ab37-beb20e7796bf | CodesbyUnnati/Solutions | Programs/Rotate_array_K_times.cpp | #include <bits/stdc++.h>
using namespace std;
void leftRotateOneTime(int arr[], int n)
{
int temp=arr[0];
for(int i=0;i<n;i++)
{
arr[i]=arr[i+1];
}
arr[n-1]=temp;
}
void LeftRotateRecursion(int arr[], int k, int n)
{
for (int i = 0; i < k; i++)
{
leftRotateOneTime(arr, n... | ALGO | 0.999835 | 5.060825 |
48583aa0-a364-4f77-b206-e0f6ee213e0e | LroseC/OI | AtCoder/Regular_134/A/main.cpp | #include <cctype>
#include <cstdio>
#include <algorithm>
using namespace std;
using LL = long long;
const char endl = '\n';
struct FastStreamInputOutput
{
using FSIO = FastStreamInputOutput;
template<typename T>
FSIO& operator>>(T &res)
{
res = 0; T f = 1; char ch = getchar();
while (!isdigit(ch)) { if (ch ==... | ALGO | 0.999874 | 3.199933 |
28d0e530-36d8-4858-82d2-237d0ce74175 | Lee-sehyun/C--Diet | baekjoon/2240/자두나무.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
//입력
int T, W, k;
cin >> T >> W;
// 시작해보자!
vector<vector<int>> plum(T+1, vector<int>(W+1));
for(int i = 1 ; i <= T ; i++){
cin >> k;
for(int j = 0 ; j <= W ; j++){
if(k == 1){
if(j == 0) pl... | ALGO | 0.999919 | 4.123331 |
9a992fdd-972b-48f2-90b5-e14818a887cf | itisameerkhan/Leetcode | 0263. Ugly Number/solution1.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isUgly(int n) {
if(n==1)
return true;
else if(n==0)
return false;
while(n!=1)
{
if(n%2==0)
n/=2;
else if(n%3==0)
n/=3;
... | ALGO | 0.99993 | 5.052269 |
311c05b4-6b9c-4cae-ade4-16c5bcf991fc | mihan-323/x-ray-t6638-dwm | xray/t6638/xrGame/dbg_draw_frustum.cpp | #include "stdafx.h"
#include "level.h"
#include "../xrCDB/frustum.h"
#ifdef DEBUG
# include "debug_renderer.h"
#endif
#ifdef DEBUG
void MK_Frustum(CFrustum& F, float FOV, float _FAR, float A, Fvector &P, Fvector &D, Fvector &U)
{
float YFov = deg2rad(FOV);
float XFov = deg2rad(FOV/A);
// calc window extents in ca... | ALGO | 0.91111 | 4.932069 |
e6e24282-ffbd-4564-83ab-ad1139944ed2 | fallow24/librealsense-2.50-patched | src/proc/decimation-filter.cpp | #include "../include/librealsense2/hpp/rs_sensor.hpp"
#include "../include/librealsense2/hpp/rs_processing.hpp"
#include <numeric>
#include <cmath>
#include "environment.h"
#include "option.h"
#include "context.h"
#include "core/video.h"
#include "proc/synthetic-stream.h"
#include "proc/decimation-filter.h"
#define P... | ALGO | 0.99936 | 4.111313 |
faa33bd5-ec72-4470-a403-630c8d278afc | codewithnick/dsaandcp | codeforces/contest div 3/thermostat.cpp |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
while(t--){
int l,r,x,a,b,change,c=0;
cin>>l>>r>>x;
cin>>a>>b;
change=abs(b-a);
if(a<b)
a+=change;
else
a-=change;
while(l<=a && a<=r){
... | ALGO | 0.999726 | 3.685424 |
a874dd6f-55de-4c53-98bf-e82499a4e3f6 | FranRuiz98/Practicas_ED_UGR | P5-Arboles/avl/AVL-versionfinal/usoAVL.cpp | #include <iostream>
#include "AVL.hpp"
using namespace std;
void intersecta(AVL<int> &a, AVL<int> &b, AVL<int> &ret)
{
AVL<int>::iterator it;
// Solo hay que añadir aquellos elementos comunes a los dos
for (it = b.begin(); it != b.end(); ++it)
{
if (a.existe(*it))
ret.insertar(*it);
}
}
int main(... | ALGO | 0.997765 | 4.127752 |
7eb3bae9-02f5-46a8-bb68-b8bda29bea2e | KingBael09/LeetCode | cpp/0027.cpp | // ? 27. Remove Element
// ? https://leetcode.com/problems/remove-element/description/
#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
int removeElement(vector<int> &nums, int val)
{
int pos = 0;
for (int i = 0; i < nums.size(); i++)
{
if (nums[i] != val)
... | ALGO | 0.999418 | 6.097426 |
a77830a7-17cc-4d25-97a5-2e4c9ca49397 | adelacvg/luogu | 数据结构1-2 二叉树/P1030.cpp | #include<bits/stdc++.h>
using namespace std;
void pre(string in,string post)
{
if(post.empty())
return;
auto root=post[post.size()-1];
cout<<root;
auto p=in.find(root);
string lin=in.substr(0,p);
string rin=in.substr(p+1);
string lpost=post.substr(0,p);
string rpost=post.substr(p... | ALGO | 0.999977 | 4.053349 |
3f4ea476-94c6-4e90-b0fe-40d00bff9039 | hfkfo/CSES_Solution | Sorting_and_Searching/Array_Division.cpp | #include<bits/stdc++.h>
using namespace std;
vector<long long int> p;
long long int cost(long long int n,long long int max)
{
long long int k = 1 , sum = 0;
for(long long int i = 0 ; i < n ; i++)
{
if(p[i] > max)
{
return 1000000000;
}
if(sum + p[i] > max)
... | ALGO | 0.999977 | 4.171978 |
994c1a26-9971-44a2-bc86-8734175bc674 | kyohei8937/ProgramingContest | 過去問精選100問/03_深さ優先探索/JOI2009予選4_薄氷渡り.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1LL << 60;
// 便利関数
// ...繰り返し
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a;i<b;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
// ...比較入れ替え
template<clas... | ALGO | 0.999191 | 5.213313 |
7682bd2b-e2e2-4bc5-b95c-d578ad43db9e | sirasgaming/C- | chuong 2/Programming Challenges/Program challeges 2-7.cpp | #include <iostream>
using namespace std;
int main() {
double oceanRiseRate = 1.5; // millimeters per year
double riseIn5Years = oceanRiseRate * 5;
double riseIn7Years = oceanRiseRate * 7;
double riseIn10Years = oceanRiseRate * 10;
cout << "In 5 years, the ocean's level will be " << riseIn5Years ... | ALGO | 0.988787 | 4.581914 |
d4726910-acc2-42e5-8bd6-819da8b880e2 | SquallATF/virtualbox | src/VBox/Runtime/common/math/lround.cpp | /* $Id$ */
/** @file
* IPRT - No-CRT - lround().
*/
/*********************************************************************************************************************************
* Header Files *
***... | ALGO | 0.991424 | 5.362738 |
3e778ad9-bb28-4216-95b1-dd316226c233 | Johniel/contests | atcoder/abc053/B/main.cpp | #include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "... | ALGO | 0.994596 | 3.659579 |
443eeac5-c167-442b-ad3d-5c53b56ff96d | raincross7/code-similarity | codes/train_code/problem065/problem065_374.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
vector<string> a;
bool cmp(string s, str... | ALGO | 0.999774 | 4.584545 |
07c242cf-8f14-4d01-9b23-4ecf3cda3ec4 | Thugday/BOJ | 10992.cpp | #include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
for( int j = 1; j <= n - i; j++) {
cout << " ";
}
if (i == 1 || i == n) {
for (int k = 1; k <= (i - 1) * 2 + 1; k++) {
cout << "*";
}
}
... | ALGO | 0.999917 | 3.736444 |
460284da-2d30-4e4e-b106-cdd4e37f8d9f | fyrsta7/LLM_on_ASAC | result_api_backup/en_without_annotation_mzn/deepseek-coder_loop10/Taotao_Picking_Apple-8.cpp | #include <iostream>
#include <vector>
int main() {
std::vector<int> apple = { /* initialize with 10 integers */ };
int h;
std::cin >> h;
int num = 0;
for (int i = 0; i < 10; ++i) {
if (apple[i] <= h + 30) {
++num;
}
}
std::cout << num << std::endl;
return 0... | ALGO | 0.997149 | 3.762032 |
50e60d80-3621-4580-b499-40f0991f8a31 | ishandutta2007/codeforces | jovanb/normal/1240/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int x, a, y, b;
ll k;
int niz[200005];
bool check(int n){
priority_queue <ll> q1;
priority_queue <ll> q2;
for(int i=1; i<=n; i++){
if(i%a == 0 && i%b == 0){
q2.push(x+y);
}
el... | ALGO | 0.999897 | 3.397839 |
242aa497-d41b-4c00-a1a5-9801b2e25e5c | neal2018/oj_env | codeforces/776/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// https://space.bilibili.com/672328094
int main() {
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
vector<ll> a(n);
for (auto& x : a) cin >> x, x--;
vector<ll> res;
for (int i = n - 1; i >= 0; i--) {
auto it = fin... | ALGO | 0.999948 | 4.828893 |
24ad97f2-0d3a-4bc9-a38c-8bba73c604d0 | Jupiter-is-BIG/competitive-coding | Codeforces/1983/D.cpp | // File generated on 24/07/22 09:04 by Anand
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(0)
#define rep(i, m, n) for (long long i = m; i < n; i++)
#define DEBUG(x) cout << "debug: " << x << "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define pb pus... | ALGO | 0.999949 | 3.602978 |
9afdf8ab-89e9-4a7c-b19b-b143619b0e00 | Omar-Fetooh/leetCode | 0102-binary-tree-level-order-traversal/0102-binary-tree-level-order-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.999967 | 6.057995 |
01999880-cd8d-4755-bd67-a463803e16b2 | underscoreanuj/Codes | LeetCode/215_kth_largest_element_in_an_array.cpp | // randomized partition based solution
class Solution
{
public:
int partition(vector<int> &nums, int l, int r)
{
swap(nums[l], nums[l + (rand() % (r - l + 1))]);
int pivot = nums[l];
int j = l + 1;
for (int i = l + 1; i <= r; ++i)
{
if (nums[i] >= pivot)
... | ALGO | 0.999982 | 5.139717 |
6507959a-8915-4492-95d9-9d55136da79e | cdlicn/Leetcode_2024_C | main_2938.cpp | #include "string"
using namespace std;
long long minimumSteps(string s) {
long long res = 0;
int idx0 = s.size() - 1;
int idx1 = 0;
while (idx0 >= 0 && s[idx0] != '0') {
idx0--;
}
while (idx1 < s.size() && s[idx1] != '1') {
idx1++;
}
while (idx0 > idx1) {
res +=... | ALGO | 0.999972 | 5.123301 |
779c7f19-ea55-4801-ae98-e68809936405 | Anuj0097/Competitive-Programming-C- | Reduce_to_One.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll> fact(1e6 + 2);
int main()
{
fact[0] = 1;
long long e = (1e9 + 7);
for (int i = 1; i < fact.size(); i++)
{
long long temp = (fact[i - 1] * (i + 1)) % e;
fact[i] = temp;
}
int t;
cin >> t;
while (... | ALGO | 0.999954 | 5.117058 |
e928bb34-82fb-48ff-bf71-d62c99b01ae2 | EmcsiCodes/Competitive-Programming | Problems for NT/Arrays/Ranglista/main.cpp | #include <iostream>
#include <set>
#include <map>
using namespace std;
/*
This problem involves calculating the wealth and origin of the top L individuals from a merged ranking based on wealth across different countries.
Here's a detailed explanation of the problem:
Input:
The first line of the input contains two i... | ALGO | 0.999968 | 4.821419 |
1c83f9e1-2e3b-406f-bbdf-035bff49ee69 | sudi050/algorithms | Array/Sort/quicksort.cpp | #include<iostream>
#include<vector>
using namespace std;
// last element is taken as pivot
int Partition(vector<int> &v, int start, int end){
int pivot = end;
int j = start;
for(int i=start;i<end;++i){
if(v[i]<v[pivot]){
swap(v[i],v[j]);
++j;
}
}
swap(v[j],v[pivot]);
return j;
}
void Quicksort(vec... | ALGO | 0.999905 | 5.262581 |
e7999bed-dc3a-4b2d-8f76-8d85559e82b2 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt35/Codenet/p01381/179147913/response_2.cpp | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, k;
while (scanf("%d%d", &n, &k) != EOF) {
if (n / 2 < k) {
printf("-1\n");
continue;
}
int p[n + 2];
p[0] = 0;
for (int i = 1; i < n; i += 2) {
p[i] = i / 2 + 1;
p[i + 1] = n - p[i];
}
... | ALGO | 0.999767 | 3.519157 |
96d9476a-229a-4583-b708-b28efae2249d | ishandutta2007/codeforces | .tx/normal/912/A.cpp | #include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;
#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)
#define STRESS 0
using lint = long long;
void so... | ALGO | 0.999071 | 3.603719 |
e55afa4f-70d5-418b-b911-81c646131ffe | Fernanda1625/Practice-1 | rewriting factorial 2.cpp | # include <iostream>
using namespace std;
int main(){
int number;
cout << "Enter a number: ";
cin >> number;
switch (number){
case 0: cout << "1\n";
break;
case 1: cout << "1\n";
break;
case 2: cout << "2\n";
break;
case 3: cout << "6\n";
break;
case 4: cout << "24\n";
break;
case 5: cout ... | ALGO | 0.998895 | 3.712966 |
0d2ef6e7-c261-407c-ad0a-84d342d08f82 | Aesthetician/leetC | 235.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
//corner con... | ALGO | 0.99999 | 6.388112 |
f7602f59-5aaa-40f7-809b-d21efc3d98c9 | ishandutta2007/codeforces | .tx/normal/939/D.cpp | #include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;
#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)
#define STRESS 0
using lint = long long;
template... | ALGO | 0.999994 | 3.807869 |
9bdc276b-5351-46b2-8200-f08d2e7185ec | againxx/cpp-practice | metaprogramming_learning/factorial.cpp | #include <iostream>
template<unsigned n>
struct factorial
{
static constexpr unsigned value = n * factorial<n - 1>::value;
};
template<>
struct factorial<0>
{
static constexpr unsigned value = 1;
};
int main() {
std::cout << factorial<6>::value << '\n';
return 0;
}
| ALGO | 0.999462 | 6.323282 |
c4a552c9-7658-488e-9807-c105f6a23637 | park-hg/swjungle-algorithm-study | BOJ-16987/connieya.cpp | #include "bits/stdc++.h"
using namespace std;
int n;
int ans;
vector<pair<int,int>> v; // 내구도 , 무게
void solve(int cur) {
if(cur == n) {
int cnt = 0;
for (int i = 0; i < n; ++i) {
cnt += v[i].first <= 0;
}
if(cnt > ans){
ans = cnt;
}
return;
... | ALGO | 0.999968 | 3.923686 |
84cf54be-f01f-4f2f-8f06-ed5bf35e6f84 | Abhishek5165/DSA-Practice-Arena | Arrays/Arrays/Find_maximum_no_of_ones.cpp | // Time Complexity : O(N);
// Space Complexity : O(1);
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int count = 0;
int maxxi = INT_MIN;
int n = nums.size();
for(int i=0;i<n;i++){
if(nums[i] == 1){
count++;
maxxi = max(maxxi,count);
}
else{
count =... | ALGO | 0.999966 | 6.087183 |
b47b0f8a-6b6e-43a6-bfa5-2e5eafdd7317 | arrayappy/datastructures-and-algorithms | Heaps/MinHeap.cpp | #include<iostream>
using namespace std;
void swap(int &x, int &y)
{
int temp = x;
x = y;
y = temp;
}
class MinHeap
{
public:
int size;
int capacity;
int *harr;
MinHeap(int cap)
{
size = 0;
capacity = cap;
harr = new int[cap];
}
int left(int ... | ALGO | 0.999861 | 4.136907 |
db2a902e-f9f9-423e-ba2e-c13b8cae5cbf | dev-vikash2v7/DSA-with-LeetCode-in-CPlus | Non-linear DS/Trees/BST/BST_insertion_deletion.cpp | #include <iostream>
using namespace std;
struct Node
{
int data;
Node *left = NULL;
Node *right = NULL;
Node(int data)
{
this->data = data;
};
};
class Tree
{
public:
Node *deleteNode(Node *root, int key)
{
if (root == NULL)
{
cout << "no data foun... | ALGO | 0.999978 | 3.718603 |
f783b5ed-b39e-44c7-942f-07f92d580cb6 | OSU-BMBL/DESSO | code/libs/Feature_encoding/DNAshape_v2.6/Src/prediction.cpp | #include "prediction.h"
#include "utilities.h"
//Can be used to predict propel as well
void predict_groove_width(std::stringstream &outs,std::vector<pointers_vector> &pointers_matrix,std::vector<int_vector> &status_matrix, \
string_vector &name_list,bool debug,DNA_to_properties &pentamers_map,std::string objectna... | ALGO | 0.983156 | 4.704069 |
dc5e4326-260f-4ffe-bb1c-4de09a42d00e | 308866567/MyHistory | acwing/math/875.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
typedef long long ll;
const long long N = 1e9 + 7;
ll qmi(ll a, ll b)//a^b
{
const ll mod = 998244353 ;
ll ans = 1;
while (b > 0)
{
if (b & 1)
ans = ans * a % mod;
a = a * a % mod;
b = b >> 1;
}
return ans % mod;
}
int main()
{
// freope... | ALGO | 0.99998 | 4.537449 |
968109cf-c835-42a0-881b-5d1de36ace6d | Victor-ZHC/LeetCodeCPP | src/0001_0050/38_count_and_say.cpp | /**
* 1 is read off as "one 1" or 11.
* 11 is read off as "two 1s" or 21.
* 21 is read off as "one 2, then one 1" or 1211.
*
* 1
* 11
* 21
* 1211
* 111221
* 312211
* 13112221
* ...
*/
#include <iostream>
#include <string.h>
using namespace std;
class Solution {
private:
string count(string in, int le... | ALGO | 0.999958 | 5.168744 |
5be4376d-29a7-448a-b67d-5ffeb2d84ab1 | MonkeyPsw/CodeTree_Psw | 250219/여러가지 진수변환/various-numeral-system-transformations.cpp | #include <iostream>
using namespace std;
int N, B;
int digits[20];
int VariousNumber(int n, int K)
{
int cnt = 0;
while (true)
{
if (n < K)
{
digits[cnt++] = n;
break;
}
digits[cnt++] = n % K;
n /= K;
}
return cnt;
}
int main... | ALGO | 0.999605 | 3.590671 |
010cf8c5-623d-4a3b-8bda-3be3d80baf23 | ahmedelmetwally74/ITI9M-AI-ML-Intake44 | 3.C++ oop/Labs/stackTest/main.cpp | #include <iostream>
#include<string.h>
using namespace std;
class stack
{
int arr[5];
int tos;
int Size;
public:
// Constractors
stack(){
tos = 0;
Size = 5;
}
int isFull()
{
if(tos == Size)
{
cout<<"The stack is full\n";
return 1;
... | ALGO | 0.949076 | 4.224293 |
6e227ac4-84c9-45ee-8e59-3f55151efb0b | IRMV-Manipulation-Group/SpherizedURDFGenerator | third_party/header_only/igl/quad_planarity.cpp | template <typename DerivedV, typename DerivedF, typename DerivedP>
IGL_INLINE void igl::quad_planarity(
const Eigen::MatrixBase<DerivedV>& V,
const Eigen::MatrixBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedP> & P)
{
int nf = F.rows();
P.setZero(nf,1);
for (int i =0; i<nf; ++i)
{
const Eigen::Matri... | ALGO | 0.997414 | 6.485548 |
5cd4dbd5-b8d4-4718-bf6f-98da6ec1a9f5 | Nobel-ruettt/Poj | 1316 - A Wedding Party2.cpp | #include <bits/stdc++.h>
#define ll long long
#define pi pair<ll,ll>
#define MAXN 503
#define MAXS 15
using namespace std;
inline bool bitcheck(ll x,ll pos)
{
return (x>>pos) & 1;
}
inline int biton(ll x,ll pos)
{
return x | (1<<pos);
}
vector<vector<pi> >graph;
vector<bitset<MAXN> >reachability;
bitset<MAXN> v... | ALGO | 0.999702 | 3.800533 |
a3c592de-e76e-42d0-b8cb-3f32262756f0 | stefolog/sdp2016 | ex04/gr1/brackets.cpp | #include <iostream>
#include "../../templates/stack.cpp"
using namespace std;
/*
{(})
{()}
{{
| |
| |
|_|
*/
struct BracketPair {
char opening;
char closing;
};
const int SUPPORTED_BRACKETS_COUNT = 5;
BracketPair supportedBrackets[] = {
{ '(', ')'},
{ '[', ']'},
{ '{', '}'},
{ '<', '>'},
... | ALGO | 0.972071 | 6.427465 |
9b7a507f-8c9a-4bf3-8315-ba10501411a0 | cefikhan/bitcoin-cassandra-plugin | src/bitcoin-tx.cpp | #if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <clientversion.h>
#include <coins.h>
#include <compat/compat.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <core_io.h>
#include <key_io.h>
#include <fs.h>
#include <policy/policy.h>
#include <primitives/transacti... | TOOL | 0.925981 | 6.182466 |
e7a33cc7-d06e-425a-b9e4-984d0bf6c1f1 | baofuhann/FISCO_BCOS_FL | deps/src/boost/libs/geometry/doc/src/examples/geometries/adapted/boost_range/filtered.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[boost_range_filtered
//` Shows how to use a Boost.Geometry linestring, filtered by Boost.Range adaptor
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometrie... | TOOL | 0.925431 | 6.833335 |
c5be7886-a6f8-4be3-928b-19ce457a6058 | DEO-DECODE/30_Days_of_Coding | Trapping Rain Water(LeetCode).cpp | // Trapping Rain Water(LeetCode)
#include <bits/stdc++.h>
using namespace std;
int trap(vector<int> &height)
{
int n=height.size();
vector<int> leftMax(n,0), rightMax(n,0);
leftMax[0]=height[0];
for(int i=1; i<n; ++i){
leftMax[i]=max(height[i], leftMax[i-1]);
}
rightMax[n-1]=height[n-1];... | ALGO | 0.999843 | 6.586977 |
99654325-18f5-499b-8619-ea8e135af6b1 | Mohamedboukerche22/Competitive_programming | codeforces/d1.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string n;
cin >>n;
cout<<n;
reverse(n.begin(),n.end());
cout<<n;
}
| ALGO | 0.998384 | 3.183126 |
5a4a96f9-e32f-4488-9988-c1fa2963d375 | sarvex/leetcode-nim | solution/0900-0999/0940.Distinct Subsequences II/Solution.cpp | class Solution {
public:
const int mod = 1e9 + 7;
int distinctSubseqII(string s) {
vector<long> dp(26);
long ans = 0;
for (char& c : s) {
int i = c - 'a';
long add = ans - dp[i] + 1;
ans = (ans + add + mod) % mod;
dp[i] = (dp[i] + add) % m... | ALGO | 0.999997 | 6.466615 |
c5dcea22-b9b4-4de0-b43b-e349793a0b45 | atanughosh01/Leetcode-grinder | 567-permutation-in-string/567-permutation-in-string.cpp | /*
// Logically correct but TLE solution
class Solution {
private:
string srt(string s) {
string a = s;
sort(a.begin(), a.end());
return a;
}
public:
bool checkInclusion(string s1, string s2) {
int m = (int)s1.size();
int n = (int)s2.size();
for(int i=-1; i<... | ALGO | 0.999988 | 6.192856 |
9a4c07e7-5b90-486b-ba5a-f7f15f578b49 | sarvex/leetcode-java | solution/0800-0899/0885.Spiral Matrix III/Solution.cpp | class Solution {
public:
vector<vector<int>> spiralMatrixIII(int rows, int cols, int rStart, int cStart) {
int cnt = rows * cols;
vector<vector<int>> ans;
ans.push_back({rStart, cStart});
if (cnt == 1) return ans;
for (int k = 1;; k += 2) {
vector<vector<int>> dir... | ALGO | 0.999927 | 4.994453 |
33bc9fa6-951a-44a3-9c4d-34115e2e2248 | Aurora-73/Data-Structure-Code | 03_Stack_Queue/链表判断是否对称.cpp | #include <iostream>
#include <typeinfo>
#include <cstdlib> // 包含用于转换的头文件
typedef char ElemType; // 使用 ElemType 定义链表类型,可以在int和char间切换,当其为char是若输出整数则为对应的ASCII码,小于34时无字符输出
// 输入函数,根据用户输入的类型保存为int型或将char类型转换为int型
int getInput() {
char input[256];
std::cin.getline(input, sizeof(input));
// 尝试将输入解析为整数
int ... | ALGO | 0.999771 | 5.166839 |
0e157c60-ee80-4258-93bf-4e84512da728 | adoptium/jdk21u | src/hotspot/share/classfile/altHashing.cpp | #include "precompiled.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/vmClasses.hpp"
#include "oops/klass.inline.hpp"
#include "oops/markWord.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/os.hpp"
// Get the hash code of the classes mirror if it exists, otherwise just
// return a random number, whi... | ALGO | 0.921012 | 7.695481 |
fd5e352c-f75d-4e6a-9d4e-986b65e0ac72 | tuananhlai/cplusplus | bai_tap/on_tap/que_diem.cpp | #include <iostream>
using namespace std;
int main() {
int so_diem;
cin >> so_diem;
double len_hop, wid_hop;
cin >> len_hop >> wid_hop;
int diem;
for (int i = 0; i < so_diem; i++) {
cin >> diem;
if (diem * diem <= len_hop*len_hop + wid_hop*wid_hop) cout << "DA" << endl;
el... | ALGO | 0.99994 | 3.849481 |
1aac9880-a00e-40b6-b2d6-295ae16fb5f0 | hyeonseong0917/BOJ | random_silver/2908.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
// your code goes here
string a,b;
cin>>a;
cin>>b;
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
if(a<b){
cout<<b;
}else{
cout<<a;
}
return 0;
} | ALGO | 0.999892 | 3.478481 |
893a3eef-99b7-4e89-9d8b-57e7a9148d71 | Muhammadali-uz/Parol | 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.998733 | 6.76775 |
330ed081-f851-48bb-bddd-9813dc4a3345 | hrushikeshmysala2003/Data-Structures-and-Algorithms | Binary_Search/leetcode_1482_minimum_number_of_days_to_make_m_buoquets.cpp |
#include <bits/stdc++.h>
using namespace std;
bool possible(vector<int> &arr, int day, int m, int k) {
int n = arr.size(); //size of the array
int cnt = 0;
int noOfB = 0;
// count the number of bouquets:
for (int i = 0; i < n; i++) {
if (arr[i] <= day) {
cnt++;
}
... | ALGO | 0.999996 | 5.290287 |
30b94346-959f-47ae-9746-5b0d679fbf13 | CodeBlocksDevelopment/CodeBlocks | ProjetoVetor/main.cpp | #include <iostream>
using namespace std;
int vetor[10];
int maior=0;
int main()
{
for (int i=0;i<10;i++){
cout<<"Posição "<<(i+1)<<": ";
cin>>vetor[i];
if (i==0){
maior = vetor[i];
} else
if (vetor[i] > maior){
maior=vetor[i];
}
}
cou... | ALGO | 0.997732 | 3.611192 |
ebeea659-8fe4-4c98-abfb-eda8dbb04b78 | akashrautela/p3 | Math Algo (30-6-19)/DP/common algo for primes upto n.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,j;
cin>>n;
long long limit = sqrt(n), limit2;
for(i=2;i<=n;i++)
{
int f=1;
limit2 = sqrt(i);
for(j=2;j<=limit2;j++)
{
if(i%j == 0)
{
f=0;
br... | ALGO | 0.999965 | 4.184143 |
987898af-7d27-4024-92ab-cf589e7599f9 | xu-weizhen/OJ_Codes | NowCoder(牛客网)/剑指Offer/调整数组顺序使奇数位于偶数前面.cpp | /*
**链接:https://www.nowcoder.com/questionTerminal/beb5aa231adc45b2a5dcc5b62c93f593
**描述:输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间的相对位置不变。
**时间:2019.10.14
**思路:略
*/
class Solution {
public:
void reOrderArray(vector<int> &array) {
int size = array.size();
if... | ALGO | 0.999969 | 5.169575 |
8e728621-f74a-4d1f-b9ff-1c2c0a541b21 | ContriverH/Common-algos | merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
void merge(vector<int> &nums, int left, int mid, int right)
{
int n1 = mid - left + 1;
int n2 = right - mid;
vector<int> leftNums(n1), rightNums(n2);
for (int i = left, j = 0; i <= mid; i++, j++)
{
leftNums[j] = nums[i];
}
for (int i = mid + 1, j = 0; ... | ALGO | 0.99998 | 4.875906 |
d5d5aee8-f154-4ac0-9e07-13d36f1b1fb0 | anna2506/ParallellAlgorithms | 8_task.cpp | #include <iostream>
#include <mpi.h>
using namespace std;
int main(int argc, char **argv)
{
int rank, size;
// initializing MPI library
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int max_length = 1000000;
double time_start = MPI_Wtime();
... | TOOL | 0.916903 | 3.79545 |
89af9c64-a4df-4175-a30e-ed6fe4f1e2e5 | Om21610018/DSA-Codes | rotationofarraybyksteps.cpp | //* circular array :
#include <bits/stdc++.h>
using namespace std;
void swap(int &a, int &b)
{
int t = a;
a = b;
b = t;
}
void reversepart(int start, int end, vector<int> &v)
{
// reverse(v.begin() + start, v.begin() + end + 1);
while (start < end)
{
swap(v[start], v[end]);
st... | ALGO | 0.999984 | 4.497796 |
462b9eea-0900-4745-858e-f824fc0904ea | Nathbobs/codetree_exercises | 250610/함수를 이용한 부분 문자열의 위치 구하기/find-the-location-of-a-substring-using-a-function.cpp | #include <iostream>
#include <string>
using namespace std;
string input, pattern;
int findSubstringIndex(const string &s, const string &t) {
size_t pos = s.find(t);
if (pos != string::npos) return pos;
return -1;
}
int main() {
cin >> input >> pattern;
cout << findSubstringIndex(input, pattern)... | ALGO | 0.99934 | 5.436678 |
e3e4ed11-b8bd-40ac-ba5d-9b34710721e4 | teju85/programming | codeeval/cpp/test.cpp | #include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
#define MOD (2*3*5*7)
string s;
long long dyn[41][MOD];
int main(int argc, char** argv) {
FILE* fp;
char str[40];
if(argc != 2) {
printf("USAGE: UglyNumbers <fileContainingTestVectors>\n");
ret... | ALGO | 0.99905 | 4.184342 |
abc73ee8-e30e-40e8-9d41-3c138a41ffe5 | codedex-io/cpp-101 | 5-vectors/28_main.cpp | // Sum of Even / Product of Odd 😵💫
// Codédex
#include <iostream>
#include <vector>
int main() {
std::vector<int> num = {2, 4, 3, 6, 1, 9, 8, 0, 8, 5, 7, 3, 3};
int sum = 0;
int product = 1;
for (int i = 0; i < num.size(); i++) {
if (num[i] % 2 == 0) {
sum = sum + num[i];
}
else {
... | ALGO | 0.999625 | 6.075721 |
65f2a63b-693f-4a7d-a5f9-1affee387faf | i-Pear/SysCore | src/kernel/kernel_heap.cpp | //#include "memory/kernel_heap.h"
//
//size_t __kernel_heap_base;
//
//__Kernel_SegmentTreeNode kernel_heap_nodes[kernel_heap_size * 4 / __align_unit];
//int __kernel_alloc_length[kernel_heap_size / __align_unit];
//
//#define cnt kernel_heap_nodes[node]
//
//int __kernel_get_size(int node) {
// return kernel_heap_n... | ALGO | 0.991064 | 3.99871 |
967c455c-7087-465b-8fc9-d6edfdbd047a | ahmadsoliman/ACM | CodeBlocks/ACM/Graphs/FASTFLOW.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ii> iii;
type... | ALGO | 0.999972 | 4.698172 |
59c01134-7f91-4ce1-b341-37e167a9c5d9 | furret112/CS-RRT | ompl/src/ompl/geometric/planners/informedtrees/bitstar/src/Vertex.cpp | /* Authors: Jonathan Gammell, Marlin Strub */
// My definition:
#include "ompl/geometric/planners/informedtrees/bitstar/Vertex.h"
// For std::move
#include <utility>
// For exceptions:
#include "ompl/util/Exception.h"
// BIT*:
// A collection of common helper functions
#include "ompl/geometric/planners/informedtree... | ALGO | 0.991156 | 5.914562 |
31dcc508-5470-40f2-bd12-73466cc2fdd7 | henrydnz/competitive-cpp | contests/utfpr_toledo/joias.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
int main() {
fastio;
int sz; cin>>sz;
int s1, s2, t1, t2;
cin>>s1>>s2>>t1>>t2;
int ans = abs(s1-t1) + abs(s2-t2);
cout<<ans<<"\n";
return 0;
} | ALGO | 0.999893 | 3.884534 |
d058d6a5-0825-413e-a749-fd71e88b41b0 | SousaEdson/CompetitiveProgramming | UVA/11572.cpp | #include<bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fori(a, l, f) for(int a = l; a<f; ++a)
#define ford(a, l, f) for(int a=l; a>=f; --a)
#define pq priority_queue
#define checkBit(mask, i) ((mask & (1 << i)) != 0) ? true:false
#define setBit(mask, i) mask = mask ... | ALGO | 0.999493 | 4.218053 |
b29ba901-9fd6-4d10-9538-4c85c760007e | Sa2003hil/DSA | Introdunction to CPP/Techniques/1 Sliding Window/slidingWindow.cpp | #include <iostream>
#include <vector>
using namespace std;
void slidingWindow(const vector<int> &nums, int k)
{
int left = 0, right = 0;
int windowSum = 0;
while (right < nums.size())
{
// Expand the window by including the current element
windowSum += nums[right];
// Process... | ALGO | 0.999931 | 6.571906 |
21bbb7db-ff87-42e7-babc-6f7e25fbb27f | Ankit8607/algozenith-training | divide and conquer/Count Inversions.cpp | // https://www.learning.algozenith.com/problems/Count-Inversions-22
/*
Description
You have given an array A of N elements. An Inversion Count of the array is defined as the number of pairs (i, j) such that Ai > Aj and i < j.
Find the Inversion Count in A.
Input Format
The first line of input contains one integer ... | ALGO | 0.999562 | 6.046032 |
bbc60778-8ed2-4c2e-ae89-9933ff285b5b | Jhecks/ITMO-Algorithms-and-Data-Structures | Lab 1/Lab_3.cpp | #include <vector>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("turtle.in");
ofstream fout("turtle.out");
vector <vector <long long>> a;
long long len = 0;
long long wid = 0;
fin >> len >> wid;
a.resize(len + 1);
for (int i = 0; i < len; i++)
{
... | ALGO | 0.999639 | 3.395413 |
fb6abd3a-e87f-4661-b8d7-f3a374d403f3 | hchaithanya/Cpp-programs- | bonus1.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,p;
int sum=0;
cout<<"Enter number:";
cin>>n;
cout<<"\nEnter the power:";
cin>>p;
int s2=pow(n,p);
while(s2){
sum+=s2%10;
s2/=10;}
cout<<"\nThe sum of digits of "<<pow(n,p)<<" = "<<sum<<"\n";
return 9;
}
| ALGO | 0.999762 | 4.56884 |
36ae3150-17b5-42ff-aa11-74334d4cc534 | Anoop12345658/C-Plus-Plus | math/check_prime.cpp | /**
* Copyright 2020 @author omkarlanghe
*
* @file
* A simple program to check if the given number if prime or not.
*
* @brief
* Reduced all possibilities of a number which cannot be prime.
* Eg: No even number, except 2 can be a prime number, hence we will increment
* our loop with i+2 jumping on all odd numb... | ALGO | 0.998879 | 5.575124 |
bae9dadb-bea0-4b3d-b8e4-1dbe91c94c7a | Jklmkii/ListaExerc-cio2024 | ListaExerc-cio2024/vetores questao 16.cpp | #include <iostream>
using namespace std;
int main() {
float vetor[5];
cout << "Digite 5 números reais:\n";
for (int i = 0; i < 5; i++) {
cin >> vetor[i];}
while (true) {
cout << "Digite 0 para sair, 1 para ordem direta, 2 para ordem inversa:\n";
int codigo;
cin >> codigo... | ALGO | 0.996608 | 3.696233 |
cab15b7e-f00f-4e65-b978-3fc6a4a8b5cb | nawngs/CompetitiveProgramming | Exercises/lhseq.cpp | #pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pll pair < ll, ll >
#define pii pair < int, int >
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const string NAME = "lhseq";
const string NA... | ALGO | 0.999534 | 3.982313 |
3794cc8a-3e11-41a4-ba43-e739863b8ea8 | neerkhandor/dsa_cpp | Stack/lec1_2.cpp | #include<iostream>
using namespace std;
//Last in first out
//sab se upar wala pehle remove hoga
//so if we insert 1 2 3 4 then while removing
//it will come as 4 3 2 1
//so whenever there is anything like reversing we can think of stack
//there are various operations of stack
//push ->pushes an element into the stack... | ALGO | 0.999071 | 4.409838 |
0aa63e42-3a89-48de-b2ef-664dde1b0bb6 | best-Hui/Games202 | Assignment2/prt/ext/tbb/examples/parallel_for/tachyon/src/grid.cpp | /*
* grid.cpp - spatial subdivision efficiency structures
*/
#include "machine.h"
#include "types.h"
#include "macros.h"
#include "vector.h"
#include "intersect.h"
#include "util.h"
#define GRID_PRIVATE
#include "grid.h"
#ifndef cbrt
#define cbrt(x) ((x) > 0.0 ? pow((double)(x), 1.0/3.0) : \
... | ALGO | 0.956196 | 6.715133 |
c9722fc6-557a-4088-99b0-2cdf1e84cb7c | rushabhdaya/100_dsa_codes | 12_split_binary_string_with_equal_1_and_0.cpp | /*
link: https://www.geeksforgeeks.org/split-the-binary-string-into-substrings-with-equal-number-of-0s-and-1s/
*/
// ----------------------------------------------------------------------------------------------------------------------- //
int split(string stringToSplit, int n) {
int arr[n];
int count = 0... | ALGO | 0.999023 | 6.01258 |
594942d0-4e7c-4b7a-8dea-cf330952f55b | JangAJang/Algorithm | 6. 함수중복/예제 6-2/예제 6-2/main.cpp | #include <iostream>
using namespace std;
int sum(int a, int b){
int sum=a;
for(int i=a; i<=b; i++){
sum +=a;
}
return sum;
}
int sum(int a){
int s=0;
for(int i=0; i<a+1; i++){
s+=i;
}
return s;
}
int main(){
cout << sum(3, 5) << endl;
cout << sum(3) << endl;
... | ALGO | 0.998773 | 4.496139 |
0d841c87-5db8-4a8e-9220-859a39c9dcad | 113bommy/LogicalErrorFixCodeT5 | LogicalErrorFix_metric/CodeT5_LineNumber_cpp_gold/Problem_116_CorrectCode_593.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 998244353;
const int MAXN = 5e5 + 5;
const ll INF = 2e18;
void add(ll &a, ll b) {
a += b;
a %= M... | ALGO | 0.999972 | 4.82779 |
034d4e35-f636-45a9-b860-600475b0a2c1 | atharvajoshi10/Competitive-coding | Codechef/Easy/HORSES.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int mindiff(ll a[], ll n)
{
ll mindif = a[n-1] - a[0];
for (int i = 0; i < n-1; ++i)
if (a[i+1]-a[i]<mindif)
mindif = a[i+1]-a[i];
return mindif;
}
int main(int argc, char const *argv[])
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll... | ALGO | 0.999806 | 3.755841 |
f8937fbc-4f27-43c7-ba7b-a09510ad6504 | praveenmunukutla/leetcode | 1944-truncate-sentence/truncate-sentence.cpp | class Solution {
public:
// string truncateSentence(string s, int k) {
// auto tokens = [](string s){
// stringstream ss(s);
// string token;
// vector<string> tokens;
// while(getline(ss,token,' ')){
// if(!token.empty())
// ... | ALGO | 0.999929 | 6.065114 |
9eb29ac0-73ef-4a92-b05b-1265b8689655 | PrajwalHD58/competative_coding | GoogleCodingCompetitions/KickStart/Round_D_@)@!/Cutting_Intervals.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,a,b) for(long long i=a;i<b;i++)
#define RREP(i,a,b) for(long long i=a;i>b;i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define popb pop_back
#define mp make_... | ALGO | 0.999917 | 4.113902 |
9de43726-13cc-4790-9f51-2381edd9caa8 | song89/Unreal-4.25 | Engine/Source/Runtime/SignalProcessing/Private/BufferOnePoleLPF.cpp | #include "DSP/BufferOnePoleLPF.h"
#include "DSP/BufferVectorOperations.h"
using namespace Audio;
// Constructor
FBufferOnePoleLPF::FBufferOnePoleLPF(float InG)
: CutoffFrequency(0.0f)
, B1(0.0f)
, A0(1.0f)
, Z1(0.0f)
{
SetG(InG);
}
// Set the LPF gain coefficient
void FBufferOnePoleLPF::SetG(float InG)
{
B1 ... | TOOL | 0.878518 | 5.943822 |
94e8d4ac-fbd8-4e81-a0c0-185dd0ca75b6 | nla-group/ABBA | src/fill_SMAWK.cpp | /*
Modified version of the C++ code from https://cran.r-project.org/web/packages/Ckmeans.1d.dp/index.html
*/
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <stack>
#include "Ckmeans.1d.dp.h"
void reduce_in_place(int imin, int imax, int istep, int q,
const... | ALGO | 0.999993 | 5.591465 |
745f920f-7500-449e-86ce-769636f9c561 | Ritik-Kumar01/Leetcode | 0108-convert-sorted-array-to-binary-search-tree/0108-convert-sorted-array-to-binary-search-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.999993 | 6.734245 |
eceb4d48-831f-4348-8f22-cdfad854808b | emotionless/Leetcode | 2267-check-if-there-is-a-valid-parentheses-string-path/2267-check-if-there-is-a-valid-parentheses-string-path.cpp | class Solution {
public:
bool solve(int x, int y, int tot, vector<vector<char>> &s) {
if (tot < 0) return 0;
if (x == (n-1) && y == (m-1)) {
return (tot + (s[x][y] == ')'? -1 : 1)) == 0;
}
if (x > (n-1) || y > (m-1)) return 0;
int &ret = dp[... | ALGO | 0.999901 | 5.247818 |
793f213d-bec0-46f9-ac85-5b820debae32 | ghrua/ccpr_release | mgiza/mgizapp/src/AlignTables.cpp | #include "AlignTables.h"
bool alignmodel::insert(Vector<WordIndex>& aj, LogProb val)
{
alignment_hash::iterator i;
i = a.find(aj);
if(i != a.end() || val <= 0)
return false ;
a.insert(pair<const Vector<WordIndex>, LogProb>(aj, val));
return true ;
}
LogProb alignmodel::getValue(Vector<WordIndex>& align)... | ALGO | 0.938896 | 4.325719 |
7fa1615c-e6d0-42f4-bac7-7aaa46424b1b | jatin837/leetcode_solutions | 114-flatten-binary-tree-to-linked-list/114-flatten-binary-tree-to-linked-list.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.999944 | 6.179916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.