text
stringlengths
59
71.4k
/** * 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 Stierlitz: * * https://github.com/asciilifeform/Stierlitz * *************************************************************************/ /**************...
// DESCRIPTION: Verilator: Verilog Test module // This file ONLY is placed into the Public Domain, for any use, // without warranty. // SPDX-License-Identifier: CC0-1.0 `timescale 1ns / 1ps module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc = 0; reg [63:0] crc; reg [31:0...
#include <bits/stdc++.h> using namespace std; const int N = 200000 + 5, inf = 2e9; const long double EPS = 1e-9L; vector<pair<int, int> > pairs[26]; vector<int> mn[26]; int leftSub[N], rightSub[N]; void computeSub(string& a, string& b, int ans[]) { for (int i = 0; i < (int)(a).size(); ++i) { int...
#include <bits/stdc++.h> using namespace std; int n; long long a[200100]; long long t[800800]; long long d[800800]; void build(int v, int tl, int tr) { if (tl == tr) { t[v] = a[tl]; } else { int tm = (tl + tr) / 2; build(2 * v, tl, tm); build(2 * v + 1, tm + 1, tr); t[v...
module fetch(IR_load_mux,new_IR_multi,equ,pr2_IR ,pr3_IR ,pr4_IR, pr5_IR,fromPipe2_PCim, fromPipe2_970, fromPipe3RFOut, fromPipe3PCInc, fromPipe4_Aluout, fromPipe5Mem, PCWrite, PCOut, IROut, incPCOut, clk, reset); output [15:0] PCOut, IROut, incPCOut; input [15:0]new_IR_multi; wire [15:0] next_IR;//read from instru...
`include "bsg_defines.v" `include "config_defs.v" module config_snooper_bind (input clk, // this reflects the destiniation domain clock input [data_max_bits_lp - 1 : 0] id_o, input [data_max_bits_lp - 1 : 0] data_o); logic [data_max_bits_lp - 1 : 0] id_o_r, id_o_n; logic [data_max_bits_lp - 1 : 0] da...
#include <bits/stdc++.h> using namespace std; const int Maxn = 14; const int INF = 0x3f3f3f3f; int N, M; vector<int> G[Maxn + 5]; void addedge(int u, int v) { G[u].push_back(v), G[v].push_back(u); } int f[(1 << Maxn) + 5]; pair<int, int> last[(1 << Maxn) + 5]; int lasts[(1 << Maxn) + 5]; bool go[Max...
`include "timescale.v" module fb_slave_mac (MRxClk, MRxDV, MRxD, Reset, TxData, SlaveDataStartCnt, SlaveDataEndCnt, LastSlave, TotalFrmNibbleCnt, MTxD, MTxEn, RxData, RxValid, RxRamAddr, TxRamAddr CrcError, StateIdle, StatePreamble, StateFFS, StateData, StateSlaveData, StateSl...
#include <bits/stdc++.h> using namespace std; vector<int> edge[80005]; int cnt[80005]; unsigned long long ret; int n; void dfs(int v, int u) { cnt[v] = 1; unsigned long long val = 1ull * n * (n - 1) / 2ull; for (int i = 0; i < edge[v].size(); i++) { int to = edge[v][i]; if (to == u) ...
#include <bits/stdc++.h> using namespace std; int a, b, c; unsigned long ans = 0; unordered_map<int, int> um; void eval(int x) { int t = 0; for (int i = 1; i <= sqrt(x); ++i) { if (i * i == x) t += 1; else if (x % i == 0) t += 2; } ans += t; um[x] = t; } int...
module fmrv32im_reg ( input RST_N, input CLK, input [4:0] WADDR, input WE, input [31:0] WDATA, input [4:0] RS1ADDR, output reg [31:0] RS1, input [4:0] RS2ADDR, output reg [31:0] RS2, // for custom instruction output [31:0] x10, output [31:0] x11, output [31...
#include <bits/stdc++.h> int a[3005]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; ++i) scanf( %d , &a[i]); int cnt = 0; for (int i = 1; i < n; ++i) for (int j = 0; j < i; ++j) if (a[i] < a[j]) ++cnt; if (cnt & 1) printf( %d , cnt * 2 - 1); else p...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; const long long MOD = 998244353; int n, k; vector<int> a, b; long long ans[MAXN][3][5]; bool found[MAXN][3][5]; long long mul(long long a, long long b) { return (a * b) % MOD; } long long dp(int pos, int last, int var) { if (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; pair<int, int> a[300005]; vector<int> v[300005]; int cnt; int main(int argc, char** argv) { int T; cin >> T; while (T--) { int n; cin >> n; a[0] = {-1, 0}; for (int i = 1; i <= n; i++) scanf( %d , &a[i].first), a[i].second = i; ...
/** * 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 = 1e5 + 5; long long a[maxn], b[maxn], dp[maxn]; int q[maxn]; int head = 0, tail = 0; double A(int i, int j) { return dp[i] - dp[j]; } double B(int i, int j) { return b[i] - b[j]; } int main() { ios::sync_with_stdio(false); cin.tie(0);...
module decoder (cx,d); output [7:0] d; input [12:0] cx; reg [7:0] d; reg [4:0] s; reg [12:0] cx1; parameter s0 = 5'b11001; parameter s1 = 5'b11000; parameter s2 = 5'b10010; parameter s3 = 5'b00010; parameter s4 = 5'b10110; parameter s5 = 5'b10000; parameter s6 = 5'b11100; parameter s7 = 5'b00000; para...
#include <bits/stdc++.h> using namespace std; int n; char a[15][15]; vector<long long int> dp[1 << 14][14]; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; } } for (int...
#include <bits/stdc++.h> using namespace std; int main() { long long n, i, s, f, h, co = 0, sum, savesum, res, re, savere; cin >> n; long long a[n + 1]; for (i = 1; i <= n; i++) { cin >> a[i]; } cin >> s >> f; h = f - s; queue<long long> qu; i = 1; sum = 0; savesum ...
#include <bits/stdc++.h> using namespace std; int a[300005], b[300005], f[300005], ori[300005]; queue<int> q; int main() { int n, i, j, k, u, v, up = n; scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d , &a[i]); } for (i = 1; i <= n; i++) { scanf( %d , &b[i]); } q.pu...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5100; int n, T; int pr[MAXN], t[MAXN]; double rest[MAXN]; double dp[MAXN][MAXN]; double pw[MAXN]; int main() { ios_base::sync_with_stdio(false); cin >> n >> T; for (int i = 1; i <= n; ++i) { cin >> pr[i] >> t[i]; doub...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:15:34 03/28/2014 // Design Name: next_pc // Module Name: D:/XilinxProject/CPU/pc_test.v // Project Name: CPU // Target Device: // Tool versions: // Descriptio...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Thu Sep 14 10:15:34 2017 // Host : PC4719 running 64-bit Service Pack 1 (...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module sync_master( input wire ...
/** * 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 Not(input in, output out); nand g(out, in, in); } CHIP Or { IN a, b; OUT out; PARTS: Not(in=a, out=nota); Not(in=b, out=notb); Nand(a=nota, b=notb, out=out); } CHIP Xor { IN a, b; OUT out; PARTS: Nand (a=a, b=b, out= AnandB); Or (a=a...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, a[200010], m = INT_MAX; string s; cin >> n >> s; for (int i = 0; i < n; i++) cin >> a[i]; long long int j = -1; for (long long int i = 0; i < s.length(); i++) { if (s[i] == R ) j = i; else { ...
module pipeline5( clk_in, RST, ctrl_in, data, addr, data_out, addr_out, en_out ); // faz o include dos parameters das instrucoes `include "params_proc.v" // input / output input clk_in, RST; input [CTRL_WIDTH-1:0] ctrl_in; input signed [DATA_WIDTH-1:0] data; input [REG_ADDR_WIDTH-1:0] ...
#include <bits/stdc++.h> using namespace std; int inline read() { int num = 0, neg = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) neg = -1; c = getchar(); } while (isdigit(c)) { num = (num << 3) + (num << 1) + c - 0 ; c = getchar(); } return num * n...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; int x = min(a, b / 2); int y = min(x, c / 4); cout << y * 7; return 0; }
///////////////////////////////////////////////////////////////////// //// //// //// Non-restoring signed by unsigned divider //// //// Uses the non-restoring unsigned by unsigned divider //// //// ...
#include <bits/stdc++.h> using namespace std; const int mn = 100010; long long x[mn], y[mn]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %lld %lld , &x[i], &y[i]); if (n <= 4) { printf( YES n ); return 0; } bool flag = 0; for (int i = 1; i <= ...
#include <bits/stdc++.h> int main(void) { unsigned short int m, n, c; scanf( %hu%hu , &m, &n); c = m * n; int i = 1; while (i) { if (c >= 2 * i) i++; else break; } printf( %d n , (i - 1)); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N; scanf( %d , &N); if (N <= 2) printf( %d , -1); else { for (int i = N; i >= 1; i--) { printf( %d , i); printf( ); } } return 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; vector<int> adj[200001]; int dis[200001]; int par[200001]; void addEdge(int u, int v) { adj[u].push_back(v); adj[v].push_back(u); } void dfs(int src, int parent, int dist) { dis[src] = dist; par[src] = parent; for (int child : adj[src]) { ...
/* * Integer conversion module for Zet * Copyright (C) 2008-2010 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 * Foundatio...
/** * 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> long long n, k, l, m, ans; struct mat { long long a[3][3]; } A, B; inline mat operator*(mat x, mat y) { mat c; memset(c.a, 0, sizeof c.a); for (int k = (0), __ = (2); k < __; ++k) for (int i = (0), __ = (2); i < __; ++i) for (int j = (0), __ = (2); j < __; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s; cin >> s; int sz = s.size(); s = X + s; int k; cin >> k; int ans = 0; for (int i = 1; i <= sz; i++) { for (int len = 1; len <= 400; len++) { ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double eps = 1e-6; const int maxn = 3e5 + 10; const int maxm = 1e6 + 10; const long long mod = 998244353; int a[maxn], b[maxn]; bool judge(int mid, int h) { int temph = h; for (int i = 0; i < mid; i++) b[i] = a[i]; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; int sz[maxn], N, M; int main() { scanf( %d%d , &N, &M); memset(sz, 0, sizeof(sz)); vector<int> cnt; cnt.resize(N); int a, b; for (int i = 1; i <= M; i++) { scanf( %d%d , &a, &b); a--, b--; cnt[a]+...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2019 by Roman Popov. // SPDX-License-Identifier: CC0-1.0 module dut #( parameter DEPTH = 16, parameter WIDTH = 32, parameter RAM_SPLIT_WIDTH = 16 ) ( output l...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2, typename T3> struct pair3 { T1 first; T2 second; T3 third; }; template <typename T1, typename T2, typename T3, typename T4> struct pair4 { T1 first; T2 second; T3 third; T4 fourth; }; const long...
module mojo_top( // 50MHz clock input input clk, // Input from rst button (active low) input rst_n, // cclk input from AVR, high when AVR is ready input cclk, // Outputs to the 8 onboard leds output[7:0]led, // AVR SPI connections output spi_miso, input spi_ss, input spi_...
/* Simple external interrupt controller for MIPSfpga+ system * managed using AHB-Lite bus * Copyright(c) 2017 Stanislav Zhelnio * https://github.com/zhelnio/ahb_lite_eic */ module priority_encoder255 ( input [ 255 : 0 ] in, output reg detect, output reg [ 7 : 0 ] out ); wire [...
#include <bits/stdc++.h> using namespace std; long long n, i, m = 1000000007, a, b; int main() { cin >> n; a = 1, b = 1; for (i = 0; i < 3 * n; i++) a = (a * 3) % m; for (i = 0; i < n; i++) b = (b * 7) % m; cout << (a - b + m) % m; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; while (t--) { int n; cin >> n; long long int a[n + 1]; int o = 0, idx, z = 0; long long int maxo = -1000000007; vector<int> v, v0; ...
/** * 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 ll = long long; void io() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int N = 1e5 + 5; vector<int> g[N]; int sz[N], parent[N], done[N]; int lvl[N]; void dfs(int u, int p) { sz[u] = 1; for (int v : g[...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: MossbauerLab // Engineer: EvilLord666 (Ushakov MV) // // Create Date: 11:24:46 09/19/2017 // Design Name: // Module Name: messbauer_test_environment // Project Name: // Target Devi...
/** * 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 two { long long int f, s; }; signed main() { long long int n; cin >> n; map<string, set<string> > mp; while (n--) { string str; cin >> str; for (long long int i = 0; i < str.size(); i++) { string tmp = ; ...
/* * Maze rom file #1. * Format: each byte indicates maps row. * Opened cell is marked as True (1) * Closed cell is marked as False (0) * * Start / end point format * * +---------+---------+------+------+------+------+------+------+ * |Preserved|Preserved|row(2)|row(1)|row(0)|col(2)|col(1)|co...
#include <bits/stdc++.h> #define dumb ios_base::sync_with_stdio(false);cin.tie(NULL); typedef long long ll; using namespace std; #define modulo 1000000007; bool isprime(long long n) { for(long long int i=2;i*i<=n;i++) { if(n%i==0) return 0; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; struct ask { int l, r, cur; } tmp; long long pre[maxn], suf[maxn], s[maxn], d[maxn], h[maxn], ans[maxn]; vector<ask> V, W; int n, m, a, b; long long solve(int l, int r, vector<ask> &V) { if (l == r) return 0; int mid = (l...
#include <bits/stdc++.h> using namespace std; template <typename T> inline T ABS(T a) { return a > 0 ? a : -a; } template <typename T> inline T MIN(T a, T b) { return a < b ? a : b; } template <typename T> inline T MAX(T a, T b) { return a > b ? a : b; } template <typename T> inline ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 << 17; pair<int, int> v[MAXN]; set<pair<int, int> > ans; queue<int> Q; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> v[i].first >> v[i].second; if (v[i].first == 1) Q.push(i); } while (!Q.em...
/* * Copyright (c) 2001 Stephen Williams () * * 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) * ...
// (c) Copyright 1995-2014 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 ...
/** * 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 mod1(input logic [1:0] reg1[4], input logic reg2[5][6], input logic [1:0] [3:0] [2:0] reg4); endmodule module mod2(output logic [1:0] reg1[4], output logic [1:0] [3:0] [2:0] reg4); endmodule module dut ( /*AUTOINPUT*/ // Beginning of...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; cin >> t; while (t--) { long long int n, i, j, k, sum = 0, ev = 0, ze = 0; string s; cin >> s; n = s.length(); for (i = 0...
#include <bits/stdc++.h> using namespace std; int main() { double v, d, l, g, r; cin >> l >> d >> v >> g >> r; double t; t = d / v; double k = 0; while (k <= t) { k += g; if (t < k) { t += (l - d) / v; cout << setprecision(8) << t; exit(0); } k...
//Legal Notice: (C)2017 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 associate...
/** * 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 (C) 2009 Onno Kortmann <> * 2015 Klaus Rudolph <> * * 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, or * (at your option) a...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; int arr[maxn]; int main() { int T; cin >> T; while (T--) { int n; cin >> n; for (int i = 0; i < n; ++i) cin >> arr[i]; for (int i = 0; i < n; ++i) { if (i % 2) { if (arr[i] > 0) arr[i]...
#include <bits/stdc++.h> using namespace std; void cline() { cout << n ; } template <typename T, typename... V> void cline(T t, V... v) { cout << t; if (sizeof...(v)) cout << ; cline(v...); } void cspc() { cout << ; } template <typename T, typename... V> void cspc(T t, V... v) { ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; map<char, int> mp; for (int i = 0; i < s.length(); i++) { mp[s[i]]++; } int mn; set<int> st; set<int>::iterator it; st.insert(mp[ B ]); st.insert(mp[ u ] / 2); st.insert(mp[ l ]); st....
#include <bits/stdc++.h> using namespace std; int main() { long long int l, r, x, y, k; cin >> l >> r >> x >> y >> k; for (long long int i = x; i <= y; ++i) { if (k * i >= l && k * i <= r) { cout << YES << endl; exit(0); } } cout << NO << endl; }
module cache_test(); reg clk; reg re, we, we2, we3; reg [31:0] address, writedata; wire [31:0] readdatacache; wire hit, miss, dirty; // test memory_system DUT(clk, re, we, we2, we3, address, writedata, readdatacache, hit, miss, dirty); // generate clock to sequence tests alwa...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000000 + 7; int main() { string s; long long n; cin >> n; long long a[n]; for (int i = 0; i < n; ++i) cin >> a[i]; long long x = 0, y = n - 1, z = 0; while (x <= y) { if (max(a[x], a[y]) < z) break; e...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int cases; scanf( %d , &cases); while (cases--) { int n, p; scanf( %d%d , &n, &p); for (int i = 2; i <= n; i++) { printf( %d %d n , 1, i); } for (int i = 2; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; struct node { long long a, sum; } t, tt; vector<node> vec[300005]; long long cost[300005], in[300005], dp[300005][2], vis[300005]; queue<node> que; int main(void) { long long i, j, n, m, a, b, c; long long ans; scanf( %lld , &n); ans = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); printf( %d n , (n & 1) ? (n - 1) + (n - 1) * ((n - 3) / 2) / 2 : (n - 2) * (n - 2) / 4 + (n - 2)); if (n & 1) { for (int i = 2; i <= n; i += 2) { printf( %d %d %d %d n , 3, 1, ...
#include <bits/stdc++.h> using std::make_pair; using std::pair; const int N = 3e5 + 1e3; int n, k; int tot, rt; struct Pair { int l, r, pos, v1; bool operator<(const Pair m) const { return v1 > m.v1; } } p1[N], p2[N]; int sum[N << 4], ls[N << 4], rs[N << 4], mn[N << 4]; int r[N], a[N], mx[N], ...
#include <bits/stdc++.h> using namespace std; int getint() { unsigned int c; int x = 0; while (((c = getchar()) - 0 ) >= 10) { if (c == - ) return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - 0 ); } while (((c = getchar()) - 0 ) < 10); return x...
/** * 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 2013, Homer Hsing <> * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
#include <bits/stdc++.h> using namespace std; using LLI = long long; long long NWD(long long blep, long long b) { return (b == 0) ? blep : NWD(b, blep % b); } long long NWW(long long blep, long long b) { return blep / NWD(blep, b) * b; } const int MX = 3e5 + 400; int n, T[MX]; long long ans[MX]; v...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: ccnu // Engineer: Poyi Xiong // // Create Date: 01/12/2017 12:00:21 PM // Design Name: // Module Name: Clock_SR_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Depend...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
#include <bits/stdc++.h> using namespace std; const int MIN = 1e3 + 2; const int MXN = 1e6 + 3; const int INF = 1e9 + 7; const long long LINF = 1e18 + 15; const double EPS = 1e-9; int s, x1, x2; int t1, t2; int p, d; int main() { cin >> s >> x1 >> x2; cin >> t1 >> t2; cin >> p >> d; ...
#include <bits/stdc++.h> using namespace std; int mod = 1000000007; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } inline long long toll(string s) { long long v; istringstream sin(s); sin >> v; return v; } template <class T> inline string ...
// (c) Copyright 1995-2016 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 ...
/* * 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...
// verilog mode bug1346 testcase module design(/*AUTOARG*/); parameter w1 = 2; parameter w2 = 4; parameter w3 = 256; input [w1:0] i0; input [w2:0] i1; output [w2*w1 :0] y10; // 8:0 output [w2/w1 :0] y11; // 2:0 output [w2+w1 :0] y12; // 6:0 output [w2-w1 :0] y13; // 2:0 ou...
#include <bits/stdc++.h> int n, sum, ans[6050]; bool isprime(int x) { if (x < 2 || (x & 1) == 0) { return 0; } for (int i = 2; i * i <= x; ++i) { if (x % i == 0) { return 0; } } return 1; } int main() { scanf( %d , &n); sum = n * (n + 1) / 2; if (isprime...
#include <bits/stdc++.h> using namespace std; template <class T> void show(T *a, int n) { for (int i = 0; i < n; i++) cout << a[i] << ; puts( ); } template <class T> void queue_clear(T *a, int n) { for (int i = 0; i < n; i++) { while (!a->empty()) a->pop(); } } template <class...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// module hilbert(CLK,RST,ED,START,DReal,DImag,RDY,DOReal,DOImag); parameter total_bits = 32; input CLK; input RST; input ED; input START; input [total_bits-1:0] DReal; input [total_bits-1:0] DImag; output re...
// 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 : Mon Feb 20 13:53:00 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> long long stk[300001][3], top = 1, n, m, best = 1, nownum, K, B; long long eval(long long x) { return (K + stk[x][0]) * stk[x][2] + B + stk[x][1]; } double intersect(long long x, long long y) { return (double)(stk[x][0] - stk[y][0]) / (stk[y][1] - stk[x][1]); } bool comp(lon...
// (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 ...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; for (int i = 0; i <= t / (1234567); i++) { for (int j = 0; j <= t / 123456; j++) { if (t - (i * 1234567) - (j * 123456) >= 0 && ((t - (i * 1234567) - (j * 123456)) % 1234 == 0)) { cout <...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int n, m, p; const double PI = acos(-1); vector<int> a, b; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; cin >> n >> m >> p; for (int i = (int)1; i <= (int)n; i++) { int x;...
//Listing 9.3 module kb_code // #(parameter W_SIZE = 2) // 2^W_SIZE words in FIFO ( input wire clk, reset,scan_done_tick, input wire [7:0] scan_out, output reg got_code_tick ); // constant declaration localparam BRK = 8'hf0; // break code // symbolic state declaration localparam ...