uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c8159cf6-be11-4880-92a3-676a03be3f67 | zhearing/lms1xx_perception | lib/eigen-3.3.7/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.973257 | 6.130261 |
55ec950e-a4c1-430b-bf07-d838ae7488de | SerenaEdel/C-codes | Matrices.cpp | /*
A C++ program for a 1D array
Author: Serena Edel
Reg No:BSCIT-05-0068/2024
Date:6/03/2025
*/
#include <iostream>
using namespace std;
int main() {
// 1D matrix (array)
int oneD[5] = {1, 2, 3, 4, 5};
cout << "1D Matrix:" << endl;
for (int i = 0; i < 5; i++) {
cout << oneD[i] << " ";
}
... | ALGO | 0.973234 | 4.919638 |
f50eeb1e-9977-4f90-ab6d-4a5314679504 | Code-Mars/LeetCode | 1105-filling-bookcase-shelves/1105-filling-bookcase-shelves.cpp | class Solution {
public:
int n,maxWidth,dp[1001];
int solve(int idx,vector<vector<int>>&books){
if(idx>=n)return 0;
if(dp[idx]!=-1)return dp[idx];
int mx=0,sum=0,ans=INT_MAX;
for(int i=idx;i<n and sum+books[i][0]<=maxWidth; i++){
mx=max(mx,books[i][1]);
su... | ALGO | 0.99996 | 6.138225 |
04261d64-98e0-4464-ab30-ede473f67cda | raincross7/code-similarity | codes/train_code/problem407/problem407_117.cpp |
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define pb(n) push_back(n);
#define ... | ALGO | 0.99998 | 3.345476 |
34fe3936-7701-478b-a79f-e61d09be6961 | ishandutta2007/codeforces | batrr/normal/237/E.cpp | #include <bits/stdc++.h>
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
*/
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#defin... | ALGO | 0.999868 | 3.463312 |
8f62f9cb-61af-46dc-9320-877f9e5d3565 | Ankit-op07/Leetcode-Problems | 55-jump-game/55-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
int n=nums.size();
vector<bool>dp(n,false);
dp[n-1]=true; // 4->true
for(int i=n-2;i>=0;i--){
// 0
int ans=false;
//jumps
for(int j=i+1;j<=i+nums[i];j++){
... | ALGO | 0.999986 | 5.942778 |
ec9a266f-f3a6-4585-91bf-5dcd8ad7e63f | Fadouse/Luogu-Solutions | Luogu/P3959.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=20, INF=0X3f3f3f3f3f;
int n,m,ans=INF;
int g[N][N];
int depth[N];
bool vis[N];
int lg2[1<<12];
int f[1<<12][N][N];
int lowbit(int x) {
return x & (-x);
}
void dfs(int u, int cnt, int cost, int stat){
if(cost>=ans) return;
if(f[stat][u][depth[u]]<=... | ALGO | 0.999941 | 4.354318 |
82c85938-6aed-4802-877e-0a8530fb8173 | choudhary-pratham/DSA_programs | Recursion/Print1_to_n_n_1.cpp | // #include<bits/stdc++.h>
// using namespace std;
// void solve(int n)
// {
// if(n==1)
// {
// cout<<n<<" ";
// return;
// }
// // cout<<n<<" "; // n-1;
// solve(n-1);
// cout<<n<<" "; // 1-n
// }
// int main(){
// int n;
// cin>>n;
// solve(n);
// return 0;
// }
// ... | ALGO | 0.999677 | 5.473886 |
e9b7d031-345c-4437-908c-7f572d54b71a | Eeman1113/Leetcode | Problems/1090.cpp | class Solution {
public:
string shortestCommonSupersequence(string str1, string str2) {
string ans;
int i = 0; // str1's index
int j = 0; // str2's index
for (const char c : lcs(str1, str2)) {
// Append the letters that are not part of the LCS.
while (str1[i] != c)
ans += str1[... | ALGO | 0.999839 | 6.336425 |
3e8a698c-8d18-40f8-b187-fc0e516ef1d4 | FH-Fahad/leetcode | 347.cpp | // https://leetcode.com/problems/top-k-frequent-elements/
class Solution
{
public:
vector<int> topKFrequent(vector<int> &nums, int k)
{
unordered_map<int, int> mp;
for (auto i : nums)
{
mp[i]++;
}
priority_queue<pair<int, int>> pq;
for (auto i : mp)
... | ALGO | 0.999971 | 6.167577 |
c1c9a01e-4b9d-42dc-b756-37a3baf2a810 | hkhetawat/SCOREP_Applications | lammps/src/imbalance_neigh.cpp | #include "imbalance_neigh.h"
#include <mpi.h>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_request.h"
#include "neigh_list.h"
#include "error.h"
using namespace LAMMPS_NS;
#define BIG 1.0e20
/* -------------------------------------------------------------------- */
Im... | ALGO | 0.998693 | 5.436868 |
01014356-ce97-4976-bc03-93b50d772c45 | zoumson/AlgorithmCode | data_structures/trie_modern.cpp | /**
* @file
*
* @author Anmol3299
* \brief A basic implementation of trie class to store only lower-case strings.
*/
#include <iostream> // for io operations
#include <memory> // for std::shared_ptr<>
#include <string> // for std::string class
/**
* A basic implementation of trie class to store only lower... | ALGO | 0.999457 | 6.978986 |
c021302f-42ba-4c60-896e-e555936233e2 | sarvex/leetcode-free-basic | solution/1700-1799/1736.Latest Time by Replacing Hidden Digits/Solution.cpp | class Solution {
public:
string maximumTime(string time) {
if (time[0] == '?') {
time[0] = (time[1] >= '4' && time[1] <= '9') ? '1' : '2';
}
if (time[1] == '?') {
time[1] = (time[0] == '2') ? '3' : '9';
}
if (time[3] == '?') {
time[3] = '5'... | ALGO | 0.99985 | 6.6279 |
e1a6b761-95e7-48b5-9e8c-5aabee77179c | DiegoWu/C-code | cf789pb.cpp | #include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<bitset>
#include<map>
#define ll long long
#define INF 1000000001
#define mod 998244353
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
while(t--){
int n, ans= 0, cn... | ALGO | 0.999802 | 4.875849 |
a3cfb2db-0f4e-4cf0-8aba-1748ba4ba5fb | ishandutta2007/codeforces | ekzhang/normal/843/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define error(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
vector<string> split(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while (getline(ss, x, c)) v.push_back(move(x)); return v; }
void err(vector<string>::ite... | ALGO | 0.999992 | 3.564461 |
d291d308-1f8e-4c80-a3e2-1fa41d3146fa | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3599_2.cpp | #include <bits/stdc++.h>
int n, m, q;
char str[1005];
bool a[1005][1005];
std::vector<std::pair<int, int> > del;
int num[1005][1005], tot, ld, ru;
std::set<std::pair<int, int> > s;
namespace FU {
int f[1005 * 1005];
std::vector<int> inv[1005 * 1005];
std::set<int> su;
void init(int i) {
if (su.count(i)) return;
su.... | ALGO | 0.999946 | 4.398689 |
43ed5f38-fff5-46af-9e62-4637fe077ebc | oldlick/CompetitiveProgramming | atcoder/3 ABC/228/D.cpp | // -------------------------------------------------------------------------------
//
// -------------------------------------------------------------------------------
// FileName : D.cpp
// Version : ver 1.0
// Date : 2021-11-20 Sat 20:25:09
// -------------------------------------------------------------------... | ALGO | 0.999973 | 3.665983 |
abf97f69-80b0-4ac2-9d6e-c47d9a3a28fa | msaisathvik/amfoss-tasks | task-03/C++/prime.cpp | #include <iostream>
using namespace std;
int main() {
int x;
cout << "Enter a number: ";
cin >> x;
for (int i=2;i<x+1;i++){
int count = 0;
for (int j=1;j<i+1;j++){
if (i%j==0) count++;
}
if (count == 2) cout << i << " ";
}
return 0;
} | ALGO | 0.99957 | 4.605415 |
9208d6d5-bd6c-410e-9f75-4ea9242f06a3 | cp-itb/contests | GEMASTIK2016/final/B-Ainge CP.cpp | /**
* Contest : GEMASTIK 2016 Final
* Team : Ainge CP
* Author : Luqman Arifin
* Problem : B
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 25;
int a[N];
// selisih - lebar
int brute(int p, int until, vector<pair<int, int>>& all, int diff, int lebar) {
if (p == until) {
all.emplace_b... | ALGO | 0.999926 | 3.869312 |
682078b5-d346-44cf-b5fe-7334c48c50b6 | J-onatha-n/csc103-lecture | practice-problems/04/linker/main.cpp | /* In this directory, you will find 3 cpp files. TODO: I want you to manually
* compile them all (using g++ -c) and link the resulting objects together.
* I have intentionally introduced a few linker errors that will require
* some editing of THIS file in order to resolve. (Leave the other cpp files
* untouched).... | ALGO | 0.999285 | 4.289493 |
d3099c57-4d6a-4371-a2e2-7ab76df80934 | GustavoPolicarpo/maratona | URI/MATHEMATICS/1761 - Christmas Decorations.cpp | // Author: Gustavo Policarpo
// Name: Christmas Decorations
// Level: 1
// Category: MATHEMATICS
// URL: https://www.beecrowd.com.br/judge/en/problems/view/1761
#include<bits/stdc++.h>
//LIFE IS NOT A PROBLEM TO BE SOLVED
using namespace std;
int main()
{
double A, B, C, pi=3.141592654;
while(cin >> A >> B >> C)
... | ALGO | 0.999309 | 4.022725 |
2ef60148-0ecf-4b68-9fa7-f1cefa9f565e | jhpetrichor/complex_prediction | src/lib/dag.cpp | /*
* @Description:
* @Author: jh
* @Date: 2024-04-30 17:11:48
* @LastEditors: wuyue.nan
* @LastEditTime: 2024-05-01 18:09:54
*/
#include "../../include/dag.h"
/**
* @description:
* @param {Node*} _ancestor
* @return {*}
* @author: wuyue.nan
*/
void Node::add(Node* _ancestor) {
ancestor.insert(_ancesto... | ALGO | 0.992411 | 4.172199 |
79112927-fd92-4437-a848-3765c661110b | teseryy/Cpp | tasks/12/main.cpp | #include <sstream>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <memory>
#include <cassert>
using namespace std;
class CDelivery
{
public:
CDelivery() = defau... | ALGO | 0.998061 | 5.62786 |
4e08836d-fe23-46cc-8a90-39c5f619433b | Pixelstar-uday/hardware_interfaces | neuralnetworks/aidl/utils/src/Utils.cpp | #include "Utils.h"
#include <aidl/android/hardware/common/Ashmem.h>
#include <aidl/android/hardware/common/MappableFile.h>
#include <aidl/android/hardware/graphics/common/HardwareBuffer.h>
#include <android/binder_auto_utils.h>
#include <android/binder_status.h>
#include <nnapi/Result.h>
#include <nnapi/SharedMemory.h... | TOOL | 0.885537 | 7.228756 |
013b3166-4d99-4c24-b7dd-2a4738baf90a | westmood1219/CodeRoad_remote | Cpp/STL_Algorithm/traversal.cpp | //for_each
//transform
#include<iostream>
using namespace std;
#include<string>
#include <vector>
#include <algorithm>
void print01(int val)
{
cout << val << " ";
}
//
class print02
{
public:
void operator()(int val)
{
cout << val << " ";
}
};
//for_each㷨÷
void test01() {
vector<int> v;
... | ALGO | 0.988958 | 4.616415 |
17252e58-42d8-414e-94fb-0e97c69f019a | montygupta32/Codeforces-Questions | lockdown.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ll tc;
cin>>tc;
while(tc--){
ll l,b;
cin>>l>>b;
int a=__gcd(l,b);
int sum = (l*b)/(a*a);
cout<<sum<<endl;
}
return 0;
} | ALGO | 0.99992 | 5.295341 |
738ea9d4-e0a8-4b47-9617-8ddf8646b69d | Just4Ease/abs | abs-extraction/TOOLS/tesseract-src/src/textord/pithsync.cpp | #include <cmath>
#include <cfloat> // for FLT_MAX
#include <vector> // for std::vector
#include "makerow.h"
#include "pitsync1.h"
#include "topitch.h"
#include "pithsync.h"
#include "tprintf.h"
#define PROJECTION_MARGIN 10 //arbitrary
/******************************************************************... | ALGO | 0.999782 | 3.964086 |
51e47dcc-37d5-49ca-97e8-cfe2bddd8b02 | nesangcode/uva-solution | 10685.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
class UnionFind{
private:
vector<ll> p, setSize;
public:
UnionFind(ll n){
p.assign(n, 0); setSize.assign(n, 1);
for(ll i = 0; i < n; i++) p[i] = i;
}
ll maxSet = 1;
ll findSet(... | ALGO | 0.999779 | 4.410743 |
034d4eae-4ddd-4c16-982f-42f4c06fad8e | Shokkenn/Notess | cppOops/37 Object Pointers Polymorphism 2.cpp | #include<iostream>
#include<cstring>
using namespace std;
class person{
int len;
char *name;
public:
void getdata();
void display(){
cout << name << endl << endl;
}
};
void person :: getdata(){
char * ch = new char[20];
cin >> ch;
len = strlen(ch);
name = new char[len];... | TOOL | 0.914248 | 3.41578 |
bd98ad17-3797-465d-933b-89d5654f7b8b | kd2-80143/CPP | A_9Q_1.cpp | #include<iostream>
using namespace std;
int factorial(int n)
{
if(n < 0)
{
throw 3;
}
if(n==0 || n==1)
{
return 1;
}
return n*factorial(n-1);
}
int main()
{
int num;
int result = 0;
cout << "Enter a number : ";
cin >> num;
try
{
result =... | ALGO | 0.993338 | 4.988861 |
07916a2e-029f-4d88-a067-f432832bb560 | marchfra/Algoritmi | Chapter06/Derivative/main.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <limits>
// #include "/Users/francescomarchisotti/Documents/Uni/Anno_4/Algoritmi/Libs/include/swap.hpp"
// #include "/Users/francescomarchisotti/Documents/Uni/Anno_4/Algoritmi/Libs/include/quad.hpp"
// #include "/Users/francescomarchis... | ALGO | 0.999595 | 5.600241 |
f7373f1c-e258-4b7b-93b2-9a46f6dea9fb | yukikamome316/atcoder-archive | abc192/abc192_c_32670409_AC.cpp | /*
* Author: yukikamome316
* Submission URL: https://atcoder.jp/contests/abc192/submissions/32670409
* Submitted at: 2022-06-23 15:49:21
* Problem URL: https://atcoder.jp/contests/abc192/tasks/abc192_c
* Result: AC
* Execution Time: 37 ms
*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++... | ALGO | 0.999882 | 4.540147 |
0d710298-ee5d-4605-adeb-4f8a0078231f | anushka2327/Operators | Coordintes in quadrants.cpp | // program to find the coordinates in which quadrant
#include <iostream>
using namespace std;
int main() {
int x;
cout<<"enter x:";
cin>>x;
int y;
cout<<"enter y:";
cin>>y;
if (x&y>0){
cout<<"cordinates x and y lie in the first quadrant ";
}
else if(x&y<0){
cout<<"c... | ALGO | 0.999379 | 4.153233 |
e13d6235-76c6-4547-ab91-3145b15534a0 | TensorCodeGen/tensor-codegen | llvm/lib/CodeGen/MachineInstrBundle.cpp | #include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h... | TOOL | 0.905114 | 7.92069 |
fda9660f-c3b3-4972-8f9d-97f14b5f2985 | moti9/iCode | cpp/2d ary5.cpp | #include<stdio.h>
int main(void)
{ int i,n,temp;
printf("Enter required number in an Array=");
scanf("%d",&n);
int ary1[n];
for(i=0;i<n;i++){
printf("Array Element-%d=",i);
scanf("%d",&ary1[i]);}
printf("Original Array:\n");
for(i=0;i<n;i++){
printf("[%d]=%d\t",i,ary1[i]);}
int ary2[n];
for(i=0;i<n;i++){
temp=a... | ALGO | 0.998961 | 3.015207 |
adb6641e-9e5c-449b-bf94-101d1aa59714 | sakibul-shovon/cpp-practice | Codeforces/A_Calculating_Function.cpp | // File Name: A_Calculating_Function.cpp
// Date: 2023-10-31
// Time: 00:21:38
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long int
#define vint vector<int>
#define vll vector<long long int>
#defin... | ALGO | 0.999708 | 4.637884 |
309dcd5b-37ef-416c-ba40-f892413b84de | sanjeev-dhakjariwala/algozenith | intervals/MinimumPlatforms.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int findPlatform(vector<int> &arr, vector<int> &dep)
{
int n = arr.size();
// Validate input
for (int i = 0; i < n; i++)
{
if (arr[i] > dep[i])
{
cout << "Invalid input... | ALGO | 0.999641 | 5.402443 |
818ddb06-5d0d-464e-b775-91076bc56cf3 | KaranGulve4342/DSA | beginning/Subsequence Addition (Hard Version).cpp | // CODEFORCES 1100 RATED
#include<bits/stdc++.h>
using namespace std;
#define int long long
string solve(){
int n;
cin >> n;
vector<int> v(n);
for(int i = 0;i < n;i++){
cin >> v[i];
}
sort(v.begin(), v.end());
int sum = 0;
for(int i = 0;i < n;i++){
if(v[i] == 1){
... | ALGO | 0.999681 | 4.649131 |
5389b746-43e4-49bd-a7f1-2bc5d1b1f4b7 | ishandutta2007/codeforces | pllk/normal/513/A.cpp | #include <iostream>
using namespace std;
int n1, n2;
int main() {
cin >> n1 >> n2;
if (n1 > n2) cout << "First\n";
else cout << "Second\n";
} | ALGO | 0.999813 | 4.737949 |
dd618597-e3fe-4a72-a3d0-efb14402343b | muskankapoor/datastructures | linkedlist/insert.cpp | //INSERT NODE IN THE BEGINNING OF THE LSIT
#include <iostream>
using namespace std;
//struct to create Node
struct Node{
int data;
Node * next; //stores address of next
};
Node *head; //stores address of head
//global variable
void insert(int x){
//the following is literally a new node
Node *temp=new Node... | ALGO | 0.999409 | 4.28286 |
aadaf93b-46db-4d25-bd5e-d81ad8c8e922 | ctosp/frameworks_av | media/libstagefright/codecs/amrnb/common/src/lsp_lsf.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsp_lsf.c
Functions: Lsp_lsf
Lsf_lsp
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template.
Description: Deleted variables listed in the Local Stores Needed/Modified
... | ALGO | 0.999111 | 6.377015 |
0752b9ac-95ff-44e0-893c-31345016313f | Strider-7/code | BST/ceil.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int x)
{
data = x;
left = nullptr;
right = nullptr;
}
};
Node *insert(Node *root, int data) {
if (!root)
return new Node(data);
if (data==root->data)
... | ALGO | 0.999994 | 4.168542 |
365190f3-6adf-4c1c-8721-834b031c9e22 | jinsung-kim/binary-search | 0076-Merging-Binary-Trees.cpp | #include "0000-DataStructures.hpp"
Tree *solve(Tree *node0, Tree *node1)
{
if (!node0 && !node1)
return nullptr;
if (!node0)
return node1;
if (!node1)
return node0;
node0->val += node1->val;
node0->left = solve(node0->left, node1->left);
node0->right = solve(node0->right... | ALGO | 0.999967 | 4.7658 |
2bd0fffe-e0d9-4321-ac77-9e375d8e1a5c | AntennaeVY/CP | CodeForces/1100/Collatz Conjecture.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--) {
int x, y, k;
cin >> x >> y >> k;
while(k) {
int r = y - (x % y);
if (k < r)
break;
x += r, k -= r;
while(x % y == 0)
x /= y;
... | ALGO | 0.999991 | 3.753005 |
8df779f9-dd4c-4255-bfe8-2692a59c5124 | telgohry/Problem-Solving | Level 1/13-max-of-three-numbers.cpp | // Program that reads three numbers
/*
- Print the max number
*/
#include <iostream>
void read_numbers(int &num1, int &num2, int &num3){
std::cout << "\nPlease enter the first number\n";
std::cin >> num1;
std::cout << "\nPlease enter the second number\n";
std::cin >> num2;
std::cout << "\nPlease enter ... | ALGO | 0.963857 | 4.885181 |
270b3e66-f529-4f0f-b0d9-b814208ad3b7 | charismaTazdid/JS-Problem-solved | steadyGene.cpp | // Problem: https://www.hackerrank.com/challenges/bear-and-steady-gene/
bool isvalid(map<char,int> a, int l){
if(a['A'] <= l && a['G'] <= l && a['T'] <= l && a['C'] <= l) return true;
return false;
}
int steadyGene(string gene) {
int n = gene.size(), mini = n;
map<char,int> am;
for(char c: ge... | ALGO | 0.999932 | 5.265544 |
51f49bc1-4da2-4db1-a039-121f62c94033 | ishandutta2007/codeforces | alexandra_udristoiu/normal/1261/D1.cpp | #include<iostream>
#define mod 998244353
#define DIM 200005
using namespace std;
int n, k, i, sol, x, inv, nr;
int fact[DIM], v[DIM];
int mult(int x, int e){
if(e == 0){
return 1;
}
else{
int a = mult(x, e / 2);
if(e % 2 == 1){
return a * 1LL * a % mod * x % mod;
... | ALGO | 0.999996 | 4.472008 |
322ba57e-5d59-4a31-ac84-931cb5e9c880 | edriskus/6-semestras | Lygiagretusis Programavimas/Laboratoriniai/2/antraslab_mpi.cpp | //#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//#include <random>
#include <iostream>
// #include <omp.h>
#include <mpi.h>
#include <iostream>
#include <iomanip>
using namespace std;
void memBegin(double** &M, int** &P, const int n);
void memGen(double** &M, int** &P, const int n);
v... | ALGO | 0.999892 | 3.834609 |
89244071-7ca1-4caa-aa4f-a9c93729c287 | Leviethal/DSA | Lab_1(EE)/Max_subarray.cpp | #include<bits/stdc++.h>
using namespace std;
int Max_subarray(int arr[], int s){
int maxsum=INT_MIN;
int current=0;
for(int i=0;i<s;i++){
current+=arr[i];
if(current<0)
current=0;
maxsum=max(maxsum,current);
}
return maxsum;
}
int Max_subseq(int arr[], int s) {
i... | ALGO | 0.999884 | 3.871017 |
93ab7bdf-6668-4c80-8005-b755d97b4209 | rebeccajames/Secure-messenger | aes_client.cpp | /*****************************************************************************/
/* Course: CNT5505 Data and Computer Communications */
/* Semester: Spring 2016 */
/* Name: Rebecca James */
... | WEB | 0.940895 | 3.926511 |
d1f18d33-a2a3-4583-98c5-04017451bbe5 | rjw57/tiw-computer | emulator/src/mame/machine/kabuki.cpp | /***************************************************************************
"Kabuki" Z80 encryption
The "Kabuki" is a custom Z80 module which runs encrypted code. The encryption
key is stored in some battery-backed RAM, therefore the chip has the annoying
habit of stopping working every few years, when the battery d... | ALGO | 0.985608 | 6.074525 |
553afdd5-2797-4e15-9a4e-a7d12577e437 | FenHua/Dynamic_programming | MatrixChain/MatrixChain/MatrixChain.cpp | /*MatrixChain.cpp : ̨Ӧóڵ㡣
ö̬滮ʽ⣬ݹʽԵϵķʽм㡣ڼ
УѽĴ𰸡ÿֻһΣں
Ҫʱֻһ£Ӷ˴ظ㣬յõʽʱ㷨
*/
#include "stdafx.h"
#include"iostream"
using namespace std;
const int L = 7;
int MatrixChain(int n, int**m, int**s, int *p);
void Traceback(int i, int j, int**s);//Ž
int main()
{
int p[L] = { 30, 35, 15, 5, 10, 20, 25 };
int**s = new int*[L];
... | ALGO | 0.999997 | 3.328404 |
66b8423d-d334-43b5-9189-adc07758c2f3 | CarlosGonzalez14/actividad-5 | 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 |
f9ccef09-e315-4750-8c1c-e17cbcfed547 | RishabhSkr/LeetcodeProblem | 1196-filling-bookcase-shelves/1196-filling-bookcase-shelves.cpp | class Solution {
public:
int n;
int WIDTH ;// when new shelf starts
vector<vector<int>>dp;
int solve(int ind,int remWidth,int maxH,vector<vector<int>>& books){
// base case
if(ind>=n)return maxH;
if(dp[ind][remWidth]!=-1)return dp[ind][remWidth];
// explore
int bo... | ALGO | 0.999874 | 6.127839 |
4cb10916-c887-48a4-960c-a01ca412a654 | ScandiumOS/packages_inputmethods_LatinIME | native/jni/src/suggest/core/result/suggestions_output_utils.cpp | #include "suggest/core/result/suggestions_output_utils.h"
#include <algorithm>
#include <vector>
#include "dictionary/utils/binary_dictionary_shortcut_iterator.h"
#include "suggest/core/dicnode/dic_node.h"
#include "suggest/core/dicnode/dic_node_utils.h"
#include "suggest/core/dictionary/error_type_utils.h"
#include ... | TOOL | 0.981215 | 7.499663 |
d36b3a89-5ae6-4e57-9eb3-ee95354fc337 | ThisoVallabaDass/Learnings | C++/pallindrom_with_spaces.cpp | #include <bits/stdc++.h>
using namespace std;
bool ispalindrome(string s){
int low=0;
int high=s.size()-1;
while(low<=high){
if(s[low]==s[high]){//checks the first ad last element
return 1;
}
else{
return 0;
}
low++;
high--;
}
}
i... | ALGO | 0.999917 | 4.797599 |
a595926d-fb25-4001-a66f-bbe7a17e1aa1 | kazi-nayeem/Programming-Problems-Solutions | lightoj/1096 - nth Term(v.0).cpp | #include<cstdio>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<cassert>
using namespace std;
struct maTix{
int arr[4][4];
};
const int mod = 10007;
maTix mat, unit;
maTix matexp(int p);
maTix multiply(maTix a, maTix b);
int main()
{
memset(unit.arr,0,sizeof unit.arr);
... | ALGO | 0.999899 | 4.060082 |
58c2994f-05ab-4ed0-b4d0-1171e79cf7d1 | blizmax/OpenRL_Baker | Source/3rdParty/UVAtlas/isochart/mergecharts.cpp | #include "../pch.h"
#include "isochartmesh.h"
#include "../maxheap.hpp"
using namespace Isochart;
using namespace DirectX;
namespace
{
const size_t MAX_FACE_NUMBER = 0xfffffffe;
};
//-------------------------------------------------------------------------------------
// Try to merge small charts
HRESULT CIsocha... | ALGO | 0.937605 | 5.593817 |
fabad643-181f-44c8-a21e-84920e53d7c4 | wabiverse/UnrealEngineOldArchived | Engine/Source/Runtime/Core/Private/Android/AndroidPlatformMisc.cpp | #include "Android/AndroidPlatformMisc.h"
#include "Android/AndroidJavaEnv.h"
#include "HAL/PlatformStackWalk.h"
#include "Misc/FileHelper.h"
#include "Misc/App.h"
#include "Misc/ConfigCacheIni.h"
#include "Misc/FeedbackContext.h"
#include "Misc/OutputDeviceRedirector.h"
#include "HAL/IConsoleManager.h"
#include "Module... | TOOL | 0.954068 | 4.037979 |
fd6a5b43-1be4-471a-91f6-51b96aa515e2 | WeiTing98/PracticeLeetCode | 7.revInt.cpp | #include <bits/stdc++.h>
using namespace std;
int reverse(int x)
{
long og = x, ans = 0;
while (og != 0)
{
ans = ans * 10 + og % 10;
og /= 10;
}
if (ans > INT32_MAX || ans < INT32_MIN)
ans = 0;
return ans;
}
int main()
{
int x;
cin >> x;
cout << reverse(x);
... | ALGO | 0.999958 | 5.258099 |
43872c4e-5255-4554-8da3-bb97dd72b329 | franv314/competitive | CSES/Strings/finding_periods.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
string s; cin >> s;
vector<int> z(s.size());
int l = 0, r = 0;
for (int i = 1; i < s.size(); i++) {
if (i < r) z[i] = min(r - i, z[i - l]);
while (i + z[i] < s.size() && s[i ... | ALGO | 0.999936 | 4.25311 |
7129d268-d0a9-49c0-95c2-1dc3784d03b3 | amanBhawsar/Coding-Tree | CODECHEF/Contests/Encoding Aug'19/SAVKONO.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >>t;
while(t--){
int n,z,minAttack=0,temp;
cin >> n >> z;
vector<int> v1;
for(int i=0;i<n;i++){
cin >> temp;
v1.push_back(temp);
}
make_heap(v1.begin(), v1.end());
... | ALGO | 0.999965 | 4.151963 |
965d684e-a997-4519-a1eb-8877974b29f9 | raincross7/code-similarity | codes/train_code/problem449/problem449_386.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
using ll = long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using P = pair<int, int>;
int main()
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> ... | ALGO | 0.996335 | 3.357621 |
0f4e6d60-0af9-4ad8-9877-b7ac08d1020f | WangSimiao2000/GAMES101-Assignments | Assignment3/rasterizer.cpp | //
// Created by goksu on 4/6/19.
//
#include <algorithm>
#include "rasterizer.hpp"
#include <opencv2/opencv.hpp>
#include <math.h>
rst::pos_buf_id rst::rasterizer::load_positions(const std::vector<Eigen::Vector3f> &positions)
{
auto id = get_next_id();
pos_buf.emplace(id, positions);
return {id};
}
rst... | TOOL | 0.9397 | 5.681585 |
0651afcb-2605-41a0-9013-56d527a396c5 | imalgrab/uni | C++17/lista4/main.cpp | #include <iostream>
#include <list>
#include <set>
#include <utility>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
vector<double> v = {1.25, 3.14, 7.6, 4.2, 31.11, 7.2, 0.3, 0.15, 492.4};
list<string> l = {"banan", "ananas", "gruszka", "malina", "pomidor"};
set<int> s = ... | ALGO | 0.98879 | 3.842976 |
69842cf2-48c3-4a88-b320-79e1388903cb | Eduardofig/Competitive-Programming-Solutions | cf-ladder/ladder-1/41.cpp | #include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using l = long;
using ul = unsigned long;
using ll = long long;
using ull = unsigned long long;
const int MXN = 2e5 + 3;
const int INF = 0x3f3f3f3f;
const int MOD = 1e7 + 9;
int n;
//int k;
//int a[MXN];
//int b[MXN];
string s;
void solve()... | ALGO | 0.999865 | 3.454495 |
fd782ab5-f072-4518-b1b6-97d316f68eca | AlanBinu007/CodeForces-Solutions | 334B - Eight Point Sets.cpp | //4176866 Jul 27, 2013 12:50:16 PM fuwutu 334B - Eight Point Sets GNU C++0x Accepted 30 ms 0 KB
#include <iostream>
#include <algorithm>
using namespace std;
struct point
{
int x;
int y;
};
bool cmp(const point& left, const point& right)
{
return (left.x < right.x)
|| (left.x == right.x && ... | ALGO | 0.999862 | 4.590782 |
06a990ae-f75b-4323-88df-d905ce3c8d1d | Mackenzie-98/Solutions | Training Camp/UNAL/2021/Day10/j.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define ft first
#define sd second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#def... | ALGO | 0.999973 | 3.515398 |
3072ec73-008b-4fdc-8707-43a2072202e4 | samruddhiDharankar/leetcode | arrays/CreateTargetArray_in_theGivenOrder.cpp | // 1389. Create Target Array in the Given Order
// Given two arrays of integers nums and index. Your task is to create target array under the following rules:
// Initially target array is empty.
// From left to right read nums[i] and index[i], insert at index index[i] the value nums[i] in target array.
// Repeat the ... | ALGO | 0.999995 | 6.476082 |
564e5022-1ce9-4422-b00b-c843a7f78305 | pavel-ryzhov/global_vars | runs/007477.cpp | #include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>
char* DigitsToLetters[] = {".,?", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
struct T9Word
{
public:
std::string Word;
int Frequent;
bool operator < (const T9Word aWord) const;
};
bo... | ALGO | 0.999378 | 3.819024 |
b0521322-4de2-4458-a877-50d7e5f93a93 | rds1983/SealangSharp | llvm/tools/clang/lib/Analysis/CFGReachabilityAnalysis.cpp | #include "clang/Analysis/Analyses/CFGReachabilityAnalysis.h"
#include "clang/Analysis/CFG.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
using namespace clang;
CFGReverseBlockReachabilityAnalysis::CFGReverseBlockReachabilityAnalysis(
const CFG &cfg)
: analyzed(cfg.getNumBlockIDs(), false... | TOOL | 0.992616 | 7.0733 |
014d2368-034c-4b18-8404-5ddeadff018f | mohamedaminebennacef/Problem-Solving | Implementation/A 2-3 Moves/A 2-3 Moves.cpp | #include <bits/stdc++.h>
using namespace std;
#define newL cout<<"\n"
int main() {
freopen("input.txt","r",stdin);
int t;
cin>>t;
int ans;
while(t--){
int n;
cin>>n;
if (n==1)
ans=2;
else {
if(n%3==0)
ans=n/3;
else
... | ALGO | 0.9999 | 3.640053 |
7cb37059-2ecd-42c3-a55a-1fa824474524 | tranhuy105/hocdot | ttud/cap/socaptongnho.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/*
Đề bài (Two Sum < X):
Đếm số lượng cặp (i, j) trong mảng `nums` sao cho:
nums[i] + nums[j] < X
với 0 <= i < j < n.
Input:
- Một mảng số nguyên `nums`.
- Một số nguyên `X`.
Output:
- Trả về số lượng cặp (i, j) thỏa mãn điều kiện.
*/
i... | ALGO | 0.999995 | 6.127918 |
d403c352-8ac1-438f-aea4-dc7acc9d2b9a | eric-gurrola/isce3 | lib/isce/core/Kernels.cpp | #include "Kernels.h"
#include <isce/except/Error.h>
#include <complex>
#include <cmath>
#include <type_traits>
using isce::except::RuntimeError;
/*
* Bartlett
*/
// constructor
template <typename T>
isce::core::BartlettKernel<T>::
BartlettKernel(double width) {
this->_halfwidth = fabs(width / 2);
}
// call... | ALGO | 0.909484 | 6.120732 |
defdcdeb-f4cd-42d8-b581-f3a69007b5c6 | dev-moonsc/BOJ | Bronze/Bronze_I/24416.cpp | #include <iostream>
using namespace std;
int dp[41], x, y;
long fib_recur(int n) {
if (n == 1 || n == 2) {
++x;
return 1;
}
return fib_recur(n - 1) + fib_recur(n - 2);
}
long fib_dp(int n) {
dp[1] = dp[2] = 1;
for (int i = 3; i <= n; ++i) {
++y;
dp[i] = dp[i - 1] + dp[i - 2];
}
return ... | ALGO | 0.999849 | 4.45607 |
c51cdb9a-9185-49dc-8614-5b7609d81dce | puppy955101/code | b113.cpp | #include<iostream>
#include<algorithm>
using namespace std;
struct xx{
long long a, b;
};
long long gcd(long long a, long long b){
long long t;
if (a == b&&a == 0)return 1;
while (b){
t = a%b, a = b, b = t;
}
return a;
}
xx s(xx a){
long long g = gcd(a.a, a.b);
a.a /= g;
a.b /= g;
if (a.b < 0)
a.a *= -1,... | ALGO | 0.999668 | 3.284689 |
00d6c657-a864-42c5-9a98-4abf118a5d1f | sheeluofficial/practice | OthersCode/LeetCode-Solutions-master/LeetCode-Solutions-master/C++/cherry-pickup-ii.cpp | // Time: O(m * n^2)
// Space: O(n^2)
class Solution {
public:
int cherryPickup(vector<vector<int>>& grid) {
vector<vector<vector<int>>> dp(2,
vector<vector<int>>(grid[0].size() + 2,
vector<int>(grid[0].size() + 2, numeric_limits<int>::min())));
dp[0][1][grid[0].s... | ALGO | 0.999998 | 6.494014 |
048cbf6f-3ed5-4456-9a23-f456ec3f7de5 | upadrastaharshavardhan/programing_quections-_c- | 899 A. Splitting in Teams.cpp | //Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
fastread();
ll n;
int a[200001];
... | ALGO | 0.999991 | 3.606355 |
cefcf470-e3fa-415f-9e77-6667dcc33fa9 | baofuhann/FISCO_BCOS_FL | deps/src/tbb/examples/parallel_for/tachyon/src/shade.cpp | /*
* shade.cpp - This file contains the functions that perform surface shading.
*/
#include "machine.hpp"
#include "types.hpp"
#include "macros.hpp"
#include "light.hpp"
#include "intersect.hpp"
#include "vector.hpp"
#include "trace.hpp"
#include "global.hpp"
#include "shade.hpp"
void reset_lights(void) {
numl... | ALGO | 0.982631 | 6.070633 |
52a4bfbf-2ff7-44c3-a0a6-530dc7b164b3 | Blockost/scheduler | src/Scheduler/SequentialScheduler.cpp | /*!
\file SequentialScheduler.cpp
\author Simon ESPIGOLÉ - Teddy GILBERT - Hugo LEGRAND
\version 0.1
\date 01/04/2016
\brief Sequential scheduler definition class
\remarks none
*/
#include "SequentialScheduler.h"
using namespace boost::interprocess;
SequentialScheduler::SequentialScheduler(... | ALGO | 0.916346 | 5.608155 |
661639ca-4a5c-4acd-947c-58eddee20c3c | sachinpal293/Datastructure-2023 | c++ with DSA/Sorting/insertion_sort.cpp | #include"iostream"
using namespace std;
void insertionsort(int *arr, int n)
{
for(int i = 1;i<n;i++)
{
int temp = arr[i];
int j = i-1;
for(j;j>=0;j--)
{
if(arr[j]>temp)
{
arr[j+1] = arr[j];
}
else
{
... | ALGO | 0.999927 | 4.253694 |
d60ac563-8aaf-4abb-acec-986b9c66044a | sidduyadav1/DSA | group anagrams leetcode.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
map<string,vector<string>>mp;
for(auto str:strs){
string s=str;
sort(s.begin(),s.end());
mp[s].push_back(str);
}
vector<vector<string>>ans;
for(auto iter=mp.begin();iter!=mp.end();iter++... | ALGO | 0.999978 | 6.293849 |
beeb0035-2138-4c16-956b-1e7f6e4e8850 | lsls01/C_Specialization_Peking_Uni | S4/W06 深度优先搜索(1)/find_path.cpp | #include <cstring>
#include <iostream>
#include <vector>
using namespace std;
int K, N, R, S, D, L, T;
struct Road {
int d, L, t;
};
vector<vector<Road> > cityMap(110);
int minLen = 1 << 30;
int totalLen;
int totalCost;
int visited[110];
int minL[110][10100];
void Dfs(int s) {
if (s == N) {
minLen = min(mi... | ALGO | 0.999401 | 3.532464 |
7de9860d-bce5-48f5-862a-862dbf96cc3f | wuillou8/SuperRepository | Simulations/Finance/ToyPricer/EIGEN/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.982994 | 3.669638 |
e5c7020e-b5e2-45f4-9921-3143dedaa943 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/answer_20210104143136.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999997 | 3.755951 |
8dd37edd-bd19-42f7-a079-285ef7ff5783 | AquariOS/frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/deringing_chroma.cpp | #include "mp4dec_lib.h"
#include "post_proc.h"
#ifdef PV_POSTPROC_ON
void Deringing_Chroma(
uint8 *Rec_C,
int width,
int height,
int16 *QP_store,
int,
uint8 *pp_mod
)
{
/*----------------------------------------------------------------------------
; Define all local variables
... | ALGO | 0.998739 | 3.841888 |
44cda7e8-7bf1-46da-90d2-dee3c6c2d143 | flucloxin500/CSE | CSE-2321-22/LinkedList/nElement.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
};
void LinkedListTraversal(Node *ptr)
{
while (ptr != nullptr)
{
cout << "Element: " << ptr->data << endl;
ptr = ptr->next;
}
}
Node *createLinkedList(int n)
{
Node *head = nullptr;
Node *t... | ALGO | 0.997726 | 5.916089 |
c21de356-092e-4635-9a68-0ce40375fbf2 | ishandutta2007/codeforces | waynetu/normal/914/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
int a[maxn], cnt;
struct segtree {
#define m ((l + r) >> 1)
segtree *lc, *rc;
int val;
void pull() { val = __gcd(lc->val, rc->val); }
segtree(int l, int r) {
lc = rc = nullptr;
if (l == r) { val = a[l]; return; }
... | ALGO | 0.99996 | 4.452047 |
f1809f44-5e41-4360-b235-555da19806f0 | SumitKKumawat/Udacity---Flying-Car-Nanodegree | Project_04/src/QuadControl.cpp | #include "Common.h"
#include "QuadControl.h"
#include "Utility/SimpleConfig.h"
#include "Utility/StringUtils.h"
#include "Trajectory.h"
#include "BaseController.h"
#include "Math/Mat3x3F.h"
#ifdef __PX4_NUTTX
#include <systemlib/param/param.h>
#endif
void QuadControl::Init()
{
BaseController::Init();
// vari... | ALGO | 0.972537 | 5.520861 |
a25a3004-30e4-4e7f-bc38-75d988e74466 | pandeyyabhishek/GlobalTrend_Programming_Assessment | Ques6.cpp | // 6. Write a function to find the factorial of a given number.The function should return the factorial of the number.
#include <iostream>
using namespace std;
int factorial(int n)
{
if (n <= 1)
return 1;
return n * factorial(n - 1);
}
int main()
{
cout << factorial(5) << endl; // Output: 120
... | ALGO | 0.998015 | 4.513967 |
3a11ed83-1827-4f76-9b39-c014cd4721fe | razimantv/leetcode-solutions | Solutions/M/minimum-hours-of-training-to-win-a-competition/Solution.cpp | // https://leetcode.com/problems/minimum-hours-of-training-to-win-a-competition
class Solution {
public:
int minNumberOfHours(int initE, int initX, vector<int>& energy,
vector<int>& experience) {
int n = energy.size();
int minE = initE, minX = initX;
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999918 | 5.613459 |
c3962077-368e-4876-a1be-cee299a9d493 | Rimpi246/6Companies30days | GS/7.PositionOfMthItem.cpp | // https://practice.geeksforgeeks.org/problems/find-the-position-of-m-th-item1723/
int findPosition(int N, int M, int K)
{
if (N == 1)
return N;
if (K + M <= N)
return K + M - 1;
return ((K + M - 1) % N == 0) ? N : (K + M - 1) % N;
} | ALGO | 0.999957 | 4.129892 |
906bdd9e-f573-4b87-8499-7bfe4e72c7c4 | TrishaBarua308/CPP_files | AtillaFvrtPrblm.cpp | //1760B
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string s;
cin>>s;
sort(s.begin(), s.end());
//cout<<s[n-1]<<endl;
cout<<int(s[n-1])-96<<endl;
}
return 0;
} | ALGO | 0.998631 | 3.896573 |
994514a3-9238-45ec-981a-615c2ea4f880 | Piyusss/Lc-2024 | 3477-minimum-operations-to-make-binary-array-elements-equal-to-one-ii/minimum-operations-to-make-binary-array-elements-equal-to-one-ii.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int n=nums.size();
int flips=0;
int curFlipCount=0;
for(int i=0;i<n;i++){
if(curFlipCount%2==nums[i]){
flips++;
curFlipCount++;
}
}
return... | ALGO | 0.999966 | 5.90678 |
960035d5-2f96-4ded-885e-ec1fdf2ba17f | Kawser-nerd/CLCDSA | Source Codes/AtCoder/arc053/A/732839.cpp | #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <map>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) f... | ALGO | 0.993227 | 3.397813 |
afe6fb9f-57a1-4a4e-af6e-befeca944711 | PrateekRohilla/DSA-Fundamentals | maths/divisorsOfNumber.cpp | #include<iostream>
#include<math.h>
using namespace std;
main(){
int n;
cin>>n;
cout<<endl<<endl;
//O(n)
// for(int i=1;i<=n;i++)
// if(n%i == 0)
// cout<<i<<" ";
//O(sqrt(n))
for(int i=1;i<=sqrt(n);i++){
if(n%i == 0){
cout<<i<<" ";
i... | ALGO | 0.999882 | 4.123047 |
438b8e2b-cf45-4193-9ac8-7da32be094a2 | innovacoin/innova | src/innova-cli.cpp | #include "chainparamsbase.h"
#include "clientversion.h"
#include "rpcclient.h"
#include "rpcprotocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#include <stdio.h>
#include <event2/event.h>
#include <event2/http.h>
#include <event2/buffer.h>
#include <event2/keyvalq_s... | WEB | 0.98777 | 6.496823 |
0197f4b4-a22c-4692-a842-4c00a54b6535 | yusra937shaikh/CPP-PROGRAMMING | UNIT 1 PRACTICAL ASSIGNMENT/9.cpp | //write a c++ program to find the area of rectangle
#include <iostream>
using namespace std;
class area
{
public:
void data()
{
float l,w,aor;
cout<<endl<<"ENTER THE VALUE OF LENGTH: ";
cin>>l;
cout<<endl<<"ENTER THE VALUE OF WIDTH: ";
cin>>w;
aor=l*w;
cout<<endl<<"AREA OF RECTANGLE IS :... | TOOL | 0.948043 | 3.15197 |
184951a4-7624-4cdf-b1ae-23c1f9edfd39 | availrum/newb | star12.cpp | #include<iostream>
using namespace std;
int main(){ //2522
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N;
cin>>N;
for(int i=1; i<=N; ++i){
for(int j=0; j<N-i; ++j){
cout<<' ';
}
for(int j=0; j<i; ++j){
cout<<'*';
}
... | ALGO | 0.999913 | 3.863361 |
8c5f14b1-85cb-47c2-a51e-b1406a5d26b2 | ShahmirAlam/BloomFilter | BloomFilterTest.cpp | #include <iostream>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <unordered_set>
#include "BloomFilter.h"
#include "HashFunctions.h"
using namespace std;
const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const unsigned int MIN_K = 2;
const unsigned int MAX_K = 5;
const ... | TEST | 0.969318 | 6.485487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.