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...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1000011; const long long INF = (1 << 29) + 123; const long long MOD = 1000000007; const long double PI = 4 * atan((long double)1); int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, w; cin >> n >> w; int l[n];...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:28:58 11/18/2013 // Design Name: top_module // Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Proyecto Final/tec-drums/top_module_test.v // Pr...
#include <bits/stdc++.h> using namespace std; struct node { int v, fr; node(){}; node(int a, int b) { v = a, fr = b; } } C[115 + 115]; long long f[115 + 115][115], K; int ar[115 + 115], n, m, P[115][115]; inline bool cmp(node a, node b) { return a.v < b.v; } inline void pluss(long long &p, lon...
#include <bits/stdc++.h> using namespace std; int Left[1000010]; int mini[1000010]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; string S; cin >> S; for (int i = 0; i < S.length(); i++) { if (S[i] == ( ) Left[i + 1] = Left[i] + 1; el...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, m = 0, sum = 0; cin >> n >> x; int *arr = new int[n]; for (long long i = 0; i < n; i++) cin >> arr[i], sum += arr[i]; if (sum > 0) while (sum > 0) { sum -= x; m++; } else while (sum < 0) { ...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_str...
// Double pumped single precision floating point add/sub // Latency = 9 kernel clocks // // (C) 1992-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...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_36x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ===========================================...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXH = 1000000; const int MAXW = 1000000; const int MAXN = 100000; const int MOD = 1000000007; typedef struct R { int x1, y1, x2, y2; } R; int h, w, n; int shead...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { std::cerr << name << : << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ...
//----------------------------------------------------------------------------- // The FPGA is responsible for interfacing between the A/D, the coil drivers, // and the ARM. In the low-frequency modes it passes the data straight // through, so that the ARM gets raw A/D samples over the SSP. In the high- // frequency mo...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
// (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 ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2017/07/10 10:07:18 // Design Name: // Module Name: clock_100kHz // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // ...
#include <bits/stdc++.h> using namespace std; const int N = 1000; int main(int argc, char *argv[]) { string s; vector<pair<char, int> > count; int n; cin >> s; n = s.size(); for (int i = 0; i < n;) { int cnt = 0; int prev = s[i]; while (s[i] == prev) { cnt++; ...
// +---------------------------------------------------------------------------- // GNU General Public License // ----------------------------------------------------------------------------- // This file is part of uDLX (micro-DeLuX) soft IP-core. // // uDLX is free soft IP-core: you can redistribute it and/or modify ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int N = 2e5 + 7; int n, m, i, j, a, b; int check(int x, int y) { int dis1 = abs(x - i); int dis2 = abs(y - j); if (dis1 % a == 0 && dis2 % b == 0) { int p = dis1 / a; int q = dis2 / b; if (p == q) ret...
#include <bits/stdc++.h> long long ans; int F[50000001], n, m, N; char str[10001]; void dfs(int x, int bit, int key) { if (x > 3) { if (bit) F[bit] += key; return; } dfs(x + 1, bit, key); int v = str[x] - a ; dfs(x + 1, bit | (1 << v), -key); } int main() { scanf( %d , &...
#include <bits/stdc++.h> using namespace std; const int MAXN = 300005, N = 333333; const int D = 1e9 + 7, inv2 = 5e8 + 4; int n, Q, a[MAXN], mul[N + 233], inv[N + 233]; int val[MAXN << 1]; int id[MAXN], w[MAXN]; int tim, len; struct node { int v, id; node() {} node(int vv, int ii) { v = vv, ...
#include <bits/stdc++.h> using namespace std; struct Node { int a, b, id; } p[100005]; bool mark[100005]; bool cmp1(const Node &p1, const Node &p2) { if (p1.b != p2.b) return p1.b > p2.b; else return p1.a < p2.a; } bool cmp2(const Node &p1, const Node &p2) { if (p1.a != p2.a) ...
#include <bits/stdc++.h> using namespace std; int n, m, tmp; long long A[1005]; long long B[1005]; long long Acost(int q) { q *= 4; long long ret = 0; for (int i = 1; i <= n; i++) { long long tmp2 = i * 4 - 2 - q; ret += A[i] * tmp2 * tmp2; } return ret; } long long Bcost(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 law...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, x, k = 0; cin >> n; vector<int> a; for (i = 0; i < n; i++) { cin >> x; a.push_back(x); } sort(a.begin(), a.end()); for (i = 0; i < n; i++) { if (a[i] % 2 != 0) k++; } int y = min(k, n - k); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); if (n == 1) { printf( a na nb nb n ); } else if (n == 2) { printf( aa nbb ncc ndd n ); } else if (n == 3) { printf( aab n ); printf( ccb n ); printf( baa n ); printf( bcc n ); ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { int n, i, j; cin >> n; vector<int> icons(n); for (i = 0; i < n; i++) { cin >> icons[i]; } vector<int> num; ...
module Seg7_integer(a_in , s_out); input [3:0] a_in; output [7:0] s_out; reg [7:0] temp; assign s_out = temp; always @(a_in) begin case (a_in) /*segdp ~ seg a*/ 4'b0000: temp = 8'b00111111; 4'b0001: temp = 8'b00000110; 4'b0010: temp = 8'b01011011; 4'b0011: temp = 8...
#include <bits/stdc++.h> #define ll long long #define II pair<int,int> #define fi first #define se second #define task test using namespace std; void Init(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); } int n; int a[200001]; int res; int d(II &a,II &b){ return ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const long long mod = 1e9 + 7; struct Matrix { int n, m; long long a[10][10]; Matrix() { memset(this->a, 0, sizeof(this->a)); } Matrix(int n, int m) { this->n = n; this->m = m; memset(this->a, 0, sizeof(thi...
#include <bits/stdc++.h> using namespace std; int main() { char no[20]; cin >> no; int len = strlen(no); int ans = (1 << len) - 2; for (int i = (len - 1), pos = 0; i >= 0; i--, pos++) { if (no[i] == 7 ) ans += (1 << pos); } cout << ans + 1 << endl; return 0; }
/* 2 to 1 MUX, select from two 32-bit input*/ module mux2to1for5bit(datain0,datain1, dataout, select); input [4:0] datain0, datain1; input select; output [4:0] dataout; reg [4:0] dataout; /*whenever datain0 or datain1 or select signals is changed*/ always @(datain0 or datain1 or select) begin if (select == 0) dat...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
/* * 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 <typename Tp> inline void outarr(Tp _begin, Tp _end, const char* _delim = ) { for (Tp current = _begin; current != _end; ++current) { std::cout << *current << _delim; } std::cout << n ; } using ll = int64_t; using pii = std::pair<...
module t; endmodule class C; function int f(); f = 17; endfunction extern function int g(); virtual function int f(); a; endfunction // int // pure virtual functions have no endfunction. C a; initial begin $display("hello world"); $display("a of f is %d, g is %d", a.f...
#include <bits/stdc++.h> struct TSubStr { TSubStr(const std::string& text, size_t begin, size_t end) : Text(text), Begin(begin), End(end) {} const std::string& Text; size_t Begin; size_t End; static inline size_t getId(const std::string& text, size_t begin, s...
`timescale 1 ns / 100 ps module helloonechar_tb #(parameter CLOCK_FREQ = 4800, parameter BAUD_RATE = 1200) (); reg ext_clock; wire uart_tx_pin; wire uart_tx_led; wire uart_clock_led; wire reset; /* uart tx */ wire uart_ready; reg [7:0] uart_data; reg uart_clock_enable; reg [7:0] count; wire uart_clock; ...
/** * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 07/02/2016 03:56:05 PM // Design Name: // Module Name: I_DESNORM_FIXED_TO_FLOAT // Project Name: // Target Devices: // Tool Versions: // Description: // // Depende...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
// file: Clock70MHz_tb.v // // (c) Copyright 2008 - 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 // laws. // // DISCLAIMER // This disclaimer is no...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n <= 2) { cout << -1; return 0; } if (n == 3) { cout << 210; return 0; } if ((n - 4) % 6 == 0) { cout << 1; for (int i = 0; i < n - 3; i++) cout << 0; cout << 50; ...
#include <bits/stdc++.h> using namespace std; long long m, n, x, y, p, q; int main() { cin >> n; for (long long k = 0; k < n; k++) { cin >> x >> y >> p >> q; m += (p - x + 1) * (q - y + 1); } cout << m; }
/** * $Id: axi_slave.v -01-21 11:40:39Z matej.oblak $ * * @brief Red Pitaya symplified AXI slave. * * @Author Matej Oblak * * (c) Red Pitaya http://www.redpitaya.com * * This part of code is written in Verilog hardware description language (HDL). * Please visit http://en.wikipedia.org/wiki/Verilog * for mor...
#include <bits/stdc++.h> using namespace std; const int INFint = 2147483647; const long long INF = 9223372036854775807ll; const long long MOD = 1000000007ll; const long double EPS = 1e-9; vector<int> p; vector<int> used; vector<vector<int> > g; long long ans = 0; void dfs(int v) { used[v] = 1; ...
#include <bits/stdc++.h> using namespace std; long long n, m, k, c, ans1, ans2, ans3, a[100005], dp[5]; pair<long long, long long> p[300005]; vector<long long> v; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; if (m == 0) { cout << -1 << n ; ...
#include <bits/stdc++.h> const int N = 300005; int t[N << 2], tag[N << 2], size[N << 2], st1[N], st2[N], tp1, tp2, n, x, y, a[N]; long long ans; void up(int x) { int t1 = t[x << 1] + tag[x << 1], t2 = t[x << 1 | 1] + tag[x << 1 | 1]; if (t1 == t2) size[x] = size[x << 1] + size[x << 1 | 1]; 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...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
`timescale 1ns / 1ns module system_tb(); reg [15:0] mem [ 0:262143 ]; reg clk; reg reset_b = 1'b1; wire [17:0] addr; wire [15:0] data; wire [15:0] data_in; reg [15:0] data_out; wire ramwe_b; wire ramoe_b; wire ramcs_b; reg rxd = 1'b1; ...
/* Copyright (c) 2014 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,...
/** * 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 gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 1000000; const int OPAND = 2, OPOR = 3, OPXOR = 4, OPNOT = 5; int n; int op[MAXN]; vector<int> ch[MAXN]; int res[MAXN]; int ans[MAXN]; int dfsres(int at) { if (op[at] == 0 ...
#include <bits/stdc++.h> using namespace std; int main() { int ntests; cin >> ntests; while (ntests--) { int n, k, a, b; cin >> k >> n >> a >> b; if (k <= 1ll * n * b) cout << -1 << endl; else { long long x = (k - 1ll * n * b - 1) / (a - b); if (x > n) 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...
#include <bits/stdc++.h> int cmp(const void *a, const void *b) { return (*(int *)a - *(int *)b); } long long int mod; void f(long long int p) { long long ans = 1, n = 3; while (p) { if (p & 1) ans = (ans * n) % mod; n = (n * n) % mod; p = p >> 1; } ans--; while (ans < 0) ans ...
/* reset...init...save.start_write.stop_write.restore.start_read(compare).stop_read.loop error... */ module mem_tester( clk, rst_n, led, // LED flashing or not // SRAM signals SRAM_DQ, // sram inout databus SRAM_ADDR, // sram address bus SRAM_UB_N, SRAM_LB_N, SRAM_WE_N, ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20); const int MAX_N = (int)1e7; vector<bool> isPrime(MAX_N, true); isPrime[1] = false; for (int i = 2; i < MAX_N; i++) { ...
#include <bits/stdc++.h> using namespace std; const int MAX = 510; int n, k; int a[MAX], b[MAX]; void init() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; cin >> k; for (int i = 1; i <= k; i++) cin >> b[i]; } bool valid(int i, int l, int r) { int x = i, y = i, sum = a[i]; w...
#include <bits/stdc++.h> long long dx[4] = {0, -1, 0, 1}; long long dy[4] = {1, 0, -1, 0}; using namespace std; class pa3 { public: long long x, y, z; pa3(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {} bool operator<(const pa3 &p) const { if (x != p.x) return x < p...
#include <bits/stdc++.h> using namespace std; struct segment { int l, r, fu; bool operator<(const segment &temp) const { return l < temp.l; } }; segment sg[5000]; int cnt_sg; const int inf = 1e9; int xx[400], yy[400]; int cnt_x, cnt_y; struct rectangle { int lx, ly, rx, ry; }; rectangl...
#include <bits/stdc++.h> const int N = 1e5 + 5, M = 2e5 + 5, logN = 17 + 1; int n, m, root, idx, a[N], f[N][logN], dfn[N], seq[N], sz[N], dep[N]; int tot, lnk[N], ter[M], nxt[M]; long long seg[N << 2], tag[N << 2]; void pushup(int rt) { seg[rt] = seg[rt << 1] + seg[rt << 1 | 1]; } void build(int rt, int l, ...
#include <bits/stdc++.h> using namespace std; long long a[20]; long long b[20][10][10]; long long c[20][10][10]; long long dp(long long n, int p) { long long n0 = n; long long ans = 0; while (n >= 10) { long long m = n; long long e = 0; while ((m + 10) % (a[e] * 10) < 10) e++; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n), b(m); int an; cin >> an; for (int i = 0; i < an; ++i) { int t; cin >> t; a[t] = 1; } int bn; cin >> bn; for (int i = 0; i < bn; ++i) { int t; ci...
// // 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...
module maquina_4_estados(clock_50mhz, clock_1hz, segmentos, anodos,estado); input clock_50mhz; //entrada de oscilacion del cristal externo output clock_1hz; //clock 1 segundo output reg [6:0] segmentos = 7'b3F; //apagar segmentos output reg [1:0] anodos = 0; //en...
#include <bits/stdc++.h> using namespace std; int main() { long long i, n, x, j, c = 0; cin >> n >> x; if (n >= x) { for (i = 2; i <= n; i++) { if (x % i == 0 && (x / i) <= n) c++; } cout << c + 1 << endl; } else { for (i = 2; i <= n; i++) { if (x % i == 0 && ...
#include <bits/stdc++.h> using namespace std; const int NUM = 2e5 + 10; struct node { int index, q; bool operator<(const node &a) const { return index + q < a.index + a.q; } } no[NUM]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d%d , &no[i].index, &no[i].q); ...
/* * 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...
/////////////////////////////////////////////////////////////////////////////// // $Id: small_fifo.v 1998 2007-07-21 01:22:57Z grg $ // // Module: fallthrough_small_fifo.v // Project: utils // Description: small fifo with fallthrough i.e. data valid when rd is high // // Change history: // 7/20/07 -- Set nearly full ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7, inf = 1061109567; const long long infll = 4557430888798830399; const int N = 2e5 + 5; int n, q, a[N], cnt[N]; bool last[N], first[N]; vector<int> app[N]; bool start[N]; signed main() { ios_base::sync_with_stdio(false); cin....
module tracemon_tb(); reg[31:0] wave2decode_instr_pc; reg[31:0] wave2decode_instr; reg wave2decode_instr_valid; reg[8:0] wave2decode_sgpr_base; reg[9:0] wave2decode_vgpr_base; reg[9:0] wave2decode_lds_base; reg salu2exec_wr_exec_en; reg[63:0] salu2exec_wr_exec_value; reg salu2exec_wr_vcc_en; reg[63:0] sa...
#include <bits/stdc++.h> using namespace std; int n, t, k; vector<int> g[200010]; int par[200010]; int nodeId; int leaf; vector<int> deep[200010]; int a[200010]; void createGraph(int x, int level) { if (level > t) return; for (int i = 1; i <= a[level]; i++) { g[x].push_back(++nodeId); ...
#include <bits/stdc++.h> int main(void) { char a[3][3]; scanf( %3s , a[0]); scanf( %3s , a[1]); scanf( %3s , a[2]); for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) if (a[i][j] != a[((((i)-1) * -1) + 1)][((((j)-1) * -1) + 1)]) { puts( NO ); return EXIT_SUCC...
#include <bits/stdc++.h> using namespace std; int helper(long long int edges, long long int nodes) { if (edges == nodes - 1) return nodes - 1; edges -= nodes - 1; return nodes - 1 - ceil((1.0 + sqrt(1.0 + 8.0 * edges)) / 2.0); } int main() { ios::sync_with_stdio(false); ; cin.tie(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 law...
/* * * Copyright (c) 2013 * * * * 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 distributed in the ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6, maxm = 1e6; unsigned int degree[maxn + 10], blk[maxn + 10]; namespace find { unsigned int fa[maxn + 10], siz[maxn + 10]; inline void Init(const unsigned int n) { iota(fa, fa + n + 1, 0); fill(siz, siz + n + 1, 1); } unsigned int...
#include <bits/stdc++.h> using namespace std; long long a[200010]; long long vis[200100]; long long x, n, k, sum, y; string s; long long dfs(long long x, long long k, long long y) { if (x == y) return k; return dfs(a[x], k + 1, y); } long long poww(long long ba) { if (ba == 0) return 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int a, b, x, y, n; cin >> a >> b >> x >> y >> n; cout << min(max(x, a - n) * max(y, b - n + min(n, a - x)), max(y, b - n) * max(x, a - n + min(n, b - y))) <<...
/** * 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> typedef long long ll; using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); ll t; cin >> t; while(t--){ ll n; cin >> n; ll x[n]; for(ll i=0; i<n; i++){ cin >> x[i]; } ...
/* * SPI input timing: * CS is active low * CLK is rising edge * * The clk_pin is clk/2. * TODO: generated clk_pin with a DDR output so that it is one bit per cycle. */ module mpc4922( input clk, input reset, // physical interface output cs_pin, output clk_pin, output data_pin, // logical interface inp...
/////////////////////////////////////////////////////////////////////////////// // // Project: Aurora 64B/66B // Company: Xilinx // // // // (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected unde...
#include <bits/stdc++.h> using namespace std; const int max_n = 300011, log_n = 32, max_m = 111, mod = 1000000007, inf = 1011111111; const long double eps = 1e-7; struct bor { stack<pair<int, int> > st; int t[max_n][27], res[max_n], sz[max_n], n; bor() { for (int i = 0; i < max_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 law...
//----------------------------------------------------- // Design Name : hw2_B_testbench // File Name : hw2_B_testbench.v // Function : This program will test hw2_B.v // Coder : hydai //----------------------------------------------------- `timescale 1 ns/1 ns module hw2_B_testbench ; reg in; reg clk, rst_n; wire o...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2017 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-...
#include <bits/stdc++.h> using namespace std; template <typename T> void chmin(T &x, const T &y) { if (x > y) x = y; } template <typename T> void chmax(T &x, const T &y) { if (x < y) x = y; } inline int read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (...
// megafunction wizard: %ALTLVDS% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altlvds_rx // ============================================================ // File Name: LVDS_AD.v // Megafunction Name(s): // altlvds_rx // // Simulation Library Files(s): // altera_mf // ========================...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:640000000 ) using namespace std; const double eps = 1e-9; const double pi = acos(-1.0); template <class T> T sqr(T x) { return x * x; } const int maxn = (int)(1e5) + 10; const int inf = (int)(2e9); struct Edge { int to, w, num; Edg...
// (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 ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:08:56 05/21/2016 // Design Name: // Module Name: MAIN // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenci...
#include <bits/stdc++.h> using namespace std; void dfs(const vector<vector<int> >& edge_list, vector<bool>& visited, int i, int& edges) { visited[i] = true; for (int j : edge_list[i]) { if (!visited[j]) dfs(edge_list, visited, j, edges); if (j >= i) ++edges; } } int main() { ...
#include <bits/stdc++.h> using namespace std; pair<int, int> pts[1001]; int n; int main() { cin >> n; for (int i = 0; i <= n; i++) { scanf( %d%d , &pts[i].first, &pts[i].second); } int ans = 0; char last = U ; for (int i = 1; i < n; i++) { char cur; if (pts[i].first ==...
#include <bits/stdc++.h> using namespace std; int a[200000]; int b[200000]; int c[200001]; int t[200001]; vector<int> x; vector<int> ans; int add(int r, int cr, int d) { if (c[r] == t[r]) cr--; t[r] += d; if (c[r] == t[r]) cr++; return cr; } int main() { int n, m, p, i, j; sc...
`include "constants.v" module fp16_smult ( input wire [31: 0] a, input wire [31: 0] b, output reg [31: 0] prod ); function [31: 0] fp16_mult; input [31: 0] a; input [31: 0] b; reg [31: 0] prod; reg [31: 0] product_hi; reg [31: 0] product_lo; reg [31: 0] A; reg [31: 0] B; reg [31: 0] C; reg [31: 0] ...
// Verilog netlist generated by Workcraft 3 module VME (d, lds, dtack, dsr, dsw, ldtack); input dsr, dsw, ldtack; output d, lds, dtack; wire U1_ON, IN_BUBBLE3_ON, IN_BUBBLE5_ON, U7_ON, IN_BUBBLE10_ON, OUT_BUBBLE1_ON, U14_ON, IN_BUBBLE16_ON, IN_BUBBLE18_ON, U20_ON, IN_BUBBLE23_ON, IN_BUBBLE25_ON, IN_BUBBLE28...
#include <bits/stdc++.h> using namespace std; const int N = 1000004; int a[N]; int spf[N], prime[N]; int cntp[N]; void sieve() { int i, j; for (i = 2; i < N; i++) { if (!prime[i]) { for (j = 1; 1LL * i * j < N; j++) { prime[i * j] = 1; if (!spf[i * j]) spf[i * j] = ...
/** * 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...