uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
405cb22d-5c98-4724-ab0c-859722d1652b | zty111/OI | zty-Templete/spfa_slf&lll.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int h[N], nxt[N], cnt, e[N], to[N];
void add_edge(int u, int v, int w) {
cnt++; nxt[cnt] = h[u]; h[u] = cnt; e[cnt] = w; to[cnt] = v;
}
int dis[N], ins[N];
void spfa(int s){
memset(dis, 0x3f, sizeof(dis));
dis[s] = 0;
deque<int> q;
... | ALGO | 0.999305 | 3.486836 |
8c6bd93e-1e82-44f2-b018-80a86cf9e26c | ezhou2008/algorithm-basic | cpp1/JZ-613_217-Remove-Duplicates-from-Unsorted-List.cpp | /*Remove duplicates from an unsorted linked list
Write a removeDuplicates() function which takes a list
and deletes any duplicate nodes from the list. The list is not sorted.
For example if the linked list is 12->11->12->21->41->43->21
then removeDuplicates() should convert the list to 12->11->21->41->43.*/
/**
* De... | ALGO | 0.999888 | 5.367002 |
9faea5e0-a55a-4210-9c9c-961d28dedceb | MKraienhorst/rnm_D | Eigen/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.990633 | 6.337957 |
35be9cfd-0bc0-4a79-afa7-98c0408eb2e0 | all0cer/testes_C | triangulo.cpp | #include <iostream>
using namespace std;
bool ehTriangulo(int a, int b, int c) {
return (a + b > c) && (a + c > b) && (b + c > a);
}
string tipoTriangulo(int a, int b, int c) {
if (!ehTriangulo(a, b, c)) {
return "Nao e um triangulo!";
}
if (a == b && b == c) {
return "Triangulo Equil... | ALGO | 0.999575 | 4.878532 |
169c53cd-0157-4c9f-be72-0b3d26201434 | SJTU-ACM/Templates | lbn/cpp/4.1.1.3.cpp | #include<bits/stdc++.h>
#define M 111111
using namespace std;
struct Complate_Package{
int V_sum,a[M],b[M],f[M];//V_sum为体积上限,f[i]为i体积最大价值
void add_new(int V,int val,int cnt){//加入一件新物品
int d,j,h,t,x,y;
for(d=0;d<V;d++){
h=1,t=0;
for(j=0;j<=(V_sum-d)/V;j++){
x=j;y=f[j*V+d]-j*val;
for(;h<=t&&b[t]<=y;t-... | ALGO | 0.999665 | 3.52594 |
adaa74d5-9de4-4f35-ab1c-2cd465ec0592 | raincross7/code-similarity | codes/train_code/problem035/problem035_330.cpp | #include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n,a,b,cnt;
while(~scanf("%d",&n)){
cnt=0;
for(a=0;a<=18;a++){
for(b=0;b<=18;b++){
if(a+b==n) cnt+= (10-(int)abs(a-9)) * (10-(int)abs(b-9));
}
}
cout << cnt << endl;
}
return 0;
} | ALGO | 0.997344 | 3.214135 |
04ac7e6c-cc17-4cc6-8688-41f2d8d82a47 | ishandutta2007/codeforces | wasa855/normal/1299/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
inline int read()
{
char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
int ans=0; while(is... | ALGO | 0.99996 | 3.762036 |
8f7916ba-7e7c-420a-8b44-088d81d79a28 | Haelgarin/Hackerrank-Challenges | Lonely Integer/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdint>
int lonelyInteger(std::vector<int> a)
{
std::sort(a.begin(), a.end());
int count{};
int uniqueVal{};
for (int64_t i{ 0 }; i < static_cast<int64_t>(a.size()); ++i)
{
// We've checked all other elements so the las... | ALGO | 0.985762 | 5.022558 |
6f1dca08-16ec-4967-8010-d11239ec27c7 | Kartik-Mathur/LiveBatchNov2020 | Lecture-2/ForLoop.cpp | // ForLoop
#include <iostream>
using namespace std;
int main(){
// init
// while(cond){
// updation
// }
int i;
int n;
cin>>n;
for(i = 2; i<=n ; i+=2){ // a=a+b == a+=b
cout<<i<<' ';
}
cout<<endl;
return 0;
} | ALGO | 0.998318 | 3.997572 |
82343850-1e2f-40c5-9723-e0273d2ab712 | CS221/dict-wars | dict_runner/weiss/TestSort.cpp | #include <iostream>
#include "Sort.h"
#include "vector.h"
#include "Random.h"
void checkSort( const vector<int> & a )
{
for( int i = 0; i < a.size( ); i++ )
if( a[ i ] != i )
std::cout << "Error at " << i << std::endl;
... | ALGO | 0.976282 | 5.317576 |
bcd13c10-be68-4b30-ab24-15d57d5a1974 | ishandutta2007/codeforces | syury/normal/1028/B.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define E(i, l, r) for(auto i = l; i <= r; ++i)
#define DF(i, l, r) for(auto i = l; i >... | ALGO | 0.999918 | 3.940469 |
030bfb5c-073a-4c25-a6d7-68c0618294c2 | ferreiraluisa/faculdade | optativas/INF 390 - Computer Graphics/atividade 03/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/ext/scalar_ulp.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#i... | TEST | 0.969704 | 6.277224 |
81be6130-88c6-42c9-8097-37d4491e2e69 | vinshuka/AOC-Day8 | Source.cpp | #include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
//Day8 Part 1
//Given a list of instructions give the current value of the accumulator after one complete cycle.
//Instruction Opcodes
//ACC: increases or decreases a single global value called the accumulator by the value gi... | ALGO | 0.999087 | 5.299882 |
423eadb5-7057-452e-9af8-01288e44a3f0 | AndyChenYH/leetcode | minimumKnightMoves.cpp | #include <bits/stdc++.h>
using namespace std;
// BFS + dp
const int INF = 1e9 + 10;
vector<vector<int>> cost(601, vector<int>(601, INF));
vector<pair<int, int>> drs = {
{-2, 1},
{-1, 2},
{1, 2},
{2, 1},
{2, -1},
{1, -2},
{-1, -2},
{-2, -1},
};
bool bound(int i, int j) {
return 0 <= i && i < 601 && 0 <= j && j... | ALGO | 0.998925 | 4.134604 |
37d7de26-249f-42ac-9f17-10db05a027d3 | akademik2607/MusicHero | cocos2d/extensions/Particle3D/PU/CCPUForceField.cpp | #include "CCPUForceField.h"
NS_CC_BEGIN
const Vec3 PUForceFieldCalculationFactory::DEFAULT_WORLDSIZE(500.0f, 500.0f, 500.0f);
//-----------------------------------------------------------------------
unsigned short PUForceFieldCalculationFactory::getOctaves() const
{
return _octaves;
}
//------------------------... | TOOL | 0.95332 | 6.590559 |
ae0b9f50-32b9-46c8-a079-8871c186a372 | P-amadou/ProjetsApps | Projet SDA v2/Projet SDA/Sprint4/Tableau2D.cpp | #include <iostream>
#include <string>
using namespace std;
#include "Tableau2D.h"
void initialiser(Tab2D& m, unsigned int nbL, unsigned int nbC) {
Item** tableau = new Item*[nbL];
for (unsigned int i = 0; i < nbL; i++)
{
tableau[i] = new Item[nbC];
}
m.nbL = nbL;
m.nbC = nbC;
m.tab = tableau;
}
void det... | ALGO | 0.981655 | 3.395532 |
663b15f0-0060-4031-81a0-3c2d81df0ae2 | varun2430/DSA | graph/kahns_algorithm_topological_sort.cpp | // Given a Directed Acyclic Graph (DAG) with V vertices and E edges, Find any Topological
// Sorting of that Graph.
#include <bits/stdc++.h>
using namespace std;
vector<int> topoSort(int V, vector<int> adj[])
{
int inDegree[V] = {0};
for (int i = 0; i < V; i++)
{
for (int &adjNode : adj[i])
... | ALGO | 0.999998 | 6.326206 |
b96b954d-190b-4bd5-b870-fe9b853299b4 | code-fans/books-source | 基础算法/第8章_高精度算法/8.1.3蜜蜂线路/bee朴素.cpp | //۷·
//ģ֪һfibonacci
#include <bits/stdc++.h>
using namespace std;
int n,m,len=1;
int f[1005][1005];//һ±ʾڼڶ±ʾλ
void Add(int x)
{
for(int i=1; i<=len; i++)
f[x][i]=f[x-1][i]+f[x-2][i];
for(int i=1; i<=len; i++)
if(f[x][i]>9)
{
f[x][i+1]++;
f[x][i]-=10;
}
if(f[x][len+1])
len++;
}
in... | ALGO | 0.999923 | 3.201855 |
3c2a2d4d-9d97-4cb5-8c31-e8241742c405 | Krstar233/krits-code-workplace | Old-Code/题解代码/acm/C - 背包3.cpp | #include <iostream>
#include <memory.h>
using namespace std;
int p[100], h[100], c[100];
int value[1000];
int volume[1000];
int tab[1000][1000] = {0};
int main()
{
int C;
cin >> C;
while (C--)
{
int n, m;
int key = 1;
memset(tab, 0, sizeof(int)*1000*1000);
cin >> n >> m;
for (int i = 0; i < m; i++... | ALGO | 0.99994 | 3.621016 |
1678fb1d-a2e8-4849-aee4-e259e8d72cf3 | FarzanaKawkab/Data-Structure- | Stack/stack_linked_list.cpp | //Using Doubly linked list
#include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node* next;
Node* prev;
Node(int val)
{
this->val = val;
this->prev= NULL;
this->next= NULL;
}
};
class myStack
{
public:
Node* head = NULL;
N... | ALGO | 0.999947 | 4.630086 |
4b5a2e2d-c5d4-4e80-8b44-4489c5cd8a29 | HrishitDas2000/OpenCV | 3rdparty/openexr/IlmImf/ImfFastHuf.cpp | #include "ImfFastHuf.h"
#include <Iex.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <vector>
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
//
// Adapted from hufUnpackEncTable -
// We don't need to reconstruct the code book, just the encoded
// lengths for each symbol. From the lengths, we can... | ALGO | 0.979232 | 5.734644 |
53b1f9a5-3f64-493b-89b2-b88dea8604fc | MarekPelowski/Polish-Junior-IT-Olympiad | course/01/akc/akc.cpp | #include <iostream>
#include <vector>
int findParticleSpeed(int particle, std::vector<int> &particles)
{
int bottomRange = 0;
int topRange = particles.size() - 1; // the last index
int bottomParticle, topParticle;
// use binary search to find the index of the first particle
while(bottomRange <... | ALGO | 0.99956 | 5.209624 |
60e5c78e-1b07-4473-ace5-9bed7ef38f83 | 7-Mangodish/CPP-PTIT | CPP0423.cpp | #include<bits/stdc++.h>
#define ll long long
#define forl(i,a,b) for(int i=a; i<b; i++)
#define forb(i,a,b) for(int i=a; i<=b; i++)
using namespace std;
int main(){
int t;
cin >>t;
while(t--)
{
int n,x;
cin >>n >>x;
int a[n];
int w=0;
for(int i=0; i<n; i++)
{
cin >>a[i];
if(a[i] <=x... | ALGO | 0.999947 | 3.608323 |
0a58e940-6121-4eef-a9cf-cb4344c7cc31 | xiaff/sword-offer-practice | 30-39/problem_32.cpp | /*
面试题32:从1到n整数中1出现的次数
输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数。
例如输入12,从1到12这些整数中包含1的数字有1,10,11和12,一共出现了5次。
*/
#include<iostream>
class Solution
{
public:
int numberOf1Between1AndN(int n) {
if (n <= 0) return 0;
char s[100];
sprintf_s(s, "%d", n);
int length = strlen(s);
return NumberOf1(s, length);
}
private... | ALGO | 0.999313 | 4.947114 |
df55f00e-7ed5-4942-ada4-f599d6fc74b0 | hyzenberg22/leetCode-Solutions- | Easy/Remove_Duplicates_from_Sorted_Array.cpp | #include <bits/stdc++.h>
using namespace std;
// This problem can be solved
// 1. Hash set appraoach , O(N*logN)+O(N)
// 2. Two Pointer appraoach O(N)
// Two pointer approach
int removeDuplicates(vector<int>& nums){
if(nums.size() == 0) return 0; // cheaking the array is valid or not
int i = 0; // T... | ALGO | 0.999696 | 5.533598 |
0204a494-4ad9-478a-ada7-a6b686db88aa | ishandutta2007/codeforces | laycurse/normal/1525/A.cpp | #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class T> struct cLtraits_identity{
using type = T;
}
;
template<class T> using cLtraits_try_make_signed =
typename conditional<
is_integral<T>::value,
make_signed<T>,
cLtraits_identity<T>
>::type;
inline int my_getc... | ALGO | 0.999483 | 4.104495 |
a0902734-9617-432a-bfef-7eee8d22392f | NgDuyPhuoc/Dev-C | 100c-btap-laptrinh/Phan 2/bai16.cpp | #include<stdio.h>
int kiemTraSoNTo(int n){
int count = 0;
for(int i = 1; i <= n; i++){
if(n % i == 0)
count++;
}
if(count == 2){
printf("%d La so nguyen to\n", n);
}else{
printf("%d Khong phai la so nguyen to\n", n);
}
return count;
}
int main(){
int n;
printf("Nhap so nguyen to: n = ");
scanf("%... | ALGO | 0.999646 | 3.567862 |
075b8d31-40e2-4902-b854-a2e67c33c448 | AngelAltur/PMDM_Miguel_Angel_24-25 | Proyecto TFC/SafeBite/safe_bite/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.996711 | 6.772262 |
c58412aa-e009-41bd-89cf-2a6ea7a10176 | yakel/OJ-solutions | uva/1030.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 10
using namespace std;
int n;
char pos[MAXN][MAXN][MAXN];
char view[6][MAXN][MAXN];
char read_char()
{
char ch;
while(1)
{
ch = getchar();
if ((ch >= 'A' && ch <= 'Z') || ch == '.') return ch;
}
}
void get(int k, int i, int j, int len,... | ALGO | 0.998748 | 3.253166 |
ddf1017b-2d89-49b9-930f-5728afc38126 | Muratvermez/-SE226- | Se226_Lab3_C++/Lab3.cpp | #include <iostream>
using namespace std;
class Node {
public:
//datayı pointlememe gerek yok zaten ben giricem
int data;
Node *next;
};
class Queue {
public:
Node *front;
Node *rear;
Queue() {
front = rear = NULL;
}
//boş olup olmadığını boolean ile kontrol ediyorum
bool ... | ALGO | 0.995587 | 4.893039 |
e21bb4f6-5cc1-46b8-8ac9-03a98ac80092 | AjajAlam1399/Leetcode-Aj | 2411-spiral-matrix-iv/spiral-matrix-iv.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
vector<vector<int>> s... | ALGO | 0.999994 | 5.826451 |
9f386169-8323-4cd1-b09b-d7e02f91d601 | Tanishgupta007/DSA-CPP | 141_Phone_keypad_problem.cpp | // // Ḷeetcode-17 Phone keypad problem
// class Solution {
// private:
// void solve(string digits,int index,string output,vector<string>& ans,string mapping[]){
// //base case
// if(index>=digits.length()){
// ans.push_back(output);
// return;
// }
// int n... | ALGO | 0.999747 | 6.334898 |
3b3cb085-fadf-4385-b042-b6cb832f77ec | utkarshluthra/CP-Archive | CodeChef/AIRLINE.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t; cin>>t;
while(t--){
int count=0;int a, b, c, d, e;cin>>a>>b>>c>>d>>e;
if(a+b<=d && c<=e){
count++;
}
else if(b+c<=d && a<=e){
count++;
}
else if(a+c<=d && b<=e){
... | ALGO | 0.999873 | 3.853518 |
4c2cc2ea-f81e-4d00-95f8-3ffc1386824e | Nebil-Hussien/Magic-Square-Game | main.cpp | /*
Magic Square Game
Done by : - Liuel Shimelis NSR/9269/10
Mukhtar Saeed NSR/3425/10
Nebil Abdulsemed NSR/1355/10
Sebhatleab Mekbib NSR/ /10
Yitayesh Asabu NSR/ /10
Yoakin H/Gebriel NSR/9650/10
*/
#in... | ALGO | 0.983558 | 3.169305 |
b404abb0-7546-48aa-bf99-707db6feb377 | ishandutta2007/codeforces | ljc00118/normal/1461/F.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename _T>
inline void read(_T &f) {
f = 0; _T fu = 1; char c = getchar... | ALGO | 0.999996 | 3.362041 |
b7d8fc63-76b2-45d3-acd5-bb1447723dd9 | IrinaStatsLab/SmoothHOOI | src/MainFuncs.cpp | #include <RcppArmadillo.h>
using namespace Rcpp;
// init_L: Initialize the L matrix
// tnsr: tensor data, but in the array form (in R, tnsr@data)
// r1: the rank to compress the 1st mode to
arma::mat init_L(const arma::cube& tnsr, int r1) {
int a = tnsr.n_rows; // original dimension of mode 1
int b = tnsr.n_col... | ALGO | 0.999256 | 6.573585 |
ef49e5d5-5d52-4d93-a18b-7ef5d38eb6e7 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/09/0918/personal_submission/cf340e_WanderOvO.cpp | /*
2 3 1 5 4
-1 3 -1 5 4
如果最开始就有 a[i] = i 的数了,直接不用算了
如果没有,考虑还没填的数字 val
val 可以分成两类:
- a[val] = -1,则 val 还不能随便填
- a[val] != -1,则 val 已经可以随便填了
假设有 not_free_cnt 个数字还存在禁止填的地方,free_cnt 个数字可以随便填
m = not_free_cnt + free_cnt
第一步是求从 m 个位置中选 not_free_cnt 个位置放数,使得满足题意的方案数
容斥,枚举至少有 i 个数放在了不动点位置,1 <= i <= not_free_cnt
C(not_free_cnt... | ALGO | 0.99997 | 4.05524 |
e3353586-9391-4eff-9c17-12b7c62e576a | payce06/cPlusPlus---Notes | vector1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
// printVector
void printVector(vector<int> v1, string methodName) {
cout << "After the method: " << methodName << endl;
for (int i = 0; i < v1.size(); i++) {
cout << v1[i] << " ";
}
cout << endl;
... | TOOL | 0.989789 | 3.843214 |
22ab7675-76a5-42fe-8474-912c249a24bb | Dynesshely/Competition | source/districts/cq/cqyc/2022/03-06/src/std/king.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m,q,a[500010];
bool set[2000010];
long long lazy[2000010],ans[500010],sum[2000010],now;
struct question{
int opt,x,y,z;
}Q[500010];
void clear(int k){
lazy[k]=sum[k]=0;
set[k]=1;
}
void in(int l,int r,int k,long long v){
sum[k]+=1ll*v*... | ALGO | 0.99966 | 3.522127 |
5c165b8b-abbd-45ce-afbe-ccd9204c9811 | SF-coding-study/study | dayeong/PGS/STACKQUE/같은 숫자는 싫어.cpp | #include <vector>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> arr)
{
vector<int> answer;
answer.push_back(arr[0]);
for(int i = 0; i < arr.size()-1; i++){
if(arr[i] != arr[i+1]){
answer.push_back(arr[i+1]);
}
}
return answer;
} | ALGO | 0.999938 | 5.12633 |
aa654293-cd2f-4ef9-90ad-039ea2c7476a | Seeyoutomato/CPE-code | uva 544.cpp | #include <iostream>
#include <map>
#include <cstring>
using namespace std;
const int unknownmaxweight = -1;
struct City{
string name;
map<string,int> edges;
int maxweight;
bool isVisited;
};
int findmaxweight(map<string,City>& roadmap,const string& sourcename,const string& targetname){
City* currentcity = &(roadm... | ALGO | 0.997644 | 3.991483 |
ed5a2185-2b8a-4fae-b437-99b0216a0fea | Jungdahee/Problem_Solving | Programmers/Programmers_42588.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> heights) { //탑 - success
vector<int> answer;
for(int i = heights.size()-1; i >= 0; i--){
int num = heights[i];
for(int j = i - 1; j >= 0; j--){
... | ALGO | 0.999803 | 4.806788 |
ef93a053-6f34-446a-b0af-fd9b3acb4bce | daamaleman/EjerciciosPracticosWhile | Ejercicio3While.cpp | /*Escriba el programa para calcular la suma
de los cuadrados de los números entre 1 y 100.*/
#include <iostream>
using namespace std;
int main()
{
int num = 1;
int sum = 0;
while (num <= 100)
{
sum += num * num;
num++;
}
cout << "La suma de los cuadrados de los números entre 1... | ALGO | 0.997598 | 3.886149 |
779bdd04-c1d5-4105-ab65-c7d3a5f1bc6e | vanphatit/ky-thuat-lap-trinh | Chuong 1/bai10chuong1.cpp | #include <bits/stdc++.h>
using namespace std;
struct FRACTION{
long long numer;
long long denomi;
};
void input(FRACTION &fr);
void output(FRACTION fr);
FRACTION reduce(FRACTION fr);
FRACTION max(int n, FRACTION fr[]);
FRACTION min(int n, FRACTION fr[]);
FRACTION sum(int n, FRACTION fr[]);
void bubbleSort(int n, F... | ALGO | 0.998885 | 3.391342 |
3d606b14-001a-4ba0-b0a3-60fd73b5725d | Kuldeepagrahari/Programming-DSA-Shell-BashScripting-OOPS | CP/Origin.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
template <typename Container>
void printer(const Container &container)
{
for (auto it = std::begin(container); it != std::end(container); ++it)
{
cout << *it << " ";
}
cout << endl;
}
// ---------------------------------... | ALGO | 0.999886 | 4.727643 |
bcbef1fb-ce75-4da9-8bb5-66c4629810cb | ishandutta2007/codeforces | yfhuang/normal/808/D.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;
int n;
const int maxn = 1e5 + 5;
int a[maxn];
map<long long,int> mp,mp1;
int main(int argc, const char * argv[]) {
cin >> n;
long long pre = 0,suf = 0;
for(int i = 1;i <= n;i++){
sc... | ALGO | 0.99997 | 3.657622 |
13f4799b-95e7-4715-984a-29efa2f9460d | mdmemonyasin/Problems | algorithm/binary_search/harbour_space.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ll t;
cin>>t;
while(t--){
ll str, in, exp;
cin>>str>>in>>exp;
if(str>in){
while(exp>0){
exp = exp -
}
}
else if(str==in){
while (e... | ALGO | 0.999535 | 3.285031 |
58e0c717-9a0a-40e9-82d7-b066836dde4a | Thyme0113/astnn_with_semi-supervised_learning | ssl_125/data/src/factorial/recursive89.cpp | long long fact( long long n ){
if( n == 1 ) return 1;
return n * fact(n-1);
}
int main(){
long long n;
cin >> n;
n = fact(n);
cout << n << endl;
return 0;
}
| ALGO | 0.999789 | 3.989044 |
9a357ee2-8685-4d8c-91ff-66885401d079 | sorious77/boj | 1000 ~ 9999/2000 ~ 2999/2400 ~ 2499/2440.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = n-i; j > 0; j--)
cout << "*";
cout << endl;
}
} | ALGO | 0.999866 | 3.782846 |
00a833c4-16db-442b-b6ff-1cf69ffa7b60 | AmanUpadhyay8/Basics-of-Cpp | C++ Practice YT/ForLoopMultiplication.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout<<"Enter a positive Integer:";
cin>>n;
int mlt;
for ( int i = 1 ; i<=10 ; ++i) {
cout<<n<<"*"<<i<<"="<<i*n<<endl;
}
return 0 ;
} | ALGO | 0.994524 | 3.444532 |
1a775a9c-2c8f-4560-882d-f7f1371ba414 | manikanta2901/ubuntu | .history/SRM/DAA/Algorithms/Backtracking/SubsetSum_20210520212142.cpp | #include<bits/stdc++.h>
using namespace std;
vector<vector<int> > result;
void PrintSubSet(){
cout << "Total number of subsets are " << result.size() << " -----> " << endl;
for(auto i : result){
cout << i.size() << "-------------> " << endl;
for(auto j : i){
cout << j << " ";
... | ALGO | 0.999216 | 3.993 |
0db79b66-4132-4d2d-b5eb-511f04c6059b | ishandutta2007/codeforces | suiseiseki/normal/1416/A.cpp | #include <cstdio>
int max(int a,int b){
return a>b?a:b;
}
int min(int a,int b){
return a<b?a:b;
}
const int Maxn=300000;
const int Inf=0x3f3f3f3f;
int n;
int a[Maxn+5];
int lst[Maxn+5],pos[Maxn+5];
int len[Maxn+5],ans[Maxn+5];
int main(){
int T;
scanf("%d",&T);
while(T--){
scanf("%d",&n);
for(int i=1;i<=n;i++)... | ALGO | 0.999687 | 3.806679 |
839580ae-5986-41ec-b66e-34b4750df4e9 | sebas095/Competitive-Programming | URI/Simple Sum.cpp | #include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl '\n'
using namespace std;
int main() {
fast;
int a, b;
cin >> a >> b;
cout << "SOMA = " << a + b << endl;
return 0;
}
| ALGO | 0.975506 | 3.170782 |
bf88af94-f954-4056-bf2e-6835ffcde663 | askyx/pg_orca | libgpopt/src/xforms/CXformLeftSemiJoin2NLJoin.cpp | #include "gpopt/xforms/CXformLeftSemiJoin2NLJoin.h"
#include "gpopt/operators/CLogicalLeftSemiJoin.h"
#include "gpopt/operators/CPatternLeaf.h"
#include "gpopt/operators/CPhysicalLeftSemiNLJoin.h"
#include "gpopt/xforms/CXformUtils.h"
#include "gpos/base.h"
using namespace gpopt;
//----------------------------------... | ALGO | 0.994808 | 6.647821 |
0f919ea2-586b-4445-a0c0-504cff8950fb | omagdy7/competitive-programming | codeforces/SumsOfSubSequence/SumsOfSubSequence.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int tt; cin >> tt;
while(tt--) {
vector<int> v(7);
for(int &x : v) {
cin >> x;
}
cout << v[0] << " " << v[1] << " " << v[6] - v[1] - v[0] << endl;
}
}
| ALGO | 0.998679 | 3.128433 |
fd8f7adb-bb0e-4010-b9ed-c73e39ef9d49 | B0TAlan/5150H_compCode | 11 21/TANKcompER40pWORKING11-7-21/Dump.cpp |
//dose not work is not continuous and dose not invert
/*bool Forward = true;
// move if states to void call voidses
//if up is preesed bool = true
if (Controller1.ButtonUp.pressing()) {
Forward = true;
}
//if right pressed bool = false
if (Controller1.ButtonRight.pressing()) {
... | ALGO | 0.978195 | 3.303199 |
84c1ddb9-8c93-4a39-96ad-d686205c0448 | kingarthur11/leetcode | solution/2400-2499/2451.Odd String Difference/Solution.cpp | class Solution {
public:
string oddString(vector<string>& words) {
unordered_map<string, vector<string>> cnt;
for (auto& w : words) {
string d;
for (int i = 0; i < w.size() - 1; ++i) {
d += (char) (w[i + 1] - w[i]);
d += ',';
}
... | ALGO | 0.999885 | 5.876162 |
8a79da97-e4f6-4a05-ad09-3050b8086db7 | yyz845935161/sigin_cpp | 8Aug/8.11.选择排序.cpp | #include <iostream>
#include <vector>
using namespace std;
template <class T = int>
struct Less
{
/* data */
bool operator()(const T &a, const T &b)
{
return a < b;
}
};
//希尔
// 1预排序
// 2直接插入排序
template <class T, class Com = Less<T>>
void SelectSort(vector<T> &v)
{
Com _com;
for (int i... | ALGO | 0.999968 | 4.703598 |
5723e11b-7424-40f9-8c7b-a2ccb7664af9 | Dolyetyus/My-Hackerrank-3-Months-Preparation-Solutions | week4/anagram.cpp | int anagram(string s) {
int len = s.size();
if (len % 2 == 1) {
return -1;
}
string str_a = s.substr(0, len/2);
string str_b = s.substr(len/2);
map <char, int> mapA;
map <char, int> mapB;
int min = 0;
for (auto chr : str_a){
mapA[chr]++;
}
... | ALGO | 0.999989 | 4.883169 |
fff59624-6080-4618-8b7d-cd6939bee75e | graphretrieval/ESSIso | MQO/MQO/MQO/CoreVertexSpanOverlapQG.cpp | #include"CoreVertexSpanOverlapQG.h"
#include"AdjacenceListsGraph.h"
#include<random>
#include<time.h>
/*
* We first find a set of core vertices and then find subgraphs around this core vertex.
* We can specify how many graphs for each core-group
*/
using namespace std;
CoreVertexSpanOverlapQG::CoreVertexSpanOverl... | ALGO | 0.967615 | 3.533347 |
d21c76f8-f9b0-4bfb-89ed-c3889285d7b0 | mukul9897/July-LeetCode-Challenge-2020 | Day04(Ugly Number II).cpp | class Solution {
public:
int count=1;
int nthUglyNumber(int n) {
set<long>s;
s.insert(1);
long long int ans=1;
while(n--){
ans=*s.begin();
s.erase(s.begin());
s.insert(ans*2);
s.insert(ans*3);
s.insert(ans*5);
}
... | ALGO | 0.999991 | 5.774356 |
d5c58591-4261-4717-b2a8-9b87f87bbe05 | Shubham21122002/DSA_QUESTIONS | rotated_array_search.cpp | #include <iostream>
#include<vector>
using namespace std;
int find_Pivot(vector<int>& arr, int n) {
int start = 0, end = n - 1;
while (start < end) {
int mid = start + (end - start) / 2;
if (arr[mid] > arr[end]) {
start = mid + 1;
} else {
end = mid;
}
... | ALGO | 0.999971 | 6.033149 |
24a4cea1-c012-46ea-a005-bd1f537d0e01 | ffskyfan/LeetcodeTest | Leetcode/code/rotate_array.cpp | //--------------------------------------------------------------------
//189. Rotate Array
//Easy
//Given an array, rotate the array to the right by k steps, where k is non - negative.
//
//Example 1:
//
//Input: [1, 2, 3, 4, 5, 6, 7] and k = 3
// Output : [5, 6, 7, 1, 2, 3, 4]
// Explanation :
// rotate 1 steps to the... | ALGO | 0.999945 | 5.66438 |
b5876caa-b1f5-4dce-bd6d-8e3eed37fc64 | Vishal-Agarwal12/Competitive-programming-codes | 1878E.cpp | #include <iostream>
#include <vector>
using namespace std;
// Function to compute bitwise AND of two numbers
int bitwiseAnd(int a, int b) {
return a & b;
}
// Function to build the segment tree
void build(vector<int>& segment_tree, vector<int>& arr, int node, int start, int end) {
if (start == end) {
... | ALGO | 0.999987 | 5.770947 |
541ca0d7-c684-458d-867c-4d898bcee9b6 | Habib599/Cpp-for-DSA | Module 3.5/G_Palindrome_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
bool isPalindrome = true;
int i = 0, j = n - 1;
while (i < j) {
if (a[i] != a[j]) {
isPalindrome = false;
break; ... | ALGO | 0.99999 | 5.340936 |
8c942e36-1071-4869-9802-77c7513807db | Jatin-parashar/Data_Structures_and_Algorithms | Array Pair Sum Divisibility Problem - GFG/array-pair-sum-divisibility-problem.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool canPair(vector<int> nums, int k) {
// Code here.
map<int,int> mp;
for(auto x:nums){
mp[x%k]++;
}
if(mp[0]%2!=0) return false;
for(in... | ALGO | 0.999524 | 5.508267 |
a89f6b6b-5248-4b1a-ac4e-a794942a0138 | MohammadElsharqawy/CompetitiveProgramming | codeforces/4/A.cpp | #include <iostream>
using namespace std ;
int main ()
{
int w =0 ;
cin>> w;
if (w>=1 &&w<=100)
if (w%2==0&&w>2)
cout<<"YES"<<endl;
else
cout <<"NO" ;
} | ALGO | 0.995851 | 3.144371 |
c567f293-f8ae-49fa-a81a-b43ebd08ed95 | ishandutta2007/codeforces | sohsoh/normal/1628/D1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl '\n'
#define debug(x) cerr << #x << ": " << x << endl;
const ll MAXN = 2000 + 10;
const ll MOD = 1e9 + 7;
const... | ALGO | 0.999968 | 4.231745 |
3867f02c-a514-4c2d-8434-e74ee7bc1a56 | deepaligarg/Optical_Character_Recognition-and-Web_Crawler | tess-two/jni/com_googlecode_tesseract_android/src/ccstruct/ratngs.cpp | #ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "ratngs.h"
#include "blobs.h"
#include "callcpp.h"
#include "genericvector.h"
#include "matrix.h"
#include "normalis.h" // kBlnBaselineOffset.
#include "unicharset.h"
using tesseract::ScriptPos;
ELISTIZE(BLOB_CHOICE);
ELISTIZE(WERD_CHOICE);
const float... | ALGO | 0.925317 | 6.607763 |
07d5c755-308e-4405-8b3b-37d16a198874 | priya-thv/dsa-practice | daily question of leetcode/number of student unble to eat.cpp | class Solution {
public:
int countStudents(vector<int>& students, vector<int>& sandwiches) {
queue<int> q_students;
stack<int> s_sandwiches;
// Initialize queues and stacks
for (int student : students)
q_students.push(student);
for (int i = sandwiches.size() - 1... | ALGO | 0.999844 | 5.717942 |
331ebc6d-feb8-4d90-9ba4-ffe66e5b419e | kaleidot725/Aoj | ITP1_1_C.cpp | #include <iostream>
int ITP1_1_C() {
int a, b;
std::cin >> a >> b;
std::cout << a * b << " " << a * 2 + b * 2 << std::endl;
return 0;
} | ALGO | 0.997798 | 5.163134 |
09e20a5f-5765-4637-aa49-d92479170656 | leandro-araujo-silva/Aprendendo-Cpp | Exercicios1/operador-ternario.cpp | #include <iostream>
using namespace std;
int main () {
double ab1, ab2, media;
cout << "Digite a nota da ab1: ";
cin >> ab1;
cout << "Digite a nota da ab2: ";
cin >> ab2;
media = (ab1 + ab2) / 2;
cout << "Sua nota: " << media << endl;
// Operador Ternario
(media >= 7) ? cout << "Aprovado!" : cou... | TOOL | 0.9867 | 4.690614 |
f17146a0-b224-4d98-a4b9-f02a407f0c03 | refiel-l/caffe-libs | opencv/modules/cudalegacy/src/bm.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
void cv::cuda::calcOpticalFlowBM(const GpuMat&, const GpuMat&, Size, Size, Size, bool, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); }
#else // HAVE_CUDA
namespace optflowbm
{
void cal... | ALGO | 0.999432 | 5.876479 |
6514208a-2ad8-4529-946c-9777fb3ffa57 | ericchristianson/csci333-hash | Hash.cpp | #include "Hash.h"
template <typename V>
Hash<V>::Hash(int s){
size = s;
table.resize(size);
}
template <typename V>
void Hash<V>::insert(string k, V v){
int x = hash(k);
for(int i=0; i < (int) table[x].size(); ++i){
if(table[x][i].getKey() == k){
table[x][i].setValue(v);
}
}
table[x].push_ba... | ALGO | 0.953623 | 5.211345 |
7d14f09d-7be5-446f-8d61-f221b5a13ba6 | yzcmf/Interview | LeetCode-Solutions/C++/generate-random-point-in-a-circle.cpp | // Time: O(1)
// Space: O(1)
class Solution {
public:
Solution(double radius, double x_center, double y_center) :
radius_(radius),
x_center_(x_center),
y_center_(y_center),
gen_((random_device())()),
uni_(0.0, 1.0) {
}
vector<double> randPoint() {
... | ALGO | 0.934161 | 6.066133 |
7602ec46-8ce1-4f65-a03e-b4c78c3ceb4b | donbasta/leetcode-submissions | Medium/861.cpp | class Solution {
public:
int matrixScore(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
int val[m];
for (int i = 0; i < m; i++) {
int tmp = 0;
for (int j = 0; j < n; j++) {
tmp += (grid[i][j] * (1 << (n - 1 - j)));
... | ALGO | 0.999931 | 6.520584 |
8a205d17-291c-4d63-8b2a-86d08a08ab43 | ydb-platform/nbs | contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp | /** \file
* \brief: NFA Graph Builder: used by Glushkov construction to construct an
* NGHolder from a parsed expression.
*/
#include "ng_builder.h"
#include "grey.h"
#include "ng.h"
#include "ng_util.h"
#include "ue2common.h"
#include "compiler/compiler.h" // for ParsedExpression
#include "util/compile_error.h"
#... | ALGO | 0.992068 | 7.850166 |
48367871-15bf-4a2f-8427-0738d3396a9b | hjiang13/LLMs-in-IR | POJ-104/59/915.cpp | #include <iostream>
using namespace std;
/*1200012866 ??? 11.29*/
char a[110][110];
int ganran(int day,int m,int n){
if(day==m){
//???m?
int count=0;
for(int i=1; i<=n; i++)
for(int j=1; j<=n; j++)
if(a[i][j]=='@'||a[i][j]=='a')
count++;
return count;
}
else{
for(int i=1; i<=n; i++)//??
for(int j=1; j<=n; j++){
if(a[i]... | ALGO | 0.997337 | 3.166806 |
7bf629c4-8db6-47ea-ac28-47f4e23d0c72 | chuquangcan/BT09 | BT09_A.cpp | #include <iostream>
#include <cstring>
using namespace std;
int sizeofS(const char* a)
{
int sizea = 0;
for (int i=0; a[i]!='\0'; i++)
{
sizea++;
}
return sizea;
}
char* concat(const char* a, const char* b)
{
int sizea = sizeofS(a);
int sizeb = sizeofS(b);
cout << sizea << " " << sizeb << endl;
char* c = ... | ALGO | 0.8699 | 3.348869 |
9945bc07-a85d-42d1-8bd5-1b9295b9aaed | Archit669/competitive-programming | codechef/starters_46/2_MATH1_Enrolment.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int x,y;
cin >> x >> y;
if (y-x>=0){
cout << y-x << endl;
}else{
cout << 0 << endl;
}
}
return 0;
} | ALGO | 0.999932 | 4.266267 |
a949581c-d093-4cc5-91e4-d561f69837d8 | muschellij2/FSL6.0.0 | extras/include/boost/libs/numeric/ublas/doc/samples/vector_unary.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<std::complex<double> > v (3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = std::complex<double> (i, i);
std::cout << - v << std::endl;
std::cout ... | ALGO | 0.89447 | 3.114119 |
b7175ae7-bb0d-43e1-94f1-8ef8a241fd52 | Jeffrin2005/sliding_window | Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold.cpp |
class Solution {
public:
int numOfSubarrays(std::vector<int>& arr, int k, int threshold) {
int count = 0;
int windowSum = 0;
int targetSum = k * threshold; // Convert average condition to sum for easier comparison
// Calculate the sum of the first window
for (int i = 0; i ... | ALGO | 0.999879 | 6.793129 |
96901354-1f34-415a-8039-fd67e80b2d24 | ishandutta2007/codeforces | ddytxdy/normal/1152/E.cpp | #include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+50;
int n,a[N],b[N],c[N*2],cnt,m,ver[N*4],nxt[N*4],head[N*2],tot=1,d[N*2],h,maxn,stck[N*3],tp,now,ans[N];bool vis[N*2];
void add(int x,int y){
ver[++tot]=y;nxt[tot]=head[x];head[x]=tot;
}
void... | ALGO | 0.99999 | 3.34004 |
f062c448-83d5-44c6-a736-503c095118af | almax87/origin | Lesson6/Task1/operations.cpp | #include "operations.h"
#include <cmath>
double calculation(double a, double b, int operation, std::string& l_operation_description)
{
switch (operation)
{
case 1: l_operation_description = "плюс"; return a+b;
case 2: l_operation_description = "минус"; return a-b;
case 3: l_operation_descriptio... | TOOL | 0.996269 | 4.101434 |
20d51be2-246e-41a4-a953-798abbb2d945 | Nilotlawl/Leetcode-codes | linkedlistcycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
if(head == NULL)
return false;
ListNode *first = head;
ListNode *la... | ALGO | 0.999787 | 5.015746 |
81e03ca2-743a-4220-aa74-3e705b6cf26e | wangxianghust/leetcode | 535EncodeAndDecodeTinyURL.cpp | /* 任意给定一个复杂的URL,将其映射为http://tinyurl.com/4e9iAk形式,也就是一个url映射为6个字符组合
* 字符集包括26*2个字母,10个数字。
* 同时要求可以将字符映射成URL
* Solution:因为要一一映射,解决方案就是计数,先查重,第一次出现的话计数器加一。现在共有62个字符,也就是可以自制一个
* 62进制的计数器。共有62^6个。现在考虑全部是6个的组合,需要两个map
* map<string long, string short>(映射存储) map<int id, string long>(查询) 其中short 是 id 的62进制转化为string,short... | ALGO | 0.997832 | 5.374833 |
291a9df4-6bbf-40e3-9151-ca20785a79f2 | Jaminur-Rashid/Problem-Solving | Uva Online Judge/GCD_11417.cpp | #include<bits/stdc++.h>
#include<algorithm>
#include<cstdio>
using namespace std;
int GCD(int n,int m){
if(m==0){
return n;
}
else{
return(GCD(m,n%m));
}
}
int main(){
int n,G,i,j,ans;
while(scanf("%d",&n)==1){
if(n==0){
break;
}
G=0;
for(i=1;i<n;i++){
for(j=... | ALGO | 0.999869 | 4.360607 |
5a8fecba-82f6-4784-b47e-c2c959962c6d | OrangeVinyl/algorithm | C++/기초지식/numberTheory/gcdLcm.cpp | #include <bits/stdc++.h>
using namespace std;
// 최대공약수
int gcd(int a, int b) {
if (a == 0) return b;
gcd(b % a, a);
}
// 최소공배수
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
int main() {
int a = 10, b = 12;
cout << lcm(a, b) << '\n';
return 0;
} | ALGO | 0.999928 | 5.225252 |
e8873105-2c40-49d8-bf0e-96b5430d0d5b | jyotiraditya0607/LeetCode_DSA | BT-Striver/BTpre-order.cpp | // #include <bits/stdc++.h>
// using namespace std;
// struct node
// {
// int data;
// struct node *left, *right;
// };
// void preOrderTrav(node *curr, vector<int> &preOrder)
// {
// if (curr == NULL)
// return;
// preOrder.push_back(curr->data);
// preOrderTrav(curr->left, preOrder);
/... | ALGO | 0.999988 | 6.288128 |
69db672b-d0af-489e-8ea3-eafd399c8c23 | Aman-Meenia/LeetcodeSolutions | 2302-count-subarrays-with-score-less-than-k/2302-count-subarrays-with-score-less-than-k.cpp | #define ll long long
class Solution {
public:
long long countSubarrays(vector<int>& v, long long k) {
int n = v.size();
int low = 0;
int high = 0;
ll ans = 0;
ll sum = 0;
while(high<n){
sum+=v[high];
if(v[high]>=k){
low=high+1;
... | ALGO | 0.999976 | 5.528709 |
9d86b99f-f72a-456c-b11d-17d4d269d592 | shrinivas96/modern_cpp_beginner | increment_demo.cpp | #include <iostream>
using namespace std;
int main()
{
int i = 0, c;
c = i++; // number will be copied and then incremented
cout << i++ << i << c << endl; // prints i then increments
c = ++i; // number will be copied after incrementing
cout << ++i << i << c << endl; // increments then prints i
retu... | ALGO | 0.99628 | 3.725737 |
14fad78a-1d88-4e51-8b83-1b76c01df341 | KUMAR7BITTU/-oops | saving.cpp | #include<iostream>
using namespace std;
int main(){
int saving;
cin>>saving;
if(saving>5000) {
cout<<"Neha\n";
} else {
cout<<"Rashmi\n";
}
return 0;
} | ALGO | 0.995717 | 3.520043 |
1a0ad67b-2114-40ff-8d04-d50ef9fe36bd | shivamrajpoot7070/Solver_hu_bhaiya | 2874-maximum-value-of-an-ordered-triplet-ii/2874-maximum-value-of-an-ordered-triplet-ii.cpp | class Solution {
public:
long long maximumTripletValue(vector<int>&arr) {
int n=arr.size();
vector<int>leftmaxi(n);
vector<int>rightmaxi(n);
long long maxi=0;
leftmaxi[0]=arr[0];
rightmaxi[n-1]=arr[n-1];
for(int i=1;i<arr.size();i++){
leftmaxi[i... | ALGO | 0.999962 | 5.461333 |
c6d0538f-d6ec-42fa-a616-707767a4744f | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4514_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 130;
long long dp[MAX][2], dt[MAX];
int slen;
char s[MAX];
struct node {
int ty;
char c;
int cnt;
void print() { printf("(ty=%d,c=%c,cnt=%d) ", ty, c, cnt); }
};
node tmp[MAX];
int tnt;
node li[MAX];
int lnt;
int main() {
scanf("%s", s);
for (int... | ALGO | 0.999862 | 3.581446 |
0109cdf8-9d8a-48e6-9142-689a47be60f8 | maxi-k/bachelor-code-arduino | libraries/PID_Beta6/PID_Beta6.cpp |
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "wiring.h"
#endif
#include <PID_Beta6.h>
#include "fuzzy_table.h"
#include <wiring_private.h>
#include <HardwareSerial.h>
/* Standard Constructor (...)***********************************************
* constructor used by most users. the ... | ALGO | 0.978485 | 6.518967 |
35d5e604-793a-4c24-9401-bbcb417323c3 | levelp/cpp_sys | 05/04_template_sum/main.cpp | // Задача:
// Функция, вычисляющая сумму элементов
// массива с произвольным типом данных.
// Понятно, что функция применима только если
// элементы массива поддерживают операцию
// сложения "+"
#include <iostream>
#include <cassert>
using namespace std;
// Универсальная функция суммирования
template <class T>
T sumA... | ALGO | 0.988122 | 5.804157 |
57cfed72-e7bf-48f2-ade7-d18f67d3454d | LeticiaND/Logica-de-Programacao-em-c | CombinandoForEif/forPalindromo.cpp | #include <iostream>
void palindrome (std::string palavra)
{
std::string palavraInverso = "";
for(int i = palavra.length() -1; i >= 0; i--)
{
palavraInverso += palavra[i];
}
if(palavra == palavraInverso)
{
std::cout << "É um palindrome";
}else
{
std::cout << "Nao... | ALGO | 0.998583 | 5.078866 |
744223bf-78a2-4433-ac34-3aec118cc8ec | Shaffin06/Week-3-C-Programming | OddNo.cpp | /* Odd Numbers*/
#include <stdio.h>
int main()
{
int i,n;
printf("Enter value for n \n");
scanf("%d",&n);
for(i=1;i<=n;i+=2)
{
printf("%d \n",i);
}
return 0;
}
| ALGO | 0.994624 | 3.803737 |
04cef960-7187-4f71-a64b-15234adf3448 | Zakalren/Problem-Solve | BOJ/2342.cpp | #include <bits/stdc++.h>
#define MAX (INT_MAX / 2)
using namespace std;
int dp[100001][5][5];
int needed_energy(int current, int target) {
if (current == target) return 1;
if (current == 0) return 2;
if (abs(current - target) == 2) return 4;
return 3;
}
int main() {
ios_base::sync_with_stdio... | ALGO | 0.999932 | 4.222857 |
ba2a7f84-dcc3-4096-8c2e-4c7ec1b405af | YasuraLaksitha/DSA | sorting/defence_kindom.cpp | /*
You are defending a kingdom represented as a 2D grid of size W x H.
Enemies have placed watchtowers at certain coordinates on this grid.
Each watchtower can monitor its entire row and column, preventing defense
placement there.
Your task is to find the largest rectangular area on the grid that is *not* monitored by... | ALGO | 0.999922 | 5.97987 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.