uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
fd2702d3-b7c4-4a24-9473-9d1840aedf70 | caicaiaaaa/bao | 三角形面积.cpp | #include<stdio.h>
#include<math.h>
int main()
{
double a,b,c;
double p,m,n,t,S;
scanf("%lf%lf%lf",&a,&b,&c);
p=(a+b+c)/2;
m=p-a;
n=p-b;
t=p-c;
S=sqrt(p*m*n*t);
printf("%.1f",S);
return 0;
}
| ALGO | 0.99991 | 3.772006 |
ae5f4970-4fce-4213-8e55-fc0d3062522d | Karelito00/problems | COJ/1177.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
while(1){
int n;
cin>>n;
if(n==0)
break;
string s;
cin>>s;
int h=s.size();
string new_s;
for(int u=0;u<n;u++){
string... | ALGO | 0.999687 | 4.216973 |
3694b131-a8b6-4a66-9802-cfe0b0001e41 | chrismarcellino/edgycamera | ThirdParty/OpenCV/modules/contrib/src/adaptiveskindetector.cpp | #include "precomp.hpp"
#define ASD_INTENSITY_SET_PIXEL(pointer, qq) {(*pointer) = (unsigned char)qq;}
#define ASD_IS_IN_MOTION(pointer, v, threshold) ((abs((*(pointer)) - (v)) > (threshold)) ? true : false)
void CvAdaptiveSkinDetector::initData(IplImage *src, int widthDivider, int heightDivider)
{
CvSize imageSize ... | ALGO | 0.97327 | 5.138399 |
e986265a-4d6b-42d0-b450-065d2ed789ec | ishandutta2007/codeforces | aryanc403/normal/1190/B.cpp | /*
Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present.
"An ideal problem has no test data."
Author - Aryan Choudhary (@aryanc403)
*/
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
... | ALGO | 0.999975 | 3.810994 |
45c8b5c8-0d83-4c56-950c-c7cbd2a28c6b | ProjectEverest/system_core | fastboot/bootimg_utils.cpp | #include "bootimg_utils.h"
#include "util.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void bootimg_set_cmdline_v3_and_above(boot_img_hdr_v3* h, const std::string& cmdline) {
if (cmdline.size() >= sizeof(h->cmdline)) die("command line too large: %zu", cmdline.size());
strcpy(reinterpr... | TOOL | 0.91895 | 6.101379 |
6a37a422-ca9a-439f-98d8-72c8200fa7d1 | wpaesen/advent-of-code | 2021/04/aoc.cpp | #include <array>
#include <bits/c++config.h>
#include <iostream>
#include <limits>
#include <vector>
#include <cstdint>
#include <fstream>
#include <regex>
#include <stdexcept>
#include <iomanip>
class Board
{
public:
static constexpr int COLUMNS = 5;
static constexpr int ROWS = 5;
static std::vector<std... | ALGO | 0.984751 | 6.041635 |
9b54ed03-e1b1-4dad-8755-c571aeb2ed67 | DrSwad/CP | Submissions/Codeforces/1592/B_Hemose_Shopping.cpp | #include <bits/stdc++.h>
using namespace std;
void test_case() {
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int &i : a) cin >> i;
bool ans;
if (n == x) ans = is_sorted(a.begin(), a.end());
else {
vector<int> aa = a;
sort(aa.begin(), aa.end());
int st = n - x;
int en = x - 1;
... | ALGO | 0.999875 | 4.154207 |
da389164-3051-4623-ba5e-e341d8c87a39 | nikhilmangali1/code | cpp programs/prime.cpp | #include <iostream>
using namespace std;
int main()
{
int n, count = 0;
cout << "\n enter n";
cin >> n;
for (int i = 1; i <= n; i++)
{
if (n % i == 0)
{
count++;
}
}
if (count == 2)
{
cout << "\n prime";
}
else
{
cout << "\n... | ALGO | 0.999635 | 3.970495 |
028e0614-0727-4541-ab53-4a70fdb2794a | WebAxol/CSES-Problem-Solutions | intro/gridPath.cpp | // Problem reference: https://cses.fi/problemset/task/1158
#include <bits/stdc++.h>
#define fastIo() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> ... | ALGO | 0.999942 | 3.769861 |
99e984f3-3966-4570-a8ff-7666e3353b9c | SahilChharra/Leetcode-Questions | 2032-largest-odd-number-in-string/largest-odd-number-in-string.cpp | class Solution {
public:
string largestOddNumber(string num) {
if (num.back() % 2 == 1) return num;
int i = num.length() - 1;
while (i >= 0) {
int n = num[i];
if (n % 2 == 1) return num.substr(0, i + 1);
i--;
}
return "";
}
}; | ALGO | 0.999885 | 6.166002 |
cc3805e1-b758-4f1c-953e-c9d5d4f978c4 | rbr2411/codeforces | contests/kickstartB2021/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int Mod=1000000007;
void solve(int n)
{
vector<int> v(n);
for (int i = 0; i < n; ++i)
{
/* code */
cin >> v[i];
}
if(n < 2)
{
cout << "0";
return;
}
int len = 0;
vector<int> res(n);
res[0] = v[0];
res[1] = v[1];
for(int i = 2... | ALGO | 0.999969 | 4.134027 |
02a81920-812d-4ca7-9af0-f28ee8136a38 | SageCT/COSC2436 | KATTIS/Cougarettes/CGE 20221106/CGE_Q1_20221106/main.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int jack3(int a, int b, int c) { return a * b * c; }
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << jack3(a, b, c);
return 0;
} | ALGO | 0.999922 | 4.796178 |
8fcf6e3a-4b7e-497e-b7a4-803de0de2fd0 | CGAL/cgal-dev | Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/benchmark_hm_n_vertices.cpp | #include <CGAL/Real_timer.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Barycentric_coordinates_2/Delaunay_domain_2.h>
#include <CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h>
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using FT = typename K... | ALGO | 0.996211 | 6.690771 |
76f93b73-04d4-4265-8aaf-f595ce3427a8 | FlowerNoClip/Programers | 프로그래머스/0/120903. 배열의 유사도/배열의 유사도.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<string> s1, vector<string> s2) {
int answer = 0;
for(int i = 0; i < s1.size(); i ++)
{
for(int j = 0; j < s2.size(); j++)
{
if(s1[i] == s2[j])
{
answer += 1;
}
... | ALGO | 0.999644 | 4.858575 |
07100354-e1d2-4911-9b9c-507a2fca0eac | jiaqi0703/lanqiao | frecurse.cpp | #include <iostream>
using namespace std;
typedef int data_t;
typedef struct{
data_t* data;
int maxlen;
int top;
}sqstack;
sqstack* SqStack_create(int maxlen){
sqstack *s;
s=(sqstack*)malloc(sizeof(sqstack));
s->data=(data_t*)malloc(maxlen*sizeof(data_t));
s->top=-1;
return s;
}
int SqSta... | ALGO | 0.999998 | 4.628483 |
f4b76750-9d28-45f2-ae65-90c323721125 | lip6/painless | solvers/cadical/test/api/example_constraint.cpp | #include "../../src/cadical.hpp"
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <cassert>
// This is the example from the header file
int main () {
CaDiCaL::Solver *solver = new CaDiCaL::Solver;
// ------------------------------------------------------------------
// Encode Problem and check without assumptions.... | ALGO | 0.968347 | 7.200745 |
dd16fb03-dc01-4b5c-bf4c-820a3be949dd | Redleaf23477/ojcodes | poj/2932.cpp | //
#include <cstdio>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<double, int> Event;
#define x first
#define idx second
const int N = 40004;
struct Circle
{
double x, y, rad;
};
bool operator < (const Event &lhs, const Event &rhs... | ALGO | 0.999982 | 4.022801 |
a53e27d4-7657-48aa-a1ca-bedc89209cf1 | FlowSight/coding | array/majority_element.cpp | int majorityElement(vector<int>& arr){
int n = arr.size(), res = 0;
for(auto i=0,cnt = 0;i<32;i++,cnt = 0){
for(auto j=0;j<n;j++){
if(arr[i] && (1<<i))cnt++;
}
if(cnt > n/2)res |= (1<<i);
}
return res;
}
int majorityElementMooreVoting(vector<int>& arr){
int n = arr... | ALGO | 0.999854 | 5.178389 |
47eccbfa-719b-4886-9ad8-093d88210ccd | oudream/RobWork | RobWork/ext/rwyaobi/src/yaobi_tri_overlap.cpp | #include "yaobi_tri_overlap.h"
#include "yaobi_matvec.h"
#include "yaobi_fpu.h"
#define ALGO_GUIGUE 1
//! The slowest algorithm, but extremely robust. Can handle degenerate
//! triangles (lines) as well.
#define ALGO_PQP 2
#define ALGO_MOLLER 3
//! defines which algorithm is used
#define ALGO ALGO_MOLLER
//! i... | ALGO | 0.998619 | 6.070765 |
df492f45-8886-43c9-9728-1caa8caa64a4 | bprakashputta/CodingClubIndia | CodingMafia/InterviewBit/DP/maxsubArr.cpp | class Solution {
public:
int maxSubArray(vector<int>& a) {
int n = a.size();
vector<int> dp(n);
dp[0] = a[0];
int maxim = a[0];
for(int i=1;i<n;i++)
{
dp[i] = a[i] + (dp[i-1] > 0 ? dp[i-1] : 0);
maxim = max(dp[i],maxim);
}
retur... | ALGO | 0.999827 | 5.649577 |
08c96580-737e-4a6d-99da-ad711ffc7e2e | Portgas-D-Asce/Algorithm | binary_search.cpp | #include <iostream>
#include <vector>
using namespace std;
// for 00001111 find first 1
/*template<typename T>
ssize_t binary_search(vector<T> nums) {
ssize_t p = 0, r = nums.size();
while(p < r) {
ssize_t q = (p + r) >> 1;
check(q) ? r = q : p = q + 1;
}
return p;
}*/
// for 11110000 ... | ALGO | 0.996885 | 3.929594 |
83479900-f7d8-42be-b57f-6adb24d1f3b3 | Nimesh-Srivastava/DSA | C++/LeetCode/1679.cpp | class Solution {
public:
int maxOperations(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int i = 0;
int j = nums.size() - 1;
int ans = 0;
while(i < j) {
int sum = nums[i] + nums[j];
if(sum == k) {
... | ALGO | 0.999909 | 6.181113 |
1fe68d6e-0d97-4fb9-9b04-e2571d719aa8 | sanketnaik20/Programming-Only | c and c++/checkifsoertedornot.cpp | #include <iostream>
using namespace std;
int main()
{
int a[50], size, i,j,k,flag=0;
cout << "enter size of array:" << endl;
cin >> size;
cout<<"enter elements of array:"<<endl;
for(i=0;i<size;i++)
{
cin>>a[i];
}
cout<<"array is :"<<endl;
for(i=0;i<size;i++)
{
co... | ALGO | 0.998446 | 3.692711 |
ff484949-d7d1-4f50-a966-bf63af21195b | jamesyea/CPE-practies | CPE49/UVa10252.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
string a,b;
while(getline(cin,a) && getline(cin,b)){
vector<int> cnt_a(26,0);
vector<int> cnt_b(26,0);
for(int i=0;i<a.length();i++){
cnt_a[a[i]-'a']++;
}
for(int i=0;i<b.length();i++){
... | ALGO | 0.999962 | 3.97053 |
8c55d496-c964-4cf5-8a40-3b77f9464bd4 | iHTCboy/iNetworkEngineering-Exercise | 2.2 JAVA/java/【1-3】源代码/s5_1_1.cpp | # include <stdio.h>
# include <math.h>
int zhouchang(int m, int n, int k)
{
return m + n + k;
}
double area(int m, int n, int k)
{
double p = 1.0*(m+n+k) / 2;
return sqrt(p * (p-m) * (p-n) * (p-k));
}
int main(void)
{
int a, b, c;
a = 3;
b = 4;
c = 5;
printf("%d, %lf\n", zhouchang(a,b,c), area(a,b,c));
... | ALGO | 0.995127 | 3.580667 |
473638c8-ef53-48f7-9dcd-727156dde418 | ImplFancy/WaaCaa | model/GradationsUtils.cpp | #include "GradationsUtils.h"
float Gradations::calcAbsStep(const float &zoomFactor, const float &bestGridInPixel /*= 100.f*/)
{
auto value = fabs(bestGridInPixel / zoomFactor);
auto digit = floor(log10(fabs(value)));
auto ret = round(value / pow(10, digit));
if (ret > 7.5) ret = 10;
else if (ret >... | ALGO | 0.938588 | 6.724702 |
4f69cc69-fa00-4129-815f-c618299a8974 | vitekign/csc139_project-3_scheduling_of_processes | main.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <queue>
#include <list>
using namespace std;
//Input File:
// Process number Arrival Time CPU burst time Priority
typedef enum {
SJF, //SHORTEST JOB FIRST
RR, //ROUND ROBIN
PR_NO_PREEMP... | ALGO | 0.999753 | 3.445277 |
5c76ab97-476c-4f80-8d8f-5eac545aa964 | m-hiroaki/atcoder-archive | atcoder.jp/abc068/arc079_a/Main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long m)
{
long long ans = 1;
while (n)
{
if (n & 1)
{
ans = (ans * a) % m;
}
a... | ALGO | 0.999939 | 4.179749 |
5870a781-6d8f-404d-84b3-49a83d57fbb1 | rakibul-wdp/phitron | XPSC/problem-solutions/week-4/day-5/Boxes.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
long long a[n], g1, g2;
for (int i = 0; i < n; i++)
cin >> a[i];
g1 = *max_element(a, a + n);
int c = 0, c2 = 0;
while (g1 > 0)
{
g1 /= 2;
c++;
}
... | ALGO | 0.999748 | 4.451581 |
985f97ed-c4e4-495b-a8b5-5057042defec | Bonikadesai/Resume_Builder_App | 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.998859 | 6.785645 |
dd9bc3bb-5762-4dcf-8262-4cc17c950fef | PEC-CSS/Open-Source | Good-First-Issues/remove_duplicate_linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node* next;
};
void removeDuplicates(Node* head)
{
Node* to_free;
if (head == NULL)
return;
if (head->next != NULL)
{
if (head->data == head->next->data)
{
to_free = head->next;
head->next = head->next->next;
free(to_... | ALGO | 0.999978 | 4.757773 |
7cb3e4d0-b42f-4bdc-996d-8a4510528800 | ishandutta2007/codeforces | luhong/normal/512/D.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#define MN 210
#define mod 1000000009
int f[MN][MN], g[MN][MN], dp[MN][MN], now[MN], siz[MN];
int C[MN][MN], inv[MN];
bool vis[MN], vis2[MN];
int n, m, tot, bl = 0, rt[MN], Siz[MN];
std::vector<int> e[MN];
int q[MN], hh = 0, tt = 0, id[MN], d[M... | ALGO | 0.999928 | 4.403828 |
13117bd2-11f8-4523-abbf-8a7d9df70cb9 | louise365/To-be-SDE | leetcode_1534/leetcode_1534.cpp | // leetcode_1534.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <algorithm>
using namespace std;
/**
* Definition for a binary tree node.
*/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution... | ALGO | 0.999912 | 6.30687 |
4d59eacd-e4e6-41a6-9479-11521149746d | raushan5271/rau | table_0f_any_number.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for (int i = 1; i <= 10; i++)
{
i*n;
cout<<i<<"*"<<n<<"=" <<i*n<<endl;
}
} | ALGO | 0.999921 | 3.568255 |
e45e0fa2-c200-4f8d-8f14-a3c817aa15ad | KSH-code/Problem-Solving | 21937.cpp | #include <bits/stdc++.h>
#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;
int xxxx[]={-1,0,1,0,-1,1,1,-1};
int yyyy[]={0,1,0,-1,-1,1,-1,1};
void solve(){
int N; cin >> N;
vector<vect... | ALGO | 0.999889 | 4.555931 |
bdb0bd20-7bc1-47e0-b6a7-a204863c6325 | HerikDR/Atividade-Lista-Pilha-e-Fila | PilhaInvertida.cpp | #include <iostream>
#define TAMANHO_MAXIMO 100
using namespace std;
struct Pilha{
int elementos[TAMANHO_MAXIMO];
int topo;
};
void iniciar(Pilha& pilha){
pilha.topo = -1;
}
bool estaVazia(const Pilha& pilha){
return pilha.topo == -1;
}
bool estaCheia(const Pilha& pilha){
return pilha.topo == TAMANH... | ALGO | 0.993549 | 5.353734 |
7f1dd947-8d07-400e-807e-7b8ad3b7ac9c | luissfernann/UFJFGIT | ALG1/estd.dados/estd 02.cpp | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
struct Funcionario {
char nome[151];
char cargo[101];
float valorHoraExtra;
float salarioBase;
int horasPorDia[31];
};
int calcularHorasExtras(Funcionario f) {
int horasExtras = 0;
for (int i = 0; i < 31; i++) {... | ALGO | 0.981863 | 5.002409 |
bd0f8c0b-f027-42bd-98f1-73291ffc98b9 | andrewaarestad/ode-system-fitting-with-boost-and-nlopt | boost_1_77_0/libs/geometry/test/algorithms/overlay/sort_by_side.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
#include <geometry_test_common.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.h... | TEST | 0.875153 | 7.389832 |
9a1a27d9-0bbf-411c-bfb0-91d0a880d25c | smh1988/EnsembleMethod | Algorithms/ELAS/elasMex.cpp | #include "mex.h"
#include "elas.h"
using namespace std;
void mexFunction (int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]) {
// check for proper number of arguments
if (nrhs!=2 && nrhs!=3)
mexErrMsgTxt("2 or 3 inputs required: I1 (left image), I2 (right image), [param].");
if (nlhs!=2)
mexErrM... | ALGO | 0.943718 | 5.405195 |
61aac2ff-28bd-406a-8e23-8110d4d950a5 | youling257/mesa | src/amd/compiler/aco_live_var_analysis.cpp | #include "aco_ir.h"
#include "util/u_math.h"
#include <set>
#include <vector>
namespace aco {
RegisterDemand
get_live_changes(aco_ptr<Instruction>& instr)
{
RegisterDemand changes;
for (const Definition& def : instr->definitions) {
if (!def.isTemp() || def.isKill())
continue;
changes += de... | ALGO | 0.927296 | 7.313332 |
fbf7bee8-ede7-4fdf-ade3-37fd68b34496 | 913887524gsd/mini-docker | src/main.cpp | #include <config.h>
#include <typedef.h>
#include <setup.h>
#include <IPC.h>
#include <util.h>
#include <tclap/CmdLine.h>
#include <bits/stdc++.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <signal.h>
char *imagedir;
std::vector<std::pair<std::st... | TOOL | 0.893312 | 5.749462 |
9a360a82-be43-4c54-8d26-c6a629f34fa7 | iamzaheershaik/CppJourneyRw4 | LabWork/Lab_9Loops/For/forSum.cpp | #include <iostream>
using namespace std;
int main(){
int i, n, sum=0;
cout<<"Enter the Value of N";
cin>>n;
for(i=1; i<=n; i++){
cout<<i<<" ";
sum = sum+i;
}
cout<<"Sum :- "<<sum<<endl;
} | ALGO | 0.985285 | 3.633459 |
c30a0f96-2de3-49ac-a464-af991d1a3e86 | littleDing/leetcode | Remove_Duplicates_from_Sorted_Array_II.cpp | //Attemp #1
//from 2013-09-09 08:27
//to 2013-09-09 08:31
//failed before small AC: CE* + RTE* + WA
//failed before large AC: None
class Solution {
public:
int removeDuplicates(int A[], int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(!n) return 0;... | ALGO | 0.999925 | 5.182379 |
ea56b3e9-2b3e-45a6-9dd2-e54e320d4b47 | alexandermatthias/SensorStation | ArduinoMegaFiles/06_ArduinoMega_XML2_SDCard_RecordTime/lib/SD/src/SD.cpp | /*
Implementation Notes
In order to handle multi-directory path traversal, functionality that
requires this ability is implemented as callback functions.
Individual methods call the `walkPath` function which performs the actual
directory traversal (swapping between two different directory/file handles
al... | TOOL | 0.932887 | 4.549272 |
11c4a208-ae5b-4f4a-9aaf-f1ac7eb932e5 | microsoft/openjdk-jdk21u | src/hotspot/share/services/virtualMemoryTracker.cpp | #include "precompiled.hpp"
#include "logging/log.hpp"
#include "memory/metaspaceUtils.hpp"
#include "memory/metaspaceStats.hpp"
#include "runtime/os.hpp"
#include "runtime/threadCritical.hpp"
#include "services/memTracker.hpp"
#include "services/threadStackTracker.hpp"
#include "services/virtualMemoryTracker.hpp"
#incl... | TOOL | 0.933911 | 7.622455 |
1071b3e4-1c69-40ab-a88b-214cdf638ef4 | eduardpetre/OOP | Lab1/POOLab1Ex1/main.cpp | #include <iostream>
using namespace std;
struct data{
int an, luna, zi;
}x,y;
int main(){
cin>>x.zi>>x.luna>>x.an;
cin>>y.zi>>y.luna>>y.an;
// a)
if (x.an > y.an)
cout<<x.zi<<"."<<x.luna<<"."<<x.an<<" este mai mare";
else if (x.an < y.an)
cout<<y.zi<<"."<<y.luna<<"."<<y.an<<" este m... | ALGO | 0.998903 | 3.5264 |
cccc49bf-5bfd-45c9-8a93-3c585d08547d | njrafi/Competitive-Programming-Solutions | CodeForces/1149A - Prefix Sum Primes - 53529709.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define gc getchar
#define pc putchar
#else
#define gc getchar_unlocked
#define pc putchar_unlocked
#endif
using namespace std;
#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int, int>
#define vpi vector<pii>
#define pri priority_queue... | ALGO | 0.999943 | 3.167691 |
c7e13ffe-6e08-49f6-b87b-6a6dcec41897 | skjmp/ProCon | AGC/AGC020/AGC020/b.cpp | //#include<math.h>
//#include<limits.h>
//#include<iostream>
//#include<string>
//#include<vector>
//#include<stdio.h>
//#include<sstream>
//#include<list>
//#include<queue>
//#include<algorithm>
//#include<functional>
//#include<map>
//#include<set>
//#include<utility>
//#include<initializer_list>
//#include<tuple>
//... | ALGO | 0.999846 | 3.144536 |
c8fbde5f-05b1-4b3b-9724-b86ebbc77d59 | JsIqbal/problem-solving | beeCrowd/snack.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c, d, e;
int x, y;
a = 4.00;
b = 4.50;
c = 5.00;
d = 2.00;
e = 1.50;
cin >> x >> y;
if (x == 1) {
cout << "Total: R$ " << fixed << setprecision(2) << y * a << endl;
}
if (x == 2) {
... | ALGO | 0.998616 | 4.005183 |
22e18bd3-e9aa-4d97-bb29-ff0738edb4ce | haoran0709/Mycode | competition-code/xiaohou/S1-250711/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<int> G[N];
int ans;
bool vis[N];
void DFS(int x,int fa){
int res=0,now=1,cnt=0;
for (int v:G[x]){
if (v!=fa) res+=(!vis[v]);
}
while(now<res+1){
now*=2;
cnt++;
}
ans+=cnt+res;
for (int v:G[x]){
if (v!=fa){
vis[v]=true;
DFS(v,x)... | ALGO | 0.999869 | 4.449561 |
5b349464-5783-49cd-8434-72b2259c65a3 | RamadanAhmed/leetcode | 661.image-smoother.cpp | /*
* @lc app=leetcode id=661 lang=cpp
*
* [661] Image Smoother
*/
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <string>
#include <vector>
#include <numeric>
using namespace std;
// @lc code=start
class Solution {
public:
vector<vector<int>> imageSmoother(vector<vector<int>> &M)... | ALGO | 0.999554 | 7.350522 |
030b4e98-178c-4191-be2a-af5096f9a06f | 113bommy/PathRepair | variable_trace/cpp/cpp_code/cpp_correct/cpp_correct_test_55_14.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int pwr(int a, long long b) {
int res = 1;
for (; b; b >>= 1) {
if (b & 1) res = 1LL * res * a % MOD;
a = 1LL * a * a % MOD;
}
return res;
}
int T, n;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
T ... | ALGO | 0.999962 | 5.1415 |
90abb870-38f5-4f14-83f5-358d1c080eae | fmi-lab/up-2018-kn-group2-sem | ex7/eratosthenes.cpp | #include <iostream>
using namespace std;
int main() {
int isComposit[100] = {0};
for (int i = 2; i < 100; i++) {
if (isComposit[i] == true) { // not a prime
continue;
}
// mark all numbers which are divided by i
for (int j = i + i; j < 100; j += i) {
isComposit[j] = true;
}
}
... | ALGO | 0.999057 | 4.470283 |
6b0231c7-d3a3-4261-a1e6-c24ce41bc7c2 | ngthanhtrung23/CompetitiveProgramming | codeforces/100942/G.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cnt[10100] = {0}, x, ans = 0;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x;
ans = max(ans, ++cnt[x]);
}
cout << ans << endl;
} | ALGO | 0.999779 | 4.265885 |
b4a45df8-2a74-417b-a122-ab3fe8e36499 | cepxuozab/CSES | AdvancedTechniques/EulerianSubgraphs/main.cpp | #include <cstdint>
#include <iostream>
#include <vector>
constexpr int MOD = 1e9+7;
auto FastPow(int64_t b, int e) -> int64_t {
if (e < 0) return 1;
int64_t resp = 1;
while (e) {
if (e&1) resp = (resp * b) % MOD;
b = (b * b) % MOD;
e >>= 1;
}
return resp;
}
auto main() -> i... | ALGO | 0.999869 | 5.577888 |
6e659f77-34d3-4c4a-a917-8c0ae5267ddf | artiam99/GeeksforGeeks | 6 Binary Search Tree/1 Construction and Coversion/12 Construct All Possible BST with key 1 to N.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define intmax std::numeric_limits<int>::max()
#define intmin std::numeric_limits<int>::min()
struct Node
{
int data;
Node* left;
Node* right;
Node(int x)
{
data=x;
left=right=NULL;
}
};
void preorder(Node* root)
{
if(!root)
return;
cout<<r... | ALGO | 0.999937 | 4.504101 |
264730af-821d-4757-970f-33e080178a3a | Jaycelation/CPP-PTIT | Prime numbers and applications/CPP0138.cpp | //https://code.ptit.edu.vn/student/question/CPP0138
//Cap so nguyen to
#include <bits/stdc++.h>
using namespace std;
vector<bool> v(1e4 + 1, 1);
void eratosthenes() {
v[0] = v[1] = 0;
for (int i = 2; i <= 100; ++i) {
if (v[i]) {
for (int j = i * i; j <= 1e4; j += i)
v[j] = 0... | ALGO | 0.999762 | 4.367531 |
6968f458-9ba2-481a-981a-fe3255318ed7 | nh0znoisung/Online_Judge-Competitive_Programming | Atcoder/Atcoder 195/c.cpp | #include <bits/stdc++.h>
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i)
#def... | ALGO | 0.999882 | 3.890991 |
f40c246c-d4dd-4d2c-8c80-d75bf0c00703 | nikhil697/Daily-Leetcode | 3246-check-if-bitwise-or-has-trailing-zeros/check-if-bitwise-or-has-trailing-zeros.cpp | class Solution {
public:
bool hasTrailingZeros(vector<int>& nums) {
for (int i = 0; i < nums.size(); ++i) {
for (int j = i + 1; j < nums.size(); ++j) {
if((nums[i] | nums[j])%2==0)
return true;
}
}
return false;
}
}; | ALGO | 0.99966 | 5.440558 |
9e4235f7-6f4d-4a48-aa21-a2dddae2438b | jddjk/Baekjoon_Online_Judge_Solutions | 2805.cpp | #include <iostream>
#include <vector>
using namespace std;
long long calculateWood(vector<int>& trees, int height) {
long long totalWood = 0;
for (int i = 0; i < trees.size(); i++) {
if (trees[i] > height) {
totalWood += trees[i] - height;
}
}
return totalWood;
}
int findMa... | ALGO | 0.999956 | 5.758729 |
630da4f3-ea4e-428b-ac0f-06beb3143689 | ponkanaponpon/ENGCE117-Computer-Programming-for-Computer-Engineering | lab_12/lab_12.2.cpp | #include <stdio.h>
int *KnapsackGreedy( int *w, int *v, int n, int wx ) ;
int main() {
int n = 5, wx = 11 ;
int w[ 5 ] = { 1, 2, 5, 6, 7 } ;
int v[ 5 ] = { 1, 6, 18, 22, 28 } ;
int *x = KnapsackGreedy( w, v, n, wx ) ;
for( int i = 0 ; i < n ; i++ ) printf( "%d ", x[ i ] ) ;
return 0 ;
}//end function
int *Knaps... | ALGO | 0.999976 | 3.469992 |
ad69f50b-805c-43cf-934d-4b5d5e167e07 | pranshu-09/DSA-Leetcode-Sheet | 901-online-stock-span/901-online-stock-span.cpp | // TC : O(N)
// SC : O(N)
class StockSpanner {
stack<pair<int, int>>s;
int idx = 0;
public:
StockSpanner() {
}
int next(int price) {
if(s.empty()){
s.push({price, idx++});
return 1;
}
while(!s.empty() and s.top(... | ALGO | 0.999426 | 6.237119 |
ac6ad53a-e591-45d6-9bca-d6f510fb2a6d | Kawser-nerd/CLCDSA | Source Codes/AtCoder/arc086/A/1860449.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include... | ALGO | 0.999982 | 3.584612 |
f55f50ed-2b0b-4266-95f0-c2adf244b411 | zohaibakhtar28/DSA_Revision | 1.Sorting/sorting.cpp | #include <bits/stdc++.h>
using namespace std;
// selection sort.
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
void selection_sort(vector<int> &arr, int n) // n*n
{
for (int i = 0; i <= n - 2; i++)
{
int min = i;
for (int j = i + 1; j <= n - 1; j++)
{
... | ALGO | 0.999965 | 4.894197 |
3225dc22-d0c5-468a-94a0-52254a150033 | yzqhao/Animation | Common/Utils.cpp | #include "Utils.h"
#include "Skeleton.h"
#include "LocalToModelJob.h"
void ComputeSkeletonBounds(const Skeleton& _skeleton, Math::AABB* _bound)
{
using Math::Mat4;
assert(_bound);
// Set a default box.
*_bound = Math::AABB();
const int num_joints = _skeleton.num_joints();
if (!num_joints) {
return;
}
//... | ALGO | 0.874463 | 7.50061 |
e0f234c9-a37b-4317-8337-ed99a521b74c | Mirocos/leetcode-repo | longestPalindrome/main.cpp | //
// Created by zeming on 22-5-24.
//
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
class Solution {
public:
string longestPalindrome(string s){
int len = s.length();
if(len == 1)
return s;
vector<vector<bool>> legal(len, vector<bool>(len,... | ALGO | 0.999692 | 5.534261 |
d9d2a659-63ec-4c52-9498-0358e9a0984f | hyl946/llvm7.0.1 | tools/llvm-xray/xray-converter.cpp | #include "trie-node.h"
#include "xray-registry.h"
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_o... | TOOL | 0.93487 | 7.698044 |
48405459-1d0a-4415-869b-4c9914bd1bb8 | ishandutta2007/codeforces | burnoutag7/normal/1313/C2.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,cen;
ll mx;
int a[500005],m[500005];
ll pre[500005],suf[500005];
void precalc(){
stack<pair<int,int> > st;
st.push(make_pair(0,0));
for(int i=1;i<=n;i++){
while(st.top().first>a[i])st.pop();
pre[i]=pre[st.top().secon... | ALGO | 1 | 3.71812 |
234c47ef-7cca-4635-8f60-dc5ccdf00b7f | IvanD-Hernandez/Extracting-Requirements-From-Code | TestCases/fibonacci.cpp | #include <iostream>
using namespace std;
/*
A simple program to generate a Fibonacci sequence of numbers
cout << fib(int n) << endl;
*/
int main(void){
int n, term_one = 0, term_two = 1, next = 0;
cout << "Enter the number of terms: ";
cin >> n;
for (int i = 1; i <= n; i++){
if (i == 1){
cout << ter... | ALGO | 0.99961 | 4.889047 |
3dc8f098-c071-4eef-82ec-1514d3bbf71c | cnon06/portrait-vertical--mode | 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 |
923c94ec-48c1-423c-989f-dee83f0335e9 | kshabir/AdvanceAlgorithmDesign-C- | FillingTheSkeleton_with_DFS.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <string>
class Graph
{
public:
Graph(int v) : V(v), adj(v) {}
void addEdge(int v, int w) { adj[v].push_back(w); }
int getVertexCount() const { return V; }
const std::vector<std::vector<int>>& getAdjList() const { return adj; }
private:
... | ALGO | 0.999963 | 6.778085 |
623b6c4c-a47c-4fcb-8d5b-3b01d1134652 | ishandutta2007/codeforces | andreasyan/normal/1551/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
int n;
void solv()
{
cin >> n;
... | ALGO | 0.999921 | 4.194705 |
910a9d92-612e-4de3-9335-c3d09c5ef36c | davil2020/Competitive-Programming | math/CSES_ProblemSet/Distributing_Apples.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define _ ios_base::sync_with_stdio(false); cin.tie(0);
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define f first
#define s second
#define pb push_back
#define MAXN 2000001
typedef long long ll;... | ALGO | 0.999959 | 5.359047 |
b5542308-ee3e-4538-99be-4035eef50f85 | Shoyeb45/CompetitiveProgramming | Codeforces/Contest/Div-3/950/sofiaAndLostOperations.cpp | #include<bits/stdc++.h>
using namespace std;
#define loop(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
const ll mod = 1000000007;
void solve() {
int n;
cin >> n;
vector<int> a(n), b(n);
loop(i, n) {
cin >> a[i];
}
loop(i, n) {
cin >> b[i];
}
int m;
cin >> m... | ALGO | 0.999949 | 3.880484 |
7e91146f-c151-4f67-af60-8c7c484b9551 | kangsw1025/TIL | SolveProblem/20/20.04/20_04_08/200408_11050_이항계수1.cpp | #include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b ,ans = 1;
/*
cin >> a >> b;
cout << a << ' ' << b << ' ';
if (a <= 0 || b <= 0 || a < b) cout << 0<< "\n";
else if (a == b) cout << 1<<"\n";
else {
for (int i = 1; i <= b; i++... | ALGO | 0.999814 | 3.460676 |
62200243-9e72-4ad9-85ea-090141466be6 | akamya997/PracticeCode | 201903_practice/lanqiao_practice1/H.cpp | #include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
te... | ALGO | 0.999917 | 3.388792 |
73bdc41a-7039-4fe3-bc8d-afeee878363a | harshthakur3/Codeforces-Solution | A_Nearest_Interesting_Number.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
bool check(int n) {
int sum = 0;
while (n) {
sum += n % 10;
n /= 10;
}
return (sum % 4 == 0);
}
signed main() {
int n;
cin >> n;
while (!check(n)) {
n++;
}
cout << n << "\n";
}
| ALGO | 0.999718 | 4.645044 |
d39688dc-05fd-4d05-9148-6b0d7a89ad97 | kig6347/BOJ | Bronze_1/BOJ#9093_단어뒤집기.cpp | #include<iostream>
#include<stack>
#include<string>
using namespace std;
int main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
cin >> T;
cin.ignore(); //남은 버퍼 삭제 역할
while(T--){
string s = "";
getline(cin,s);
s += '\n';
stack<char> st;
for(int i = 0; i ... | ALGO | 0.999556 | 4.744451 |
6c68819d-4cd9-4bf0-a019-240204acc04e | ShawnTSH1229/XEngine | ThirdParty/boost_1_78_0/libs/hana/benchmark/transform/execute.fusion.vector.erb.cpp | <% if input_size > 10 %>
#define FUSION_MAX_VECTOR_SIZE <%= ((input_size + 9) / 10) * 10 %>
<% end %>
#include <boost/fusion/include/as_vector.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/fusion/include/transform.hpp>
#include "measure.hpp"
#include <cstdlib>
namespace fusion = boost::fusi... | ALGO | 0.97807 | 4.928375 |
8eee2e70-39cb-4d41-bb52-00a96a936783 | ppppplus/habitat-ros | habitat_sim/src/deps/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp | MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << ... | ALGO | 0.99954 | 3.056724 |
61a93cfe-7daf-4d67-a37d-ecf6323895f1 | AnuragChouhanDEV/LeetCode | kth-largest-element-in-an-array/Accepted/5-23-2023, 9_53_27 PM/Solution.cpp | // https://leetcode.com/problems/kth-largest-element-in-an-array
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int, vector<int>, greater<int>> pq;
for (auto it:nums) {
pq.push(it);
if (pq.size()>k)
pq.pop();
}
... | ALGO | 0.999942 | 5.278774 |
4d75b061-ce26-4aa5-881a-67ec6b1bc813 | Mr-Xiao2021/ascend_op_learning | cplusplus/level1_single_api/4_op_dev/6_ascendc_custom_op/acl_invocation/op_dev/op_kernel/add_custom.cpp | #include "kernel_operator.h"
using namespace AscendC;
constexpr int32_t BUFFER_NUM = 2;
class KernelAdd {
public:
__aicore__ inline KernelAdd() {}
__aicore__ inline void Init(GM_ADDR x, GM_ADDR y, GM_ADDR z, uint32_t totalLength, uint32_t tileNum)
{
ASSERT(GetBlockNum() != 0 && "block dim can not ... | ALGO | 0.97579 | 6.051325 |
d2f49c8f-b205-44b8-98d8-1e98afaff960 | Irfan-Ali01/Data-Structure-Labs | lab8_1.cpp | // queue is fifo (first in first out)
#include <iostream>
using namespace std;
struct Node{
int data;
Node* next;
Node(int v): data(v) , next(nullptr){};
};
struct Queue{
Node* head;
Queue(): head(nullptr){};
void enqueue(int v){
Node* n = new Node(v);
if ( head == nullptr)... | ALGO | 0.996242 | 4.753525 |
b475b6f6-91a6-4058-97ce-a94b5720dd4c | JerikoJei/flutter_Jeriko | 18_Flutter-State-Management-(BloC)/praktikum/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.997987 | 6.76073 |
da75e44a-8620-42f0-a3aa-8c8b23dd842e | naveenls/Competitive-Coding | C++/c6.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long n;
cin>>n;
long long cnt=0;
while(n>=2)
{
long long temp=(-1+sqrt(1+24*n))/6;
//cout<<temp<<endl;
n-=((3*temp*temp+temp)/2);
cnt++;
}
cout<<cnt<<endl;
}
return 0;
}
| ALGO | 0.999806 | 3.783855 |
ee2f8e4a-2fc2-4480-b0ee-1a2c1116baa5 | ishandutta2007/codeforces | madball/normal/1091/C.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <se... | ALGO | 0.99991 | 4.050618 |
30a40d70-7845-4c4e-a3bd-5106c36eca24 | chiragmishra03/LeetCode-DSA | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin... | class Solution {
public:
int minOperations(vector<int>& nums) {
unordered_map<int,int>mp;
for(int i=0;i<nums.size();i++){
mp[nums[i]]++;
}
int ans=0;
for(auto x:mp)
{
if(x.second==1)return -1;
int num = x.second;
while(n... | ALGO | 0.999943 | 5.582116 |
35ea8161-1b64-4be9-a57c-672ee35bfe18 | docongban/zcode_C- | re_arr_12(tich_day_con_lien_tuc_max)5.cpp | #include<bits/stdc++.h>
using namespace std;
int arr[100];
void Nhap(int arr[],int n)
{
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
}
void Xu_li(int arr[],int n)
{
long long Max=1,Min=1,x=1;
for(int i=0;i<n;i++)
{
long long t=arr[i];
if(t<0)
{
swap(Max,Min);
}
Max=max(Max*t,t);
Min=min(Min*t,t);
x=m... | ALGO | 0.999965 | 4.222237 |
6e8c4e0e-0cbd-4ee2-80b3-c8afeaffc143 | Han-Goo-Rang/STD_ZULFA_MUSTAFA_AKHYAR_ISWAHYUDI_2311104010 | 01_Pengenalan_CPP_Bagian_1/Praktikum_1/operasiFloat.cpp |
#include <iostream>
using namespace std;
//Inisiasi float-nya
int main() {
float angka1, angka2;
cout << "Input angka1 : " ;
cin >> angka1;
cout << "Input angka2 : " ;
cin >> angka2;
//Proses rumus
float jmlh = angka1 + angka2;
float kurang = angka1 - angka2;
float kali = angka1 * angka2;... | TOOL | 0.949454 | 3.425488 |
aaff6b33-c534-45e6-ab54-dfa4f55ef2c5 | alibaba/nann | blaze-benchmark/thirdparty/boost_1_53_0/libs/numeric/ublas/test/test_inplace_solve.cpp | #include <iostream>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
#include "utils.hpp"
namespace ublas = boost::numeric::ublas;
static const dou... | TEST | 0.952789 | 6.146303 |
d869e73e-ee5b-45ab-8e8c-4d6bc3f74a54 | eitanbyron/Competitive-Programming | Class 10/UVA_11631.cpp | // This file contains implementations of some well-known graph algorithms.
// Written by Nofar Carmeli. Some code is based on the book Competitive Programming 3 by Steven and Felix Halim.
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
using namespace std;
typedef pair<int,... | ALGO | 0.999898 | 4.879268 |
cc2e8732-b7c4-4c71-aaa0-6593f6c38bee | Xilinx/SDAccel-Tutorials | docs-jp/docs/mixing-c-rtl-kernels/reference-files/krnl_vadd.cpp | //------------------------------------------------------------------------------
//
// kernel: vadd
//
// Purpose: Demonstrate Vector Add in OpenCL
//
#define BUFFER_SIZE 256
extern "C" {
void krnl_vadd(
int* a,
int* b,
int* c,
const int n_elements)
{
... | ALGO | 0.938296 | 4.406893 |
ad7ef583-dd4d-4323-b31c-274126681268 | YoungJooYoo/For_Coding_Test | Inflearn_coding_test_c++/57.CPP | #pragma warning(disable:4996)
#include <iostream>
using namespace std;
void solution(size_t n)
{
if (n == 0)
{
return;
}
solution(n / 2);
cout << n % 2;
}
int main(void)
{
//freopen("input.txt", "rt", stdin);
size_t n;
cin >> n;
solution(n);
return 0;
}
| ALGO | 0.999971 | 4.241028 |
6b0da585-59db-4a6d-872a-2f2a19118954 | nandiyassa/algoritmaweb2 | Pertemuan 10/nandiyassa_binary.cpp | #include<iostream>
using namespace std;
int main() {
int i, j, n, bilangan[12], kiri, kanan, tengah, temp, target;
bool ketemu = false;
cout<<"Masukan jumlah data : ";
cin>>n;
for (i=0; i<n; i++)
{
cout<<"Bilangan ke - ["<<i<<"] : " ;
cin>>bilangan[i];
}
for(i=0; i<n; i++)
{
for(j=0; j< n-i-1; j... | ALGO | 0.999931 | 3.876851 |
2c7817c9-30fc-4d47-bdd3-e11a8b9afc44 | Hikari9/UVa | 10389 - Subway.cpp | /**
UVa 10389 - Subway
by Rico Tiongson
Submitted: August 20, 2013
Accepted 0.019s C++
O(mlogn) time
*/
#include<iostream>
#include<vector>
#include<queue>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
using namespace std;
struct edge{
int i;
double w;
edge() {}
edge( int I, double W ): ... | ALGO | 0.999331 | 3.691706 |
ffb79b38-f267-4fe0-a915-3e0b96f5bf77 | siddharthagar229/Leetcode | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin... |
class Solution {
public:
int cnt=0;
pair<int,int> slv(TreeNode*root)
{
if(!root)
return {0,0};
pair<int,int>l=slv(root->left);
pair<int,int>r=slv(root->right);
int n=l.second+r.second+1;
int sum=l.first+r.first+root->val;
... | ALGO | 0.999856 | 6.754914 |
71968cd0-a6c5-4780-89d8-635d75bc80c3 | Umer-prog/DSA | Data Structures/Graphs/Graph Problems/graph maze (obj 9).cpp | #include <iostream>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <array>
#include <string>
using namespace std;
struct Vertex {
string data;
int index;
struct Vertex* Next;
struct Edge* Elist;
};
struct Edge {
//int weight;
struct Vertex* ToVertex;
struct Edge* next;
};
... | ALGO | 0.993755 | 3.475129 |
2564bfdf-f620-4e96-8d0e-3e68693cc712 | Yehia-Nour/LeetCode | 0225-implement-stack-using-queues/0225-implement-stack-using-queues.cpp | class MyStack {
queue<int> qu1;
queue<int> qu2;
public:
MyStack() {
}
void push(int x) {
qu2.push(x);
while (!qu1.empty()) {
qu2.push(qu1.front());
qu1.pop();
}
swap(qu1, qu2);
}
int pop() {
int remove = qu1.front();
... | ALGO | 0.998591 | 5.359999 |
8c48a4b2-f670-4ba5-8181-b33b5895a598 | chengyiwei/algorithm | xcpc/ICPC2024online1/G/G0.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2008;
int arr[N], sa[N];
int b[N][N], sb[N][N];
void eachT() {
int n;
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
}
auto check = [&](int x) {
sa[0] = 0;
for (int i = 1; i <= n; ++i) {
int ... | ALGO | 0.999991 | 4.400159 |
7a0a5e24-a7a8-446d-ac6f-25bfed7d9e17 | Gyanthakur/GFG_POTD | September_2024/potd_30sept.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str) {
// Corner ... | ALGO | 0.999953 | 6.250536 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.