text
stringlengths
59
71.4k
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ctu_clsp_clkgn_clksw.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...
#include <bits/stdc++.h> int ss[250000], ff[250000], cc[250000], rr[250000], ii[250000]; int compare(const void *a, const void *b) { int i = *(int *)a; int j = *(int *)b; return rr[i] - rr[j]; } int main() { static int aa[400]; typedef int ian[400]; static ian dp_[400], dq_[400], *dp = d...
#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--) { long long n, a, b, c, d; cin >> n >> a >> b >> c >> d; int x = 0; if (((c + d) < n * (a - b)) || ((c - d) > n * (...
/** * 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 fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; template <typename T, typename TT> ostream& operator<<(ostream& s, pair<T, TT> t) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; string s; cin >> s; int l = -1; for (int i = 0; i < n - 1 && k > 0; i++) { if (s[i] == 4 && s[i + 1] == 7 ) { if (i % 2 == 1) { if (...
// megafunction wizard: %FIFO%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_4k.v // Megafunction Name(s): // dcfifo // ============================================================ // ******************************...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5, K = 505, INF = K * (1e4 + 5); int n, m, k; int c[N], a[N], visit[N]; int w[K][K]; vector<pair<int, int>> edges[N]; vector<int> colors; void dfs(int s) { visit[s] = 1; colors.push_back(a[s]); for (auto x : edges[s]) { ...
// (C) 1992-2015 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 simulati...
#include <bits/stdc++.h> using namespace std; int a[100000], s[100000]; void qs(int q, int w) { int e = q, r = w, t = a[q + (rand() % (w - q + 1))], y; do { while (a[e] < t) e++; while (a[r] > t) r--; if (e <= r) { y = a[e]; a[e] = a[r]; a[r] = y; y = s[e]...
#include <bits/stdc++.h> using namespace std; const long long N = 2 * 1e5 + 100; long long t, n; struct node { long long m, p; } sh[N]; bool cmp(node a, node b) { return a.m > b.m; } signed main() { scanf( %lld , &t); while (t--) { scanf( %lld , &n); for (long long i = 1; i <= n; i...
/* Anthony De Caria - May 22, 2014 This module creates a Shift Register with a seperate enable signal. This specific module creates an output that is 16-bits wide. This module uses asyncronous D Flip Flops. It also can allow data to be inputed into the flip flops before shifting. */ module ShiftRegisterWEnableFourtee...
#include <bits/stdc++.h> using namespace std; int x; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> x; if (x == 3) { cout << 5 << endl; return 0; } for (int i = 1; i <= 199; i += 2) { int temp = i * i + 1; temp /= 2; ...
#include <bits/stdc++.h> using namespace std; vector<vector<pair<int, int> > > Mat; vector<int> Grafo; vector<int> Entrada; vector<int> Rev; vector<int> Aristas; stack<int> STACK; vector<int> Backi; int grafos; bool dfs(int A, int i, int pos) { Grafo[A] = grafos; Entrada[A] = pos; Backi[...
`define bsg_mux_gen_macro(words,bits) \ if (harden_p && els_p == words && width_p == bits) \ begin: macro \ wire [els_p-1:0] sel_onehot = els_p ' (1'b1 << sel_i); \ ...
#include <bits/stdc++.h> using namespace std; int main() { int s1, s2, s3, a, b, c; cin >> s1 >> s2 >> s3; a = (s1 * s2) / s3; a = pow(a, 0.5); b = (s2 * s3) / s1; b = pow(b, 0.5); c = (s1 * s3) / s2; c = pow(c, 0.5); cout << 4 * (a + b + c) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; template <typename T> T getint() { T x = 0, p = 1; char ch; do { ch = getchar(); } while (ch <= ); if (ch == - ) p = -1, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return x * p; } mt1...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 1; const long long M = 1e5 + 1; vector<int> len; vector<int> dist[N]; vector<long long> pre[N]; long long n, m; void mer(long long v, long long l, long long addl, long long r, long long addr) { dist[v].push_back(0); ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; using ii = pair<int, int>; using ll = long long; const int mod = 1e9 + 7; const int N = 1e6 + 5; const int M = 29; int ans[N]; int dp[3][N]; struct suffixAutomaton { struct state { int len...
/* * 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; struct Compteur { int nbs[4]; Compteur() { for (int iCoeff = 0; iCoeff < 4; iCoeff++) { nbs[iCoeff] = 0; } } }; Compteur operator+(const Compteur &a, const Compteur &b) { Compteur nouv; for (int iCoeff = 0; iCoeff < 4; iCoeff+...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module cmd_seq #( parameter BASEADDR = 32'h0000, ...
#include <bits/stdc++.h> constexpr int Maxn = 53; std::vector<int> e[Maxn]; int n, m; int main() { scanf( %d%d , &n, &m); for (int i = 1, u, v; i <= m; ++i) { scanf( %d%d , &u, &v); if (u <= 50 && v <= 50) { e[u].emplace_back(v); e[v].emplace_back(u); } } n = st...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e11; const int M = 1e5 + 5; vector<pair<long long, int> > adj[M]; vector<int> ans; long long d[M], vis[M], pre[M]; int n, m; void Dijkstra() { for (int i = 1; i <= n; ++i) d[i] = INF; d[1] = 0; priority_queue<pair<long long...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int r, c, i, j, flag = 0; cin >> r >> c; char a[r + 2][c + 2]; for (i = 0; i < (r + 2); i++) { for (j = 0; j < (c + 2); j++) a[i][j] = . ; } for (i =...
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { int n; cin >> n; int a[n], i, j, k, l, m; string s, temp; for (i = 0; i < n; i++) cin >> a[i]; char c = a , d; for (i = 0; i <= 50; i++) { s += a ; } ...
/** * 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...
`define ADDER_WIDTH 021 `define DUMMY_WIDTH 128 `define 3_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
// A few simple tests of translating parameters to generics module top(); wire [7:0] v1, v2, v3; wire [7:0] w1, w2, w3; child c1(v1, w1); child c2(v2, w2); child c3(v3, w3); defparam c1.MY_VALUE = 6; defparam c2.MY_VALUE = 44; initial begin #2; $display("c1 reg value: %d", v1); $display("...
#include <bits/stdc++.h> using namespace std; int to[55][35][35][4][3]; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int Sign(int x) { return x > 0 ? 1 : x < 0 ? -1 : 0; } int main() { int n, b; cin >> n >> b; ++b; for (int i = 0; i < b; ++i) { for (int j = 0; j < b; ++j) { ...
#include <bits/stdc++.h> using namespace std; int n, Cnt = 0, Num = 0; int l[200000 + 10], r[200000 + 10]; map<int, int> mp; int Di[200000 + 10]; vector<int> f[200000 + 10], No[200000 + 10]; int cur[200000 + 10]; bool b[200000 + 10]; int Ans[200000 + 10]; int Check() { int Now = -1, ODD = 0; ...
// Copyright 2007 Altera Corporation. All rights reserved. // Altera products are protected under numerous U.S. and foreign patents, // maskwork rights, copyrights and other intellectual property laws. // // This reference design file, and your use thereof, is subject to and governed // by the terms and conditions...
#include <bits/stdc++.h> using namespace std; const int MAXN = 500005; int ult; int cont; int prim; char cad[MAXN]; bool Solve(int a, int n, int T) { int c = 0, time = 0; queue<int> s; prim = -1; for (int i = 0; i < n && c < cont; i++, time++) { if (cad[i] == H && a > 0) { ...
#include <bits/stdc++.h> using namespace std; long long n, b, x, q, t, ans, l, r, m, p, now, sum; bool ok; string s; map<int, int> a, pos; map<char, int> c; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> q; while (q--) { cin >> n >> m; cin >> s; ...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; vector<int> *mapo; long long Montgomery(long long a, long long b) { long long ans = 1; a = a % mod; while (b > 0) { if (b & 1) ans = ans * a % mod; b >>= 1; a = a * a % mod; } return ans; } bool in...
/** * 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() { long long int n; cin >> n; set<long long int> s; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] > 0) { s.insert(a[i]); } } long long int len1 = s.size(); cout << len1 << endl...
`timescale 1 ns / 1 ps module sensor_interface_v1_0 # ( // Users to add parameters here parameter integer C_SYSTEM_CLOCK = 100_000_000, parameter integer C_BUS_CLOCK = 400_000, // User parameters ends // THESE AREN'T USER CONFIGURABLE // Parameters of Axi Slave Bus Interface S00_AXI para...
#include <bits/stdc++.h> using namespace std; int dp[60002][10]; int main() { int n, m; scanf( %d%d , &n, &m); int a; for (int j = 0; j < m; j++) { cin >> a; if (!j) dp[0][j] = a; else dp[0][j] = dp[0][j - 1] + a; } cout << dp[0][m - 1] << ; for (in...
#include <bits/stdc++.h> using namespace std; int const N = 1e5 + 10; vector<int> e[N], b[N], d[N]; bool v[N], in[N]; void dfs(int root, int parent, int depth) { v[root] = true, in[root] = true; d[depth].push_back(root); for (auto child : e[root]) { if (in[child]) b[root].push_back(child); ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (lin64) Build Thu Jun 15 18:39:10 MDT 2017 // Date : Fri Jun 23 10:02:11 2017 // Host : dshwdev running 64-bit Ubuntu 16.04.2 LTS /...
`timescale 1 ns / 1 ps `default_nettype none `ifndef VCDFILE `define VCDFILE "testbench_lcu_tb.vcd" `endif module tb; `include "../../../../library/tbassert.v" // ============================================================================ reg clk; reg thresh_sw; reg [31:0] threshold, threshold_down, counter, cou...
//Legal Notice: (C)2015 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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string q; cin >> q; int n; cin >> n; vector<string> m(n); for (int i = 0; i < (n); ++i) cin >> m[i]; sort(m.begin(), m.end()); for (int i = 0; i < (n); ++i) { if ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:00:19 12/14/2016 // Design Name: // Module Name: BR_Top // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
#include <bits/stdc++.h> using namespace std; int main() { long long x, y, z; long long x1, y1, z1; vector<long long> a(6); long long sum = 0; cin >> x >> y >> z; cin >> x1 >> y1 >> z1; for (int i = 0; i < 6; ++i) { long long b; cin >> b; a[i] = b; } if (x < 0) ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int q = 0; q < t; ++q) { int n, k; cin >> n >> k; vector<int> x(n); for (int i = 0; i < n; ++i) { cin >> x[i]; } vector<int> p(n, 0); for (int i = 1; i < n - 1; ++i) { ...
#include<bits/stdc++.h> using namespace std; #define forg(i,x) for(register int i=fir[x];i;i=nxt[i]) #define uu unsigned #define scanf a14=scanf #define rint register int #define fre(x) freopen(#x .in , r ,stdin),freopen(#x .out , w ,stdout) typedef long long ll; typedef uu long long ull; typedef pair...
#include <bits/stdc++.h> using namespace std; const int size = 50 + 10; int n, k, aim[size], num[size], ans = -1; int main() { cin >> n >> k; if (k > n) { cout << -1 << endl; return 0; } for (int i = 1; i <= n; i++) cin >> aim[i]; sort(aim + 1, aim + n + 1); num[1] = 0; f...
#include <bits/stdc++.h> using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; return (a % b == 0 ? b : GCD(b, a % b)); } long long POW(long long base, long long exp) { long long val; val = 1; while (exp > 0) { if (exp % 2 == 1) { val = (val * bas...
#include <bits/stdc++.h> using namespace std; int main() { int test; cin >> test; while (test--) { int a, b; cin >> a >> b; cout << (a ^ b) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int a[1000]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); double ans = 0; for (int i = 1; i <= m; ++i) { int x, y, z; scanf( %d%d%d , &x, &y, &z); ans = max(ans, ((double)a[x] + a[...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long a, long long b) { long long r; while (b) { ...
//***************************************************************************** // (c) Copyright 2008-2009 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 // ...
/* Copyright (C) {2014} {James Thomas} <> Copyright (C) {2014} {Ganesh Ajjanagadde} <> 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 option) any later...
/** * 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; using namespace std::chrono; long double PI = 3.14159265358979323846; using ll = long long; const ll modo = 1000000000; const ll inf = LONG_LONG_MAX; const ll ms = (2e6) + 5; ll peil(ll a, ll b) { if (a % b) return a / b + 1; return a / b; } long...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 2000; const int maxm = 1000 * 10; struct edge { int v, w, next; } e[maxm * 2]; struct node { int d, u; bool operator<(const node &b) const { return d > b.d; } }; int head[maxn], d[maxn], d2[maxn]; ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n, k; vector<vector<long long>> adj, leaf; vector<long long> level, par, out; vector<long long> counti; void dfs(int src, int lvl, int p = -1) { int child = 0; level[src] = lvl; for (auto it : adj[src]) { if (it =...
module t481_lev2(pi00, pi01, pi02, pi03, pi04, pi05, pi06, pi07, pi08, pi09, pi10, pi11, pi12, pi13, pi14, pi15, po0); input pi00, pi01, pi02, pi03, pi04, pi05, pi06, pi07, pi08, pi09, pi10, pi11, pi12, pi13, pi14, pi15; output po0; wire n46, n47, n48, n49, n50, n51, n52, n53, n54, n55, n56, n57, n58, n59, n60...
#include <bits/stdc++.h> using namespace std; int main() { long long t = 1; while (t--) { string s; cin >> s; sort(s.begin(), s.end()); long long n = s.size(), ans = 0; long long l = 0, r = n - 1; while (l <= r) { long long m = l + (r - l) / 2; if (s[m] ==...
#include <bits/stdc++.h> using namespace std; int n; string s; vector<string> text; vector<int> lens; bool check(int w) { int c = 0, lines = 1; for (int i = 0; i < (int)(lens).size(); i++) { if (lens[i] > w) return false; if (c + lens[i] > w) { lines++; i--; c = 0...
`default_nettype none module pulse_gen( input clk, // 12 MHz base clock input RS232_Rx, // Receive pin for the FTDI chip input resetn, // Reset the cycle output RS232_Tx, // Transmit pin for the FTDI chip output Pulse, // Output pin for the switch output Sync, // Output pin for the SYNC pulse // output FM, /...
#include <bits/stdc++.h> using namespace std; int a[5000 + 10]; int main() { int n; cin >> n; for (int i = 1; i < n + 1; i++) cin >> a[i]; bool flag = false; for (int i = 1; i < n; i++) { if (a[a[a[i]]] == i) { flag = true; break; } } if (flag) cout <<...
#include <bits/stdc++.h> using namespace std; int n, head[100005], tot, d[100005], fa[100005], vis[100005], lf[100005], cnt; struct node { int v, nxt; } edg[100005 << 1]; inline void addedg(int u, int v) { edg[tot].v = v; edg[tot].nxt = head[u]; head[u] = tot++; } inline void init() { ...
#include <bits/stdc++.h> using namespace std; int dp[2][300005], x[300005], y[300005]; int n, k; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> x[i]; for (int i = 1; i <= n; i++) cin >> y[i]; for (int i = 1; i <= n; i++) { if (!(~dp[0][i - 1])) { dp[0][i] = -1; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2017/07/18 10:59:33 // Design Name: // Module Name: data_in // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revis...
#include <bits/stdc++.h> using namespace std; namespace io { string separator = ; } template <typename T> inline void write(T x) { cout << x << io::separator; } template <typename T, typename... Args> inline void write(T x, Args... args) { write(x); write(args...); } inline void wri...
/* Atari on an FPGA Masters of Engineering Project Cornell University, 2007 Daniel Beer RIOT.v Redesign of the MOS 6532 chip. Provides RAM, I/O and timers to the Atari. */ `timescale 1ns / 1ps `include "riot.vh" module RIOT(A, // Address bus input Din, // Data bus input Dout, // Data bus output CS,...
#include <bits/stdc++.h> using namespace std; long long n, a[3][333333], x, y, sum[4][333333], r[4][333333]; set<pair<long long, long long> > s[333333]; map<pair<long long, long long>, long long> d; map<long long, long long> last[4]; void read(long long &x) { scanf( %lld , &x); } int main() { cin >> n...
#include <bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template <class T> ostream& prnt(ostream& out, T v) { out << v.size() << n ; for (auto e : v) out << e << ; return out; } template <class T> ostream& operator<<(ostream& out, vector<T> v) { return prnt(ou...
#include <bits/stdc++.h> const int N = 1e7 + 5; int n, pos[N], ans1, ans2; long long ans = 1e14; int main() { scanf( %d , &n); for (int i = 1, x; i <= n; ++i) { scanf( %d , &x); if (pos[x]) { if (x < ans) ans1 = pos[x], ans2 = i, ans = x; } else pos[x] = i; } fo...
//================================================================================================== // Filename : RKOA_OPCHANGE.v // Created On : 2016-10-26 23:25:59 // Last Modified : 2016-10-27 23:56:17 // Revision : // Author : Jorge Esteban Sequeira Rojas // Company : Instituto Tec...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2005 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=0; reg [7:0] crc; reg [223:0] sum; wire [255:0] mglehy = {3...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:11:44 04/08/2014 // Design Name: fourbit_cpu // Module Name: C:/Users/Jonathan/Documents/Xilinx/Projects/CPU/test_cpu.v // Project Name: CPU // Target D...
`include "adder.v" module IMUL16 # (parameter NUM_BITS = 2) ( input wire [NUM_BITS-1:0] A, input wire [NUM_BITS-1:0] B, output wire [2*NUM_BITS-1:0] oResult ); wire [NUM_BITS-1:0] wCarry [NUM_BITS-2:0]; // matriz definida para conectar los carry's wire[NUM_BITS-1:0] Temp_results [NUM_BITS-1:0]; // matriz definida ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 512; const int INF = 0x3f3f3f3f; long long dis[MAXN][MAXN], a[MAXN], ans[MAXN]; bool in[MAXN]; int n; void Floyd() { for (int k = n; k >= 1; k--) { int t = a[k]; in[t] = 1; for (int i = 1; i <= n; i++) { for (int ...
/* * 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) 2015 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
#include <bits/stdc++.h> using namespace std; istream& in = cin; int n; int a[1000010]; void input() { in >> n; for (int i = 1; i <= n; ++i) in >> a[i]; } long long mod = (long long)1e9 + 7; long long fac[1000010], inv[1000010]; long long quick_mod(long long a, long long p) { long long ret...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 07/07/2016 09:24:55 AM // Design Name: // Module Name: Deslinealizador // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: /...
/* * 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 la...
#include <bits/stdc++.h> using namespace std; template <class T> inline void checkMin(T &a, T b) { if (b < a) a = b; } template <class T> inline void checkMax(T &a, T b) { if (a < b) a = b; } template <class T> inline T Min(T a, T b) { return a < b ? a : b; } template <class T> inlin...
#include <bits/stdc++.h> using namespace std; int mat[1005][1005]; long long cols[1000005]; long long rows[1000005]; priority_queue<long long> pq; int main() { int n, m; long long k, p; scanf( %d %d %lld %lld , &n, &m, &k, &p); for (int i = 0; i < n; i++) { long long sum = 0; for...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: RAM.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ====================================...
#include <bits/stdc++.h> using namespace std; struct node { long k, na; }; const long maxn = 100001; node a[maxn]; long n, b[maxn]; int qsort(long low, long high) { long i = low, j = high, x = a[(i + j) / 2].k; while (i < j) { while (a[i].k < x) i++; while (a[j].k > x) j--; i...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 * 2 + 10; int n, len, h; struct node { int flag, mx, l, r; } t[MAXN << 2]; int a[MAXN], b[MAXN]; int L[MAXN]; void push_down(int k) { if (t[k].flag) { t[k << 1].flag += t[k].flag; t[k << 1 | 1].flag += t[k].flag; ...
/* * 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 la...
#include <bits/stdc++.h> using namespace std; struct Node { int num, cnt; friend bool operator<(const Node &n1, const Node &n2) { if (n1.cnt != n2.cnt) return n1.cnt < n2.cnt; else return n1.num < n2.num; } }; set<Node> cur, tmp; vector<int> xx, num; map<int, int> mp;...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_exu_rml_inc3.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 i...
// // Copyright 2011 Ettus Research LLC // // 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 option) any later version. // // This program is dis...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 + 5; int N, P[MAXN]; long long D[MAXN]; vector<pair<long long, int>> v, f[2]; int main() { scanf( %d , &N); P[1] = 1, P[2] = 2; for (int i = 3, x; i <= N; ++i) { printf( 2 1 %d %d n , P[2], i); fflush(stdout); ...
// creates an array of shift registers, with independently // controlled three input muxes, // 0=keep value, 1=get prev value,2=set new value // // `include "bsg_defines.v" module bsg_fifo_shift_datapath #(parameter `BSG_INV_PARAM( width_p ) ,parameter `BSG_INV_PARAM(els_p ) ...
/** * 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 = 1000010; int tot; struct node { node *ch[26], *fail; int len, id; node* init(int tlen) { memset(ch, 0, sizeof(ch)); fail = NULL; len = tlen; return this; } } * root, spT[N]; vector<int> g[N]; void addin(cha...
`include "route_compute.v" module test_route_compute (); reg [12:0] inc; reg [1:0] addrx; reg [1:0] addry; reg [1:0] addrx_max; reg [1:0] addry_max; wire [3:0] rmatrix; reg clock; reg [2:0] test; RouteCompute rc(inc, addrx, addry, addrx_max, addry_max, clock, rmatrix); alway...
#include <bits/stdc++.h> clock_t t = clock(); namespace my_std { using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T rnd(T l, T r) { return uniform_int_distribution<T>(l, r)(rng); } template <typename T> inline bool chkmax(T &x, ...
#include <bits/stdc++.h> using namespace ::std; int main() { long long int temp, q, v1, v2, t, d, i, sum = 0; cin >> v1 >> v2 >> t >> d; long long int a[t]; sum = d * (t - 1); i = 0; temp = 0; bool ff = false; while (1) { if (!ff) { i += v1; a[temp] = i; ...