uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9f4d2ccd-b14a-4ef2-aaee-bd30602c6bca | devparthgarg/Data-Structures-and-Algorithms | 11. Linked List/20 Insert At Tail Circular LL/20 Insert At Tail Circular LL.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node* next;
Node(int data_)
{
data=data_;
next=NULL;
}
};
//Time: O(N)
//Space: O(1)
Node* insertAtTail(Node* &head,int key)
{
Node* n=new Node(key);
if(head==NULL)
{
n->next=n;
return n;
}
//traverse till last node
//... | ALGO | 0.999762 | 4.845713 |
7daa5090-68a0-4d12-bd1e-f60993823f19 | Bx-champ/coding-practice- | reverse_words.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
string s1="";
string w="";
cout<<"enter the string:";
getline(cin,s);
s=s+" ";
for(int i=0;i<s.size();i++){
char g=s[i];
if(g!=' '){
w=w+g;
}else{
s1=w+" "+s1;
... | ALGO | 0.999601 | 3.535619 |
960d0a89-612c-43d0-ba7a-7efb099de383 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/AndOrGame_20210108163615.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.999963 | 3.597243 |
c709e023-35a5-4515-946e-e7fced325004 | prat-glitch/CP | A_Dora_s_Set.cpp | #include<bits/stdc++.h>
using namespace std ;
int gcd(int a , int b )
{
while(b)
{
swap(a, b);
}
return a ;
}
int solve()
{
int t;
cin>>t;
while(t--)
{
int l;
cin>>l;
int r;
cin>>r;
set<int>s;
int n =s.size();
for(int i=0 ; i< n; i++ )
{
s.insert(i);
}
int oper=0;
whil... | ALGO | 0.999821 | 4.298527 |
65261600-e0e2-410b-99b1-57e796605edb | FaizanCod/Computer-Networks-Lab | programs/playfair-cipher.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
string key;
string inputText, cipherText;
vector<vector<char>> mat(5, vector<char>(5));
pii check(vector<vector<char>> &v, char ch){
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
if(v[i][j]==ch)
return {i,j};
}
}
}
string removeSpac... | ALGO | 0.999329 | 4.970902 |
08410d7d-d76d-4b18-9b7a-e2c4099b4d87 | AryanGuptaJi/CPP_DSA | Bit/BinToDec.cpp | #include<iostream>
#include <cmath>
using namespace std;
int main(){
int n; cin>>n;
int i=0, ans=0;
while(n > 0){
int digit = n%10;
if(digit==1){
ans = ans + pow(2,i);
}
n = n/10;
i++;
}
cout<<ans<<endl;
} | ALGO | 0.99995 | 4.079964 |
64e25f0e-6d4e-4638-89b5-cf10bc07b06b | RashiBaranwal/Cpp-Practices | tut18b.cpp | #include <iostream>
using namespace std;
int fib(int n)
{
if (n < 2)
{
return 1;
}
return fib(n - 2) + fib(n - 1);
}
// fib(5)
// fib(4) + fib(3)
// fib(2) + fib(3) + fib(2) + fib(3)
int factorial(int n)
{
if (n <= 1)
{
return 1;
}
return n * factorial(n - 1);
}
//... | ALGO | 0.999205 | 4.182612 |
1567f83d-87b1-44ff-ab6c-3dab0fad100f | jensimaniya/CPP | practice/pro2.cpp | // #include<iostream>
// using namespace std;
// int Linier(int arr[],int t, int n){
// for(int i=0; i<n; i++){
// if(arr[i]==t){
// return i;
// }
// }
// return -1;
// }
// int main(){
// int arr[5]={10,20,30,40,50};
// int t;
// cout<<"enter your Target Value:";
//... | ALGO | 0.999788 | 5.255035 |
b1c69b53-1f8a-417b-8e7e-64f0b5f8fdd9 | ganesh94jrl/helpfull_placement_progrmmes | Armstrong_number.cpp | // check given number is armstrong number or not
#include <iostream>
#include <cmath>
using namespace std;
bool isArmstrong(int num) {
int originalNum = num;
int sum = 0;
int numDigits = to_string(num).length();
while (num > 0) {
int digit = num % 10;
sum += pow(digit, numDigits);
... | ALGO | 0.999924 | 5.758339 |
65cdf511-2c5c-4ddf-9312-92d7767d31d5 | Sumanth-NR/Data_Structures_Cpp | ComplexDataStructures/R_Trees/RTrees_raw.cpp | #include <iostream>
#include <float.h>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <vector>
using namespace std;
#define inf INT32_MAX
#define TOTAL 2000
// A Point is just a point in a 20-dimensional space
// The location of the Point is stored in an array of floats of size 20
class Point {
publi... | ALGO | 0.991502 | 3.05608 |
507234da-85c9-4a82-9c8f-f0ef2176293b | OniityanH/project6 | 2014/s2/adds/assignment9/linked_list.cpp | #include "linked_list.h"
#include <cstdlib>
#include <iostream>
using namespace std;
void linked_list::AddNode(node *&head, node *&tail, int data){
if(empty(head)){ // we consider 2 cases,1. add a number to a empty linked list
node *temp=new node; //2. add anumber to a unempt... | ALGO | 0.99642 | 4.379358 |
7411c45c-5cd6-429c-bc6f-3bbd9874cc3d | CyanoProject/cyano | src/pow.cpp | #include "pow.h"
#include "arith_uint256.h"
#include "chain.h"
#include "chainparams.h"
#include "primitives/block.h"
#include "uint256.h"
#include <math.h>
unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const Consensus::Params& params) {
const CBlockIndex *BlockLastSolved = pindexLast;
... | ALGO | 0.999627 | 6.660865 |
206b996d-6e46-4ced-b101-c1ae1e170ef0 | raincross7/code-similarity | codes/train_code/problem038/problem038_471.cpp | #include<iostream>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
int main() {
string A; cin >> A;
int N = (int)A.size();
vector<ll> dp(N, 0);
dp[0] = 1;
vector<int> cnt(26, 0);
cnt[A[0] - 'a']++;
for (int i = 1; i < N; i++) {
int x = A[i] - 'a';
dp[i] = dp[i - 1] + (i - cnt[x]... | ALGO | 0.999934 | 4.403722 |
e9ae4e90-991b-40f8-8b02-140dd1bea599 | lpradop/CC-2 | lab3/e2.cpp | #include <iostream>
using namespace std;
void PrintArr(int *arr, size_t size)
{
for (; size > 0; --size)
{
cout << *arr << " ";
if (size != 1)
++arr;
}
cout << endl;
}
void InvertirArrI(int *arr, size_t size)
{
while (size > 0)
{
for (size_t i = --size; i > ... | ALGO | 0.999499 | 4.689089 |
d706ca8b-681f-4ae9-833b-7763b19e93fe | hamasurrab/Data-Structure | Array/reverse_array.cpp | #include<iostream>
using namespace std;
int reverse_array(int *a,int n){
int s=0;
int e=n-1;
while(s<e){
swap(a[s],a[e]);
s++;
e--;
}
return 0;
}
int main(){
int a[]={10,20,30,40,50,60};
int n=sizeof(a)/sizeof(int);
for(int i=0;i<n;i++){
cout<<a[i]<<" ";... | ALGO | 0.999004 | 4.177584 |
bacb4bbd-9b60-4428-b0dc-98a6c22b97b1 | sansriti14/Leetcode | 0518-coin-change-ii/0518-coin-change-ii.cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
int n = coins.size();
if(amount == 0) return 1;
if(n == 0) return 0;
vector<vector<int>> dp;
dp.resize(n+2, vector<int> (amount+2, -1));
for(int i=0;i<n+1;i++) {
d... | ALGO | 0.999925 | 5.889163 |
c7fe1ea2-d1cc-4fd5-9399-7d4933a8688f | CodeWithIsmail/Competitive-Programming | Codeforces/B_Matrix_Stabilization.cpp | /// *** --- || In the name of ALLAH ||| --- *** ///
/// *** --- || Author: Code_with_Ismail ||| --- *** ///
#include <bits/stdc++.h>
using namespace std;
// Data Type:
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typede... | ALGO | 0.999976 | 3.785898 |
ee5fc59a-ea3e-4cef-aef2-a0fe1882e263 | Bagyki/Project_1 | Robot lawn mover/Robot lawn mover/Area.cpp | #include "Area.h"
#include <iostream>
using namespace std;
void Area::printOutArea()
{
for (int row = 0; row < m_RowNo; row++, cout << "\n")
{
for (int col = 0; col < m_ColNo; col++)
{
if (m_Area[row][col].getCondition() == Condition::notLawned)
{
cout << 'w';
}
if (m_Area[row][col].getCondition... | TOOL | 0.869485 | 4.182631 |
9a0f928d-9d5a-433b-8325-779e83cacf10 | ishandutta2007/codeforces | geothermal/normal/1536/E.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<l... | ALGO | 0.999718 | 5.585949 |
e15325f8-cf01-4300-b9be-29c1a4905107 | sayan112/Leetcode_Sayan | 191-number-of-1-bits/191-number-of-1-bits.cpp | class Solution {
public:
int hammingWeight(uint32_t n) {
int cnt=0; // count of set bit
while(n>0){ // iterate until all bits are traversed
if((n&1)>0) // check the parity of first bit from right
++cnt;
n=n>>1; //n=n/2, shift one bit to right
}
... | ALGO | 0.999937 | 6.1384 |
72ed214c-5c49-4745-96d8-76b3a9a582dc | mmatrosov/FKN2020 | preliminary/F/33913434.cpp | #include <bits/stdc++.h>
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
typedef long long ll;
#pragma GCC optimize("Ofast", "unroll-loops", "no-stack-protector", "fast-math", "O3")
//#pragm... | ALGO | 0.999979 | 3.015133 |
98a2c432-7fd6-4471-900d-99e931246b14 | ishandutta2007/codeforces | oleh1421/normal/1436/F.cpp |
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define endl '\n'
const int N=100100;
const ll mod=998244353;
ll cnt[N];
ll ans[N];
ll binpow(ll a,ll b){
if (!b) return 1ll;
if (b%2) return binpow(a,b-1)*a%mod;
else ... | ALGO | 0.999985 | 3.881186 |
7b4afba3-c22c-4597-9636-6c1ffbf9f878 | curiousMind1234/Data_Structures | Stack and Queues/Minimum Stack/code.cpp | class MinStack {
public:
stack <int> st,mn;
MinStack() {
}
void push(int val) {
if(st.empty() || val <= mn.top())
{
mn.push(val);
}
st.push(val);
}
void pop() {
if(st.top() == mn.top())
mn.pop();
st.pop();
... | ALGO | 0.999828 | 6.567821 |
a6eff187-6ad9-43cd-a640-1ed6be775ccb | Salmanufaris/phone-star | practicing/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.997567 | 6.76073 |
8203512f-42c5-417b-ae4b-70d1f8c5b3fd | yangxinsharon/Math6370-Yang | lab2-intermediate_unix/driver.cpp | /* Daniel R. Reynolds
SMU Mathematics
Math 4370 / 6370
*/
#include <stdlib.h>
#include <iostream>
#include <iomanip>
// prototypes
double one_norm(int n, double* u);
void vector_sum(int n, double* u, double* v, double* w);
void vector_difference(int n, double* u, double* v, double* w);
void vector_product(int n... | ALGO | 0.997148 | 4.709421 |
56e0bf31-f3c5-4150-9896-ffccf494c2a3 | aqsis/aqsis | prototypes/newcore/experiments/edge_eqn_test2.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <OpenEXR/ImathVec.h>
typedef Imath::V2f Vec2;
float cross(Vec2 a, Vec2 b)
{
return a.x*b.y - b.x*a.y;
}
struct EdgeEqn
{
float mx;
float my;
float off;
EdgeEqn(Vec2 a, Vec2 b)
{
Vec2 e = b-a;
mx = -e.y;
... | ALGO | 0.997589 | 4.704041 |
1cf6a566-d145-4331-a481-8c869284afc0 | NipunSyn/DSA-CPP | Basic C++/Code/functions/factorial.cpp | #include<iostream>
#include<math.h>
using namespace std;
int fact(int n) {
int factorial = 1;
for (int i=1; i<=n; i++) {
factorial *= i;
}
return factorial;
}
int main() {
int n;
cin>>n;
int ans = fact(n);
cout<<ans<<endl;
return 0;
} | ALGO | 0.999986 | 5.343205 |
c9395c3a-7837-4bca-863c-9b5286c1896d | Chin-Z/Code-of-White-Book | 入门经典/part3/chapter10/10.3递推关系/10.3.1汉诺塔.cpp | #include<cstdio>
int step = 0;
void hanoi(int n, int from, int to, int via){
if(n == 1) {
printf("S%d: plate 1 %c -> %c\n", ++step, from, to);
return;
}
hanoi(n-1, from, via, to);
printf("S%d: plate %d %c -> %c\n", ++step, n, from, to);
hanoi(n-1, via, to, from);
}
int main(){
int n;
scanf("%d",... | ALGO | 0.999933 | 3.921544 |
0297582c-dca7-49dc-bb8a-59d4630d0726 | tempure/algorithm-advance | OJ/codeforces/735_div2/a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e5 + 10;
int a[N];
void solve() {
int n;
cin >> n;
// bool flag = false;
// int max1 = -1;
// int pos = -1;
ll res = 0;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0... | ALGO | 0.999922 | 4.42545 |
e5887d86-88f4-4c32-8c0f-4257054a7b15 | LinkStartNow/DataStructures | 学习笔记666/图论/差分约束/狡猾的商人.cpp | #include<bits/stdc++.h>
#define ll long long
#define run(i, a, b) for(int i = a; i <= b; i ++)
#define rep(i, a, b) for(int i = a; i >= b; i --)
#define x(i) x = i << 1
#define y(i) y = i << 1 | 1
#define m(l, r) mid = (l + r) >> 1
#define t() int t; cin >> t; while(t --)
//#define t(i) int t; cin >> t; run(i, 1, t)
#... | ALGO | 0.999867 | 4.998469 |
0a620ae1-5406-43e9-bd8b-c0b296c368e0 | Iamutkarshkumar/LEETCODE | 1621-number-of-subsequences-that-satisfy-the-given-sum-condition/1621-number-of-subsequences-that-satisfy-the-given-sum-condition.cpp | class Solution {
public:
int numSubseq(vector<int>& nums, int target) {
const int MOD=1e9+7;
int n=nums.size(), ans=0;
sort(nums.begin(), nums.end());
vector<int> pow2(n);
pow2[0]=1;
for(int i=1;i<n;i++)
pow2[i] = (pow2[i-1]*2ll) % MOD;
int l=0, r=... | ALGO | 0.999997 | 6.203784 |
63ebfd3f-f675-491a-8080-7978949eed57 | coderheck/learning-programming-languages | why-am-i-learning-cpp-now/grade-9/ThayKien/sep 19th 2024/factork.cpp | #include"iostream"
#include"vector"
using namespace std;
#define ll long long
int t,k;ll n;
int main(){
cin>>t;
while(t--){
vector<ll>WTF;
cin>>n>>k;
if(n%2==0){WTF.push_back(2);while(n%2==0){n/=2;}}
for(ll i=3;i*i<=n;i+=2){
if(n%i==0){WTF.push_back(i);while(n%i==0){n/=i;}}
}
(k>WTF.si... | ALGO | 0.999831 | 4.199662 |
84f6e209-cd3a-449c-b7af-f5bb51bb55de | cmuparlay/Cluster-BFS | benchmark/Akiba_BFS.cpp | #include <iostream>
#include <string>
#include <parlay/primitives.h>
#include <parlay/sequence.h>
#include <parlay/internal/get_time.h>
#include <parlay/slice.h>
#include <parlay/io.h>
#include "BFS_ligra.h"
#include "ligra_light.h"
#include "graph_utils.h"
#include "parseCommandLine.h"
#include "utils.h"
using vert... | ALGO | 0.997885 | 5.191087 |
0527dd6f-5771-4f13-9b5e-4377bea71b85 | LoiNguyennn/CompetitiveProgramming4_Solutions | Kattis_OJ/flowerytrails.cpp | #include <bits/stdc++.h>
#define inf 1e9
using namespace std;
typedef pair<int, int> ii;
bool visited[10000];
int len;
void dfs(int u, vector<vector<ii>>& predecessor) {
visited[u] = true;
for (auto x : predecessor[u]) {
int w = x.first, v = x.second;
len += w;
if (!visited[v])
... | ALGO | 0.999845 | 4.116896 |
41418fb8-f7bc-4e66-aa29-78cd356a7dfe | Sabbir-Shihab/CODE_-FORCES_solve- | div 3 923/A.cpp | #include<bits/stdc++.h>
typedef long long ll;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define fs(lcv,hi) for(int lcv=0;lcv<hi;lcv++)
#define fb(lcv,hi) for(int lcv=hi; lcv>=0;lcv--)
using namespace std;
void Tests()
{
//code here
int n;
cin>>n;
string str;
cin>>str;
int a=0,b=0;
fs(i,n)
{
if(str[i]=='... | ALGO | 0.998672 | 3.978737 |
a6cd1d82-6272-42fe-b1a3-ce13f9105fa4 | CodeWilliamT/MyAlgorithms | C++_Algorithm/LeetCodeDemo/LeetCodeDemo/0108.cpp | 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), left(left), right(right) {}
};
//回溯 两分 树结构遍历
//无限中点构造
class Solution {
void dfs(v... | ALGO | 0.999999 | 6.045413 |
358667c2-a16a-4c6e-84a0-4f9ec42ea87d | ishandutta2007/codeforces | climpet/normal/226/A.cpp | #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include ... | ALGO | 0.999964 | 3.808496 |
1e12f2f1-c7a7-4c8e-ac1e-8817aa99371c | Ishashikant9/leetcode | RemoveElementFromSortedArray2.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int j = 1;
for (int i = 1; i < nums.size(); i++) {
if (j == 1 || nums[i] != nums[j - 2]) {
nums[j++] = nums[i];
}
}
r... | ALGO | 0.999962 | 6.72623 |
84beeda3-99f4-421d-b926-f6769813f820 | Henrik-Yao/NEUQ-ACM-Solution | week5/刘东升/山.cpp | #include<bits/stdc++.h>
using namespace std;
const int dx[4]={-1,0,1,0};//ƶʽ
const int dy[4]={0,-1,0,1};
int m,n,ans=0,fx,fy;
void dfs(int x,int y);
const int M=2001;
bool mou[M][M];//ͼ
bool judge[M][M];//ж
int main()
{
cin>>m>>n;
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
cin>>mou[i][j];
}
}
fo... | ALGO | 0.99986 | 3.168832 |
5cd49116-c113-4172-bcff-e61cd617c664 | madmaxujjwal/leetcode-solutions | 1244-design-a-leaderboard/1244-design-a-leaderboard.cpp | class Leaderboard {
public:
unordered_map<int,int> ht;
Leaderboard() {
}
void addScore(int playerId, int score) {
ht[playerId]+=score;
}
int top(int K) {
priority_queue<int,vector<int>,greater<int>> minh;
for(auto it:ht){
minh.push(it.second... | ALGO | 0.999647 | 5.844168 |
6be61371-af16-41a1-8d21-9aabb77bd414 | DionysiosB/CodeForces | 0100-0199/186B-GrowingMushrooms.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
struct strat{long order; double outcome;};
bool stratSort(strat A, strat B){
if(A.outcome < B.outcome){return 0;}
else if(A.outcome == B.outcome){return A.order < B.order;}
return 1;
};
int main(){
long n, t1, t2, k; scanf("%ld %ld %ld %ld\n",... | ALGO | 0.999875 | 3.247932 |
21603d8d-4f42-4884-a1af-4fdb4bd689ef | bioc/Linnorm | src/Misc.cpp | #include <R_ext/Rdynload.h>
#include <R.h>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <RcppArmadillo.h>
#include <vector>
#include <limits>
#include <stdint.h>
// [[Rcpp::plugins(cpp11)]]
using namespace std;
using namespace Rcpp;
//Convert dataset into Relative Expression. ... | ALGO | 0.994627 | 4.081404 |
eebd11f9-051d-4e03-9ebd-b39f49234431 | surya02112002/Leetcode_DSA | 2888-minimum-index-of-a-valid-split/minimum-index-of-a-valid-split.cpp | class Solution {
public:
int minimumIndex(vector<int>& nums) {
int n = nums.size();
int dom = nums[0], freq = 1;
for(int i=1; i<n; i++){
if(nums[i] == dom) freq++;
else {
if(--freq == 0){
dom = nums[i];
freq = 1;... | ALGO | 0.999998 | 5.851489 |
3df310f5-5c04-4094-8a5f-34e89d32e1a0 | JunHeonYoon/MPCC_manipulator | cpp/src/main.cpp | #include <iostream>
#include <fstream>
#include "MPC/mpc.h"
#include "Model/integrator.h"
#include "Params/track.h"
#include <nlohmann/json.hpp>
using json = nlohmann::json;
#ifdef USE_CVPLOT
#include <CvPlot/cvplot.h>
#include <opencv2/opencv.hpp>
#endif
int main() {
using namespace mpcc;
std::ifstream iCo... | ALGO | 0.997217 | 3.608692 |
c078440f-e0d7-43a9-a40d-74d0faf5178d | hhhhaura/competitive-programming | AA1/pA.cpp | #define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / (b))
#define all(a) a.begin(), a.end()
using namespace std;
#defi... | ALGO | 0.999977 | 4.195437 |
c8c44edb-0f54-434c-8f3b-6e2c31261043 | Jordinaa/PX4-Autopilot | src/modules/land_detector/RoverLandDetector.cpp | /**
* @file RoverLandDetector.cpp
* Land detection algorithm for Rovers
*
* @author Roman Bapst <<EMAIL>>
* @author Julian Oes <<EMAIL>>
*/
#include "RoverLandDetector.h"
namespace land_detector
{
bool RoverLandDetector::_get_ground_contact_state()
{
return true;
}
bool RoverLandDetector::_get_landed_state()... | TOOL | 0.868335 | 6.278503 |
9308c80b-7514-4a70-969b-a5f23e293ba2 | ishandutta2007/codeforces | square1001/normal/797/C.cpp | #include <stack>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.size();
vector<int> last(26, 0);
for (int i = 0; i < n; ++i) {
last[s[i] - 'a'] = max(last[s[i] - 'a'], i + 1);
}
stack<char> st;
int ptr = 0;
string a... | ALGO | 0.999981 | 4.118741 |
34756edc-685f-4606-bdeb-d14f06602e76 | shaileshKumar55/GFG-Problems | Last cell in a Matrix.cpp | /*
Given a binary matrix of dimensions with R rows and C columns. Start from cell(0, 0), moving in the right direction. Perform the following operations:
If the value of matrix[i][j] is 0, then traverse in the same direction and check the next value.
If the value of matrix[i][j] is 1, then update matrix[i][j] to 0 ... | ALGO | 0.999631 | 5.25688 |
087badb8-49c9-49bb-86aa-da427ce7c1be | FXTD-ODYSSEY/cppreference | examples/boost/range_02/main.cpp | #include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <array>
#include <iterator>
#include <iostream>
int main()
{
std::array<int, 6> a{{0, 1, 2, 3, 4, 5}};
boost::random_shuffle(a);
boost::copy(a, std::ostream_iterator<int>{std::cout, ","});
std::cout << "\n" << *boost::max_element(... | TOOL | 0.97893 | 4.296519 |
0b100cc7-4598-4ad7-b4d9-2878c88b55a1 | sydobd/cpp-101 | 19.functions2.cpp | #include <iostream>
using namespace std;
bool isPrimeNumber(int num)
{
for (int i = 2; i < num; i++)
{
if (num % i == 0)
{
return false;
}
}
return true;
}
int main()
{
int number;
cout << "Number: ";
cin >> number;
bool isPrimeFlag = isPrimeNumbe... | ALGO | 0.999279 | 4.23339 |
fc29d391-b9d2-4303-9d55-c2c096a7a051 | wallstead/cs302 | project6/PA06.cpp | /**
* @file PA06.cpp
*
* @brief Main driver for project 6
*
* @author Willis Allstead
*
* @version 1.0
*
*/
#include <iostream>
#include "BinarySearchTree.h"
using namespace std;
bool existsInArray(int toCheck, int arr[], int count);
void visit(int &visited) {
cout << visited << endl;
}
int main() {
/... | ALGO | 0.993426 | 4.986101 |
47c98404-9edf-4050-9b63-cfd2cb101a6b | RDRGS-NIRVANA/smartcar | src/roborts_costmap/src/costmap_math.cpp | #include "costmap_math.h"
namespace roborts_costmap {
double Distance2Line(double pX, double pY, double x0, double y0, double x1, double y1) {
double A = pX - x0;
double B = pY - y0;
double C = x1 - x0;
double D = y1 - y0;
double dot = A * C + B * D;
double len_sq = C * C + D * D;
double param = dot / le... | ALGO | 0.999217 | 4.819106 |
99ff0e0d-aa9a-4bac-b880-ee46c295091b | ishandutta2007/codeforces | namnamseo/normal/1548/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void cppio(){ ios_base::sync_with_stdio(0); cin.tie(0); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define rep(i,n) for(int i =... | ALGO | 0.999956 | 3.945991 |
04b9751c-103d-4f1f-b393-c4ccafbd1f37 | TangBin-0524/Algorithm-learning | 贪心算法/intellectual_storm.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=505;
/*
显然这个题的贪心就是按照罚款降序排序,罚款多的优先做
,为了尽量不占用其他时间,最好把它安排到活动截止前最后的有空时间。
如果没法塞进去就只好被罚款了
*/
struct act{
int t,w;
}Act[N];//定义活动的结构体
int m,n,hsh[N],ans;
//m为时间段,n为活动个数,hsh标记哪些时间段有活动,ans为最小罚款
int main()
{
cin>>m>>n;
for(int i=1;i<=n;i++)cin>>Act[i].t;
for(int i=1... | ALGO | 0.999994 | 3.546776 |
9cc199db-8688-4453-9a75-a0ff25048ba9 | Pawan7778/AC_POTD | POTD/24-12-2024/SortColors.cpp | // https://leetcode.com/problems/sort-colors/
#include <iostream>
#include <vector>
using namespace std;
void merge(vector<int> &arr, int low, int mid, int high)
{
int n1 = mid - low + 1;
int n2 = high - mid;
vector<int> left(n1);
vector<int> right(n2);
for (int i = 0; i < n1; i++)
{
l... | ALGO | 0.999885 | 5.932928 |
09b744cc-9aa8-413b-8bbe-08ed199bb7b7 | ernie55ernie/OnlineJudge | NTUJudge/GoldCoins.cpp | /*
* GoldCoins.cpp
*
* Created on: Jul 19, 2014
* Author: user
*/
/*#include <iostream>
#include <cstdlib>
#include <queue>
using namespace std;
int main(int argc,char** argv){
int i = -1, sum = 0;
queue<int>* q = new queue<int>();
while(true){
cin >> i;
if( i == 0 )break;
q->push(i);
}
while(!... | ALGO | 0.998709 | 3.637614 |
b5941b18-8434-4c91-8f1b-107815c36490 | Soumyamittal2003/Practice | DSA/c++/reverse_alternate_array.cpp | #include<iostream>
using namespace std;
void reverse_alt(int arr[],int n){
for(int i=0;i<n;i+=2){
if(i+1 < n){
swap(arr[i],arr[i+1]);
}
}
}
void printArray(int arr[],int n){
for(int i=0;i<n;i++){
cout<<arr[i]<< " ";
}
cout<<endl;
}
int main(){
int arr[6]... | ALGO | 0.999562 | 4.833265 |
bbc6edd1-e018-4ba6-8c9e-59094db52fd4 | aelthwin/Battle-for-Wesnoth--Zombie-Edition | src/server/metrics.cpp | /* $Id: metrics.cpp 48153 2011-01-01 15:57:50Z mordante $ */
/**
* @file
* Various server-statistics.
*/
#include "../global.hpp"
#include "metrics.hpp"
#include <algorithm>
#include <iostream>
struct compare_samples_to_stringspan {
bool operator()(const simple_wml::string_span& a, const simple_wml::string_spa... | TOOL | 0.895015 | 6.633031 |
14f8059e-21cc-4539-970f-b70fbaab6eb6 | cedarcoin/cedarcoin | src/script/interpreter.cpp | #include "interpreter.h"
#include "primitives/transaction.h"
#include "crypto/ripemd160.h"
#include "crypto/sha1.h"
#include "crypto/sha256.h"
#include "pubkey.h"
#include "script/script.h"
#include "uint256.h"
typedef std::vector<unsigned char> valtype;
namespace {
inline bool set_success(ScriptError* ret)
{
i... | ALGO | 0.876197 | 5.61572 |
ba3a6be6-0ed1-4c47-9ffb-389450661734 | iamabhi0619/DSA | leetcode/day7.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
int maxProfit(vector<int> &prices)
{
int min=prices[1], max=prices[1];
for (int i = 1; i < prices.size(); i++)
{
if(prices[i]<min){
min = prices[i];
... | ALGO | 0.999817 | 5.572145 |
cc8d30c3-d585-41c9-a5d2-19a9c11850ca | menaehab/Codeforces-Solutions | 0 - 1000 problems/Stack1.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <iomanip>
#include <string>
#include <set>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#define speedup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long ... | ALGO | 0.999116 | 4.674752 |
f7d3a34b-7fb7-4017-9f3e-2e95f83b61f0 | Shivam-Shandilya1/CC-- | CodeJam/Q2Qualification.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int T;
bool flag = true;
cin>>T;
for(int i=0;i<T;i++)
{
unsigned long long C = INT_MAX,M = INT_MAX,Y = INT_MAX,K = INT_MAX;
unsigned long long minC = INT_MAX,minM=INT_MAX,minY=INT_MAX,minK=INT_MAX;
flag ... | ALGO | 0.999907 | 3.66276 |
7e20b7b6-e945-416e-bdbb-ae1e321d3626 | Starry0/ACM | codeforces/535div3/b.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5+10;
int a[N], n, x;
int main() {
cin >> n;
for(int i = 1; i <= n; i ++) {
cin >> x;
a[x]++;
}
ll x = 1, y = 1;
for(int i = 10000; i >= 1; i --) {
if(a[i]) {
x = i;
break;
}
}
for(int i = 1; i <= x; i ++) {
if(x%i... | ALGO | 0.999864 | 3.640118 |
8fa7a8b5-2fa6-4427-b9c6-b3941723fd51 | trinhminhtriet/leetcode | solutions/0000-0099/0088.merge-sorted-array/Solution.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
for (int i = m - 1, j = n - 1, k = m + n - 1; ~j; --k) {
nums1[k] = i >= 0 && nums1[i] > nums2[j] ? nums1[i--] : nums2[j--];
}
}
}; | ALGO | 0.99999 | 5.505304 |
fe4f337e-69b9-4019-973d-64faad3c705a | ishandutta2007/codeforces | nikolapesic2802/normal/1114/E.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define D(x) cerr << #x << " is " <<... | ALGO | 0.999891 | 3.399694 |
23daf4a7-dae4-4ddd-b6aa-93eb9b3fc3dd | soumen1208/LearningCPP | Final Exam of DSA1/Oct_25th/Ques2/distinct.cpp | #include <iostream>
using namespace std;
long long aliceDInt(int n) {
long long a = 2;
long long b = 3;
long long c;
if (n == 1) return 2;
if (n == 2) return 3;
for (int i = 3; i <= n; i++) {
c = a + b;
a = b;
b = c;
}
return c;
}
int main() {
int T;
cin... | ALGO | 0.999809 | 4.033705 |
b0287a78-43f3-4227-ab96-454e6ab3e621 | karin0/problems | probs/luogu1914.cpp | #include <cstdio>
#define MAXS 9999999
int n, ord;
char s[MAXS];
int main() {
scanf("%d%s", &n, s);
n %= 26;
for (char *p = &s[0]; *p; ++p) {
ord = (*p - 'a') + n;
while (ord > 'z' - 'a')
ord -= 26;
printf("%c", 'a' + ord);
}
printf("\n");
return 0;
}
| ALGO | 0.999768 | 3.840087 |
b22469b1-baee-4ed8-bba5-c98f8c95c29d | DimaKuzmin/tsm-project-soc-mp | Layers/xrRenderPC_R2/r2_R_lights.cpp | #include "stdafx.h"
IC bool pred_area(light *_1, light *_2)
{
u32 a0 = _1->X.S.size;
u32 a1 = _2->X.S.size;
return a0 > a1; // reverse -> descending
}
void CRender::render_lights(light_Package &LP)
{
//////////////////////////////////////////////////////////////////////////
// Refactor order based on ability to ... | TOOL | 0.933578 | 4.245358 |
c87f0489-7b29-4058-839c-104d66b88e49 | Ravnen01/AideAuDys | AideAuxDys/libraries/tess-two/jni/com_googlecode_tesseract_android/src/cube/char_bigrams.cpp | #include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include "char_bigrams.h"
#include "cube_utils.h"
#include "ndminx.h"
#include "cube_const.h"
namespace tesseract {
CharBigrams::CharBigrams() {
memset(&bigram_table_, 0, sizeof(bigram_table_));
}
CharBigrams::~CharBigrams() {
if (bigram... | ALGO | 0.872932 | 6.002388 |
51292995-45f8-43ee-88b7-efb67c7312cf | andyguan10942/DS-OOP_Hw | oop_ds2/rational.cpp | #include "rational.h"
Rational::Rational(const int numerator, const int denominator){
this->a = numerator;
this->b = denominator;
// Maybe you should do sth to let it be reduced form
//ƴ
int GCD=gcd(abs(this->a),abs(this->b));
this->a/=GCD;
this->b/=GCD;
}
// TODO
// write all functions here
int Rati... | TOOL | 0.979527 | 5.467393 |
6631ce3c-f534-45d2-b997-86254c7673ac | gordian-eggo/Narkissa | sisa_body/WheelPair.cpp | #include "WheelPair.h"
void WheelPair::leftTurn() {}
void WheelPair::rightTurn() {}
/*
Moved code here from sisa_body.
// working 10/3, needs some adjustment tho
void left() {
front_left.setSpeed(50);
front_right.setSpeed(50);
back_left.setSpeed(70);
back_right.setSpeed(70);
front_left.run(BACKWARD)... | ALGO | 0.954981 | 4.794981 |
388b8942-f2f4-4667-84f8-826f336067d6 | kev-yan/cs24 | calculator/MyStack.cpp | #include "MyStack.h"
#include <iostream>
using namespace std;
// TODO: Implement MyStack member functions here.
void MyStack::print(){
Node* temp = list->head;
int i =0;
cout << "head" << list->head << endl;
cout << "tail" << list->tail << endl;
while(temp != nullptr){
cout << i << ": " ... | TOOL | 0.97322 | 4.465617 |
4fd0e9db-fc9d-4e59-92e0-05119dd1001e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7153_0.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i + 2 < s.size(); i++) {
set<char> qwe;
for (int j = 0; j < 3; j++) {
if (s[i + j] != '.') qwe.insert(s[i + j]);
}
if (qwe.size() == 3) {
printf("Yes\n");
return 0;
}
}
printf("... | ALGO | 0.99983 | 3.525795 |
2cfe4399-87b0-43f1-91f2-6f1b26eaee26 | RocaIgnacio1/Programacion-Competitiva | simulaciones/TAPs/tap2018/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, n) for(int i = 0; i < n; i++)
#define fori(i, n) for(int i = n - 1; i <= 0; i--)
int solve(int n){
if(n == 1) return 4;
if(n == 2) return 6;
if(n == 3) return 2;
if(n == 4) return 4;
if(n == 5) return 8;
n-=6;
... | ALGO | 0.999808 | 4.616512 |
ae7c7f2d-be54-48fb-9366-2b26f63d7fe6 | prashantgupta8feb/trees | levelorder.cpp | #include<iostream>
#include<queue>
using namespace std;
struct bstnode{
int data;
bstnode* left;
bstnode* right;
};
bstnode* getnewnode(int x){
bstnode* newnode = new bstnode();
newnode->data=x;
newnode->left=NULL;
newnode->right=NULL;
return newnode;
}
bstnode* inser... | ALGO | 0.999979 | 4.020111 |
cf078d81-77ab-4f05-b9c4-36a51e7a749c | utsavtiwary04/UVa | c++/UV_11495.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
string line;
vector<vector<int> > all_integers;
while ( getline( std::cin, line ) ) {
std::istringstream is( line );
all_integers.push_back(
std::vector<int>( std::istream_iterat... | ALGO | 0.967674 | 3.657073 |
cb5e8366-65c8-45a0-9cf4-3a5b3971c05f | Nipuntank/DSA-Cpp- | Linked list/Reverse_iterative.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
Node *input()
{
int data;
cin >> data;
Node *head = NULL;
Node *tail = NULL;
while (data != -1)
{
Node *newn... | ALGO | 0.999913 | 4.58681 |
fe329956-6845-4d8f-9d0d-5a914cfd0677 | dixitt5/CP-Solutions | C++/Multiplication.cpp | #include <iostream>
using namespace std;
int main() {
double num1, num2, product;
cout << "Enter two numbers: ";
// stores two floating point numbers in num1 and num2 respectively
cin >> num1 >> num2;
// performs multiplication and stores the result in product variable
product = num1 * num2;
cout <... | TOOL | 0.983182 | 4.089074 |
8f45bef4-a413-431e-9397-9f29f31bd875 | debopriyo-das-rahul/Codeforces-Solutions | 1296B Food Buying.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
int ans = n;
if (n < 10) {
cout << n << endl;
} else {
while (n >= 10) {
int div = n / 10;
int mod = n % 10;
n = div + mod;
ans += div;
}
cout << ans << endl;
}
}
int main() {
ios_base::sy... | ALGO | 0.999866 | 5.931143 |
5ab3813e-6e38-4200-9080-25a9a9470bd8 | goblinengine/goblin | servers/physics/collision_solver_sw.cpp | /*************************************************************************/
/* collision_solver_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | ALGO | 0.999707 | 6.59725 |
3fee2d7a-ee5e-41c9-8ed1-c54d59ab4522 | raincross7/code-similarity | codes/train_code/problem416/problem416_113.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
LL ans, base[22];
char s[4];
int num;
bool query(LL x){
printf("? %lld\n", x);
fflush(stdout);
scanf("%s", s + 1);
return s[1] == 'Y';
}
int main(){
base[0] = 1;
for(int i = 1;i <= 9; i++){
base[i] = base[i-1] * 10ll;
... | ALGO | 0.999658 | 3.023337 |
5516593f-e07c-46e5-a0a2-8c1631ca14d3 | Mackenzie-98/Solutions | Codeforces/Div3/644/f.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 F first
#define S 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)
#defin... | ALGO | 0.999933 | 4.323037 |
94665881-cc95-4b16-aedf-b7f16f56f60a | Aaditya-Kumar-Mittal/Striver-DSA-Course | Bit Manipulations/CPP_BM_Set_Kth_Bit.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
// Function to set the Kth bit of the number N
int setKthBit(int N, int K)
{
// The bitwise OR operation is used to set the Kth bit.
// 1 << K creates a number where only the Kth bit is 1.
... | ALGO | 0.999883 | 6.599228 |
5ecb9541-4ce5-4b78-a2a5-84d69e2b91de | johannesgerer/jburkardt-cpp | mgmres/mgmres_prb.cpp | # include <cstdlib>
# include <iostream>
# include <iomanip>
# include <ctime>
# include <cmath>
using namespace std;
# include "mgmres.hpp"
int main ( );
void test01 ( );
void test02 ( );
void test03 ( );
void test04 ( );
//****************************************************************************80
int main ( ... | ALGO | 0.998538 | 5.719059 |
a78e865a-029d-422a-adf6-128c0d0a9d7e | bhagyo/faltu-code | light oj code/light oj 1275.cpp | /****** HAREE KRISHNA ******/
#include<bits/stdc++.h>
using namespace std;
typedef long int ld;
typedef long long int lld;
typedef float f;
typedef double lf;
typedef unsigned int u;
typedef unsigned long int lu;
typedef unsigned long long int llu;
typedef char C;
#define sf scanf
#define pf printf
#define ff fir... | ALGO | 0.999944 | 3.521317 |
b729fd2d-92bf-40a1-aa8c-549494f5f2ea | AbhilashBhargava36/APS-100_Code_Library | subset_sum.cpp | #include <bits/stdc++.h>
using namespace std;
int isSubsetSum(int set[], int n, int sum)
{
int dp[n+1][sum+1];
for(int i=0;i<=sum;i++)
dp[0][i]=0;
for(int i=0;i<=n;i++)
dp[i][0]=1;
if(sum==0)
return 1;
if(n<=0)
return 0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=sum;j++)
{... | ALGO | 0.999921 | 5.514055 |
9a3cdedc-0ea5-4010-9947-2dc810cf986a | JonMeister/OS_Lab-1_2322626 | MyCppCodes/Program_3/main.cpp | /*
Authors:
- Jonathan Aristizabal (202322626)
Email:
- <EMAIL>
Created: 08/25/2024
Last modified: 08/26/2024
*/
#include <iostream>
#include <vector>
bool isPrime(int number) {
if (number <= 1)
return false;
for (int i = 2; i * i <= number; i++) {
if (number % i == 0)
return false... | ALGO | 0.998672 | 5.553965 |
eeb52b9b-4679-4c85-b901-b5b2f300fc25 | sarvex/leetcode-chez | solution/1800-1899/1898.Maximum Number of Removable Characters/Solution.cpp | class Solution {
public:
int maximumRemovals(string s, string p, vector<int>& removable) {
int left = 0, right = removable.size();
while (left < right) {
int mid = left + right + 1 >> 1;
if (check(s, p, removable, mid)) {
left = mid;
} else {
... | ALGO | 0.999841 | 6.071787 |
85a25c41-313f-4e32-8bd7-0756f73a80c0 | Sadi-Hurayv/Competitive-Programming | Online Judge/Vjudge/Practice/Dev Skill/Dev Skill - CPi B12 - Assessment contest/B_Bogart Gets Disqualified.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
char name[50];
for(int i=0; i<n; i++){
cin >> name;
cout << name << ": F\n";
}
return 0;
}
| ALGO | 0.992033 | 3.497426 |
92eaa849-0750-46f3-ac99-7547b04ac26c | adityaparmar9813/daily-leetcode | number_of_students_unable_to_eat_lunch.cpp | class Solution {
public:
int countStudents(vector<int>& students, vector<int>& sandwiches) {
queue<int> q;
for(int student: students) {
q.push(student);
}
for(int sandwich: sandwiches) {
int size = q.size();
while(q.front() != sandwich &... | ALGO | 0.999974 | 6.096674 |
36dbe28a-8740-4dbe-90c8-5a028f12cb17 | genome/breakdancer | src/lib/io/BamConfig.cpp | #include "BamConfig.hpp"
#include "BamConfigEntry.hpp"
#include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
using boost::format;
using namespace std;
const int BamConfig::DEFAULT_MAX_READ_WINDOW_SIZE(1e8);
BamConfig::BamConfig()
: _max_read_window_size(DEFAULT_MAX_READ_WINDOW_SIZE)
{
}
B... | CONFIG | 0.903752 | 6.588111 |
0e09f883-206d-42a9-b7dd-10f064b491e2 | ashu098/Codeforces | Codeforces_668/codeforces_668_C.cpp | #include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--) {
int n,k;
cin>>n>>k;
string s;
cin>>s;
for(int i=0;i<k;i++) {
if(s[i] == '?') {
for(int j=i+k;j<n;j+=k)... | ALGO | 0.99991 | 3.590684 |
dbe9c063-a5f6-4335-9a07-bc2bb0781a44 | IcEy-999/MyUESource | Engine/Source/ThirdParty/openexr/OpenEXR-1.7.1/openexr-1.7.1/exrenvmap/blurImage.cpp | //-----------------------------------------------------------------------------
//
// function blurImage() -- performs a hemispherical blur
//
//-----------------------------------------------------------------------------
#include <blurImage.h>
#include <resizeImage.h>
#include <cstring>
#include "Iex.h"
#include <i... | ALGO | 0.978118 | 6.085956 |
ef2871b3-af48-4cc3-a219-41a2f668e86d | codeshuttler/CodeGenCangjie | data/transcoder_evaluation_gfg/cpp/SUM_SERIES_12_32_52_2N_12.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int n ) {
int sum = 0;
for ( int i = 1;
i <= n;
i ++ ) sum = sum + ( 2 * i - 1 ) * ( 2 * i - 1 );
return sum;
}
//TOFILL
int main() {
... | ALGO | 0.995977 | 5.024565 |
813fc405-0d10-4107-902b-5049c1e7bce9 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/minimum-time-to-revert-word-to-initial-state-ii-Solution.minimumTimeToInitialState/177893_+Info.cpp | int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_one(b);
BN_zero(c);
if (BN_mod_exp(d, a, b, c, ctx)) {
fprintf(stderr, "BN_mod_exp with zero modulus succee... | TEST | 0.998129 | 4.437272 |
e1a2060b-3eba-4f5b-87da-4929ef7e9824 | nguyenhuudatcoder/BachLieuNTUCoder | SNT3.cpp | /// A game is our childhood
/// Made by Nguyễn Hữu Đạt
#include <bits/stdc++.h>
#define ll long long
#define kien main
using namespace std;
const ll inf = LLONG_MAX;
const ll mod = 1e9 + 7;
int n, ans;
ll x;
// ll tich(ll a, ll b, ll c)
// {
// a%=c;
// ll ans = 0;
// while (b > 0)
// {
// if (b... | ALGO | 0.999894 | 3.999088 |
06161688-8d96-4bea-8111-0c84eb6b9812 | mdshadesh/Codeforcesall-problem-solution- | 151A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{
int n, k, l, c, d, p, np, nl, min = 0;
cin >> n >> k >> l >> c >> d >> p >> nl >> np;
int t1 = (k * l) / nl;
int t2 = c * d;
int t3 = p / np;
if (t1 >= t2)
{
min = t2;
if (t3 < min)
... | ALGO | 0.999145 | 3.328829 |
1022a439-47b0-4ef8-bf77-88a636ce516e | sally4405/Hongik-Univ_OOP | test/190401/05.cpp | // (3장) 1. 인라인 함수
#include <iostream>
using namespace std;
//#define MIN(x,y) ((x) < (y)? (x) : (y))
int MIN(int X, int Y)
{
return (X < Y ? X : Y);
}
inline int Fact(int n)
{
return ((n <= 1) ? 1 : n * Fact(n-1));
}
int main(void)
{
cout << MIN(4,5) << endl;
cout << MIN((2+3), (1+2)) << endl;
cout << "5! = ... | ALGO | 0.956594 | 3.871444 |
f5116356-43ca-4dfd-bfb2-230da4ec941c | AshkenSC/Programming-Practice | LeetCode/!!0047. Permutations II.cpp | /*
0047. Permutations II
给定一个可包含重复数字的序列 nums ,按任意顺序 返回所有不重复的全排列。
思路:可包含重复数字,意味着无法再用哈希的方法记录某个数字是否已经用过。
也许也可以哈希?只不过不直接记录“值为a的数字已经用过”,
而是记录“在nums中编号为i的数字已经用过”。
心路历程:
一开始,只通过判定used[i]是否为false,结果并不能剪枝,还是会重复输出。
后来,想到通过判断if (i > startIndex && nums[i] == nums[i - 1])则直接continue,又走进另一个极端:完全没结果。
然后看liweiwei参考答案。有了第三版成功版。
http... | ALGO | 0.999985 | 6.046494 |
5dce91d3-76d1-4634-9b06-071025b9a017 | taoyilee/gem5 | src/systemc/tests/systemc/misc/unit/data/datawidth_unsigned/promote_truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.961331 | 5.331775 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.