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 |
|---|---|---|---|---|---|---|
bf8fcbe0-5377-4086-818e-46f1022b5a33 | AliakseiSuvorau/Algotithm-and-data-structures | min_split/main.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
/// Минимальный разрез ///
////////////////////////////////////////////////////////////////////////////////
const int64_... | ALGO | 0.999706 | 4.465756 |
7e5af6cb-ea22-41ad-93fc-fd34d7ddb87f | pku-liang/hlcd-archive | labs/lab02-hls-basic/04-fft/fft_1.cpp | /*
/*
This is traditional 2-radix DIT FFT algorithm implementation.
INPUT:
In_R, In_I[]: Real and Imag parts of Complex signal
OUTPUT:
Out_R, Out_I[]: Real and Imag parts of Complex signal
*/
#include "fft.h"
#include "hls_stream.h"
#include <iostream>
void bit_reverse(DTYPE X_R[N], DTYPE X_I[N], DTYPE OUT_R[N], DT... | ALGO | 0.999965 | 5.272897 |
fc22c33e-7fea-4e3c-ac66-b64adfba1c8c | Nirbhay21/C-and-DSA-codes | pattern30_meth2.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter number = ";
cin >> n;
for (int row = 0; row < n; row++)
{
for (int col = 0; col < n - row; col++)
{
if (col == 0 || row == 0)
{
cout << col + row + 1 << " ";
... | ALGO | 0.999795 | 3.554312 |
d4a0cc90-71b8-4143-91aa-c139f57078b3 | aleahfaa/IF4202-Data-Structures | Final Practicum IF4202/Final Practicum Answer/fp2_allbst.cpp | /*077's notes:
IN:insert/push
FD:level;print “on level x” if exists, else print “no {x}”
RK:get the x-th number in an ascending sequence
PH:path;print “{path to x}” if x exists, else print “no {x}”
L:left child
R:right child
S:arrived at the destination
STOP:stop the program, print “done”.
output based on the command d... | ALGO | 0.999646 | 3.783575 |
464b84e7-943f-4b7f-9eff-cdbc7da8f8b6 | JohnVlBetter/LeetCode | 2574. 左右元素和的差值.cpp | /*
* @lc app=leetcode.cn id=2574 lang=rust
*
* [2574] 左右元素和的差值
*/
// @lc code=start
impl Solution {
pub fn left_right_difference(mut nums: Vec<i32>) -> Vec<i32> {
let n = nums.len() as i32;
let mut vec : Vec<i32> = vec![n;0];
let mut left_sum = 0;
let mut right_sum : i32 = nums.... | ALGO | 0.999216 | 6.006163 |
f3f00c17-140e-4d17-8507-7bcf4bf03473 | deletexxx/assignments-of-HPC | lab2/lab2/lab2_3_vector.cpp | #include<iostream>
#include<vector>
#include<time.h>
using namespace std;
void PRINT(vector<vector<double>> x,int m,int n){
for(int i=0;i<m;++i){
for(int j=0;j<n;++j) cout<<x[i][j]<<" ";
cout<<endl;
}
cout<<endl;
}
vector<vector<double>> GEMM(vector<vector<double>> A, vector<vector<double... | ALGO | 0.999499 | 3.721766 |
ed9436ca-a3f7-41c2-a56a-f4639e0ff7fd | NSaiVamsi/Operating_Systems | Jurrasic_Park_Problem/Jurassic_park_problem.cpp | #include <iostream>
#include <pthread.h>
#include <semaphore.h>
#include <fstream>
#include <stdlib.h>
#include <limits.h>
#include <algorithm>
#include <unistd.h>
#include <random>
#define N 1000000
using namespace std;
sem_t sem;
int arr[N][2];
int P, C, k;
float l1, l2;
FILE *fout = fopen("log.txt", "w");
time_... | ALGO | 0.998572 | 3.512393 |
640698b2-6237-4c8d-9047-6c34576a0ac4 | YuliaSholohon/Week-4_class | zadach_17.cpp | #include <iostream>
#include <iomanip>
using namespace std;
class CMountain
{
char *name; // імя
float height; // висота
public:
char *Getname() {return name;}
float & GetHigh() {return height;}
CMountain(int ); // Конструктор
void Show(); // Вивід інформациї н... | TOOL | 0.994739 | 3.891682 |
d0479f75-dbbd-4fa6-a4e8-0233aa7289c7 | jsj2008/kdegames | kpat/patsolve/mod3solver.cpp | #include "mod3solver.h"
#include "../mod3.h"
#include <KDebug>
#define PRINT 0
#define PRINT2 0
/* These two routines make and unmake moves. */
void Mod3Solver::make_move(MOVE *m)
{
#if PRINT
if ( m->totype == O_Type )
fprintf( stderr, "\nmake move %d from %d out %d (at %d)\n\n", m->card_index, m->from... | ALGO | 0.990191 | 4.461456 |
3c621384-7de2-42f8-ac1b-1038bce0c3ee | nkmashaev/SupersonicFlowSolver | psstLocalTimeCalculation.cpp | #include "psstLocalTimeCalculation.h"
#include "psstFiniteVolumeGrid.h"
#include "psstFiniteVolumeGridTools.h"
#include "psstVariable.h"
#include <vector>
/*
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.988107 | 5.77295 |
ecc2c42b-fc9d-48a5-b980-7f18a760dc10 | apple/llvm-project-v5 | clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp | #include "ReorderFieldsAction.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/Refactoring.h"
#inclu... | TOOL | 0.881138 | 7.774496 |
7ded18b1-7717-4e13-8577-0cf3d61e3f2a | Raj217/Strivers-SDE-Sheet-Challenge | Day 17/9. Tree Traversals.cpp | // https://www.codingninjas.com/studio/problems/981269?topList=striver-sde-sheet-problems&utm_source=striver&utm_medium=website&leftPanelTab=1
#include <bits/stdc++.h>
using namespace std;
template <typename T>
class BinaryTreeNode
{
public:
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
... | ALGO | 0.999941 | 5.593825 |
9edd6714-bfb0-4a26-a9d4-3f1a3099484a | MASHRAFI47/Data-Structures | Practice-Day/01/PP1.cpp | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int value;
Node* next;
Node(int value) {
this->value = value;
this->next = NULL;
}
};
void insert_at_tail(Node* &head, Node* &tail, int value) {
Node* newNode = new Node(value);
if(head == NULL) {
... | ALGO | 0.99932 | 4.617565 |
e119a605-2c12-4f0f-8417-822c24158ee8 | idiotman-2212/BTCodePTITHCM | Cac_bai_toan_chuan_hoa/CPP0332_diaChiEmail-1.cpp | #include<bits/stdc++.h>
using namespace std;
string chuyen(string s){
for(int i=0;i<s.size();i++){
if(s[i]>='A'&&s[i]<='Z') s[i]+=32;
} return s;
}
int main(){
string s;
getline(cin,s);
chuyen(s);
stringstream ss(chuyen(s));
string s1;
stringstream the(chuyen(s));
while(ss>>s1){ }
cout<<s1;
string s2;
... | ALGO | 0.999763 | 3.242284 |
7682f880-f5ae-4c18-97a5-7b961bd55490 | seanlai12/Sort-Comparison-and-Analysis | lab4performance.cpp | /**
@file lab4performance.cpp
This is the main function file for lab4. It will create an array of random
int elements with a constant maximum and size, and will perform each four sorts
to time the difference. The sort methods are iterative merge, recursive merge,
heap, and quick.
@author Sean Lai
@author Sai B... | ALGO | 0.996479 | 5.141128 |
d0d20d03-84fa-4759-bf3a-651160d27cf6 | aRandomPPPPPerson/IterativeSearch | IterativeSearch/State.cpp | #include "State.h"
#include <nmmintrin.h>
#include "w16v.h"
#include <iomanip>
State::State(int sn) :_u8_num(sn), _u128_vec(((_u8_num - 1) >> 4) + 1,_mm_setzero_si128()) {}
State::State(const vector<WordType>& s) :_u8_num(s.size()), _u128_vec(((_u8_num - 1) >> 4) + 1, _mm_setzero_si128()) {
for (int i = 0; i < _u8_nu... | TOOL | 0.963052 | 4.302783 |
0ede5560-4ec7-4cff-a099-82e1326acba3 | lugnitdgp/codecracker_sharif | assignments/assignment_8/p2/oblivions/submission_6.cpp | /* TEAM : OBLIVION
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef __linux__
#define LLD "%lld"
#define _get getchar_unlocked
#else
#define LLD "%I64d"
#endif
#define P(n) printf("%d",n)
#define SL(n) scanf(LLD,&(n))
#define PL(n) printf(LLD,n)
#define SD(n) scanf("%lf",&n)
#define SS(n) scanf("%s",n)
#defin... | ALGO | 0.998059 | 4.403471 |
bae70d08-f680-499d-bfc0-f269742988f5 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J01907/poker/poker.cpp | #include <iostream>
using namespace std;
const int N=114;
int d[N],c[N],h[N],s[N];
int ans=52;
int main()
{
freopen("poker.in","r",stdin);
freopen("poker.out","w",stdout);
int n,num;
cin>>n;
for (int i=0;i<n;i++)
{
char a,b;
cin>>a>>b;
if (b<='9'&&b>='0') num=b-'0';
if (b=='A') num=1;
if (b=='T') ... | ALGO | 0.994321 | 3.270694 |
499a6a98-dadf-4ca6-b4fe-dfd2fab18480 | baohaopoo/Algorithm | 직사각형별찍기.cpp | #include <iostream>
using namespace std;
int main(void) {
int a;
int b;
cin >> a >> b;
for (int i = 0; i < a * b; ++i)
{
if (i != 0 && i % a == 0)
cout << endl;
cout << "*";
}
return 0;
} | ALGO | 0.999657 | 3.636385 |
d4f7127b-2424-4b95-bbae-6150699cec47 | Mohit21251139/stiver_sde_sheet | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divamazon-divdiv-classcompanytagscontainer-tagoccurence7-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgba0-1... | /**
* 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) {
if (head == NULL || head-> next == NULL)return NULL;
ListNode* slow= head;
L... | ALGO | 0.999926 | 5.272661 |
c9b4f8ec-266c-4a13-ba8b-e531486ff41f | sust18023/ACM | KuangBin/专题四 最短路练习(AK)/Currency Exchange.cpp | /*
Currency Exchange
POJ - 1860
https://cn.vjudge.net/problem/POJ-1860
题意: 兑换货币
每个地方倒每个地方的兑换汇率和佣金都不一样
他要是回到出发点时自己的钱增加了,就输出YES否NO
输入:
第一行是 : 点个数,边个数,出发点,开始的钱
下面m行是 : 从u->v u->v的汇率 u->v的佣金 v->u的汇率 v->u的佣金
样例输入:
3 2 1 20.0
1 2 1.00 1.00 1.00 1.00
2 3 1.10 1.00 1.10 1.00
样例输出:
... | ALGO | 0.99988 | 3.186495 |
e93b16cb-7c0a-4181-aa66-d263af6483a0 | hoanxuanbach/Competitive-Programming | OI/IOI/2024/treasure.cpp | #include "treasure.h"
#include<bits/stdc++.h>
using namespace std;
const int S = 5e8+1;
std::vector<int> encode(std::vector<std::pair<int, int>> P) {
int N=(int)P.size();
vector<int> res,com;
for(int i=0;i<N;i++){
res.push_back(P[i].first);
res.push_back(S+P[i].second);
com.push_bac... | ALGO | 0.999718 | 3.557846 |
13760650-44c1-499a-83b9-f7f3e2333ab2 | atanughosh01/Leetcode-grinder | 0389-find-the-difference/0389-find-the-difference.cpp | class Solution_1 {
public:
char findTheDifference(string &s, string &t) {
int n = s.size();
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < n; ++i) {
if (s[i] != t[i]) {
return t[i];
}
}
return t[n];
... | ALGO | 0.999924 | 6.45691 |
80b72b1d-3458-4614-b2a3-1fc5f645bb26 | smy999/practice_algorithm | baekjoon/For문/2438_별찍기_1.cpp | #include <iostream>
using namespace std;
int main() {
/* #2438*/
int N;
cin >> N;
for (int i = 0; i < N; i++) {
for (int j = 0; j <= i; j++) {
cout << "*";
}
cout << "\n";
}
}
| ALGO | 0.999943 | 3.78852 |
d70dbf49-5c46-4006-87d5-d10dfc6a91ce | tczz88888/algorithm | cf/div2/div3/1016/F.cpp | #include "bits/stdc++.h"
#include <cstring>
using namespace std;
#define ll long long
const int maxn=505;
string s[maxn];
string p[maxn][maxn];
bool gao[maxn];
int tms[maxn];
bool ism[maxn][maxn];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
memset(ism, 0, size... | ALGO | 0.999938 | 3.708828 |
5c51b05a-5e03-48bb-8270-dd99609dd27c | sagarkumar1302/Leet-Code | 2068-check-whether-two-strings-are-almost-equivalent/2068-check-whether-two-strings-are-almost-equivalent.cpp | class Solution {
public:
bool checkAlmostEquivalent(string word1, string word2) {
for(int i=0;i<26;i++){
int cnt=count(word1.begin(),word1.end(),'a'+i);
int dt=count(word2.begin(),word2.end(),'a'+i);
if(abs(cnt-dt)>3)return false;
}
return true;
}
}; | ALGO | 0.999814 | 5.677706 |
8d9d54b7-2279-446f-88b0-cdf6bc74e330 | Ace-Lite/Prototype-Engine | src/ease.cpp | #include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>
float lerp(float t, float start, float end) {
return start + (end - start) * t;
}
// Referenced https://easings.net/#
// Some of the code here is rewrite from my lua script libraries
class Ease {
public:
//
// BASIC
//
float linear(float t, floa... | ALGO | 0.998834 | 6.01292 |
b6726128-361f-4ed0-a59a-ffbbe289700d | ishandutta2007/codeforces | mengbierr/normal/842/B.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int read()
{
char ch=getchar();int f=0;
while(ch<'0'||ch>'9') ch=getchar();
while(ch>='0'&&ch<='9') {f=f*10+(ch^48);ch=getchar();}
return f;
}
int d,R;
int main()
{
int n,ans=0;
d=read(),R=d-read();
n=r... | ALGO | 0.9995 | 3.710975 |
b6bc6a7f-f36e-4cbb-8a65-3a1fd6fe8dd4 | alemuntoni/meshlab-external-libraries | downloads/boost_1_87_0/libs/parameter/test/literate/predicate-requirements0.cpp |
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME((_graph, graphs) graph)
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
BOOST_PARAMETER_NAME((_root_vertex, graphs) in(root_vertex))
BOOST_PARAMETER_NAME((_index_map, graphs) in(index_map))
BOOST_PARAMETER_NAME((_color_map, graphs) in_out(color_map))
#include <boo... | ALGO | 0.992675 | 6.54924 |
a8d6827a-c92e-49b7-8fd1-be4df07ee577 | linuxmint17/TheCompleteRefercnce | 18Template/overloadswaptemplate.cpp | #include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<new>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;
//even though a generic function overloads itself as needed
//you can explicitly overload one,too. This is formally called explicit
// specializa... | ALGO | 0.956099 | 4.930204 |
71dd4059-0485-4765-bef3-014ddf73bdd5 | smshaqib/Coding_Concept | Random.cpp | #include<iostream> //0 1 Knapsack
using namespace std;
int knapsack(int W, int wt[], int val[], int n) {
int i, w;
int knap[n+1][W+1];
for (i = 0; i <= n; i++) {
for (w = 0; w <= W; w++) {
if (i==0 || w==0)
knap[i][w] = 0;
else if (wt[i-1] <= w)
knap[i][w] = ma... | ALGO | 0.999681 | 3.403117 |
a86ad5ad-5263-4d11-9f19-43dc5da31231 | raomilind04/cf | A_Cover_in_Water.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
string s;
cin >> s;
int count = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '.') {
count++;
}
}... | ALGO | 0.999153 | 3.632905 |
35d071db-b1e9-4017-9979-796637d0ce76 | Piyushhh786/DSA_with_CPP | binarySearch/firstoccurance.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){//imp
int arr[]={1,2,2,2,2,3,3,3,3,3,3,4,4,5,5,6,6,6,6};
int n=sizeof(arr)/4;
int idx,target =1;
int low=0,high=n-1,mid;
bool flag = false;
while(low<=high){
mid=(low + high)/2;
if(arr[mid]==target){
... | ALGO | 0.999892 | 4.07739 |
2b6a77fc-b2d4-4e82-b5be-bf8ee4e6261b | hero-007/Algorithm-And-Data-Structures-Implementation | GFG/MustDoQuestionsTrack/Tree/checkBSTefficient.cpp | bool checkBST(Node* root,int maxLimit,int minLimit)
{
if(root == NULL)
return true;
if(root->data > maxLimit || root->data < minLimit)
return false;
bool leftTree = checkBST(root->left,root->data - 1,minLimit);
bool rightTree = checkBST(root->right,maxLimit,root->data - 1);... | ALGO | 0.999814 | 5.290978 |
dbe0aad5-0dc9-4a55-a02c-45ff6ec06013 | JosepHyv/Contest-Archive | omegaup/matartiempo/entreconjuntos.cpp | #include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long int ll;
constexpr int MAXN = 1e6+2;
constexpr int inf = 2e9;
// void solve() {}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL... | ALGO | 0.999988 | 3.029656 |
2a297d61-d135-415e-bdc3-0d9ed450bfb4 | sanyam-taneja/frameworks_av | media/libstagefright/codecs/amrwb/src/normalize_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: normalize_amr_wb.cpp
Date: 12/10/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.998212 | 5.778057 |
810a0ac2-23fc-4388-92b1-f1438b11cdbe | PranjalTheCoder/TLE_SHEET | 800/q25.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
int n;
cin >> n;
string s;
cin >> s;
int i=0, j=n-1;
// string str = "";
while(true){
if((s[i] == '0' && s[j] == '1') || (s[i] == '1' && s[j] == '0')){
i++;
j--;
}
... | ALGO | 0.999912 | 4.338734 |
c1dbb7ab-d022-4fc0-9d08-05abb795b02a | bartvbl/Shapebench | lib/CGAL-5.6.1/examples/Polygon_mesh_processing/isotropic_remeshing_of_patch_example.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/remesh.h>
#include <CGAL/Polygon_mesh_processing/border.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <boost/iterator/function_output_iterator.hpp>
#include... | ALGO | 0.87234 | 5.824985 |
053eb1f7-f236-461e-a296-266b845564fc | rishikeshan007/DSA-preparation-codings | Basic programs/pattern2.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
cout<<"*"<<" ";
}
cout<<endl;
}
}
| ALGO | 0.999667 | 3.599024 |
715f9ae8-0145-4077-9910-3a3a7edb063f | menyf/Code-Snippet | Leetcode/Valid_Parentheses.cpp | #include <unordered_map>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <iosfwd>
#include <deque>
#include <algorithm>
#define debug(x) cout<<"Debu... | ALGO | 0.999886 | 5.638709 |
7a918a62-fd96-4181-91f8-f8dc2a0bd851 | CryptoForge/zcash-patched-for-explorer | src/snark/libsnark/algebra/curves/alt_bn128/alt_bn128_g2.cpp | /** @file
*****************************************************************************
* @author This file is part of libsnark, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
********************************************************************... | TOOL | 0.880435 | 7.217737 |
bba1ebab-3732-427c-b4b0-afb8abc87712 | wuyinjun-1993/concept_based_retrieval | Dessert-main-v4/deps/eigen/bench/benchmarkSlice.cpp | // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 10000
#endif
#ifndef SCALAR
#define SCALAR float
#endif
int main(int argc, char *argv[])
{
typedef Matrix<SCALAR, Eigen::Dynam... | TOOL | 0.906423 | 3.688043 |
9bfef607-b1b8-4cee-9ad1-07c159e75525 | qk12/Contest | SHU Summer Newbie Contest/3/E-秦神的签到题.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 10;
int pos[maxn];
int main()
{
int n, x;
scanf... | ALGO | 0.999973 | 3.997444 |
1427cf4a-fd79-4392-8097-4fd9031faf69 | aeum1016/miscPrograms | src/UFPTPractice/problem_types/adhoc/glitchbot.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int x = 0, y = 0;
int dX, dY;
scanf("%d %d\n", &dX, &dY);
int q; scanf("%d\n", &q);
vector<int> inst;
while(q--)
{
string a; cin >> a;
if(a == "Forward")
{
inst.push_back(0);
... | ALGO | 0.999987 | 3.299279 |
d7510c14-5580-4ddc-9ad8-1deb9a66910f | IMWYY/algorithmING | leetCode/string/Problem091.cpp | #include <vector>
#include <string>
// dynamic programming
int numDecodings(std::string s) {
int n = s.size();
std::vector<int> dp(n + 1);
dp[n] = 1;
for (int i = n - 1; i >= 0; i--) {
if (s[i] == '0')
dp[i] = 0;
else {
dp[i] = dp[i + 1];
if (i < n - 1 && (s[i] == '1' || s[i] == '2' &... | ALGO | 0.999674 | 5.971351 |
5431f1b6-7be7-418f-a0aa-f71b3f52a25a | danieltlachy/Ejercicios_Introduccion_Programacion | calculo_promedio.cpp | #include <iostream>
using namespace std;
void LlenadoDeVectores(int [], int);
float CalcularPromedio(int [], int);
void MostrarNumerosArribaDelPromedio(int [], float, int);
int main(){
int numeros[5];
const int LONGITUD_DEL_VECTOR = 5;
float promedio;
cout<<"Dame 5 numeros enteros"<<endl;
LlenadoDeVectores(numer... | ALGO | 0.998329 | 3.454583 |
867d5180-85cc-4890-a80e-f7fcb6227d04 | Dai-Wenxun/Algorithm-Adventure | 图/261. 以图判树.cpp | class UF {
public:
vector<int> fa;
vector<int> size;
int count;
UF(int n) {
count = n;
fa.resize(n, 0);
size.resize(n, 1);
for (int i = 0; i < n; ++i)
fa[i] = i;
}
int find(int p) {
while (fa[p] != p) {
fa[p] = fa[fa[p]];
p = fa[p];
}
return p;
}
bool isconnect(int p, int q) {
retur... | ALGO | 0.999942 | 5.710281 |
38e8cfb4-b9c2-4c25-9e8b-6b29e81245e1 | mabarrera4/UVa-Online-Judge-Solutions | 12278.cpp | /*
* 12278. Three-Sided Dice
* TOPIC: geometry, probability, vector calculus
* status: Accepted
*/
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#define DIM 3
#define tol 1e-9
using namespace std;
const long double pi = 2*acos(0.00... | ALGO | 0.999517 | 3.785249 |
5fbe50f3-0fbf-47f5-bccf-517edf855b50 | vincentjordan27/CP | C++/gunung.cpp | #include<iostream>
using namespace std;
int main()
{
int n,up,even=2;
cin >> n;
int down = n;
for(int i=1; i<=n*(n-1)+1; i++)
{
if(i%2 == 1)
cout << "*\n";
else if(even != n+1)
{
for(int j=0; j<even; j++)
cout << "*";
even... | ALGO | 0.999961 | 3.32766 |
5e74bd03-3a1f-41f7-b726-f29fca0258fa | Rampeddireddi/leetcode | 2571-find-the-pivot-integer/find-the-pivot-integer.cpp | class Solution {
public:
int pivotInteger(int n) {
int fsum=0;
int bsum=0;
for(int i=n;i>=1;i--){
fsum+=i;
bsum=(i*(i+1))/2;
if(fsum==bsum)return i;
}
return -1;
}
}; | ALGO | 0.99994 | 5.816855 |
6c607796-e581-4e33-9e5e-ebf49c488788 | danujamark/post-method | 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 |
b941c632-1eed-4aff-8c52-41349b195e38 | XuHQ1997/code_notes | bisearch.cpp | #include <iostream>
#include <algorithm>
#include <random>
#include <ctime>
#include <vector>
#include <cassert>
using namespace std;
int find(const vector<int>& nums, int target) {
int left = 0;
int right = nums.size();
while(left < right) {
int mid = left + (right - left) / 2;
if(nums[m... | TEST | 0.99329 | 5.750931 |
5a11d599-cfd3-4642-b09f-6632f8cd671e | Reyn-Mukai/Leet-Code | C++/Fizz-Buzz.cpp | class Solution {
public:
vector<string> fizzBuzz(int n) {
vector<string> s;
for(int i=1;i<=n;i++){
if(i%3==0&&i%5==0){
s.push_back("FizzBuzz");
}
else if(i%3==0){
s.push_back("Fizz");
}
else if(i%5==0){
... | ALGO | 0.999725 | 6.737041 |
b1750948-d2a5-41b6-a237-5738865b7def | BakirK/etf-alles | II semester/programming-techniques/labovi/T4/Z4/main.cpp | /* TP 2016/2017 (Tutorijal 4, Zadatak 4)
Autotestovi by Eldar Kurtic, sva pitanja, sugestije i prijave gresaka javite na
mail <EMAIL>
NAPOMENA: testovi ce biti konacni TEK pred pocetak tutorijala. Zbog toga pokrenite
testove za SVE zadatke na tutorijalu, da se ne bi desila situacija da neko uradi
z... | ALGO | 0.993046 | 4.46959 |
9d0caa6a-d8e1-4648-92fc-39e8df545001 | yuhwanwoo/cpp_review | bark/0x06/queue.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX=1000005;
int dat[MX];
int head=0, tail=0;
void push(int x){
dat[tail++]=x;
}
void pop(){
head++;
}
int front(){
return dat[head];
}
int back(){
return dat[tail-1];
}
void test(){
}
int main(){
test();
} | ALGO | 0.870035 | 3.25763 |
8019d986-386b-4d3a-9ae0-b50f8ee8f941 | GreengageDB/greengage | src/backend/gporca/libgpopt/src/xforms/CXformSimplifySubquery.cpp | #include "gpopt/xforms/CXformSimplifySubquery.h"
#include "gpos/base.h"
#include "gpopt/operators/CExpressionHandle.h"
#include "gpopt/operators/CNormalizer.h"
#include "gpopt/operators/COperator.h"
#include "gpopt/xforms/CXformUtils.h"
#include "naucrates/md/IMDScalarOp.h"
using namespace gpmd;
using namespace gpop... | TOOL | 0.973819 | 4.658355 |
13f4a2a7-c2e1-49ef-9776-802b4844c3fd | hardeepsingh34/CPlusPluscodes | program35.cpp | #include<iostream>
using namespace std;
int main(){
// fibonacci series
int a =0;
int b =1;
int n,c;
cout<<"enter a number"<<endl;
cin>>n;
cout<<" "<<a<<" "<<b<<" ";
for(int i=2; i<n; i++){
c= a+b;
a=b;
b=c;
cout<<" "<<c<<" ";
}
} | ALGO | 0.999963 | 3.46915 |
628ea13d-cbed-4b1a-854e-1026aacd9dea | morris821028/UVa | OnlineJudge/ZEROJUDGE/b147. NOIP2004 2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, K;
while (scanf("%d %d %d", &N, &M, &K) == 3) {
pair<int, int> A[505];
int has[505] = {}, x;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= M; j++) {
scanf("%d", &x);
A[x] = make_pair(i, j), has[x] = 1;
}
}
int px = ... | ALGO | 0.999937 | 3.788528 |
c8ba4ea6-cff7-4cf3-bb82-a6d94c1b4598 | liuguojun/OnlineJudge | POJ/2377/2965896_AC_61MS_372K.cpp | #include<iostream>
#include<stdio.h>
struct node{
int from;
int to;
int value;
}point[20001];
int cmp(const void*i,const void*j)
{
node*p=(node*)i;
node*q=(node*)j;
return q->value-p->value;
}
void main()
{
int N,M,i,k,tag[1001]={0},num=0,sum=0;
scanf("%d%d",&N,&M);
for(i=0;i<M;i++)
scanf("%d%d%d",&point[i... | ALGO | 0.99998 | 3.647685 |
b49e4353-d350-41d6-9d0f-980822cff191 | drjrkuhn/angora | src/nffft/td/Ctr_td_fs_pp.cpp | //Defines the post-processing steps in the TIME_DOMAIN near-field-to-far-field transformer object "Ctr_td_fs" in free space
#include "headers.h"
#include "Ctr_td_fs.h"
void Ctr_td_fs::ConstructFarField()
{
}
double Ctr_td_fs::TheoreticalFarFieldTheta(const int& n)
//Theoretical theta-component of the radiated E-fie... | ALGO | 0.983948 | 4.826276 |
54b3f9b8-8391-4bf3-9276-43c2d772cc97 | dvtdat/cp | codeforces/1954B.cpp | // fear of missing out?
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef long long ll;
typedef long double ld;
const ll infLL = 2e18 + 7;
const int inf = 2e9 + 7;
const int maxN = 200010;
const ll MOD = 998244353;
const double eps = 1e-12;
const int LIM = ... | ALGO | 0.999589 | 4.611064 |
72720a6f-0374-44a3-a62d-594785af6313 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3688_3.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, d[120], a, b, ans = 0;
cin >> n;
for (int i = 1; i <= n - 1; i++) {
cin >> d[i];
}
cin >> a >> b;
for (int i = a; i <= b - 1; i++) {
ans += d[i];
}
cout << ans;
return 0;
}
| ALGO | 0.999764 | 3.331994 |
bbd6f4be-ca44-47e5-b5dc-940dde53569a | ebeyabraham/Codeforces-Problemset-Solutions | Cpp/50A.cpp | /*
* Link to the question:
* http://codeforces.com/problemset/problem/50/A
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int INT;
int main()
{
int m,n;
cin>>m>>n;
int ans=m*n/2;
cout<<ans;
return 0;
}
| ALGO | 0.999417 | 3.423209 |
ee813b4e-2e60-4e43-b372-792516d72fe0 | heedong801/C- | 09extra/ShallowCopyError.cpp | #include <iostream>
#include <cstring>
using namespace std;
class Person
{
char * name;
int age;
public:
Person(char * myname, int myage)
{
int len=strlen(myname)+1;
name=new char[len];
strcpy(name, myname);
age=myage;
}
/*Person(const Person& copy): name(copy.name), age(copy.age)
{ }*/
Person(const Pe... | TOOL | 0.885995 | 4.033617 |
b7260082-c648-45da-92f1-afe9f7543059 | raincross7/code-similarity | codes/train_code/problem098/problem098_382.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
//????¬???¬??¢?????°???
int getint(char ch) {
if (ch == 'A') return 1;
else if (ch == 'C') return 2;
else if (ch == 'G') return 3;
else if (ch == 'T') return 4;
else return 0;
}
//?°?????¬????... | ALGO | 0.999871 | 4.125831 |
ad788887-3249-4ee3-86e3-280dad9c800b | subratamondalnsec/Pw-cpp-code | 11recursion/class/29k-thSymbolinGrammar_leet-779.cpp | /*leet -779*/
#include <bits/stdc++.h>
using namespace std;
int kthGrammar(int n,int k){
if(n==1) return 0;
if(k%2==0){//flip , even ,k/2
int prevans =kthGrammar(n-1,k/2);
if(prevans==0) return 1;
else return 0;
}
else{//same , odd ,k/2+1
... | ALGO | 0.999981 | 4.829493 |
f7d9de82-40dc-4741-8138-3dd2900ee52b | zhangwj0101/codestudy | algorithm/HDU-ACM/HDU_ACM_C++/2041.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: devil_momo
////Nickname: Lucifer
////Run ID:
////Submit time: 2008-06-06 01:09:33
////Compiler: Visual C++
///////... | ALGO | 0.99997 | 3.266041 |
70840f16-9e24-4f0f-925b-67811b5f6b47 | GonoBae/CodingTestStudy | GonoBae/Programmers_Level_2/2022-10-21-Level2_Truck.cpp | #include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
// 첫 번째 풀이
int solution(int bridge_length, int weight, vector<int> truck_weights) {
int answer = 0;
int curTotalWeight = 0;
// 트럭 무게, 트럭이 다리에 진입하는 시간
queue<pair<int, int>> Q;
for(int i = 0; i < truck_weig... | ALGO | 0.999744 | 5.973978 |
fa9db5d1-b01b-4cc7-b9d2-397e2c59683c | thegamer1907/Code_Analysis | Codes/AC/3753.cpp | #include<iostream>
#include<cstring>
#include<climits>
#include<map>
#include<vector>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<numeric>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<unordered_map>
using namespace std;
#d... | ALGO | 0.999789 | 3.328528 |
ee8f2d8b-a2e9-4bd1-80e5-432d5309a21a | CaptNikh/CP-Problems | CODEFORCES/PRACTICE/CF1561A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
int res = 0;
while (!is_sorted(arr.begin(), arr.end... | ALGO | 0.999934 | 4.330868 |
d9319963-229c-43b2-8eff-8e7e9133e000 | cazzwastaken/kakhack | cheat/core/functions/listleavesinbox.cpp | #include "../hooks.h"
#include <intrin.h>
int __stdcall h::ListLeavesInBox(const Vector& mins, const Vector& maxs, unsigned short* list, int listMax)
{
static const auto insertIntoTree = reinterpret_cast<std::uintptr_t>(m::sigs.insertIntoTree);
if (reinterpret_cast<std::uintptr_t>(_ReturnAddress()) != insertIntoTr... | TOOL | 0.911003 | 6.14426 |
f0fc035b-6038-4516-9146-972c7830e9c6 | ishandutta2007/codeforces | aryanc403/normal/1101/G.cpp | // Neal submission - https://codeforces.com/contest/1101/submission/48312743
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> basis;
int everything = 0;
for (int i = 0; i < N; i++) {
int a;
... | ALGO | 0.999831 | 4.401041 |
518a4402-116f-4a6b-ade0-a93b24811e0d | fsy-juruo/noip-2021-js-answer | t2021/JS-0013/variance/variance.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define fill0(a) memset(a, 0, sizeof(a))
#define fill1(a) memset(a, -1, sizeof(a))
#define fillbig(a) memset(a, 63, sizeof(a))
#define mp make_pair
#define pb push_back
#define ppb pop_back
template<typename T1, typename T2> void chkmin(T1... | ALGO | 0.999956 | 3.618644 |
ff818c6e-fc99-4be5-90e4-e6e46920ea6a | NE-Practicals-2025/dsa-past-corrections | 2023-reference-work/structures_concept/multiple.cpp | #include <iostream>
using namespace std;
class Student
{
public:
int id;
int age;
string name;
Student *next;
Student(int id, int age, string name)
{
this->id = id;
this->age = age;
this->name = name;
next = NULL;
}
};
Student *head = NULL;
// Here changes to ... | ALGO | 0.995485 | 4.849712 |
ccdb17ec-d992-466b-89d9-e164020862bd | elli0t43/Nand2Tetris | Project6-Assembler/src/main.cpp | #include <cstdlib>
#include <iostream>
#include <algorithm>
#include <regex>
#include <unordered_map>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <cctype>
#include "colors.h"
#include "instrumenter.h"
struct symbolTableRecord{
std::string symbolName;
int address;
std... | TOOL | 0.921742 | 4.251739 |
99e436d4-f177-4e9a-a981-03dbc1125c64 | lijwen2748/aaltaf | main.cpp | #include "formula/aalta_formula.h"
#include "ltlfchecker.h"
#include "carchecker.h"
#include "solver.h"
#include <stdio.h>
#include <string.h>
#define MAXN 100000
char in[MAXN];
using namespace aalta;
void
print_help ()
{
cout << "usage: ./aalta_f [-e|-v|-blsc|-t|-h] [\"formula\"]" << endl;
cout << "\t -e\t:\t pr... | ALGO | 0.996524 | 4.444745 |
5cc87f63-a8d7-4037-a04b-682e63c67d71 | tasumath/rule_code_solution | 058a.cpp | #include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<map>
#include<string>
#include<set>
#include<queue>
using namespace std;
int main(){
int a,b,c; cin>>a>>b>>c;
if((a+c)==2*b) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} | ALGO | 0.999916 | 3.707892 |
5df139a4-d15b-4291-b50c-b8f28cb63fb2 | AbhilashBhargava36/APS-100_Code_Library | Handout.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int num[1000];
int n,i,j,k,temp,c=0;
cout<<"Enter number\n";
cin>>n;
cout<<"enter elements\n";
for(i=0;i<n;i++)
cin>>num[i];
cout<<"Permutations are\n";
for(j=1;j<=n;j++)
{
for(i=0;i<n-1;i++)
{
temp=num[i];
num[i]=num[i+1];
num[i+1]=temp;
for(k=0;k<n;k++)
cout<... | ALGO | 0.999865 | 3.861121 |
4045b193-f003-4a6c-92c1-b45aca455846 | ishandutta2007/codeforces | dreamoon_love_aa/normal/788/C.cpp | #include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y... | ALGO | 0.99991 | 3.324814 |
75655a2e-77fb-4049-8138-6f7f22edf287 | rickors560/LeetCode | TheSkylineProblem.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<vector<int>> getSkyline(vector<vector<int>> &buildings)
{
vector<pair<int, int>> heights;
for (auto building : buildings)
{
heights.push_back({building[0], -building[2]}); // Start of building
... | ALGO | 0.999962 | 5.906436 |
ca391f69-a1c6-42e8-bbf3-a21421241219 | ccw2010/lc | 138. Copy List with Random Pointer.cpp | /* 138. Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could
point to any node in the list or null.
Return a deep copy of the list.
*/
/**
* Definition for singly-linked list with a random pointer.
* struct RandomListNode {
* int label;
... | ALGO | 0.999859 | 4.77678 |
e58d2ec1-5534-4f35-bf3c-5f620675de05 | udacity/nd013-c6-control-starter | project/pid_controller/eigen-3.3.7/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp | ArrayXXf table(10, 4);
table.col(0) = ArrayXf::LinSpaced(10, 0, 90);
table.col(1) = M_PI / 180 * table.col(0);
table.col(2) = table.col(1).sin();
table.col(3) = table.col(1).cos();
std::cout << " Degrees Radians Sine Cosine\n";
std::cout << table << std::endl;
| ALGO | 0.932825 | 3.543272 |
fe1e4881-1de4-44c4-aaf4-0fac33c992ac | AbhinavTiwari2705/Leetcode | 563. Binary Tree Tilt.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999976 | 6.598002 |
0151d082-37b0-46c4-9497-487d558574ad | nthu-pllab/llvm9-project-rvp | llvm/lib/CodeGen/ImplicitNullChecks.cpp | #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/CodeGen/FaultMaps.h"
#include "llvm... | ALGO | 0.930919 | 7.984231 |
80811fc9-b1ef-4e4c-b3be-35a653d21e95 | ishandutta2007/codeforces | avinashkartik/normal/1633/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define GODSPEED ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define f first
#define s second
#define newl cout<<"\n";
#define pb push_back
#define mset(a,x) memset(a,x... | ALGO | 0.999772 | 3.379242 |
c934cfd3-d8dc-45d8-8aaf-bfd9c6168781 | Y3U18/ollvm-poject | clang/lib/Driver/SanitizerArgs.cpp | using namespace clang;
using namespace clang::driver;
using namespace llvm::opt;
static const SanitizerMask NeedsUbsanRt =
SanitizerKind::Undefined | SanitizerKind::Integer |
SanitizerKind::ImplicitConversion | SanitizerKind::Nullability |
SanitizerKind::CFI | SanitizerKind::FloatDivideByZero |
Sanitiz... | TOOL | 0.861167 | 7.714489 |
6fb63ff1-00d0-4182-8e55-3c7ee7226c20 | graindb/graindb | third_party/tpce-tool/main/EGenValidate.cpp | /*
* - 0.3 - Tue Oct 3 23:39:48 CDT 2006
* Extracted BucketSimulator class
* Extracted string parsing and format functions
* Re-vamped to use new threading
*
* - 0.2 - Mon Sep 11 09:06:35 CDT 2006
* Incorporated Matthew Emmerton's suggestions:
* Fixed calculation of simorders... | TOOL | 0.878276 | 6.173092 |
87bd4ed2-8764-4241-b618-151a9342c595 | sanskarrd/450DSA | Reverse a Doubly Linked List - GFG/reverse-a-doubly-linked-list.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node * next;
Node * prev;
Node (int x)
{
data=x;
next=NULL;
prev=NULL;
}
};
Node *newNode(int data)
{
Node *temp=new Node(data);
... | ALGO | 0.999624 | 5.941074 |
11c4bef0-88bb-458d-83e9-7b481164574f | ishandutta2007/codeforces | dlalswp25/normal/1270/B.cpp | #include <bits/stdc++.h>
using namespace std;
int A[202020];
int main() {
int T; scanf("%d", &T);
while(T--) {
int N; scanf("%d", &N);
for(int i = 1; i <= N; i++) scanf("%d", &A[i]);
bool ok = false;
for(int i = 2; i <= N; i++) {
if(abs(A[i] - A[i - 1]) > 1) {
puts("YES");
printf("%d %d\n", i - ... | ALGO | 0.999817 | 3.473613 |
c8442f90-f047-407a-9d41-74105eaebab7 | dev-moonsc/BOJ | Silver/Silver_IV/2839.cpp | /*
Sol 1 : Greedy algorithm (탐욕법)
Sol 2 : Dynamic programming (동적 계획법)
알고리즘 기법 : 정렬 알고리즘, 검색 알고리즘, ...
알고리즘 설계 기법 : 분할 정복, 동적 계획법, 탐욕법, 백트래킹, ...
탐욕법과 동적 계획법은 "알고리즘 설계 기법"에 해당
탐욕법 : 매 단계에서 가장 최적이라고 생각되는 선택을 하는 방식
- 국소 최적 선택(Local Optimal Choice)
- 빠르고 간단
- 최적해를 보장하지는 않는다
동적 계획법 : 문제를 작은 부분 문제로 나누어 푸는 방식
- 재귀적 관계(점화... | ALGO | 0.999952 | 5.165236 |
88c6b674-484b-41bc-bbf1-d5909178c845 | briansenas/Local-Search-Classification-Problem | tools/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = (m.array() + 4).matrix() * m;
cout << "-- Combination 1: --" << endl << result << endl << e... | ALGO | 0.999502 | 4.531452 |
cf076e46-2f14-4596-a63c-93c15228692b | AnanthaLakshmi24/cpp-c- | INTRDSGN.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
while(t--){
int a,b,c,d;
cin >> a >> b >> c >> d;
int x= a+b;
int y=c+d;
if (x>=y){
cout << y << endl;
}
else{
cout << x << endl;
}
}
}
| ALGO | 0.999817 | 3.874545 |
74cc5dfe-6745-40c8-b7ca-1e41ea93a175 | anilpiparaiya/DSA-IN-C-plusplus | Linked List/Medium/Merge 2 sorted linked list in reverse order.cpp | /*
The structure of linked list is the following
struct Node
{
int data;
Node* next;
};
*/
class Solution
{
public:
Node* solve( Node* first, Node* second ) {
// If only one element present in first Linked list
if( first -> next == NULL ) {
first -> next = ... | ALGO | 0.999998 | 5.367677 |
792e461d-7793-4433-9724-974f066807c2 | akshaydhule/Codes | Data-Structures/String-Manipulations/stringmatch.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
bool stringmatch(string *s1, string *s2)
{
std::unordered_map<char, int> map;
std::unordered_map<char, int>::iterator it;
if(s1.length()!=s2->length())
return false;
for(int i=0;i<s1->length();i++)
{
if(map.find(s1[i])!=map.end())
{
it = m... | ALGO | 0.999533 | 4.256054 |
9f4e2e58-b236-4df2-b8e4-65b5814bb616 | Reaziii/Online_Judge_Problem_Solve | projecteuler/4.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
bool sol(long ans){
ll result = 0;
ll memory = ans;
while( ans!= 0 ){
ll x = ans%10;
result = result*10+x;
ans/=10;
}
if(memory==result) return true;
return false;
}
int main(){
long x ... | ALGO | 0.999754 | 3.999603 |
8daf6718-b34a-485b-b46c-51452c2c29c8 | RahulRajGiri15/Competitive-Programming | GFG/POTD/MAY/N/Insert in Sorted Circular Linked List.cpp | //////////Insert in Sorted Circular Linked List
////////https://www.geeksforgeeks.org/problems/sorted-insert-for-circular-linked-list/1
class Solution {
public:
Node* sortedInsert(Node* head, int data) {
//CodeGenius
Node *NN=new Node(data),*temp=head;
//case 1;
if(head-... | ALGO | 0.999928 | 5.546516 |
dba99213-6911-4434-90d5-9c93a83fbad7 | AryanSharma47/leetcode-solutions | 237.DeleteNodeInLinkedList.cpp | //2 Liner Code || Simple Approach || Best Solution
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
node->val=node->next->val;
node... | ALGO | 0.999943 | 5.610424 |
72128bec-fe5e-4661-816d-4c6d5147e1a8 | Llf0703/OI-Template | 树链剖分.cpp | #include<bits/stdc++.h>
using namespace std;
struct Edge{
int next,to;
} edge[200005];
int fa[200005],size[200005],deep[200005],w[200005],wnew[200005],head[200005],son[200005],id[200005],top[200005];
struct Tree{
int left,right,sum,delta;
} tree[800005];
int cnt=1,ans,n,m,a,b,c,d,p,dfsord,root;
inline void add(... | ALGO | 0.999974 | 3.632305 |
ea30c0f2-af95-4196-b3d1-16481f0a9981 | Mayer-Cheung/acm-poj | poj2606.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
double x[205], y[205], d[205];
const int INF = 1 << 30;
int main()
{
int n, i, j, k;
int ans, cnt;
while (scanf("%d", &n) != EOF)
{
ans = 1;
for (i = 0; i < n; i++)
scanf("%lf%lf", &x[i], &y[... | ALGO | 0.99951 | 3.7744 |
e68d7e30-c560-4fbb-b770-9e3d5bbe3623 | carloocchiena/code_bites | c++/c++_leap_year.cpp | #include <iostream>
using namespace std;
int main() {
int year;
cout << "Enter a year: ";
cin >> year;
if (year % 4 == 0) {
if (year % 100 == 0) {
if (year % 400 == 0)
cout << year << " is a leap year.";
else
cout << year << " is not a l... | ALGO | 0.998813 | 3.862665 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.