text
stringlengths
59
71.4k
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: tryagain.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===========================...
#include <bits/stdc++.h> using namespace std; struct node { long long l, r; long long mx = -1e18; long long ch = 0; }; vector<node> tree; void push(long long v) { if (tree[v].l == tree[v].r) { tree[v].ch = 0; } else { tree[v * 2].ch += tree[v].ch; tree[v * 2 + 1].ch += tr...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; const int MAXR = 1; const int MAXC = 1; const int INF = (int)1e9; priority_queue<int, vector<int>, greater<int>> q1; priority_queue<int, vector<int>, less<int>> q2; int arr[MAXN]; vector<pair<int, int>> v(MAXN); vector<vector<int>> ...
#include <bits/stdc++.h> #pragma GCC target( sse4,avx ) const double pi = 3.14159265358979323; struct dpoint { double x, y; dpoint() : x(0), y(0) {} dpoint(double x, double y) : x(x), y(y) {} }; void run(std::istream& in, std::ostream& out) { int n; dpoint p; in >> n >> p.x >> p.y; ...
// -*- Mode: Verilog -*- // Filename : fifo.v // Description : FIFO // Author : Philip Tracton // Created On : Tue May 27 16:03:26 2014 // Last Modified By: Philip Tracton // Last Modified On: Tue May 27 16:03:26 2014 // Update Count : 0 // Status : Unkn...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; while (cin >> n >> m) { int tmp = 0, mid = (m + 1) / 2, res = mid; while (n--) { if (tmp % 2 == m % 2) res -= tmp; else res += tmp; if (tmp == m) tmp = 0, res = mid; cout << r...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimization( unroll-loops ) const int N = 1e5 + 5; const long long int mod = 1e9 + 7; const long long int Mod = 998244353; const long double Pi = acos(-1); const long long int Inf = 4e18; using namespace std; int n, m; vector<pair<i...
module main; reg [7:0] th2, init; reg carry, clk, rst, foo; (* ivl_synthesis_on *) always @(posedge clk) begin if (rst) begin th2 <= 0; carry <= 1; foo <= 0; // This causes foo to be an output to the block. end else begin if (carry) {carry, th2} <= {1'b0, init}; else ...
// (c) Copyright 1995-2017 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 ...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 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 ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long inf = 1e18; vector<long long> factorial; void fill_factorial(long long n) { factorial.resize(n + 1); factorial[0] = 1; for (long long i = 1; i <= n; i++) factorial[i] = (factorial[i - 1] * i) % mod; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long double n, h; cin >> n >> h; cout << setprecision(20); for (long double i = 0; i < n - 1; i++) { cout << h * sqrt((i + 1) / 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 maxn = 100010; int gcd(int x, int y) { return !y ? x : gcd(y, x % y); } int rev(int num) { int dig[10], tot = 0, s = 0; for (; num; num /= 10) dig[tot++] = num % 10; for (int i = 0; i < tot; i++) s = s * 10 + dig[i]; return s; } pair<in...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long a, b; cin >> a >> b; while (a != 0 && b != 0) { if (a >= 2 * b) { a = a % (2 * b); } else if (b >= 2 * a) { b = b % (a * 2); } else break; } cout << a << << b << endl; ...
#include <bits/stdc++.h> using namespace std; int par[20][100001], dep[100001], lg[100001], sizes[100001]; bool isParent[100001]; vector<int> adj[100001]; void dfs(int u) { for (int i = 0; i < adj[u].size(); i++) { int v = adj[u][i]; if (v != par[0][u]) { isParent[u] = true; de...
#include <bits/stdc++.h> const double pi = acos(-1); const int o = 524288; int a[1111111]; double x[1111111], y[1111111]; int z[1111111]; int main() { double tx, ty; int i, j, k, n, m, tz; scanf( %d%d , &n, &m); for (i = 0; i < n; i++) a[i + o] = x[i + o] = 1; for (i = o - 1; i >= 0; i--...
// $Id: c_wf_alloc_loop.v 1534 2009-09-16 16:10:23Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions o...
#include <bits/stdc++.h> using namespace std; int m[367], f[367]; int main() { memset(m, 0, sizeof(m)); memset(f, 0, sizeof(f)); int N; cin >> N; char ch; int a, b; for (int i = 0; i < N; ++i) { cin >> ch >> a >> b; if (ch == M ) for (int j = a; j <= b; ++j) ++m[j]...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; const int N = 30 + 7; const int mod = 1e9 + 7; const int B = 317; int n; int u, r; int a[N][N]; int b[N]; int c[N]; i...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: ffoo.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ==================================================...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // 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 2 of the License...
// 3rd party code: from Swapforth [1] // // Copyright (c) 2015 James Bowman // // [1] https://github.com/jamesbowman/swapforth // /* Copyright (c) 2015, James Bowman All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditi...
#pragma GCC optimize( O2 ) #include<bits/stdc++.h> #define ll long long //#define int long long #define fi first #define se second #define mpa make_pair #define eb emplace_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; mt19937 gen(time(0...
/** * 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 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Fri Apr 1 16:03:12 2016 //Host : ubuntu-desktop running 64-bit Ubuntu 14.04.4 LTS...
// // Copyright (c) 1999 Steven Wilson () // // 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) // ...
#include <bits/stdc++.h> using namespace std; int n; int x[1000000]; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); int sol = x[n - 1] - x[0]; int p = n / 2 - 1; for (int i = 0; i <= p; i++) sol = min(sol, x[n - 1 - (p - i...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int x = 1, y = 1; int k = 0; cin >> k; bool fl = false; for (int i = 1; i <= n; i++) { int t; if (i != n) cin >> t; else t = 1 - k; if (t == k && fl == false) { x++...
#include <bits/stdc++.h> using namespace std; bool visited[300000]; long long int parent[300000]; void initialise() { for (long long int i = 0; i < 300000; i++) { visited[i] = false; parent[i] = i; } } pair<long long int, long long int> dfs( vector<pair<long long int, long long int...
/* Copyright (c) 2014-2018 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, distri...
/* * 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; template <class T> const T& max(const T& a, const T& b, const T& c) { return max(a, max(b, c)); } template <class T> const T& min(const T& a, const T& b, const T& c) { return min(a, min(b, c)); } long long stoi(string& str) { istringstream second...
/* * Copyright (c) 2008 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; 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, or (at your option) an...
#include <bits/stdc++.h> using namespace std; const int N = 1 << 23; const int offset = (int)1e6; int st_sum[2 * N]; int st_ma[2 * N]; int getMax(int a, int b) { a += N + offset; b += N + offset; int ma = -1e9; int sum_a = 0; int ma_b = 0; for (; a < b; a /= 2, b /= 2) { if (a ...
module ex_div( input wire clock, input wire reset, input wire is_signed, input wire[`REGS_DATA_BUS] operand1, input wire[`REGS_DATA_BUS] operand2, input wire is_start, inpu...
#include <bits/stdc++.h> using namespace std; const double Pi = acos(-1.0); const int INF = 1 << 29; const int MAXN = 505; int n; int M[MAXN][MAXN]; int R[MAXN]; long long A[MAXN]; int main(int argc, char** argv) { scanf( %d , &n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++...
// // 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 long long int mod = 998244353; const long long int mxn = 1e5 + 7; long long int a[mxn]; long long int power(long long int a, long long int b); long long int flcm(long long int n, long long int m); long long int fgcd(long long int n, long long int m); l...
// file: system_clk_wiz_0_0.v // // (c) Copyright 2008 - 2013 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...
module ex; /* autoinst_paramover_sub AUTO_TEMPLATE "u_\(.*\)" ( .a(inA_@[]), .b(outA_@[]), );*/ autoinst_paramover_sub u_foo(/*AUTOINST*/ // Inouts .a (inA_foo[bitsa:0]), // Templated ....
/* * 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 n, ntot, ieven, rs[6], ord[6 + 1], iord[6 + 1]; vector<int> xs; inline int imake(int i) { return i > 0 ? ord[i] : -ord[-i]; } void iextend_even(int p, vector<int> &vi) { vector<int> vr[2], vg; vr[1] = vi; for (int i = (int)vi.size() - 1; i >= 0; i-...
#include <bits/stdc++.h> using namespace std; const int N = 2300; int dp[N], a[N], res = 0, n; void dfs(int u, int d) { if (d == n) { dp[u] = 0; return; } int l = u * 2, r = l + 1; dfs(l, d + 1); dfs(r, d + 1); int x = dp[l] + a[l], y = dp[r] + a[r]; if (x < y) swap(x, y)...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 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 distributed ...
// A simple OSD implementation. Can be hooked up between a cores // VGA output and the physical VGA pins module osd ( // OSDs pixel clock, should be synchronous to cores pixel clock to // avoid jitter. input clk_sys, input ce, // SPI interface input SPI_SCK, input SPI_SS3, input ...
/* File: ewrapper_io_rx_slow.v This file is part of the Parallella Project . 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 Foun...
/* Copyright (c) 2014-2017 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, distri...
// megafunction wizard: %RAM: 2-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: RAM16_s36_s36_altera.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===...
/* * VGA CSR interface for SRAM * Copyright (c) 2009 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; 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 ve...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int i, a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); i = 1; while (a[i] == a[0]) { i++; } if (i < n) cout << a[i]; else cout << NO ; return 0; }
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `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 bas...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:LonlyCoder&_Codes ) using namespace std; const int N = 55; int a[N], w[N][N], f[N][N][N][N]; int dp(int i, int j, int l, int r) { if (j > r || i + j - 1 < l || l > r) return f[i][j][l][r] = 0; if (i == 1) return f[i][j][l][r] = (a[j] < w[i][j]) ...
module test (); reg pass = 1'b1; reg d; real a = 0.0; wire real f = a; always @(d) force f = 0.0; initial begin // Verify the initial value. #1; if (f != 0.0) begin $display("Failed initial value, expected 0.0, got %f", f); pass = 1'b0; end // Verify the value can change. ...
`timescale 1ns/10ps /** * `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:...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int a[N], c[N], f[N], g[N], n, q, m, len, ans[N]; map<int, int> mp; inline void read(int &x) { char c = getchar(); x = 0; while (c > 9 || c < 0 ) c = getchar(); while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; ...
/** * 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() { double n; cin >> n; while (n--) { double ele; cin >> ele; if (ele < 4 && ele > 0) cout << N n ; else { double a = (ele + sqrt((ele * ele) - (4 * ele))) / 2; double b = (ele - sqrt((ele * ele) - (4...
#include <bits/stdc++.h> using namespace std; const int Maxn = 1e5 + 2; const int Nn = 251; char s[Maxn]; int a[Maxn][26], f[Nn][Nn][Nn], length[3], i, j, k, l, Min, n, m, id, p; char ss[3][Nn], op, c, sss[Nn]; void done() { for (int i = 0; i < 26; i++) { a[n][i] = n + 1; a[n + 1][i] = n +...
#include <bits/stdc++.h> using namespace std; int const N = 200001; int main() { long long n, k, d; scanf( %lld%lld%lld , &n, &k, &d); if (d < k) return puts( NO ), 0; long long dv = d / k; if (dv + 1 > n || (dv + (d % k == 0 ? 0 : 2)) > n) return puts( NO ), 0; vector<long long> an; p...
#include <bits/stdc++.h> using namespace std; int dirx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int diry[] = {-1, 0, 1, -1, 1, -1, 0, 1}; const int N = 1e2 + 5, M = (1 << 17) + 5, inf = 1e7; int a[N], dp[N][M], bit[N], n; bool ip(int i) { for (int it = 2; it * it <= i; it++) { if (i % it == 0) return fals...
#include <bits/stdc++.h> const long long kot = LLONG_MAX; using kk = long double; const long long int alpha = 1e18; using namespace std; int gcd(long long int a, long long int b) { if (a == 0) return b; if (b == 0) return a; if (a == b) return a; if (a > b) return gcd(a - b, b); return gcd...
/* * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Thu Feb 09 23:35:45 2017 // Host : TheMosass-PC running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } x *= f; } const int N = ...
#include <bits/stdc++.h> using namespace std; vector<int> v[300005]; int n, m, s; int edgeck[300005], Etype[300005]; pair<int, int> E[300005]; int vis[300005]; void bfs() { memset(vis, 0, sizeof(vis)); queue<int> que; que.push(s); while (!que.empty()) { int now = que.front(); q...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 7; const int M = 60; const int inf = 1e9 + 7; const long long base = 1e18; const double pi = acos(-1); const double ep = 1e-18; int n; int a[N]; void solve() { cin >> n; for (int i = 0; i < n; i++) scanf( %d , a + i); int ...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // // Module: jtag_bus.v // Project: NF2 (NF2 Control Network FPGA) // Description: NF2/CPCI bus interface. // // Provides synchronization logic for CPCI reg...
// synopsys translate_off `include "timescale.v" // synopsys translate_on `include "def_pippo.v" module tb_dsu_rx(clk, rst, RxD, RxD_data_ready, RxD_data, RxD_endofpacket, RxD_idle); input clk, rst, RxD; output RxD_data_ready; // onc clock pulse when RxD_data is valid output [7:0] RxD_data; parameter Baud = 115200;...
#include <bits/stdc++.h> using namespace std; const int N = 3000000 + 11; const int mod = 1e9 + 7; const int MAXN = 3000000 + 5; int n, m; int c[MAXN]; struct Node { int l, r; } a[MAXN]; int lowbit(int i) { return i & (-i); } long long sum(int x) { long long sum = 0; while (x) { su...
#include <bits/stdc++.h> using namespace std; string s; int l, r; inline void get() { l = 1; r = 2; printf( ? %d %d n , l, r); fflush(stdout); cin >> s; while (s[0] == y ) { l <<= 1; r <<= 1; printf( ? %d %d n , l, r); fflush(stdout); cin >> s; } } ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 77; int main() { int a, b; cin >> a >> b; int ans = 0; while (1) { if (a <= 0 || b <= 0) break; if (a < b) { a++; b -= 2; } else { b++; a -= 2; } if (a < 0 || b < 0) brea...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; char ch; bool v[111][111]; struct data { int x1, y1, s1, x2, y2, s2; void sv(int a, int b, int c, int d, int e, int f) { x1 = a; y1 = b; s1 = c; x2 = d; y2 = e; s2 = f; } } p[111][111][2...
/* * 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; const int MAXN = 3e5 + 10; int n, k; int v[MAXN]; int f[MAXN]; int search(int num) { int l = 1, r = n; while (l < r) { int mid = (l + r) / 2; if (v[mid] < num) { l = mid + 1; } else { r = mid; } } return l;...
#include <bits/stdc++.h> using namespace std; int n, k, a, b, q, d, ai, p, t, zb[200001], suma[800005], sumb[800005], za[200001], res; void build1(int a[], int v, int tl, int tr) { if (tl == tr) suma[v] = a[tl]; else { int tm = (tl + tr) / 2; build1(a, v * 2, tl, tm); build1(...
#include <bits/stdc++.h> using namespace std; long long n, m; pair<long long, long long> seg[500000 + 1]; long long dp[20 + 1][500000 + 1]; signed main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); cin >> n >> m; for (long long i = 1; i < n + 1; i++) { long long l, r...
#include <bits/stdc++.h> using namespace std; inline int read() { int first = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) { if (ch == - ) f = -1; } for (; isdigit(ch); ch = getchar()) { first = first * 10 + ch - 48; } return first * f; } const int...
/////////////////////////////////////////////////////////////////////////////// // // Module: fallthrough_small_fifo.v // Project: utils // Description: small fifo with fallthrough i.e. data valid when rd is high // /////////////////////////////////////////////////////////////////////////////// module fallth...
// ---------------------------------------------------------------------- // 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:...
#include <bits/stdc++.h> using namespace std; const int MX = 1000000000; int n, m, x, i, j, a[5050], f[5050]; int main() { scanf( %d%d , &n, &m); for (i = 3; i <= n; i++) f[i] = f[i - 1] + (i - 1) / 2; if (f[n] < m) { puts( -1 ); return 0; } for (i = 3; i <= n; i++) if (f[i...
`timescale 1 ns / 1 ps module axis_pulse_height_analyzer # ( parameter integer AXIS_TDATA_WIDTH = 16, parameter AXIS_TDATA_SIGNED = "FALSE", parameter integer CNTR_WIDTH = 16 ) ( // System signals input wire aclk, input wire aresetn, input ...
/** * 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...
module main; reg a, b; triand net; assign net = a; assign net = b; initial begin a = 'b0; b = 'b0; #1 if (net !== 1'b0) begin $display("FAILED -- a=%b, b=%b, net=%b", a, b, net); $finish; end a = 'b0; b = 'b1; #1 if (net !== 1'b0) begin $display("FAILE...
//====================================================================== // // vndecorrelator.v // ---------------- // von Neumann decorrelator for bits. The module consumes bits // and for every two bits consume will either emit zero or one bits. // // // Author: Joachim Strombergson // Copyright (c) 2014, Secworks Sw...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Clifford Wolf <> * Copyright (C) 2018 David Shah <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission...
module Control_tb (); reg irq, PC31; reg [5:0] OpCode, Funct; wire [2:0] PCSrc; wire [1:0] RegDst, MemtoReg; wire [5:0] ALUFun; wire RegWrite, ALUSrc1, ALUSrc2, Branch, MemWrite, MemRead, ExtOp, LuOp, Sign, Jump; Control con( .irq(irq), .PC31(PC31), .OpCode(OpCode), ...
//Legal Notice: (C)2011 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...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE revB.2 compliant I2C Master controller Top-level //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; struct Antenna { int iniLeft, iniRight; }; int main() { ios::sync_with_stdio(false); cin.tie(0); int nbAntennas, totLen; cin >> nbAntennas >> totLen; vector<Antenna> ants(nbAntennas); for (int iAnt = 0; iAnt < nbAntennas; ++iAnt) { ...
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) #pragma GCC optimize( unroll-loops ) using namespace std; long long power(long long a, long long b, long long md) { return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md))...
module control ( input [5:0] op, output [2:0] alu_op, output regDst0, regDst1, aluSrc, memToReg0, memToReg1, regWrite, output memRead, memWrite, branch, branch_ne, jump ); reg addi, andi, lw, sw, ori, beq, bne, j, jal, slti, r_format, x_found; always @(*) begin addi <= 1'b0; lw ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:23:45 11/28/2017 // Design Name: // Module Name: bram_controller // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, sum = 0, curr = 0, j = 0; vector<long long int> a(100000), res; cin >> n >> k; for (long long int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } if (sum % k) { cout << No ; } else { ...
#include <bits/stdc++.h> using namespace std; mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> T ceil(T a, T b) { return (a + b - 1) / b; } template <typename T> T binpow(T a, T b) { T res = 1; while (b > 0) { if (b & 1) res = res * a; a = ...
// (C) 2001-2017 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; vector<string> com; vector<int> num; vector<string> adj[1000010]; struct node { string s; int i; node() {} node(string x, int idx) { s = x; i = idx; } }; int toNum(string s) { int i, j, k; int l = s.length(); k = 1; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2014 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int n; int b[MAXN]; set<pair<int, int>, greater<pair<int, int> > > s; int ans[MAXN]; int main() { scanf( %d , &n); for (auto i = 0; i != n; i++) scanf( %d , &b[i]); for (auto i = 0; i != n; i++) { int j = (i + 1) % n...