uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
66a317cc-098f-41bc-b311-e6d88b176fbd | ishandutta2007/codeforces | fallac/normal/1693/A.cpp | /*
*/
#include <bits/stdc++.h>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define omode T=1
#define tmode cin>>T
#define cmode(c) T=c
#define... | ALGO | 0.999969 | 4.415266 |
716f4bd5-c80d-4e32-ae8d-f68918bd4869 | Saketmishra14/DSA-Supreme-3.0 | 17 Binary Search Tree/Binary Search Tree class-01/search.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int val){
this->data=val;
left=NULL;
right=NULL;
}
};
// O(logn) to insert a node
Node* buildBST(Node* &root,int val... | ALGO | 0.999959 | 4.73958 |
1cc9b41e-3323-4755-ab9d-87042fc1b96f | AlessandroCecilio/Algoritimo_e_Estrutura_de_Dados | consulta/listaCPP/exs6.cpp | /*Faa um programa que receba a altura e o peso de uma pessoa. De acordo com a
tabela a seguir, verifique e mostre a classificao da pessoa:
Altura Peso
At 60 Entre 60 e 90 Acima de 90
Menores que 1,20 A D G
De 1,20 a 1,70 B E H
Mai... | TOOL | 0.962615 | 3.745931 |
2533e98d-3d56-499a-ac66-6ddca655fff1 | XiandaChen/Handover-LTE-Sim | src/protocolStack/rrc/ho/position-based-ho-manager.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "position-based-ho-manager.h"
#include "../../../device/NetworkNode.h"
#include "../../../device/UserEquipment.h"
#include "../../../device/ENodeB.h"
#include "../../../device/HeNodeB.h"
#include "../../../componentManagers/NetworkManager.h"
P... | ALGO | 0.972577 | 5.858164 |
ce6c13d2-c8d1-41b2-9208-f05d7304c9dd | oushuai01/algorithm | LiKou/随想录/hot100/链表/42_将有序数组转换为二叉搜索树.cpp | /*
* @Author: oushuai <EMAIL>
* @Date: 2023-11-09 19:14:56
* @LastEditors: oushuai <EMAIL>
* @LastEditTime: 2023-11-09 19:26:51
* @FilePath: \algorithm\LiKou\随想录\hot100\链表\42_将有序数组转换为二叉搜索树.cpp
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85... | ALGO | 0.999998 | 6.602743 |
c0e32994-9397-4b9a-83a8-f001a3a782ee | ishandutta2007/codeforces | igorfardoc/normal/1391/E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
int n, m;
vvi g;
vi st;
vi d;
vector<bool> used;
bool dfs(int v, int depth) {
used[v] = true;
st.push_back(v);
d[v] = depth;
if(st.size() >= (n - 1) / 2 + 1) {
return true... | ALGO | 0.999911 | 4.84843 |
a2aec109-ecb8-440c-aa9a-ef8d26c62206 | gkeksd/studyCPP | 챕터9/챕터9_swap.cpp | #include <iostream>
using namespace std;
void swap(int* p1, int* p2) {
int temp = *p1;
*p1 = *p2;
*p2 = *p1;
}
int main() {
int a, b;
cin >> a >> b;
cout << a << b << "\n"; //ҵDZ
swap(a, b);
cout << a << b << "\n"; //ҵ
} | ALGO | 0.999659 | 3.867791 |
7691fe88-457a-4bf4-b118-cb9f387c9032 | anuragbansals/Cpp-Programs | Practice/threedigit.cpp | #include<iostream>
#include<string>
#include<unordered_map>
#include<algorithm>
#include<climits>
#include<vector>
#include<stack>
#include<math.h>
#include<set>
using namespace std;
int calculate(int prod,int y,int k,int x)
{
int c = 3,res = 1,f=0;
for(int i=k,y=y-1;c>0;i--)
{
res = res * k; c--;
... | ALGO | 0.999967 | 4.496739 |
5b251ebc-e267-49f3-8264-4c924f090d73 | Alok-Khansali/Lets-LeetCode | Medium/Check if Number is a Sum of Powers of Three.cpp | // First of all, we need to find the maximum power of 3 that is close to the constraints
// 3^14 = 4782969 (max power of 3 that is close to constraints)
// Now, we need to find all the combinations of 2^15
// We can solve this by bit masking
// We can get the binary of a number in log(n) time
// We can multiply and a... | ALGO | 0.999767 | 6.017503 |
76db0388-3aff-41aa-80e0-0116d3f1a388 | vbonnici/grafe-sim | analysis/data/p02267/s193629699.cpp | #include <bits/stdc++.h>
using namespace std;
class LinearSearch {
public:
int n, q;
vector< int > S, T;
LinearSearch() {}
void solve() {
int ans = 0;
for (int i = 0; i < q; ++i) {
int tar = T[i];
for (int j = 0; j < n; ++j) {
if (S[j] == tar) {
++ans;
break;
}
}
}
... | ALGO | 0.999757 | 4.845263 |
10cad858-fdf6-4388-8001-50649eab5116 | DaddyTrap/DriverFight | cocos2d/cocos/base/CCProperties.cpp | #include "CCProperties.h"
#include <string.h>
#include "platform/CCPlatformMacros.h"
#include "platform/CCFileUtils.h"
#include "math/Vec2.h"
#include "math/Vec3.h"
#include "math/Vec4.h"
#include "math/Mat4.h"
#include "base/ccUTF8.h"
#include "base/CCData.h"
#include "deprecated/CCString.h"
USING_NS_CC;
// Utilit... | TOOL | 0.867955 | 6.739342 |
9cda4cf2-d68e-4104-b8bd-e81757697d1e | eryueniaobp/leetcode | revised/Sqrt(x).cpp | /**
* 牛顿迭代法 f(y) = y^2 - x ( 注意:x是已知量)
* y(n+1) = y(n) - f(y(n))/f'(y(n))
*/
class Solution {
public:
int sqrt(int x) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
double ans = x;
while(abs(ans * ans - x) > 0.0001)
{
... | ALGO | 0.99984 | 4.360523 |
7c58e3ae-5568-4651-8c95-dd318dc348e8 | splucs/Competitive-Programming | Codeforces/Gym/101177 2016-2017 ACM-ICPC, South Pacific Regional Contest (SPPC 16)/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 200009
int N, L, R, x[MAXN], y[MAXN], cnt;
typedef pair<int, int> ii;
vector<ii> adjList[MAXN];
void dfs(int u, int uver) {
if (cnt >= L && cnt < R) {
printf("%d ", u);
}
cnt++;
if (cnt > R) return;
for(int i=0; i<(int)adjList[u].size(); i++) {
int v... | ALGO | 0.999989 | 3.000073 |
ddca060b-6ade-4fc7-ba29-4fab8fef4296 | rv404674/CPcodes | a2 online judge/div2 B/50 prob div2b lev4/garland.cpp |
#include<iostream>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<utility>
#include<limits.h>
#include<functional>
#include<algorithm>
using namespace std;
int... | ALGO | 0.999959 | 3.439192 |
0a2e644a-9ba2-489f-b719-ea4f6ecf5724 | fortuneOS-AOSP/frameworks_av | media/libeffects/hapticgenerator/Processors.cpp | #define LOG_TAG "EffectHG_Processors"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
#include <assert.h>
#include <cmath>
#include "Processors.h"
#if defined(__aarch64__) || defined(__ARM_NEON__)
#ifndef USE_NEON
#define USE_NEON (true)
#endif
#else
#define USE_NEON (false)
#endif
#if USE_NEON
#include <arm_neon.h>
... | ALGO | 0.996421 | 5.578896 |
9653b057-284a-44e7-b8c5-29120a56d34b | tonmoy197/Road_to_1400_on_Codeforces | B_Outstanding_Impressionist.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 400001
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
int l[MAXN], r[MAXN], sum[MAXN], cnt[MAXN];
void solve() {
int n;
cin >> n;
fill(sum, sum + 2 * n + 1, 0);
fill(cnt, cnt + 2 * n + 1, 0);
for (int i = 1; i <... | ALGO | 0.999959 | 4.250341 |
21a150aa-c6d6-48b5-8a05-2df92e391240 | Jaiaid/contest_code | hackerrank/WorldCodeSprint12/TheSalesman.cpp | #include <bits/stdc++.h>
using namespace std;
int minimumTime(vector <int> x) {
// Return the minimum time needed to visit all the houses.
int maxX = x[0], minX = x[0];
for(int l = 1;l < x.size();l++)
{
if(x[l] > maxX) maxX = x[l];
else if(x[l] < minX) minX = x[l];
}
return maxX-minX;
}
int main() {
int... | ALGO | 0.999468 | 5.120527 |
20e024a5-f36f-4897-9a4a-31ee758132c1 | shehzad78675/C-DSA-Code | Loops/Pattens/TrianglePattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter a number ";
cin>>n;
for(int row=1; row<=n; row++){
for(int col=1; col<=row; col++){
cout<<"* ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.996456 | 3.815401 |
c4fab6ab-baa0-4341-9593-15f7fbd16e2f | king-yyf/cpcode | codeforce/cr854/b_1.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for(int i = 1; i <= (e); ++i)
#define f2(i,e) for(int i = 0; i < (e); ++i)
#define r... | ALGO | 0.993542 | 3.671771 |
2aa3a88c-9b65-45e5-bb8f-1b3cd728a652 | hunterkillerbb/Computational-Finance | Coursework 2/Coursework 2 Source code/2.1/2.1.4 different SMax.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <conio.h>
#include <chrono>
using namespace std;
// A generic lagrange interpolation function
double lagrangeInterpolation(const vector<double>& y, const vector<double>& x, double x0, unsigned int n)
{
if (x.size()... | ALGO | 0.999826 | 5.561937 |
3d969484-aaa9-47a7-ada9-720be9f13580 | lovethiscode/boost | libs/geometry/example/c06_custom_polygon_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
struct my_point
{
my_point(double an_x = 0, double an_y = 0)
: x(an_x)
, y(an_y)
{}
... | TOOL | 0.961646 | 7.845809 |
743174af-b445-4b2f-86ab-8a8698175b04 | NavdeepKaurRupaul/IP-DSA | 6 RECURSION/inter leaving.cpp | #include <iostream>
#include<cstring>
using namespace std;
void InterLeaving(char* first, char* second,int m,int n, char* output, int i){
if(m==0 && n==0){
cout<<output<<endl;
}
if(m!=0){
output[i]=first[0];
InterLeaving(first+1,second,m-1,n,output,i+1);
}
if(n!=0){
output[i]=second[0];
InterLeaving(firs... | ALGO | 0.999858 | 3.468204 |
96a5c056-d3fa-4fa2-8206-89d6134fc9da | eerrjhj/CP-Solutions | CodeForces/GNU C++20 (64)/1176A | Divide it!/143107512.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define debug(x) cout << x << endl;
#define ll long long
#define mod 1000000007
//fast factors
//count distinct array
// fast prime
// XOR(num & string)
int main()
{
#ifndef ONLINE_JUDGE
freopen("IN.txt","r",stdin);
freopen("OUT.txt","w",... | ALGO | 0.999927 | 4.165187 |
6d1fb13d-3e83-4c82-8adf-b0d162dd5a77 | ishandutta2007/codeforces | karry5307/normal/429/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double db;
const ll MAXN=2e5+51;
struct Point{
ll x,y;
inline bool operator <(const Point &rhs)const
{
return x==rhs.x?y<rhs.y:x<rhs.x;
}
};
Point pt[MAXN];
ll n;
ll x[MAXN],prefix[MAXN],rr[MAXN];
inline ll read()
{
register ll num... | ALGO | 0.999882 | 3.925723 |
7ff8aad9-fc11-446b-a064-e1d921e010c7 | takano536/atcoder | abc/abc303/c.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
int main() {
const std::map<char, std::pair<int, int>> DIRECTION = {
{'L', {-1, 0}},
{'R', {1, 0}},
{'U', {0, 1}},
{'D', {0, -1}}
};
int n, m, h, k;
std::cin >> n >> m >> h >> k;... | ALGO | 0.999988 | 4.869493 |
a7ab0b86-3f45-4817-957e-aefcf61a482e | JISecond/AlgorithmsLabs | Lab3_QuickSort/Lab3QuickSort/Lab3QuickSort.cpp |
#include <fstream>
#include <chrono>
#include "QuickSort.h"
#include <iostream>
int main() {
srand(time(NULL));
std::ofstream f("SortTime.txt");
for (int size = 1; size <= 100; ++size)
{
std::chrono::nanoseconds time1 = std::chrono::nanoseconds(0);
std::chrono::nanoseconds time2 ... | ALGO | 0.952627 | 4.794517 |
951862ac-f898-4c3c-b84d-34d2f05bf492 | 2019Shun/atcoder_submission | ABC/abc002/abc002_4_5411263.cpp | #include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
... | ALGO | 0.999955 | 3.468089 |
362fc0b5-50c2-4c2a-924e-9e8f5ebfdf85 | RealtimeRobotics/netgen | libsrc/meshing/improve2.cpp | #include <mystdlib.h>
#include "meshing.hpp"
#include <opti.hpp>
#ifndef SMALLLIB
//#ifndef NOTCL
//#include <visual.hpp>
//#endif
#endif
namespace netgen
{
class Neighbour
{
int nr[3];
int orient[3];
public:
Neighbour () { ; }
void SetNr (int side, int anr) { nr[side] = anr; }
int GetN... | ALGO | 0.999635 | 5.22353 |
cd44377a-8c5c-42a1-91b4-70a221880c0c | UestcXiye/Leetcode | 665.非递减数列.cpp | /*
* @lc app=leetcode.cn id=665 lang=cpp
*
* [665] 非递减数列
*/
// @lc code=start
class Solution
{
public:
bool checkPossibility(vector<int> &nums)
{
if (nums.size() <= 2)
return true;
int n = nums.size();
bool flag = nums[0] <= nums[1] ? true : false; // 标识是否还能修改
//... | ALGO | 0.999992 | 6.380813 |
56a20828-4720-4d92-a8c9-fdb3b2d395ee | liza-jahan/CodeForce | CF.A. Epic Game.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
return a?gcd(b%a,a):b; }
int main()
{
int a ,b,c,n=0,v=0,x,y;
cin>>a>>b>>c;
while(c>0)
{
if(n==0)
{
x = gcd(a,c);
c-=x;
n=1;
}
else {
y =gcd(b,c);
c-=y;
n =0;
}
}
if(n==1)
{
... | ALGO | 0.999978 | 4.035398 |
5a00d985-f94c-4186-b09c-a91d7f1afc27 | vipullm10/DSA | BinarySearch/RotatedBinarySearch.cpp | //
// RotatedBinarySearch.cpp
// DSA
//
// Created by Vipul Devnani on 19/09/23.
//
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
int getPivotIndex(vector<int> &arr){
int start = 0 , end = arr.size() - 1;
while(start <= end){
int mid = start + (end - start)/2;
... | ALGO | 0.999998 | 6.147528 |
fbca3eb4-e13c-43c6-bd13-5d766c002518 | kamleshjoshi8102/Data_Structure_And_Algorithms | Graphs/Single_source_shortest_path.cpp | #include <bits/stdc++.h>
#define ll long long
#define en '\n'
#define rep(a,b) for(ll i=a;i<b;i++)
#define pb push_back
const ll mod = 1e9 + 7;
using namespace std;
template<typename T>// map<T>mp => map<int>mp || map<char>mp || map<str... | ALGO | 0.999911 | 4.138613 |
32d4cb3c-7bd5-4b33-b499-61be93c3052c | rs22shekhawat/DSA-SUPREME-CODES-LOVE-BABBAR | Babbar Lecture Codes/Stacks/StacksL2/sortAStack.cpp | #include <iostream>
#include<stack>
using namespace std;
void insertSorted(stack<int>& s, int target) {
//base case
if(s.empty()) {
s.push(target);
return;
}
if(s.top() >= target) {
s.push(target);
return;
}
... | ALGO | 0.999939 | 5.196701 |
5d800ff0-2c9a-4a82-afb2-1d6a71bb060b | 8bit-nyk/HSLAM | Thirdparty/opencv-3.4.6/opencv_contrib-3.4.6/modules/tracking/samples/benchmark.cpp | #include "opencv2/core/utility.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/tracking.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/plot.hpp"
#include "samples_utility.hpp"
#include <fstream>
#include <iomanip>
#include <iostream>
using namespace std;
using namespace cv;
// TODO: do normalization ala ... | ALGO | 0.996971 | 6.118627 |
3858d105-5b6c-4b1a-828d-1df7a6c35783 | Danny024/Self_Driving_Car_Engineer | P4_Motion_Planning/nd013-c5-planning-starter/project/starter_files/behavior_planner_FSM.cpp | /**********************************************
* Self-Driving Car Nano-degree - Udacity
* Created on: September 20, 2020
* Author: Munir Jojo-Verge
**********************************************/
/**
* @file behavior_planner_FSM.cpp
**/
#include "behavior_planner_FSM.h"
using std::pow;
using std::sin;
us... | ALGO | 0.998931 | 6.048192 |
2bd4fe0f-4213-4b68-9b3f-301d284cd1ad | MyLeetCodeRecord/cpp-leetcode | workspace/392.判断子序列.cpp | /*
* @lc app=leetcode.cn id=392 lang=cpp
*
* [392] 判断子序列
*/
// @lc code=start
class Solution {
public:
bool isSubsequence(string s, string t) {
vector<vector<int> > dp(s.size()+1, vector<int>(t.size()+1, 0));
for(int i=1; i<=s.size(); i++){
for(int j=1; j<=t.size(); j++){
... | ALGO | 0.999934 | 6.418609 |
695b230a-ef4f-4617-95e5-efcbe803df57 | zihaomu/opencv_lite | 3rdparty/MNN/source/backend/cpu/compute/ConvolutionPackFreeWinograd.cpp | #include "backend/cpu/compute/ConvolutionPackFreeWinograd.hpp"
#include <math.h>
#include "backend/cpu/compute/CommonOptFunction.h"
#include "core/Concurrency.h"
#include "backend/cpu/compute/ConvOpt.h"
#include "core/Macro.h"
#include "core/TensorUtils.hpp"
#include "math/WingoradGenerater.hpp"
#include <MNN/AutoTime.... | ALGO | 0.998952 | 3.918271 |
b97c4701-5a7c-44e7-bcf2-fab6045d9ce1 | Akshaysd592/DSA-problems | pointer/character_array.cpp | #include<bits/stdc++.h>
using namespace std;
int printsum(int *arr,int n);
void print(int *p){
cout<<*p<<endl;
}
void update (int *pt){
// pt= pt+1;
// cout<<"inside the function"<<pt<<endl;
*pt = *pt +1;
cout<<"inside "<<*pt<<endl;
}
int main(){
// int arr[5]={1,2,3,4,5};
// char ch[6]="abcde";
/... | ALGO | 0.992293 | 3.887108 |
595e6337-093d-40ee-8c4d-2e6c8f013419 | movingrock/Baekjoon | 프로그래머스/1/42862. 체육복/체육복.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
int student[31] = {0, };
int solution(int n, vector<int> lost, vector<int> reserve) {
int answer = 0;
for(int i= 1; i<=n; i++){
student[i] = 1;
}
for(int i= 0; i<reserve.size(); i++){
student[reserv... | ALGO | 0.999621 | 4.389271 |
82b8a706-cdf5-4970-a584-0956a3874833 | tcg-ethun/C-Plus-Plus | 9.cpp | #include<iostream>
using namespace std;
void shot(int arr[],int n){
int temp;
for(int pass=0; pass<n-1;pass++){
for (int j = 0; j < n - 1 - pass; j++) {
if (arr[j] > arr[j + 1]) {
temp = arr[j];
arr[j] = arr[j + 1];
... | ALGO | 0.99989 | 5.269348 |
2c752575-fb20-4e12-8894-b5195f66193f | rwightman/boost | libs/math/example/bessel_zeros_example_1.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4512) // assignment operator could not be generated.
# pragma warning (disable : 4996) // assignment operator could not be generated.
#endif
#include <iostream>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <iterator>
// Weisstein, E... | ALGO | 0.998173 | 6.228512 |
a5725fe3-bec4-47e9-b31f-44fdd395b766 | taku-xhift/atcoder | APG4b/AdditionAndMultiplication.cpp |
#include <iostream>
using namespace std;
long min(long n, long k, long now) {
if (n == 0) {
return now;
}
long d = now * 2;
long add = now + k;
long ret = 0;
if (d > add) {
ret = min(n-1, k, add);
} else {
ret = min(n-1, k, d);
}
return ret;
}
int main() {
long n, k;
cin >> n >> k;
long resul... | ALGO | 0.999881 | 3.539181 |
e97a5da8-798c-45c1-8f54-fa323f92aa87 | mgncodes/SolveLeetCode | Q1834_SingleThreadedCPU.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
vector<int> getOrder(vector<vector<int>>& tasks) {
long n = tasks.size(), t = 0, i = 0;
priority_queue<pair<long, long>, vector<pair<long, long>>, greater<>> p;
vector<int> ans;
for(int i=0; i<n; ++i)
tasks[i].push_bac... | ALGO | 0.999982 | 4.758302 |
b5c9d2cd-f9ba-4162-983f-c42bd3362891 | ishandutta2007/codeforces | 4et_llpuyhbljl/normal/1506/E.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
#include<vector>
#include<iostream>
#include<stack>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<tuple>
#include<bitset>
#include<queue>
#include<... | ALGO | 0.999988 | 4.164608 |
9b731118-acdf-451d-ae71-9533623c24f9 | codewithowais/4th-class-b6 | 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 |
5af1a5b5-85e9-4d40-8ce2-9ea23ce8b6b9 | OnMyTeam/Cpp | CppExample/Example35.cpp | // 코드업 기초 100제 - [기초-산술연산] 정수 두 개 입력받아 합 출력하기1
/*
문제 :
정수 2개를 입력받아 합을 출력하는 프로그램을 작성해보자.
(단, 입력되는 정수는 -1073741824 ~ 1073741824 이다.)
입력
두 개의 정수가 공백으로 구분되어 입력된다.
** 주의 : 계산의 결과가 int 데이터형의 표현 범위로 가능한지를 생각해 보아야 한다.
출력
입력 받은 두 정수의 합을 출력한다.
입력 예시
123 -123
출력 예시
0
*/
#include<stdio.h>
int main(){
int ia,ib;
... | ALGO | 0.99847 | 4.142751 |
c63eb556-6d48-4451-a133-c0009ab8bd29 | ishandutta2007/codeforces | lyc_music/normal/1628/D2.cpp | // Lynkcat.
// Problem: D2. Game on Sum (Hard Version)
// URL: https://codeforces.com/contest/1628/problem/D2
// Memory Limit: 256 MB
// Time Limit: 3000 ms
// -----------------------------------------------
//~~
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long l... | ALGO | 0.999945 | 4.612035 |
f29f9504-f961-4d2b-aef8-905eb11cac9a | GreyAtlantean/cell-automata | src/grid.cpp | #include "../include/grid.h"
#include <raylib.h>
#include <omp.h>
Grid::Grid(int x, int y, int w) {
grid_x = x;
grid_y = y;
grid_w = w;
reset_grid();
}
Grid::Grid() {
grid_w = 25;
}
void Grid::setup_grid(int x, int y) {
grid_x = x;
grid_y = y;
reset_grid();
}
void Grid::toggle_square(int x, int y) {
i... | ALGO | 0.965888 | 5.07061 |
d94ecb65-b596-4ac4-8577-83242611d9da | adityadeshmukh10/GFG | Difficulty: Easy/N meetings in one room/n-meetings-in-one-room.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to find the maximum number of meetings that can
// be performed in a meeting room.
int maxMeetings(int n, int start[], int end[]) {
// Your code here
vector<pair... | ALGO | 0.999923 | 6.058197 |
96bde492-08a4-4379-bbfb-f7b243787a48 | matcher9131/AtCoder-Repo | typical90/051-060/056/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <climits>
#include <cfloat>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <numeric>... | ALGO | 0.999955 | 4.256832 |
c424b096-d0e9-44de-8e9e-a7e3c39248a7 | MahmudNiloy680/XPSC_Phitron_B6 | Week_7_Bit_Manipulation_1/A_OR_Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl '\n'
#define tt(x) int x; cin >> x; while (x--)
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
tt(t)
{
int n; cin >> n;
for (int i = n ;i > 0; i--)
cout << i << " ";
cout << n... | ALGO | 0.999863 | 5.014433 |
331f3b29-8b0c-483b-9a40-35cd870ec994 | daajoe/dynasp | dynasp/src/algorithms/InverseSimpleDynAspTuple.cpp | #ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "../util/debug.hpp"
#include "InverseSimpleDynAspTuple.hpp"
#include <stack>
#include <cmath>
namespace dynasp
{
using htd::vertex_t;
using htd::vertex_container;
using sharp::Hash;
using std::size_t;
using std::unordered_set;
using std::stack;
using... | ALGO | 0.992646 | 5.352437 |
392bbfdc-c7cf-4e43-8f97-c1bf2551d7be | AshrafWzza/merger | 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.998762 | 6.786404 |
69220cce-9565-4afd-947e-88e2486f32d6 | A-R-M-028/DSA | 9 RECURSION/clibmSairs.cpp | //You are climbing a staircase. It takes n steps to reach the top.
//Each time you can either climb 1 or 2 steps.
//In how many distinct ways can you climb to the top?
class Solution {
public:
int climbStairs(int n) {
//opnimization needed after completion of DP
// if(n==0||n==1) return 1;... | ALGO | 0.99983 | 5.251462 |
731a7d3d-fc19-4e9e-b63f-aa0a4f31361c | SantiagoBaezDuic/UTN-AyED-Ejercicios | 1.2.1/Ejercicio16.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
Consigna:
Dado un valor numérico entero positivo n, informar el n-ésimo término de la suce-
sión de Fibonacci. Por ejemplo: si n es 6, la salida del programa debe ser 8.
NOTA: Los primeros dos términos de la serie de Fibonacci son 1 y 1. Luego, cada
términ... | ALGO | 0.999922 | 5.557127 |
adbfa733-cb0e-4b96-853a-71f6f0e61a1b | emanueljuliano/Competitive_Programming | prog_comp/lista_2/isosceles.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define f first
#define s second
typedef pair<int, int> ii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
int main(){ _
int n; cin >> n;
vector<int> v(n);
for(auto &i: v) c... | ALGO | 0.999974 | 3.898843 |
f6ae4305-d0ee-4331-9057-1d6c20c0c4d8 | meatsby/cpp | CS2311/Lab4/Q2.cpp | #include <iostream>
using namespace std;
int main() {
int cur_year, cur_month, cur_age, birth_month, year, month;
cout << "Enter the current year:" << endl;
cin >> cur_year;
cout << "Enter the current month:" << endl;
cin >> cur_month;
if (1 > cur_month || cur_month > 12) {
cout << "... | TOOL | 0.952488 | 3.59694 |
e005c4ff-2c89-4d1d-b53f-cf5982768f20 | FelipeSempertegui/FEM_renderer | externalLibraries/libigl-master/include/igl/uniformly_sample_two_manifold.cpp | //////////////////////////////////////////////////////////////////////////////
// Helper functions
//////////////////////////////////////////////////////////////////////////////
IGL_INLINE void igl::uniformly_sample_two_manifold(
const Eigen::MatrixXd & W,
const Eigen::MatrixXi & F,
const int k,
const double p... | ALGO | 0.999623 | 5.70478 |
5f0e086b-38a6-4485-8795-95393b0dbcd7 | RadicalTeapot/arduino-sixd | src/lfo.cpp | #include "lfo.h"
#include <math.h>
float Lfo::Process(float delta) {
phase_ += delta * frequency_;
phase_ = phase_ - static_cast<int>(phase_); // Keep only fractional part (delta is assumed to be positive)
return 2 * amplitude_ * fabs((phase_ + phaseShift_) - floor((phase_ + phaseShift_)+0.5f));
}
| ALGO | 0.986932 | 4.974203 |
4e7e8d05-01ce-4b33-bb4f-f76f0946556d | khichinho/COL380-Parallel-Assignments | A1/a1_pthreads.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <random>
#include <cstdlib>
using namespace std;
int n; // Size of matrix
int t; // Number of threads
void print_matrix(double **a){
for(int i =0 ; i < n ; i +=1){
for(int j = 0 ; j < n ; j +=1){
cout << a[i][j] << " " ;
... | ALGO | 0.999824 | 3.45328 |
04a76d86-63bb-45c8-8ee0-7fa5d43d4547 | msk7529/history | algorithm/Graph/dfs/효율적인해킹.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <stack>
#include <utility>
#include <cmath>
using namespace std;
// baekjoon
int N, M, num1, num2, ret;
vector<int> adj[10001];
vector<int> result;
int visit[10001];
void dfs(int a)
{
visit[a] = 1;
ret++;
for (... | ALGO | 0.999996 | 3.958784 |
c818299d-bcbf-411d-b6d7-e172a23267c6 | lwher/Algorithm-exercise | C++/tyvj/TYVJ 1519.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,R,dui[400010];
int sz,son[400010][10],fail[400010],to[400010][10];
long long f[70][400010],ans1,ans2;
char s[25];
bool danger[400010];
void Ins()
{
int len=strlen(s+1),i,k,now=0;
fo... | ALGO | 0.999272 | 3.368997 |
3d39b1c1-ba9f-42b8-aaa3-cd6232ab7bf9 | xmg2024/Leetcode-Solutions | 0501-1000/0956-Tallest-Billboard/cpp-0956/main.cpp | /// Source : https://leetcode.com/problems/tallest-billboard/
/// Author : liuyubobobo
/// Time : 2020-05-12
#include <iostream>
#include <vector>
using namespace std;
/// Memory Search
/// Time Complexity: O(n * max_sum)
/// Space Complexity: O(n * max_sum)
class Solution {
private:
const int OFFSET = 5000;
... | ALGO | 0.999915 | 5.729524 |
8a7060fd-0217-4e21-bf05-1c7562a220a9 | jitu7033/DSA_IN_CPP | level4-main/empb.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
Node* left;
Node* right;
int val;
Node(int val){
this->val = val;
left = right = NULL;
}
};
Node* insert(Node* root, int val){
if(root == NULL)return new Node(val);
if(val < root->val){
root->left = insert(root->left,val);
}
if(val > r... | ALGO | 0.999993 | 4.68543 |
b6374c99-e956-4bbb-92df-1e0375f02cdd | fanyuguang/programming | algorithms/heap_sort.cpp | #include <iostream>
using namespace std;
// heap_size: n
// height: log2^(n + 1)
// first leaf index: n / 2 + 1
// for node i, leaf node: i * 2 + 1, right node: i * 2 + 2
void max_heapify(int* array, int index, int end_index)
{
if (index > end_index || index < 0)
{
return;
}
int left = index * 2 + 1;
in... | ALGO | 0.999943 | 4.66832 |
b895920b-726b-4c8f-a2a3-4f8895970710 | ApumpK1n/Games101 | homework/Assignment7/Assignment7/BVH.cpp | #include <algorithm>
#include <cassert>
#include "BVH.hpp"
BVHAccel::BVHAccel(std::vector<Object*> p, int maxPrimsInNode,
SplitMethod splitMethod)
: maxPrimsInNode(std::min(255, maxPrimsInNode)), splitMethod(splitMethod),
primitives(std::move(p))
{
time_t start, stop;
time(&start);... | ALGO | 0.996877 | 6.091931 |
1c29bb39-7aa3-4362-9b57-98f246413621 | nteshome/C-simple-projects | 3.cpp | #include <iostream>
using namespace std;
int main()
{
int n1, n2, n3, temp=0;
cout<<"Please input the first number"<<\n;
cin>>n1;
cout<<"please input the second number"<<\n;
cin>>n2;
cout<<"please input the third number"<<\n;
cin>>num3;
if (n1>n2){
temp=n1;
n1=n2;
n2=temp;
}
if (n1>n3){
temp=0;
temp... | ALGO | 0.995013 | 3.348477 |
4d7f79d2-fb51-4a16-8b3f-3e402aadaaa2 | purvasingh96/My-Leetcode-Solutions | 2477-minimum-fuel-cost-to-report-to-the-capital/2477-minimum-fuel-cost-to-report-to-the-capital.cpp | class Solution {
public:
long long minimumFuelCost(vector<vector<int>>& roads, int seats) {
unordered_map<int, int> degree;
unordered_map<int, vector<int>> adj;
for(auto r:roads){
degree[r[0]]+=1;
degree[r[1]]+=1;
adj[r[0]].push_... | ALGO | 0.999927 | 5.969599 |
f0449336-c7be-48ca-a27a-3c596ede780e | hjoy13/Codeforces-problems | 276B_little_girl_and_game.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int count[26]={0},odd=0,even=0;
for(int i=0; i<s.size(); i++){
count[s[i]-'a']++;
}
for(int i=0; i<26; i++){
if(count[i]%2!=0) odd++;
}
if((odd==0) || (odd==1) || (odd%2)) cout<<"Firs... | ALGO | 0.999995 | 4.134757 |
7f2c72a0-0338-4599-81a2-91bd3e66de1b | rdstihz/Learning-and-Coding | src/CCPC/2021/online/1007.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<LL> p[100];
void init() {
int N = 1000000;
for (int i = 1; i <= N; i++) {
int x = i, s = 0;
while (x) {
s += x % 10;
x /= 10;
}
p[s].push_back(i);
}
}
LL A, B, C, D, n, g;
LL... | ALGO | 0.998725 | 4.965536 |
79b7bef4-2dbf-4662-846a-b5d5c42553e2 | yugkhokhar/DSA | DataStructures-Algorithms/Library/Miscellanious/MosMaxFrequency.cpp | #include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define ss(s) scanf("%s",s)
#define pb push_back
#define mp make_pair
#define F first
#define S ... | ALGO | 0.999907 | 3.884695 |
e98324ec-e718-42d7-a49b-60b111116d9c | akulagrawal/Competitive-Coding | 919E.cpp | #include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define mp make_pair
#define MAX 1000006
#define mod 1000000007
#define pb push_back
#define INF 1e18
#define pii pair<int,int>
ll modInverse(ll a, ll m)
{
a = a%m;
for (ll x=1; x<m; x++)
if ((a*x) % m == ... | ALGO | 0.999781 | 3.460511 |
37861720-9b6f-4418-8510-d77360c9a347 | CXH2015/CPPPP | arrtest.cpp | #include<iostream>
#include<vector>
using namespace std;
int ia[]={8,2,3};
static int res=0;
int sum(vector<int>::iterator begin, vector<int>::iterator end,int n)
{
while(n>0&&begin!=end)
{
res+=*begin++;
n--;
}
return res;
}
int main()
{
int *p=ia;
cout<<*p<<endl;
p++;
cout<<*p<<endl;
*p=0;
cout<<*p<<endl;
cout<<"... | ALGO | 0.997112 | 3.498725 |
2a77de44-615c-4cc2-ba03-0241bad045ae | yosupo06/library-checker-problems | linear_algebra/matrix_rank_mod_2/gen/random.cpp | #include <cstdio>
#include <cstdlib>
#include "../params.h"
#include "random.h"
using namespace std;
int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);
int n = gen.uniform<int>(1, 4096);
int m = gen.uniform<int>(1, NM_MAX / n);
if (seed % 2) swap(n, m);
vector<string... | ALGO | 0.993069 | 3.895272 |
f033264c-be26-46bd-bd0d-4cf1751d18fc | u4250/zhang_jinlin | 第九章/2.cpp | #include <iostream>
#include "Rational.h"
using namespace std;
Rational::Rational( int n, int d )
{
numerator = n;
denominator = d;
reduction();
}
Rational Rational::addition( const Rational b)
{
Rational t;
t.numerator = b.numerator * denominator;
t.numerator += b.denominator * numerator;
t.... | TOOL | 0.892849 | 4.771413 |
8d89f818-e1d3-400b-a36f-0be4859f50b2 | dbojadzic/C-Deep-Learning-Library | cmake-build-release/extern/eigen-git-mirror/doc/snippets/compile_SelfAdjointEigenSolver_eigenvalues.cpp | static bool eigen_did_assert = false;
#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;}
#include <iostream>
#include <Eigen/Eigen>
#ifndef M_PI... | ALGO | 0.971628 | 3.592368 |
339e0b52-12b6-4819-9faa-fee7d0600ff9 | iioan/PA_HW2 | supercomputer.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <queue>
using namespace std;
#define NMAX 100001
vector <int> adj[NMAX];
vector <int> topo;
int grad_int[NMAX];
int set[NMAX];
int topologicalSort(int n) {
int count = 0;
queue <int> q;
queue <int> lost;
for (int i = 1; i <= n; i++) {
... | ALGO | 0.999809 | 4.639546 |
d4180dee-5452-4965-b530-cd44ea4d7834 | fairoznidhi/Codeforces_A2OJ | Ladder 11/41A.cpp | #include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
char s[104],t[104];
scanf("%s %s",s,t);
int sl=strlen(s);
int tl=strlen(t);
bool paisi=true;
if(sl!=tl)
paisi=false;
else{
for(int i=0,j=sl-1;i<tl;i++,j--){
if(s[i]!=t[j])
... | ALGO | 0.999972 | 3.338341 |
1d20d819-6481-4127-8f63-a912671e1cd4 | Minato0859/School-stuff | Fall 2023/C++ Programming for Science/9780135921050_IS_Source_Code/Gaddis-CPP_10e_SourceCode/Chapter 07/Pr7-26.cpp | // This program demonstrates the range-based for loop with a vector.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// Define a vector.
vector<int> numbers(5);
// Get values for the vector elements.
for (int &val : numbers)
{
cout << "Enter an integer value: ";
ci... | ALGO | 0.996439 | 3.742598 |
f71b15aa-82b7-4ad0-861d-a4411b7ea141 | marioyc/CP-Library | geometry/union_rect.cpp | #define MAX_N 10000
struct event{
int ind;
bool type;
event(){};
event(int ind, int type) : ind(ind), type(type) {};
};
struct point{
int x,y;
};
int N;
point rects[MAX_N][2];
// rects[i][0] : esquina inferior izquierda
// rects[i][1] : esquina superior derecha
event events_v[2*MAX_N],events_h[... | ALGO | 0.999508 | 4.409499 |
50c05415-eedc-4545-8ebc-7bfc06af51a4 | Hari15112003/farmshield | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
c97a1c83-0bc6-4633-85e5-5a8efe8cd50e | MatyBarrientos/Guia-de-ejercicios-Prog-1-c- | Guia de Ejercicios/unidad_2/ejercicio_5.cpp | #include <iostream>
#include <locale>
using namespace std;
int main()
{
setlocale(LC_ALL,"");
float importeVenta,descuento,total;
cout<<"Ingrese el importe total de la compra: ";
cin>>importeVenta;
if(importeVenta<100){
total=importeVenta*0.95;
}else if(importeVenta>=100 && importeVent... | TOOL | 0.991348 | 3.94822 |
db230560-b83f-4ea3-b012-0b4b8910e4a5 | PuiPu/CS_institute_entrance_exam | 資結/code practice/textbook practice/p211.cpp | #include <iostream>
#define MAX_STACK 500
using namespace std;
// tree define
typedef TreeNode *TreePtr;
typedef struct TreeNode {
int data;
TreeNode *left, *right;
} TreeNode;
// stack define
int top = -1;
TreePtr stack[MAX_STACK];
void push(TreePtr node) {
if (top < MAX_STACK) {
stack[top++] = ... | ALGO | 0.999954 | 4.283095 |
d82b385c-7825-41d7-bb50-2ce83f94fbdc | kordax/Stroustrup | source/17.7.1.cpp | // 17.7.1.cpp: .
//
#include <std_lib_facilities.h>
//------------------------------------------------------------------------------
int str_len(const char* s)
{
const int MAXLEN = 512; // max allowable string length
int len = 0; // calculated length of string, 0 == error (null str, not null terminated, too l... | TOOL | 0.94172 | 5.008219 |
233b812a-ca41-479d-96b2-30d704393295 | bingps/llvm-project | libcxx/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp | // <algorithm>
// template<InputIterator InIter, typename OutIter, class T>
// requires OutputIterator<OutIter, InIter::reference>
// && OutputIterator<OutIter, const T&>
// && HasEqualTo<InIter::value_type, T>
// constexpr OutIter // constexpr after C++17
// replace_copy(InIter first, InIte... | TEST | 0.972409 | 6.812037 |
216693d0-726b-4f37-b544-7b9c81e56331 | sunnivja/FYS3110 | warmup1.cpp | using namespace std;
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <fstream>
double derivative_tan(double x, double h, double& out1, double& out2);
double derivative_2(double x, double h, double& out1);
//double writetofile(double h_val[], double derivs1,[] double derivs2[]);
double error(double f1... | ALGO | 0.986958 | 3.584626 |
10bbd35d-f34a-4a93-99ee-98ac0f445482 | AnuragJha003/BinarySearch | SearchInsertPosition.cpp | class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int mx=-1;
int s=0;int e=nums.size()-1;
while(s<=e){
int mid=s+(e-s)/2;
if(nums[mid]==target){
mx=mid;
break;
}
else if(nums[mid]<target)... | ALGO | 0.999995 | 6.60421 |
6a314f8f-a8f0-4aa7-a7a5-1118b0f4b39e | Rifatmahmood/DSA | 0. Think like a programmer/3-print-1-10-recursion.cpp | #include <bits/stdc++.h>
using namespace std;
int print_to_n(int n) {
if(n == 1) {
return 1;
}
print_to_n(n - 1);
cout << n << " ";
}
int main()
{
int n;
cin >> n;
print_to_n(n);
return 0;
} | ALGO | 0.998833 | 4.530302 |
54fb2f29-518f-4206-8d7d-5c0d4d4c63ad | MustangYM/ShelbyObfuscator | libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp | // <algorithm>
// template <class InputIterator, class Predicate>
// constexpr bool // constexpr after C++17
// is_partitioned(InputIterator first, InputIterator last, Predicate pred);
#include <algorithm>
#include <functional>
#include <cstddef>
#include <cassert>
#include "test_macros.h"
#include "te... | TEST | 0.948092 | 7.258035 |
64518735-ca6d-4926-84db-432b8fda79a9 | ehnryx/acm | kattis/stringfactoring.cpp | #include <bits/stdc++.h>
using namespace std;
//%:include "utility/fast_input.h"
//%:include "utility/output.h"
using ll = long long;
using ld = long double;
constexpr char nl = '\n';
constexpr int MOD = 998244353;
constexpr ld EPS = 1e-9L;
random_device _rd; mt19937 rng(_rd());
//#define MULTI_TEST
void solve_main... | ALGO | 0.999968 | 5.988127 |
1e32e7bc-0f86-4fa5-ac3f-4ba0e8262e8a | abhitejabhi/leetcoding | 0142-linked-list-cycle-ii/0142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode *temp=head;
unordered_set<ListNode*>st;
while(temp!=NULL)
... | ALGO | 0.999916 | 5.249516 |
91b51361-cef3-45ed-af58-7bd075d8280d | nileshsah/Algorithms | CF462C.cpp | #include <bits/stdc++.h>
#define ll long long
#define get(a) cin >> a;
#define rep(n) for( ll i = 1; i <= n; i++ )
#define repVector(v) for( vector<ll>::iterator it = v.begin(); it != v.end(); it++ )
#define repSet(s) for( set<ll>::iterator it = s.begin(); it != s.end(); it++ )
#define all(c) c.begin(), c.end()
#defin... | ALGO | 0.999946 | 3.630261 |
62642e73-7711-42f6-a373-327538b382e0 | GANJI-PRAVEEN/Leetcode-Solution | 0239-sliding-window-maximum/0239-sliding-window-maximum.cpp | class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
priority_queue<pair<int,int>>pq;
int i;
for(i=0;i<k;i++){
pq.push({nums[i],i});
}
vector<int>ans;
ans.push_back(pq.top().first);
int n=nums.size();
while(i<n){... | ALGO | 0.999997 | 5.731466 |
1bbd1e3a-e2da-4298-aebb-cc0ad473fad7 | svgsponer/seqlgbm | seql/src/search_node.cpp | #include "search_node.h"
void SNode::shrink() {
std::vector<int> tmp;
for (auto const &currLoc : loc) {
if (currLoc < 0) {
tmp.push_back(currLoc);
}
}
loc = std::move(tmp);
loc.shrink_to_fit();
// Does not shrink the capacity of the location erase remove idome
... | ALGO | 0.993112 | 5.570186 |
2e80258e-d19a-4ac9-8875-a4e1b717f235 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5359_11.cpp | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
vector<int> vv;
int x[105], y[105];
int main() {
int n, m, b, g;
cin >> n >> m >> b;
for (int i = 0; i < b; i++) {
int t;
cin >> t;
x[t] = 1;
}
cin >> g;
for (int i = 0; i < g; i++) {
int t;
cin >> t;
y[t] = 1;
... | ALGO | 0.999989 | 3.240578 |
097e5ffd-3d6a-4807-9456-d70247d346b0 | du0079/InterviewBit_Solutions | String/Palindrome_String.cpp |
int Solution::isPalindrome(string A) {
int i = 0;
int j = A.size()-1;
LOOP:while(i < j){
char c = A[i];
char d = A[j];
if(!((( (int)c >= 97)&& ((int)c <= 122)) || ( ( (int)c >= 65 ) && ( (int)c <= 90 )) ||(isdigit(c))))
{i++;
goto LOOP;
}
... | ALGO | 0.999729 | 5.569786 |
a1c10687-c6c5-49e2-80c6-0bda77835f86 | atef7534/codeforces1000 | #574 Card Trick/solve.cpp | /*
author: atef_ai
created: 16 Jul 2024
problem: Card Trick
*/
#include <iostream>
#include <vector>
int main(void)
{
int tests;
std::cin >> tests;
while (tests--)
{
int n;
std::cin >> n;
std::vector<int> a(n, 0);
for (int itr = 0; itr < n; itr++)
{
std::cin >> a.at(itr);
}
... | ALGO | 0.999961 | 4.483702 |
e18c447b-849e-41ee-9f9d-97fa72b5e578 | nikup-collab/Nikup_leetcode | Parenthesis Checker - GFG/parenthesis-checker.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to check if brackets are balanced or not.
bool ispar(string x)
{
// Your code here
stack<char> stack;
int i=0;
while(i<x.size()){
... | ALGO | 0.999382 | 6.266158 |
ea58c513-1665-4462-b26c-a34bd7ff29be | farhadjaman/Competitive-Programming-Code-Base | Tools/calculator for matching simillarity test.cpp | #include<iostream>
using namespace std;
int main()
{
int count,flag=1,div,rem;
cin>>count;
while(count>0)
{
flag=0;
rem=count%10;
div=count/10;
if(rem==7 || rem==4)
{
flag=0;
}
else
{
flag=1;
break;
}
... | ALGO | 0.999579 | 3.470812 |
45322764-0e78-4e84-b18a-01a40a87e6d3 | andOneBasketball/noi_practice | dynamic_programming/knapsack/complete_knapsack_1.cpp | /*
有 N
种物品和一个容量是 V
的背包,每种物品都有无限件可用。
第 i
种物品的体积是 vi
,价值是 wi
。
求解将哪些物品装入背包,可使这些物品的总体积不超过背包容量,且总价值最大。
输出最大价值。
输入格式
第一行两个整数,N,V
,用空格隔开,分别表示物品种数和背包容积。
接下来有 N
行,每行两个整数 vi,wi
,用空格隔开,分别表示第 i
种物品的体积和价值。
输出格式
输出一个整数,表示最大价值。
数据范围
0<N,V≤1000
0<vi,wi≤1000
输入样例
4 5
1 2
2 4
3 4
4 5
输出样例:
10
dp[n] = max(dp[n], dp[n-k*vi]... | ALGO | 0.999996 | 4.91465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.