uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
8e434d17-0ca3-4bdc-bd1f-d2200f15ebc7 | fanpu/Competitive-Programming | travel.cpp | #include<bits/stdc++.h>
using namespace std;
#define INF 2000000000
#define mp make_pair
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> adjList;
adjList al;
int main(){
ios_base::sync_with_stdio(0);
int n,m; cin >> n >> m;
al.assign(n+1,vii());
int u,v,l;
for(int i = 0; i < m; i++){
cin >>... | ALGO | 0.99992 | 3.790282 |
0f7317a3-3b2d-4c48-a56a-0cdbaefc2da1 | orihehe/Codeforces | Codeforces Round #547 (Div. 3)/D - Colored Boots.cpp | /*
앞에있는 boots의 원소를 원소별로 위치를 모두 저장
뒤의 boots의 ? 가 아닌 값중 앞에도 같은 값이 있다면 ans에 넣어준다.
이제 남은 값들을 ?와 매칭
*/
#include <cstdio>
#include <vector>
#define pii pair<int,int>
using namespace std;
/* 🐣🐥 */
vector<int> a[27], b[27];
vector<pii> ans;
int main() {
int n;
char fr[150002], ba[150002];
scanf("%d", &n);
scanf("%s %s",... | ALGO | 0.999984 | 3.378556 |
926001a9-9dbc-43fd-985c-8f042cddb3f7 | JustAG7/Competitive_Programming | Olympic/Sinh Vien/OLP CT 2023/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define ll long long
#define pb push_back
#define pf push_front
#define db double
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define... | ALGO | 0.999692 | 4.289816 |
7a69d868-3cc3-47b5-8def-dfbd6ccb9f7c | Muenzee901/Met3D_TropopauseDetection | met.3d/src/fronts/frontdetection3DsourceGPU.cpp | #include "frontdetection3DsourceGPU.h"
#include "util/mmarchingcubes.h"
#include <unistd.h>
// standard library imports
// related third party imports
#include <omp.h>
// local application imports
#include <log4cplus/loggingmacros.h>
#define COMPUTE_PARALLEL
#define MEASURE_CPU_TIME
#define qNaN (std::numeric_limit... | ALGO | 0.989321 | 5.511279 |
6935d527-fa2a-401e-a646-f66f9afd69e0 | ouvh/CP-Training | Assignment 2/Set 2/4 - UVA 700 Data bugs.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,y,a,b,max,count;
long long cas =0;
cin >> n;
while(n != 0){
cas++;
vector <pair<int,int>> year;
pair<int,int> element;
for(int i=0;i<n;i++){
cin >> y >> a >> b;
element.first = y;elem... | ALGO | 0.999342 | 3.723369 |
4b40097c-95bd-42f7-946c-d2c1f0258169 | alamin2566/Competitive-problem-solving | c_Buttons.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x,y,noob=0;
cin>>x>>y;
if(x>y){
noob=x+(x-1);
cout<<noob<<'\n';
}
else if(x<y){
noob=y+(y-1);
cout<<noob<<'\n';
}
else {
cout<<x+y<<'\n';
}
} | ALGO | 0.999916 | 3.66692 |
077b01fc-dce8-4fc2-8c4f-398d0d6ea58a | KanaevaEkaterina/Projects.2012-1 | First term/elementWithMaxAmong/qsort.cpp | #include "qsort.h"
#include "stdafx.h"
void qsort(int left, int right, int mass[])
{
if ((right - left) > 9)
{
int i = left;
int j = right;
int x1 = mass[left];
int x2 = mass[left];
int x = mass[left];
for(int k = left + 1; k <= right; k++)
{
if (mass[k] != mass[left])
{
x2 = mass[k]... | ALGO | 0.999764 | 4.40742 |
0e0c3b70-b068-4b66-9429-6b68afcfb252 | kamilszymczak1/my_solutions | cf/contests/1430/a.cpp | #include <iostream>
#include <array>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int t, n;
cin >> t;
array<int, 3>res;
for(int i = 0; i < t; i++) {
cin >> n;
array<int, 3>res = {0, 0, 0};
if((n % 3 == 1 && n < 7) || (n % 3 == 2 && n < 5)) ... | ALGO | 0.999907 | 4.010943 |
69c214c4-8fd4-4bd4-b35c-b8de07258599 | anhdatsiudeptrai/bai11chuvihinhchunhat2 | bai11chuvihinhchunhat2.cpp | #define _USE_MATH_DEFINES
#include <iostream>
using namespace std;
int main()
{
cout << "tinh dien tich chu vi hinh tron\n";
double chuvi, dientich, bankinh;
cout << "nhap bankinh "; cin >> bankinh;
//SỬ DỤNG M_PI THAY VÌ SỬ DỤNG PI= 3.14
chuvi = 2 * M_PI * bankinh;
dientich = M_PI * bankinh * bankinh;
cout <... | ALGO | 0.952781 | 3.327703 |
5775e18c-ab04-407c-926d-82ea18ff5287 | leduong92/C-Project | VcTool/pre_dotnoet/Tool/TBinaryTable.cpp | //=======================================================================================================
// •ϒoCit@CNX
// Class Name TBinaryTable
// File Name TBinaryTable.cpp
// 쐬ҁFCoba
// 쐬F2002.02.01
// CF
//=======================================================================================================
#inc... | TOOL | 0.871163 | 4.645986 |
fe834e29-dc81-4ea7-97fe-047d2536bf66 | Farepal/myTLX | jawbreaker4nv.cpp | //ANJING LAH GARA GARA SOAL NYA
//Ingat bahwa Anda hanya boleh memilih bola ketika rangkaian yang mengandung bola tersebut memiliki lebih dari satu bola.
//jadi ngulang ngulang asw
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int n, m;
char kotak[50][50];
char ko... | ALGO | 0.999858 | 3.980977 |
d07f91b9-77ec-4872-9ea8-de86de7bca01 | nhannguyen95/algorithms | practices/leetcode/tree/563-binary-tree-tilt.cpp | // Solution 1: recursion inside recursion
// N = number of nodes in tree
// O(NlogN) in time in average
// Proof: by solving T1, T2
// O(N) in space if skewed tree
// O(logN) in space in average
class Solution {
public:
// T2(n) = n
int getSum(TreeNode* node) {
if (node == NULL) return 0;
return... | ALGO | 0.999994 | 6.748445 |
cb3a8d3a-1d49-4f8d-b7af-cfc51bfeccf6 | ishandutta2007/codeforces | ooops_no/normal/962/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ld long double
#define ll long long
#define int long long
mt19937 rnd(51);
const int N = 1e5 + 10;
int par[N], tin[N], bal[N], cnt[N], kol = 0;
vector<bool> used(N);
vector<int> g[N];
void dfs(int v, int p) {
par[v] = p;
tin[v] = kol... | ALGO | 0.999994 | 4.691151 |
968bf120-b736-49d2-9b19-8250d98d7f97 | Cccceb/UvaCode | 习题3-3.cpp | #include<iostream>
#pragma warning(disable:4996)
#define LOCAL
#ifdef LOCAL
FILE *fin = freopen("ϰ3-3in.txt", "r", stdin);
FILE *fout = freopen("ϰ3-3out.txt", "w", stdout);
#endif
int main() {
using namespace std;//Ҫmainж
int n,first=1,T;
scanf("%d", &T);
while (T--) {
first = 1;
int num[10]{};
scanf("%d", &... | ALGO | 0.999349 | 4.351572 |
84325b18-fc2e-473c-ae91-1ba5276940b8 | Shivin01/DataStructure | cSorting/selectSort.cpp | #include <bits/stdc++.h>
void selectionSort(vector<int>& arr, int n)
{
for (int i =0; i<=n-2; i++) {
int min = i;
for (int j=i; j<n; j++) {
if (arr[j] < arr[min]) {
min = j;
}
}
int temp = arr[min];
arr[min] = arr[i];
arr[i]... | ALGO | 0.999927 | 5.219529 |
6ec81f1a-0648-4f58-97a0-fac49f0444fc | abcivashritt/codechef | Cricket Match.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
int n,m;
cin>>n>>m;
cout<<(n<=m*36?"YES":"NO")<<"\n";
}
return 0;
}
| ALGO | 0.997841 | 3.800209 |
82d8b2b9-1aa9-4975-8d5b-f2799278e1b2 | ishandutta2007/codeforces | ivan100sic/normal/510/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
basic_string<int> e[1005];
int g[1005];
int n;
string a[1005];
void no() {
cout << "Impossible\n";
exit(0);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nul... | ALGO | 0.999907 | 3.926999 |
7d6ddf84-9621-4cd8-bf2f-0e0674aa5f8e | KaVoshnik/College-works | binary search.cpp | #include <iostream>
#include <algorithm>
int main()
{
int arr[10]; // создали массив на 10 элементов
int key; // создали переменную в которой будет находиться ключ
std::cout << "enter 10 number for massive: " << std::endl;
for (int i = 0; i < 10; i++)
{
std::cin >> arr[i]; // считыва... | ALGO | 0.99984 | 4.544473 |
b28e0c60-d199-4e04-b7a3-eb2bc113ace4 | Joshoccas/DGIIM | Primero/Segundo Cuatrimestre/Metodología de la Programación/Prácticas/Entorno de trabajo con todos los proyectos hechos y librerías necesarias/MPGeometry_MOD/src/main.cpp | /**
* @file main.cpp
* @author DECSAI
* @note To be implemented (partially) by students
*
*/
/**
* @mainpage MP1920Geometry
*
* Given two rectangles and a sequence of points
* this program calculates which points are inscribed within the intersection of the two
* rectangles
* - programmatically sets the da... | ALGO | 0.995429 | 5.257211 |
eef021a8-f7b1-4d91-8316-c1b20b990fc2 | JeetYad07/DSA | basicofprogram/righttrianglepattern.cpp | // * * * * i=0,j=0,1,2,3
// * * * i=1,j=0,1,2 concept is take i=0 to n and j=0 to n-i
// * * i=2,j=0,1
// * i=3,j=0
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter a number: "<<endl;
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<n-i;j++){
cou... | ALGO | 0.999819 | 3.750807 |
0b3e3179-f083-491f-9cf8-17624ed97913 | raincross7/code-similarity | codes/train_code/problem158/problem158_345.cpp | #include <bits/stdc++.h>
#include <cassert>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() puts(o... | ALGO | 0.999623 | 3.415449 |
8186596b-1eb7-45b9-a626-a2f5ff8e6939 | SangHunHan92/SensorsCalibration | lidar2camera/joint_calib/3rdparty/eigen3/test/sparse_permutations.cpp | static long int nb_transposed_copies;
#define EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN {nb_transposed_copies++;}
#define VERIFY_TRANSPOSITION_COUNT(XPR,N) {\
nb_transposed_copies = 0; \
XPR; \
if(nb_transposed_copies!=N) std::cerr << "nb_transposed_copies == " << nb_transposed_copies << "\n"; \
VERIFY( (#XPR... | TEST | 0.973866 | 6.338624 |
f514dd87-47d0-4674-83af-3ed8719d9a38 | ishandutta2007/codeforces | neal/normal/997/D.cpp | #include <iostream>
#include <vector>
using namespace std;
const int MOD = 998244353;
template<typename T1, typename T2>
void mod_add(T1 &a, T2 b) {
a += b;
if (a >= MOD)
a -= MOD;
}
struct tree {
int N, K;
vector<vector<int>> adj;
void init(int n, int k) {
N = n;
K = k;... | ALGO | 0.999974 | 4.70906 |
b39df34b-c231-4876-8753-2bf1288449a4 | SteveOnAlex69/ICPC-Training | ICPC National Vietnam - 2024/code/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){
return (ull) rng() % (r - l + 1) + l;
}
ll gcd(ll a, ll b) {return __gcd(a, b);}
ll min(ll a,ll b){return (a > b)? b:... | ALGO | 0.999896 | 4.63166 |
1e2ac93b-26ec-4a3d-aa4a-6761b4361b3d | Sarang8/Leetcode_Problems | 611-valid-triangle-number/611-valid-triangle-number.cpp | class Solution {
public:
int triangleNumber(vector<int>& nums) {
int n=nums.size();
sort(nums.begin(), nums.end());
int ans=0;
for(int i=n-1; i>=2; i--){
int c=i;
int b=c-1;
int a=0;
while(a<b... | ALGO | 0.999993 | 6.069162 |
9eae0ecd-f887-4a91-b9b1-7eaf2de606b6 | ishandutta2007/codeforces | forza_ferrari/normal/1000/G.cpp | #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define int long long
struct edge
{
int node,val1,val2;
edge(int node_,int val1_,int val2_):
node(node_),val1(val1_),val2(val2_){}
};
vector<edge> v[300001];
//0~1 dp0~1 2 3 4
int n,m,a[300001],dp[300001][3],sum[300001][3],dep[300... | ALGO | 0.999989 | 4.261084 |
18302843-01ef-437b-8bfe-4d9f92d708e1 | noashadmon/Huffman-Tree | decoder1.cpp | // Author: Sean Davis
#include <cstdlib>
#include <iostream>
#include <ostream>
#include "BinaryHeap.h"
#include "decoder.h"
using namespace std;
Decoder::Decoder()
{
} // Decoder()
Decoder::~Decoder()
{
} // ~Decoder()
void Decoder::decode(const unsigned char* encodedMessage, const int encodedSize,
unsigned cha... | ALGO | 0.985116 | 3.921746 |
c3fb40d1-a3c6-4a7e-88a8-ad8b91e12b13 | SarahGuo97/Evaluating-the-Impact-of-Quarterly-Earnings-Report-on-Stock-Price-Movement- | project/Bootstrap.cpp | #include "Bootstrap.h"
using namespace std;
void Bootstrap:: load_earning_data(string filename){
ifstream ip(filename);
if(!ip.is_open()) std::cout << "ERROR: File Open" << '\n';
int index = 0;
while(ip.good()){
vector<string> earning_info;
string substr;
//first 6 columns... | DATA | 0.89882 | 3.758353 |
dff5c8fe-81eb-41b7-9066-5dbaf6d76c4d | SonianF/System_programming_4_sem | evm-laba2.cpp | #include <iostream>
#include <string>
using namespace std;
int result_cpp(int a, int c, int d) {
return ((2 * c - d / 3) / (1 - a / 4));
}
int check_input(string num) { //проверка введенных значений для длины массива
//блок try catch исользуется для поиска ошибки, например, в нашем случае это недопустимого размера ... | ALGO | 0.997405 | 3.582582 |
5ebb7e11-420e-43fe-abfd-9d1354d0aa57 | amrit-paudel/Learning-Data-Structures | NOTES/6 sorting algorithms/bubble sort/improved_bubble_sort.cpp |
#include<iostream>
using namespace std;
// function to bubble sort data
// this is to sort in ascending order
void bubbleSort(int* nums,int size){
int temp;
int flag = 1;
for( int i=0;i<=size-1 && flag == 1 ;i++ ){
// look at the above properly, first time doing this
// actually we could ... | ALGO | 0.999766 | 4.491597 |
ca863a4e-975d-403f-a32e-c57b061d5ace | slyjain/CP | AZ/FibonacciBreakdown.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
//do not forget to reset the GLOBAL VARIABLES AFTER EACH TEST CASE
vector<int>fib;
void fibo(){
fib.push_back(1);
fib.push_back(1);
int temp=fib[0]+fib[1];
int c=2;
while(temp<=1e9){
fib.push_back(temp);
temp=fib[c]+f... | ALGO | 0.999775 | 4.580045 |
481d60fb-3e6a-4fe3-a806-6b30ab3dc8b8 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/inversmodular/euler-toutient/train/7ecc4c54-1831-4ab7-810a-d7de9684dee7.cpp | #include <cstdio>
int A, N;
int totient(int N) {
int result = N;
for (int i = 2; i * i <= N; i++) {
if (N % i == 0) {
result = result / i * (i - 1);
while (N % i == 0) {
N /= i;
}
}
}
if (N != 1) {
result = result / N * (N - 1);
}
return result;
}
int lgput(int base, int exponent, int MOD)... | ALGO | 0.999961 | 4.752347 |
fc5c8a11-52e0-4861-a33b-026fe85a5d6c | gaminKim/Algorithm-Study | 2021년 (3월-12월)/week02/카드 짝 맞추기/donghyeon.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
#include <queue>>
using namespace std;
vector<vector<int>> tmp; // board ӽ
vector<int> cardNum; // īȣ
vector<pair<int, int>> cardPos[7]; // cardPos[n] -> n ī ġ1,2
int cardCnt;
int minCost;
int dr[] = { 1,0,-1,0 };
int dc[... | ALGO | 0.999829 | 3.431996 |
b0f25229-f61f-4a06-ac58-da3b3b82ce10 | stormbreaker07/CodingQuestions | problem set 2/codefocesless1300pro4.cpp | #include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{ string s;
cin>>s;
for(int i=0;i<s.length();i++)
{if( s[i]=='.')
{cout<<0;}
else if(s[i]=='-')
{if(s[i+1]=='.')
{cout<<'1';
i++;}
else if(s[i+1]='-')
{cout<<'2';
i++;}
}
}
return 0;
}
| ALGO | 0.999575 | 3.150533 |
aaa4962d-daad-4b58-9045-dcdf83cdc659 | Ananileaf/object-oriented | myself/fzu/fzu 1008.cpp | /************************************************************
FileName: fzu 1008.cpp
Author: 031502248
Date: 2016/3/31
History:
<author> <time> <version> <desc>
questionlink http://acm.fzu.edu.cn/problem.php?pid=1008
********************************************************... | ALGO | 0.996883 | 3.173419 |
e34d0031-9b7f-4b8b-a490-371c89ab80ca | Desi9nerd/Programmers | Codility/TreeHeight.cpp | #include <algorithm>
int answer;
void DFS(tree* node, int currLength)
{
if(node == nullptr) return;
answer = max(answer, currLength);
if(node->l != nullptr){
DFS(node->l, currLength + 1);
}
if(node->r != nullptr){
DFS(node->r, currLength + 1);
}
}
int solution(tree* T) {
... | ALGO | 0.999872 | 5.473212 |
524fbe2d-6dc2-4490-81f9-dfe1a0bd9696 | ishandutta2007/codeforces | spycheese/normal/1572/D.cpp | #include <bits/stdc++.h>
#ifndef LOCAL
#define cerr dolor_sit_amet
#endif
#define mp make_pair
#define sz(x) ((int)((x).size()))
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ipair;
typedef pair... | ALGO | 0.999949 | 4.113606 |
9ec09164-aa2a-4c9d-a093-f32e6a0f356e | Mekin-jema/Data-Structor | LinkedLIst/Stack/RverseLinkedLIstUsingStack.cpp | #include <iostream>
#include<stack>
using namespace std;
struct Node{
Node * next;
int data;
};
Node * head=NULL;
Node * GetNewNode(int data){
Node * newNode= new Node();
newNode->data=data;
newNode->next=NULL;
return newNode;
}
void insert(int data){
if(head==NULL){
head= GetNe... | ALGO | 0.999866 | 4.697265 |
0b6126c8-f342-4efb-b8fd-165e534ba622 | HBreithaupt/DigiPenCode | CS170/Lab6/List.cpp | #include <iostream> // cout
#include "List.h"
/*******************************************************************/
/*******************************************************************/
/*****************************************************************************/
/*!
\file List.cpp
\author Haven Breithaupt
\pa... | TOOL | 0.926364 | 4.330496 |
ab483588-8fe1-4901-ae05-05531c429f51 | toufu-24/AtCoder | ABC/ABC327/D.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define all(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
#define REVERSE(v) reverse(v.begin(), v.end())
#define ll int64_t
#define ld long double
#define int ll
... | ALGO | 0.999999 | 4.688773 |
3c6890e8-06ca-4ac0-a926-e275416d483b | amnesia4bygone/codeleet | InsertInterval.cpp | /**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
class Solution {
public:
vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) {
// Start typin... | ALGO | 0.999964 | 5.810745 |
93fd567d-9429-4d52-b284-b3f3945b08f2 | Yina-Zhao/gnssLab-whu | thirdparty/eigen-3.4.0/doc/examples/nullary_indexing.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [functor]
template<class ArgType, class RowIndexType, class ColIndexType>
class indexing_functor {
const ArgType &m_arg;
const RowIndexType &m_rowIndices;
const ColIndexType &m_colIndices;
public:
typedef Matrix<typename ArgType::Scal... | ALGO | 0.989711 | 6.829144 |
fc48beaa-d982-456b-9e51-0d9826b133f7 | dominikMilde/DiscreteMathematics | Lab3 - chromatic number/zad3.cpp | #include <iostream>
#include <fstream>
#include <set>
using namespace std;
int cromaticNumber(int bojeVrhova[], int brojVrhova)
{
//int counter = 0;
set<int> boje;
for (int i = 0; i < brojVrhova; i++)
{
if (bojeVrhova[i] == 0)
{
cout << "Graf nije obojan!" << endl;
return -1;
... | ALGO | 0.999109 | 5.316383 |
e4dc4f04-9574-4fb6-a18e-0022494b5493 | hariom20singh/data-structure- | gcd_recursive.cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
return b == 0 ? a : gcd(b, a % b);
}
int32_t main()
{
int a, b;
cout << "Enter 2 numbers" << endl;
cin >> a >> b;
cout << "GCD of " << a << " and " << b << " is " << gcd(a, b);
return 0;
}
| ALGO | 0.997908 | 5.371877 |
0e2de1e1-3f70-476f-b24b-76fc190a81aa | codingwill/competitive-programming | Codeforces/A-1030-InSearchOfEasyProb.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int ans;
string hasil = "EASY";
for (int i = 0; i < n; i++)
{
cin >> ans;
if (ans == 1)
hasil = "HARD";
}
cout << hasil << "\n";
return 0;
}
| ALGO | 0.999483 | 3.621461 |
3440ece8-3a22-4a98-a980-6009272665de | minhhai205/DSA_23020055_NguyenMinhHai | src/Week5/sxnhanh_quicksort.cpp | #include<bits/stdc++.h>
using namespace std;
// Phân hoạch lomuto
// duy trì 2 chỉ số i, j. j để so sánh giá trị với pivot còn i để swap
// và đảm bảo các phần từ bên trái i đã duyệt luôn <= pivot
// void quicksort(int a[], int left, int right){
// if(left >= right) return;
// int pivot = a[right];
// in... | ALGO | 0.999958 | 4.819585 |
c820af9e-4ab1-47db-a92d-1c4777ac9bca | ishandutta2007/codeforces | i_love_dasha_karpenko/normal/1666/L.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int n, m, s;
cin >> n >> m >> s;
vector<vector<int>> adj(n + 1);
while (m--)
{
int a, b;
cin >> a >> b;
adj... | ALGO | 0.999941 | 4.02503 |
1e029ecb-d6c0-4be2-8771-e2b8a0aa359a | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5665_14.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int n, j, d, k = 0, x, y = 0, t, q, i, m;
char c;
set<long long int> s;
cin >> n;
long long int a[n][2], b[n][2], v2[m];
for (i = 0; i < n; i++) {
cin >> a[i][0] >> a[i][... | ALGO | 0.999974 | 3.830992 |
26200519-7eaa-4759-b380-d10a9d135121 | GFG-CLUB-KIIT/100-Days-of-Code | Rohit/day2.cpp | Link: https://leetcode.com/problems/permutation-in-string/
class Solution {
public:
bool checkInclusion(string s1, string s2) {
int freq[26] = {0};
for(char c : s1) freq[c - 'a']++;
int j = 0, i = 0, count_chars = s1.size();
while(j < s2.size()){
if(freq[s2[j++] - 'a']--... | ALGO | 0.999818 | 6.69623 |
953ba367-6fe6-47a8-928c-36d16fa9220b | rebellizedteam/frameworks_av | media/libstagefright/codecs/amrnb/dec/src/pstfilt.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include <string.h>
#include "pstfilt.h"
#include "typedef.h"
#include "mode.h"
#include "basicop_malloc.h"
#include "basic_op.h"
#include "weight_a.h... | ALGO | 0.992522 | 4.827775 |
3d111803-01ce-47fe-9a66-13098ddf6695 | ishandutta2007/codeforces | benq/normal/746/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int,int> mii;
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = b-1; i >= a; i--)
#define F0Rd... | ALGO | 0.999997 | 3.3567 |
e7932891-67ab-4bc4-889e-5eba8f09cb3f | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_12626_1.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long max_n = 12;
const long long log_n = 20;
const long long inf = 1e17 + 6;
const long long K = 1000;
std::mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
struct node {
long long tag = -1, sum = 0, mn = inf;
... | ALGO | 0.999857 | 4.459483 |
4c06f09a-4e53-451c-b9d3-3db20cde00bd | LeRoii/RosADAS | src/lanedet/Ultra-Fast-Lane-Detection/evaluation/culane/src/lane_compare.cpp | /*************************************************************************
> File Name: lane_compare.cpp
> Author: Xingang Pan, Jun Li
> Mail: <EMAIL>
> Created Time: Fri Jul 15 10:26:32 2016
************************************************************************/
#include "lane_compare.hpp"
double LaneCompare:... | ALGO | 0.991488 | 4.842396 |
5db855ea-a21b-43d5-b672-3a9b07215166 | dankanium/LeetCode-Practice | Easy/Check if Array Is Sorted and Rotated.cpp | // https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; i++) {
int a;
cin >> a;
nums.push_back(a);
}
} | ALGO | 0.999958 | 5.129272 |
1710f76c-72da-442d-be1c-333930659c2f | Fraunhofer-AISEC/cryptsan-llvm-project | llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp | #include "AggressiveAntiDepBreaker.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/... | ALGO | 0.983116 | 6.496446 |
07602116-9efe-4e86-b492-5276e792be6a | HisShadow85/SoftUni-Algo | week2_Combinatorial/homework/solutions/Variation/VariationsWithoutRepetitionn/VariationsWithoutRepetition.cpp | #include<iostream>
#include<vector>
using namespace std;
class VariationsWithoutRepetition{
public:
static void variationsWithoutRepetition(int classDegree, vector<int> &set){
static vector<int> variation;
static int index = -1;
static int couter = 0;
index++;
if(index == 0){
variation.cle... | ALGO | 0.999925 | 4.078087 |
6d852d90-6bb3-4faa-b919-28e323f747b4 | SJTU-ACM/Templates | Reshiram/unlimited/source/Geometry-Algorithm/Basic3D.cpp | int dcmp(const double &x) {
return fabs(x) < eps ? 0 : (x > 0 ? 1 : -1);
}
struct TPoint{
double x, y, z;
TPoint() {}
TPoint(double x, double y, double z) : x(x), y(y), z(z) {}
TPoint operator +(const TPoint &p)const {
return TPoint(x + p.x, y + p.y, z + p.z);
}
TPoint operator -(const TPoint &p)const {
ret... | ALGO | 0.999346 | 4.422494 |
4498fc74-9f94-4099-aa21-159a952c786e | ChaoticMagician/cTest | 4test/4_4.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
double arr[5] = {21.1,32.8,23.4,45.2,37.4};
double *pd = arr;
cout << pd << endl;
// cout << ++pd << endl;
cout << *++pd << endl;
cout << ++*pd << endl;
cout << (*pd)++ << endl;
cout << *pd << endl;
cout << *pd++ ... | TOOL | 0.906931 | 3.266457 |
30d011cc-6faf-4f82-8ca6-da3235fb386c | lepecoder/algorithms | leetcode_cn/728.自除数.cpp | /*
* @lc app=leetcode.cn id=728 lang=cpp
*
* [728] 自除数
*/
// @lc code=start
class Solution {
public:
vector<int> selfDividingNumbers(int left, int right) {
}
};
// @lc code=end
| ALGO | 0.999445 | 5.674479 |
58ac3eb3-c09d-4c27-8122-c8066717dc79 | ramancoder123/100-Days-of-DSA | Day3/maxIndex.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Given an array arr[] of n non-negative integers.
// The task is to find the maximum of j - i (i<=j)
// subjected to the constraint of arr[i] <= arr[j].
int maxIndex(vector<int> &arr, int n){
vector<int> left;
vector<int> righ... | ALGO | 0.999943 | 4.851962 |
a288f80f-5b01-463a-aa0b-00828fc2afcc | Bri1987/acwing | algorithm_basic/basic/float_790_2_divide.cpp | #include <iostream>
double f_bsearch(double l,double r,double val){
//要使float精确,还是用1e-7才行
//1e-6表示的是十进制中的小数位数,即0.000001。然而,当这个小数转换为二进制表示时,可能会产生无限循环的二进制小数。
//因此,使用1e-6(或更大的精度)作为精度值时,可能会导致舍入误差和截断误差的累积,从而无法得到预期的精确结果。
const double eps = 1e-7;
//注意eps是用在while里,中间的mid*mid*mid == val是等号#in
while (r - ... | ALGO | 0.999826 | 3.485084 |
59388a03-120c-4480-970c-b57086611091 | Sillyplus/Solution | Tyvj/p2067.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 2; i <= sqrt(n); i++)
if (n % i == 0) {
cout << n/i << endl;
break;
}
return 0;
}
| ALGO | 0.99998 | 3.731111 |
01cd7ab1-681d-4cc6-a3d2-2e5666800045 | bishalprasad321/SDE-Sheet | Day 03/majority_elements.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Problem Description:
--------------------
Given an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Constraint:
-----------
... | ALGO | 0.999993 | 6.403071 |
202efcf4-1c83-41f8-b130-351fdca1bd94 | akshaykumar192110006/CSA0626 | GCD.cpp | #include <stdio.h>
int gcd(int a, int b) {
return (b == 0) ? a : gcd(b, a % b);
}
int main() {
int num1, num2;
printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2);
printf("The GCD of %d and %d is %d\n", num1, num2, gcd(num1, num2));
return 0;
}
| ALGO | 0.995936 | 5.695816 |
e254bf12-1029-4436-8c66-ea5179bbce29 | Vedantjn/Patterns | t1.cpp | #include<iostream>
using namespace std;
int main(){
int r;
for (int r =1 ; r <= 5; r++)
{
cout<<"*";
cout<<"*";
cout<<"*";
cout<<"*";
cout<<endl;
};
return 0;
}
// ======================================================================================... | ALGO | 0.99787 | 3.679675 |
943cb66a-e24c-4703-83ee-a9d9eefd2803 | yashsiwach/Competitive-Programming | CP Templetes/trees/treebuilds.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountll
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<x<<" ";
class node... | ALGO | 0.999983 | 4.417236 |
3ce895ed-37cf-4cdf-b885-d1d76eb5bc23 | bsilver8192/SHRC-Arm | shrc/path_planning/aStarSearch.cpp | #include "aStarSearch.h"
#include "fringeData.h"
#include <cstdlib>
#include <iostream>
#include <cassert>
#include <utility>
#include <set>
/*AStarSearch::AStarSearch(point g, double maxVel, unsigned int ss) : sizeSuccessors(ss)
{
goal.x=g.x;
goal.y=g.y;
goal.z=g.z;
maxVelocity=maxVel;
}
bool AStarSe... | ALGO | 0.999889 | 3.361461 |
bfe63e62-1919-4215-a5d4-5cf954886778 | samiodo/CP | BitWise & BitMasking/odd_even_check.cpp | /* given a number check if it is odd or even */
/* basically we are just checking the last
bit. If the last bit is 1 then it is odd
and if the last bit is 0 the it is even
and to check it we just need to "&1" to the number
5 = 101
&1
1 -> that means last bit is 1
4 = 100
&1
0 -> that means las... | ALGO | 0.999632 | 4.004042 |
232d5b4b-5ca6-4b29-afdc-06e38882371b | bobxiong88/Competitive-Programming-Solutions | DMOJ solutions/IOI/ioi09p4.cpp | #include <bits/stdc++.h>
using namespace std;
#define mx 55
int dp[mx][mx][mx][mx];
int psa[mx][mx];
bool used[mx][mx][mx][mx];
int a[mx][mx];
int sum(int x1, int y1, int x2, int y2){
return psa[x2][y2]-psa[x2][y1-1]-psa[x1-1][y2]+psa[x1-1][y1-1];
}
int get(int x1, int y1, int x2, int y2){
if (used[x1][y1][x2][... | ALGO | 0.999964 | 3.189154 |
92073b38-4689-46f7-b2a0-e3c0b1b725e6 | ksungkeun84/datastructure | fds/c10/two34.cpp | #include <iostream.h>
#include <fstream.h>
enum Boolean { FALSE, TRUE};
enum result {equal, leaf, lChild, lmChild, rmChild, rChild};
template <class KeyType>
class Element {
public:
KeyType key;
};
enum Node234{TwoNode, ThreeNode};
template <class KeyType> class Two34; // forward declaration
template <class Ke... | ALGO | 0.999615 | 3.729325 |
d6c35d5b-3834-4db2-84e9-e5436a4c8099 | Mostafa142/Assuit-Sheets-Solutions | Sheet #3/J. Lucky Array.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int numOfEle;
cin>>numOfEle;
int arr[numOfEle];
for (int i=0;i<numOfEle;i++){
cin>>arr[i];
}
int min = arr[0];
int counter=0;
for(int i=0;i<numOfEle;i++){
if(min == arr[i]){
counter++;
}
if(min > arr[i]){
min = arr[i];
counter=1;
}
}
if(counter % 2 ==... | ALGO | 0.999934 | 4.034728 |
ea4f61e6-26f5-4949-84e1-afaaff2eae57 | sushil-bharati/lichessBot | LiChessBot/stockfish-8-win/stockfish-8-win/src/material.cpp | #include <algorithm> // For std::min
#include <cassert>
#include <cstring> // For std::memset
#include "material.h"
#include "thread.h"
using namespace std;
namespace {
// Polynomial material imbalance parameters
const int QuadraticOurs[][PIECE_TYPE_NB] = {
// OUR PIECES
// pair pawn knigh... | ALGO | 0.9976 | 6.47069 |
86f2f7a6-acdc-4ca8-b813-2b4148660728 | TayabAmir/LeetCode_Problems | 1014-k-closest-points-to-origin/1014-k-closest-points-to-origin.cpp | class Solution {
public:
double calculateDistance(int x, int y){
return sqrt((x*x)+(y*y));
}
vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {
priority_queue<pair<double, vector<int>>> pq;
for(auto v : points){
pq.push(make_pair(calculateDistance... | ALGO | 0.999999 | 6.123191 |
df2f0fde-a928-45f1-9848-e8d9cadf58c6 | Sudhir769/Sudhirleet769 | Move all negative elements to end - GFG/move-all-negative-elements-to-end.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void segregateElements(int arr[],int n)
{
vector<int>a;
for(int i=0;i<n;i++)if(arr[i]>=0)a.push_back(arr[i]);
for(int i=0;i<n;i++)if(arr[i]<0)a.push_back(arr[i... | ALGO | 0.999604 | 6.067453 |
f73406d2-1e6d-454c-b087-48f0a0b3d2a7 | pixelled/Rain-Sim | ext/nanogui/ext/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.994465 | 6.317623 |
61828b63-ca89-42f1-9f19-e82daf3be171 | SSUHYUNKIM/Algorithm | implementation/solution/Bronze/Bronze1/9093.cpp | #include <iostream>
#include<string>
#include <stack>
using namespace std;
int T;
string str;
stack<char> s;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> T;
cin.ignore();
for(int i = 0; i < T; i++)
{
getline(cin, str);
str += " ";
f... | ALGO | 0.9997 | 4.791458 |
d5004b63-4eac-42ba-8782-b51e4ca801ea | feifeiwei/LeetCode | 016.最接近的三数之和/run.cpp |
//
// main.cpp
// leetcode_learn
//
// Created by feifeiwei on 2022/4/29.
//
#include <iostream>
#include <list>
#include <algorithm>
#include <vector>
#include<queue>
#include <cstdlib>
#include <math.h>
using namespace std;
//using vectorIter = vector<int>::iterator;
class Solution {
public:
int threeSumClo... | ALGO | 0.999992 | 5.732645 |
1d98a5ab-5e85-46d1-81ab-db877fa25ccf | Mahbub-Hasan-Talukder/LeetCode | matrix/spiral-matrix.cpp | https://leetcode.com/problems/spiral-matrix/?envType=study-plan-v2&envId=top-interview-150
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
int rowLow = 0, rowHigh = matrix.size()-1;
int colLow = 0, colHigh = matrix[0].size()-1;
vector<int> v;
int cnt ... | ALGO | 0.999998 | 6.780593 |
39c15eaa-4240-49a0-9572-12c53ce784d1 | scott-sihui-wang/LeetCode | 557_Reverse_Words_in_a_String_III.cpp | class Solution {
public:
string reverseWords(string s) {
vector<string>words;
int i=0,prev=0;
while(i<s.size()){
while(i<s.size() && s[i]!=' '){
i++;
}
words.push_back(s.substr(prev,i-prev));
i++;
prev=i;
}
... | ALGO | 0.999985 | 6.333688 |
7134b6ff-b211-4c9a-96d1-480b0ba6250b | rwightman/boost | libs/units/example/performance.cpp | /**
\file
\brief performance.cpp
\details
Test runtime performance.
Output:
@verbatim
multiplying ublas::matrix<double>(1000, 1000) : 25.03 seconds
multiplying ublas::matrix<quantity>(1000, 1000) : 24.49 seconds
tiled_matrix_multiply<double>(1000, 1000) : 1.12 seconds
tiled_matrix_multiply<quantity>(1000, 1000... | TEST | 0.968209 | 6.002544 |
306eb143-35fe-4352-ae18-e47bd5b7c25a | MrHrh/p2psystem | client/sem.cpp | /*************************************************************************
> File Name: sem.c
> Created Time: Sun 14 Oct 2018 04:41:01 PM CST
************************************************************************/
#include"sem.h"
int sem_init(key_t key) //获取信号量集id函数
{
int id=semget(key,1,IPC_CREAT&IPC_EXCL... | TOOL | 0.935127 | 3.376019 |
95e48a81-6235-4aa8-a4f1-85c18817ff4c | Alaxe/noi2-ranking | 2017/solutions/A/DKV-Pleven/number.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main ()
{
long long m,n,firstnum,lastnum,cnt,add,guess;
cnt=0;
cin>>m>>n;
firstnum=sqrt(m);
lastnum=sqrt(n);
if(firstnum*(firstnum+1)<m)
firstnum++;
if(lastnum*(lastnum+1)>n)
lastnum--;
cout<<lastnum-firstnum+1;
return 0;
}
| ALGO | 0.999983 | 3.98411 |
b08751ce-5513-4248-a5a9-53c0a8338b3c | Aryant-Tripathi/StriverSdeSheetChallange | June-11-2022(Linked_list_Part_1)/4)Delete_kth_Node_from_end.cpp | #include <bits/stdc++.h>
/****************************************************************
Following is the class structure of the LinkedListNode class:
template <typename T>
class LinkedListNode
{
public:
T data;
LinkedListNode<T> *next;
LinkedListNode(T data)
{
... | ALGO | 0.999896 | 5.045683 |
d2060805-1ef4-43a5-9481-3fd9e3e1eb2e | raincross7/code-similarity | codes/train_code/problem186/problem186_348.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define mxx 100005
#define endl "\n"
const ll mod=1e9+7;
int main()
{
ios::sync_with_stdio(0);
//cin.tie(0);
ll n,k;
cin>>n>>k;
int p=0,ans=0;
for... | ALGO | 0.999942 | 3.894756 |
5ff625bb-3221-46f4-82a6-20844f6a1929 | acetoacetato/ibex-dqn | src/symbolic/ibex_ExprSize.cpp | #include "ibex_ExprSize.h"
#include "ibex_Expr.h"
using namespace std;
namespace ibex {
int ExprSize::bin_size(const ExprNode& l, const ExprNode& r) {
return visit(l) + visit(r) +1;
}
int ExprSize::nary_size(const Array<const ExprNode>& args) {
int acc=0;
for (int i=0; i<args.size(); i++) acc+=visit(args[i]);
r... | ALGO | 0.933086 | 7.227923 |
ff40bcd2-aa98-4a4c-83e6-ec5b44c216ef | Oysterfield/Estrutura-de-Dados---Cpp | CppBasics/AlocDinam_2.cpp | class Aluno {
public:
Aluno() {} // construtor
~Aluno() {} // destrutor
std::string devolveNome() {
return nome;
}
int devolveMatricula() {
return matricula;
}
void escreveNome(std::string nome_) {
nome = nome_;
}
void escreveMatricula(int matricula_) {
... | TOOL | 0.976393 | 4.543732 |
1a7bf0db-286d-4697-a1d6-fe636f86b248 | Harshadaa2004/Logic-Building | program210.cpp | #include<iostream>
using namespace std;
bool CheckBit(int iNo)
{
int iMask = 0x10;
int iResult = 0;
iResult = iNo & iMask;
if(iResult == iMask)
{ return true; }
else
{ return false; }
}
int main()
{
int iValue = 0;
bool bRet = false;
cout<<"Enter number : \n";
ci... | ALGO | 0.989389 | 5.80197 |
37797115-9713-4df5-b03f-965f46322353 | youmelo1/TrabGA-CG2024 | Visualizador3D/Dependencies/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if ((unsigned)n > 63) {printf("rotatel, n out of ... | ALGO | 0.999579 | 4.574697 |
905d91a3-5a9b-4398-aaf6-62999424a89e | Benson-zxs/algorithm-cpp | Section-2/Chapter6/test_heap_sort.cpp | //
// Created by benson.zheng on 2021/11/29.
//
#include "Part4.h"
#include <iomanip>
int main()
{
vector<int> test_vec = {5, 13, 2, 25, 7, 17, 20, 8, 4};
heap<int> test_heap(test_vec);
heap_sort(test_heap);
for (int i = 0; i < test_heap.length(); i++)
cout << setw(2) << test_heap[i] << "\t";
cout << endl;
/... | ALGO | 0.994942 | 4.83185 |
5084c835-f3d0-459b-81eb-01d7d4350c23 | Kishansingh01/C-plus-Raghav-bhaiya | array.cpp | // #include<iostream>
// using namespace std;
// int main(){
// int arr[5];
// arr[0]=6;
// arr[1]=2;
// arr[2]=4;
// arr[3]=9;
// arr[4]=8;
// // cout<<arr[0]<<" ";
// // cout<<arr[1]<<" ";
// // cout<<arr[2]<<" ";
// // cout<<arr[3]<<" ";
// // cout<<arr[4]<<" ";
// for(in... | ALGO | 0.954801 | 3.031581 |
5de42fb7-0e04-4cfe-8a6f-178e555e50a6 | rustdesk-org/flutter_gpu_texture_renderer | example/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.998905 | 6.785645 |
512746db-b322-4582-a1b6-4f3790044df7 | arthur0237/dsa_leetcode_gfg | 268_Missing_Number.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int missingNumber(vector<int>& nums) {
int n = nums.size();
n = (n*(n+1))/2;
int a=0;
for(int i=0;i<nums.size();i++){
a = a + nums[i];
}
return n-a;
}
}; | ALGO | 0.999935 | 4.510641 |
4915e454-3fd5-4c4f-afb0-70f64bca8816 | Kagari22/MyCode | BinaryIndexTree/BIT_BANZI.cpp | #include <bits/stdc++.h>
// 树状数组模版
// https://codeforces.com/contest/597/problem/C
// from: cpp.json
#define INF 2e18
#define int long long
using namespace std;
const int MAXN = 1e5 + 5;
struct BIT {
int tree[MAXN];
int lowbit(int i) {
return i & -i;
}
void add(int i, int v) {
while... | ALGO | 0.999935 | 4.468675 |
b8a6e7ef-026a-43bf-90c1-863d6c5a948f | BangKartavya/DSA-Sheet-by-Love-Babbar | Binary Trees/Binary Tree to DLL/main.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
Node()
: data(0), left(NULL), right(NULL) {}
Node(int x)
: data(x), left(NULL), right(NULL) {}
};
// Utility function to ... | ALGO | 0.999773 | 7.171507 |
797e3717-de5c-4f91-8707-4fa1ed1aa2f8 | AlexWei061/cpp | practice/SeniorHigh1/semester1/October2021/20211011stringAndGraph/String/Hash.cpp | #include<bits/stdc++.h>
using namespace std;
#define P 13331
#define MAXN 10010
typedef unsigned long long ull;
char str[MAXN];
ull f[MAXN] = { 0 };
ull p[MAXN] = { 0 };
void prework(int n){
p[0] = 1;
for(int i = 1; i <= n; i++){
p[i] = P * p[i - 1];
f[i] = P * f[i - 1] + (str[i] - 'a' + 1);
}
}
ull queryHas... | ALGO | 0.999835 | 4.0179 |
ed30eeb1-8576-4667-8f11-cb99dad96e85 | BoffinHack/Study-in-University | First year/Stack/Stack.cpp | #include <iostream>
using namespace std;
//#include <iomanip>
template <typename T>
class Stack{
private:
T *prt; //Pointer to the beginning of the stack
int amount,cam; //Number of elements
public:
Stack(int amount);
~Stack();
void push(T el);
void pop();
void pr... | ALGO | 0.990751 | 4.203344 |
56544390-8b71-4a6c-b2b1-ee71b6a4640c | RahulScripted/CodeChef | CodeChef-Problems/Rating 1000 To 1400/Rating 1200 To 1400/NothingInCommon.cpp | // Alice has quarreled with Berta recently. Now she doesn't want to have anything in common with her! Recently, they've received two collections of positive integers. The Alice's integers were A1, A2, ..., AN, while Berta's were B1, B2, ..., BM. Now Alice wants to throw away the minimal amount of number from her collec... | ALGO | 0.999649 | 4.0243 |
d1fdf38e-2a34-4215-accb-e7629488f80b | EhsanGhasemii/Sharif_AlgorithmsAnalysis | project/test.cpp |
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> v{1, 5, 8, 9, 6, 7, 3, 4, 2, 0};
sort(v.begin(), v.end());
cout << "Sorted vector:\n";
for (auto x : v) {
cout << x << " ";
}
return 0;
}
| ALGO | 0.999483 | 4.833859 |
ed0e3e68-f665-4ab5-8c77-93e3fae78d9e | Rikon07/Codeforces-Rik_on | A_Halloumi_Boxes.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int test;
cin >> test;
while(test--)
{
int n, k;
cin >> n >> k;
vector<int>arr(n);
bool same = true;
for(int i=0; i<n; i++)
{
cin >> arr[i];
}
for(int i=0; i<n-1; i++)
... | ALGO | 0.999976 | 3.814828 |
8635183e-14b7-40e2-9a21-d2f6e7bcd2f7 | Gunavardhan-Potharlanka/LEETCODE-to-Github | 143-reorder-list/reorder-list.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:
void reorderList(List... | ALGO | 0.999995 | 5.890235 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.