text
stringlengths
59
71.4k
/// date:2016/3/9 /// engineer: ZhaiShaoMin module d_m_areg(//input clk, rst, d_flits_m, v_d_flits_m, mem_done_access, //output d_m_areg_flits, v_d_m_areg_flits, ...
#include <bits/stdc++.h> using namespace std; long long i, a[200005], n, x = 0; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; a[i] += x; x = max(x, a[i]); } for (i = 0; i < n; i++) cout << a[i] << ; cout << endl; }
#include <bits/stdc++.h> using namespace std; const int N = 100500; using ll = long long; using point = pair<ll, ll>; ll& x(point& p) { return p.first; } ll& y(point& p) { return p.second; } int n; point p[N], p2[N]; set<point> s; point centerN, center2, invP; int no() { cout << NO << endl; ...
#include <bits/stdc++.h> using namespace std; #define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define TEST ll Test ; cin >> Test; while #define TEST2 int Test = 1; while #define READ freopen( input.txt , r , stdin); freopen( output.txt , w ,...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2020 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define CONCAT(a, b) a``b `define STRINGIFY(x) `"x`" module t (/*AUTOARG*/ // Inputs clk ); ...
/* This file is part of JT12. JT12 program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. JT12 program is distributed...
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; struct EDGE { int u, v, l, next; bool train; EDGE() {} EDGE(int a, int b, int c, int d, bool bo) { u = a; v = b; l = c; next = d; train = bo; } } edge[1000000]; int n, m, k; int edgenumber, head[200100], visit[2001...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// // Copyright (C) 2017 Markus Hiienkari <> // // This file is part of Open Source Scan Converter project. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module limbus ( clk_100_clk, reset_100_reset_n, tristate_conduit_bridge_sram_out_sram_tcm_data_out, tristate_conduit_bridge_sram_out_sram_tcm_address_out, tristate_conduit_bridge_sram_out_sram_tcm_outputenable_n_out, tristate_conduit_bridge_sram_out_sram_tcm_chipselect_n_out, tristate_conduit_bridge_sram_out_sr...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:11:08 02/27/2016 // Design Name: Register // Module Name: C:/Users/Ranolazine/Desktop/Lab/lab5/eueau.v // Project Name: lab5 // Target Device: // Too...
/* * .--------------. .----------------. .------------. * | .------------. | .--------------. | .----------. | * | | ____ ____ | | | ____ ____ | | | ______ | | * | ||_ || _|| | ||_ \ / _||...
#include <bits/stdc++.h> using namespace std; int a[200000]; long long INF = 1e12; inline bool comp_bit(int x, int y) { return !!(x & y); } inline int binsearch(int l, int r, int depth) { return (upper_bound(a + l, a + r, 1 << depth, comp_bit) - a); } long long connect(int depth, int l1, int r1, int l...
#include <bits/stdc++.h> using namespace std; int n; double p[110], S = 0, P = 1, ans; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %lf , &p[i]); sort(p + 1, p + n + 1); for (int i = n; i >= 1; i--) if (1.0 - S >= 1e-12) { ans += P * p[i] * (1 - S); S +...
module unified_mem(clk,rst_n,addr,re,we,wdata,rd_data,rdy); ///////////////////////////////////////////////////////////////////// // Unified memory with 4-clock access times for reads & writes. // // Organized as 16384 64-bit words (i.e. same width a cache line // /////////////////////////////////////////////...
// ---------------------------------------------------------------------- // Copyright (c) 2016, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated docum...
#include <bits/stdc++.h> using namespace std; long long num[20]; int cnt; int main() { int n; long long k, x; long long ans = 0LL; scanf( %d , &n); for (int i = 1; i <= n; i++) { cnt = 0; scanf( %I64d%I64d , &x, &k); long long r = x + k - 1LL; long long l = x; w...
#include <bits/stdc++.h> using namespace std; int n, ans; int x[1100000], pw[1100000]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &x[i]); sort(x + 1, x + n + 1); pw[0] = 1; for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * 2 % 1000000007; for (int i = 1; i < n;...
`timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be...
`timescale 1ns / 1ps // To use RESIM // ================================================ // Add this new file module pcie_empty ( input trn_clk, input trn_reset_n, input trn_lnk_up_n, ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; vector<pair<int, int>> a; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; a.push_back({x, i}); } sort(a.begin(), a.end(), greater<pair<int, int>>());...
#include <bits/stdc++.h> using namespace std; struct E { int to, nxt, d; } b[100005 << 1]; int fst[100005], tot; void insert(int f, int t, int d) { b[++tot] = (E){t, fst[f], d}; fst[f] = tot; b[++tot] = (E){f, fst[t], d}; fst[t] = tot; } int in[100005]; int dfn[100005]; int deep[10...
/* * Copyright (c) 2001 Brendan J Simon * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * a...
#include <bits/stdc++.h> using namespace std; pair<long long int, long long int> rec(long long int n) { long long int mini = 1e18, maxi = -1; while (n) { mini = min(mini, n % 10); maxi = max(maxi, n % 10); n /= 10; } return {mini, maxi}; } int main() { long long int t; ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; void subMain() { double a, b; cin >> a >> b; cout << fixed << (b * b - a * a) / (2 * a); } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); subMain(); cerr << Time : << 100...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distribut...
#include <bits/stdc++.h> using namespace std; int main() { int n; long long sum; vector<int> v; ios::sync_with_stdio(0); cin >> n; sum = (1LL + n) * n / 2LL; if (sum % 2LL == 0LL) { sum /= 2LL; for (int i = n; i >= 1; i--) if (sum >= i) { v.push_back(i); ...
#include <bits/stdc++.h> using namespace std; const int dx[4] = {1, 0}; const int dy[4] = {0, 1}; pair<int, vector<vector<int> > > MoveBotsDirs( const vector<vector<int> >& bots_dirs) { map<int, int> xs; map<int, int> ys; for (int i = 0; i < bots_dirs.size(); ++i) { if (bots_dirs[i][2] =...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21.02.2016 16:25:28 // Design Name: // Module Name: SPI // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision:...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int t; cin >> t; bool even; bool odd; for (int i = 1; i <= t; i++) { int size; even = false; odd = false; cin >> size; int arr[size]; for (int j = 0; j < size; j++) cin >> a...
#include <bits/stdc++.h> using namespace std; int main() { long long N, M; cin >> N >> M; set<long long> x_t; set<long long> y_t; vector<long long> ans; for (long long i = 0; i < M; i++) { long long x, y; cin >> x >> y; if (x_t.find(x) == x_t.end()) x_t.insert(x); if ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long a, b; long long f(long long a, long long b) { if (b == 0) return 0; return a / b + f(b, a % b); } int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> a >> b; cout << f(a, b) << endl; }
module cam_allocator (/*AUTOARG*/ // Outputs res_search_out, // Inputs clk, rst, res_search_en, res_search_size, cam_wr_en, cam_wr_addr, cam_wr_data ); parameter CU_ID_WIDTH = 6; parameter NUMBER_CU = 64; parameter RES_ID_WIDTH = 10; parameter NUMBER_RES_SLOTS = 1024; // Search por...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch; for (ch = getchar(); (ch < 0 || ch > 9 ) && ch != - ; ch = getchar()) ; if (ch == - ) f = 0, ch = getchar(); while (ch >= 0 && ch <= 9 ) { x = (x << 1) + (x << 3) + ch - ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e6 + 5; const double delta = 1e-6; const long long mod = 1e9 + 7; struct ev { double coord; int type; int mincost; }; const bool operator<(const ev& f, const ev& s) { return f.coord < s.coord; } void init() {} class fenwick {...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { int x; cin >> x; cout << x - !(x & 1) << ; } }
#include <bits/stdc++.h> using namespace std; int ekub(int a, int b) { return b == 0 ? a : ekub(b, a % b); } long long s[51][51]; int main() { long long i, j, n, m, a, b, ans = 1e9; cin >> n >> m; for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) { cin >> s[i][j]; s[i][j] += s[...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) using namespace std; const int maxn = 3e5 + 5; const int maaxn = 1e7 + 2; const int minn = 22; const long long mod = 1e9 + 7; const long do...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> T pow_mod(T a, U b, int mod) { T r = 1; for (; b > 0; b >>= 1) { if (b & 1) r = (long long)r * a % mod; a = (long long)a * a % mod; } return r; } enum bit_op { AND, OR, XOR }; namespace bitwise_transf...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2012 by Wilson Snyder. //bug456 typedef logic signed [34:0] rc_t; module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0]...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_108x128.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ==========================================...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; long long cnt[1001] = {}; for (long long i = 0; i < n; ++i) { long long x; cin >> x; cnt[x]++; if (cnt[x] > (n + 1) / 2) { ...
//date:2016/3/13 //engineer:ZhaiShaoMin //module name:pipeline register between mem and wb module core_mem_wb(//input clk, rst, regwrite, memtoreg, aluresult, read_memdata, ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: nukeint_mon.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and/o...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; ++i) cout << 1 << ; cout << endl; } }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:40:46 05/12/2015 // Design Name: // Module Name: ID_EX // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
#include <bits/stdc++.h> using namespace std; void init() { ios::sync_with_stdio(0); cin.tie(0); } int main() { init(); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; long long arr[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) {...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_aa // // Generated // by: wig // on: Tue Jul 4 08:39:13 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../verilog.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 6; int ans[N]; int main() { int n, k; scanf( %d %d , &n, &k); if (k == 1 or k * 3 > n) return !printf( -1 n ); for (int x = 1; x <= k; x += 2) { for (int j = 0; j < 6; ++j) { if (j == 0 or j == 1 or j == 3) ...
module stimulus (output reg A, B); initial begin {A, B} = 2'b00; #10 {A, B} = 2'b01; #10 {A, B} = 2'b10; #10 {A, B} = 2'b11; end endmodule module scoreboard (input Y, A, B); function truth_table (input a, b); reg [1:0] gate_operand; reg gate_output; begin gate_operand[1:0] = {a,...
// Copyright (c) 2015 CERN // Maciej Suminski <> // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // any late...
//----------------------------------------------------------------------------- // // Jonathan Westhues, April 2006 //----------------------------------------------------------------------------- module hi_read_rx_xcorr( pck0, ck_1356meg, ck_1356megb, pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4, ...
#include <bits/stdc++.h> int N; int Weight[300005]; long long SubWeight[300005]; std::vector<int> ADC[300005]; inline void AddEdge(int x, int y) { ADC[x].push_back(y); ADC[y].push_back(x); } long long Max; int Count; void DFS(bool Step, int Node = 1, int Parent = 0) { SubWeight[Node] = Wei...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 10; const long long int LINF = 1LL * INF * INF; const int MAXN = 2e5 + 10; const int MAXM = 5e3 + 10; priority_queue<int> pq; vector<vector<int> > graph; queue<int> que; pair<int, int> A[20]; long long int dp[20][(1 << 20)]; long ...
//Shrey Dubey #include<iostream> #include<string> #include<algorithm> #include<map> #include<unordered_map> #include<vector> #include<set> #include<list> #include<iomanip> #include<queue> #include<stack> #include <math.h> #include<climits> #include<bitset> #include<cstring> #...
/* File: fifo.v This file is part of the Parallella FPGA Reference Design. Copyright (C) 2013 Adapteva, Inc. Contributed by Roman Trogan <> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Founda...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string str1, str2; cin >> str1 >> str2; int diffcount = 0; for (int i = 0; i < str1.length(); i++) { if (str1[i] != str2[i]) diffcount++; } if (diffcount % 2 == 1) { ...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( O0 ) #pragma GCC optimize( O1 ) template <typename T> void vec_SUN(vector<T> &Vec) { vector<T> X; X = Vec; sort(X.begin(), X.end()); X.resize(unique(X.begi...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* This file is part of JT51. JT51 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. JT51 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k; cin >> n >> m >> k; if (n + m - 2 < k) { cout << -1 n ; return 0; } long long ans = max(n * (m / (k + 1)), m * (n / (k + 1))); if ((k - m + 2) > 0) ans = max(ans, n / (k - m + 2)); if ((k - n + 2) ...
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // =========================================================== `timescale 1 ns / 1 ps modul...
#include <bits/stdc++.h> using namespace std; int main() { int t, n, i, j, ma; cin >> n; int arr[n], b[n]; for (i = 0; i < n; i++) { cin >> arr[i]; } ma = arr[n - 1]; b[n - 1] = 0; for (i = n - 2; i >= 0; i--) { if (arr[i] <= ma) { b[i] = (ma - arr[i]) + 1; ...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2, typename T3> T2 x_pow_y(T1 x, T3 y, T2 mod) { T2 ans = 1; long long a = x % mod; while (y) { if (y & 1) ans = (ans * a) % mod; a = (a * a) % mod; y >>= 1; } return ans; } template <typename ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> s(n, 0); s[n - 1] = a[n - 1]; for (int i = n - 2; i >= 0; i--) s[i] = max(a[i], s[i + 1]); for (int i = 0; i < n - 1; i++) cout << max(0,...
#include <bits/stdc++.h> using namespace std; const int MAXN = 105000; int n, m; int tin[MAXN], tout[MAXN]; vector<int> g[MAXN]; vector<int> gr[MAXN]; vector<int> gg[MAXN]; vector<int> vv; bool used[MAXN]; int sz[MAXN]; int cursize; int p[MAXN]; bool has[MAXN]; int ans; void dfs(int v) { ...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
// megafunction wizard: %RAM: 3-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: alt3pram // ============================================================ // File Name: IMG_TRI_BUFFER.v // Megafunction Name(s): // alt3pram // // Simulation Library Files(s): // altera_mf // =============...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
////////////////////////////////////////////////////////////////////// //// //// //// MAC_rx.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 11, mod = 998244353; int ans, n, k, blo, bel[N], f[N], g[N], a[N], L[N], R[N], las[N], bef[N], lim[N], sum[411][N], Sum[411]; inline void inc(int &x, int y) { x += y; if (x >= mod) x -= mod; } inline void deal(int l, int r, int ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11:06:10 07/23/2015 // Design Name: asic // Module Name: C:/Users/rodriguj/Documents/zxspectrum/zxuno/repositorio/cores/sam_coupe_spartan6/test1/tb_asic.v // Project ...
#include <bits/stdc++.h> using namespace std; int dfs(vector<int>* v, int n) { int cost = -1; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { if (binary_search(v[i].begin(), v[i].end(), j) == 0) continue; for (int k = 0; k < v[i].size(); k++) { for (int s = ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int a, ta, b, i, j, tb, h, m, t; int d, ar; char ch[10]; cin >> a >> ta >> b >> tb; cin >> ch; h = (ch[0] - 0 ) * 10 + ch[1] - 0 ; m = (ch[3] - 0 ) * 10 + ch[4] - 0 ; t = (h - 5) * 60 + m; j = 0; long long count =...
#include <bits/stdc++.h> using namespace std; map<int, int> p; int a[100005]; int a1[100005], a2[100005]; int n, flag, pl = 1; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); if (p[a[i]] == 0) p[a[i]] = pl++; } for (int i = 1; i <= n; i++) { ...
// // Copyright (c) 2015 Jan Adelsbach <>. // All Rights Reserved. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your optio...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char arr[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> arr[i][j]; } } pair<int, int> p[n * n]; int in = 0; for (int i = 0; i < n; i++) { for (int j = 0; j...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v, v1; for (int i = 0; i < n; i++) { int t, y; cin >> t >> y; v.push_back(t); v1.push_back(y); } sort(v.begin(), v.end()); sort(v1.begin(), v1.end()); long long ans = n; ...
#include <bits/stdc++.h> using namespace std; const int Maxn = 100 * 1000 + 10; int n, m, l[Maxn], ans1, ans2; long double a, b; pair<long double, int> arr[Maxn], brr[Maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m >> a >> b; for (int i = 0; i...
module top_teclado(Clock, Reset, ClockKeyboard, DataKeyboard, StringDisplay, RS, RW, EN, MsbOD,completeOut,string); input Clock; input Reset; input ClockKeyboard; input DataKeyboard; output [6:0] StringDisplay; output RS, RW, EN; output MsbOD; output completeOut; output wire [76:0] s...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; long long a[n + 2]; a[0] = 0; long long sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] > a[i - 1]) su...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; bool shown[100001]; vector<pair<int, int> > v; vector<int> cycle; vector<vector<int> > ans; int main() { int n, tmp; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &tmp); v.push_back(make_pair(tmp, i)); } sort(v.begin(...
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const long double PI = 3.141592653589793238462643383279502884197; priority_queue<int, vector<int>, greater<int> > pq; vector<int> v; char s[300001]; int main() { int n; scanf( %d , &n); scanf( %s , s); ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(nullptr); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int res = 0; for (int i = 0; i < k; i++) { int x = 0, y = 0; for (int j = i; j < n; j ...
//START_MODULE_NAME------------------------------------------------------------ // // Module Name : lpm_divide // // Description : Parameterized divider megafunction. This function performs a // divide operation such that denom * quotient + remain = numer // The function ...