text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int N = 5010; const int MOD = 1000000007; int n, x[N], y[N], w[N][N], vis[N]; inline void dfs(int v, int val) { for (int u = 0; u < n; u++) { if (w[v][u] > val) { if (vis[u] == vis[v]) throw 0; if (vis[u] != -1) continue; vi...
// // Copyright (c) 1999 Stephan Boettcher () // // 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) //...
// 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 [63:0] crc; reg [63:0] sum; wire r1_en /*verilator ...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const int N = (int)(5e5) + 7; int cnt[N]; int last[N]; int slast[N]; int pcnt[N]; long long psum[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin ...
`include "hrfp_defs.vh" module hrfp_add #(parameter PIPELINESTAGES=5) (input wire clk, input wire [`MSBBIT:0] op3_a, op3_b, input wire [30:0] mantissa_3_align0, mantissa_3_align1, input wire expdiff_msb_3, output reg [`MSBBIT:0] result_4, output reg [30:0] mantissa_4, output reg [7:0] zer...
/* * 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; struct point { int x, y; point() : x(0), y(0) {} point(int x, int y) : x(x), y(y) {} point operator-(const point& p) const { return point(x - p.x, y - p.y); } int dot(const point& p) const { return x * p.x + y * p.y; } int cross(const point& p) c...
#include <bits/stdc++.h> using namespace std; const int MAX = 200200; vector<int> adj[MAX]; int ch[MAX], sz, from[MAX], dpthMx[MAX], dpthMn[MAX], n; void dfs(int cur, int par) { for (auto i : adj[cur]) if (i != par) { dfs(i, cur); dpthMn[cur] = min(dpthMn[cur], dpthMn[i] + 1); ...
#include <bits/stdc++.h> using namespace std; struct node { long long c, f, l; }; bool operator<(node a, node b) { return a.f < b.f; } long long n, dx, fx, bn, tot, i, tf, fn, first, xn, sum, xx; node a[100004], b[100004]; bool can; int main() { cin >> n >> dx >> fx; bn = -1; tot = 0; ...
#include <bits/stdc++.h> #pragma GCC optimize( O2,unroll-loops ) using namespace std; const int mod = 1000000007, N = 17; int n, x, ans; int A[1 << N], B[N + 1][1 << N], C[N + 1][1 << N], D[1 << N], E[1 << N]; long long fib[1 << N]; inline void fix(int& x) { if (x >= mod) x -= mod; if (x < 0) x +=...
#include <bits/stdc++.h> using namespace std; const long long int N = 100005; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); { long long int i, j, k, n, m, ans = 0, cnt = 0, sum = 0; cin >> n; vector<long long int> v; cout << n << ; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b; cin >> n >> m; if (m == n) { vector<bool> rev(n, false); vector<vector<int> > mat(n + 1); for (int i = 0; i < m; i++) { cin >> a >> b; mat[a].push_back(b); mat[b].push_back(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) { ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2016 Xilinx, Inc. // // 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 // //...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-6; const double PI = acos(-1); const int INF = 1e9; void FAST() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } signed main() { FAST(); int n; cin >> n; vector<long long> a(n + n); for...
module ITU_656_Decoder( // TV Decoder Input iTD_DATA, // Position Output oTV_X, oTV_Y, oTV_Cont, // YUV 4:2:2 Output oYCbCr, oDVAL, // Control Signals iSwap_CbCr, iSkip, iRST_N, iCLK_27 ); input [7:0] iTD_DATA; inp...
// megafunction wizard: %ALTDDIO_IN% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altddio_in // ============================================================ // File Name: rgmii_in4.v // Megafunction Name(s): // altddio_in // ============================================================ // ********...
module module6(clk_, rst_, bar, foo); input clk_; input rst_; input [1:0] bar; output [1:0] foo; parameter poser_tied = 1'b1; parameter poser_width_in = 0+1-0+1; parameter poser_width_out = 0+1-0+1; parameter poser_grid_width = 4; parameter poser_grid_depth = 1; parameter [poser_grid_width-1:0] cell...
#include <bits/stdc++.h> using namespace std; long long n, k, x, y, z, A[(1 << 17)], B[(1 << 17)], C[(1 << 17)], mmp[(1 << 17)], Comb[18][18]; long long O[(1 << 17)], Ans[4][(1 << 17)], S[4][(1 << 17)]; long long powmod(long long x, long long y = 998244353 - 2, long long p = 998244353) ...
// $Id: eplv_chkr.v,v 1.1 1997/05/04 17:15:44 demaille Exp $ // This module checks for BDVL deasserting when BEPVL is asserted. module epvl_chkr(clk, bpvl, bepvl, bdvl, stop); input clk; input bpvl; input bepvl; input bdvl; input stop; // $stop (or $finish if BATCH) on error `ifdef JUST_C...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none // Closed loop solution module cdc_pulse_sync ( ...
/* * Copyright (c) 2002 Jane Skinner * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any ...
#include <bits/stdc++.h> using namespace std; const int N = 100 + 7; int n; map<pair<int, int>, int> id; vector<int> g[N]; long double rep(long double x) { if (x >= 2) { x -= 2; } return x; } void dfs(int a, int p = 0, long double t = 0) { int deg = (int)g[a].size(); long doubl...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:52:22 06/30/2015 // Design Name: // Module Name: ps2mouse_to_kmouse // Project Name: // Target Devices: // Tool versions: // Descri...
#include <bits/stdc++.h> using namespace std; int n; const long long int MOD = 998244353; class Combination { long long int ppow(long long int i, long long int j) { long long int res = 1LL; while (j) { if ((j & 1LL)) { res *= i; if (res >= MOD) { res %= MO...
#include <bits/stdc++.h> int main() { int i, y, ans, z, b, x[2]; for (i = 0; i < 2; i++) { scanf( %d , &x[i]); } y = x[0] * x[1]; ans = y / 2; { printf( %d , ans); } return 0; }
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int INF = 1e9 + 5; const long long INF64 = 1e18; string to_string(const string &s) { return + s + ; } string to_string(bool b) { return b ? true : false ; } template <typename A, typename B> string to_string(pair<A, B...
module hybrid(x,y,p); input [7:0] x,y; output [15:0] p; wire [7:0] i,j,k,l,n,o,q,r; wire [9:0] fp,sp,tp,fop; wire [3:0] one,two,sign; wire [6:0] c0,ip0; wire [12:0] c1,ip1; wire [6:0] c2; wire [11:0] m; wire [3:0] cry,z; // carry generation // 1st xor n9(z[0],one[0],two[0]); and n10(cry[0],z[0],sign[0]); //2nd xor n13(...
/** * 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; #define w(t) int t; cin>>t; while(t--) #define int long long int #define I int32_t #define asc(i,a,n) for(int i=a;i<n;i++) #define dsc(i,n,a) for(int i=n;i>=a;i--) #define vi vector<int> #define pi pair<int,int> #define PB push_back #define MP make_pair ...
#include <bits/stdc++.h> using namespace std; const int N = 2010; struct P { long long x, y; int id; bool operator<(P B) const { if (y != B.y) return y < B.y; return x < B.x; } } p[N], op; long long cross(P A, P B, P C) { return (A.x - B.x) * (C.y - B.y) - (C.x - B.x) * (A.y - ...
// // 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) // ...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015 // Date : Wed May 11 10:40:59 2016 // Host : josem-Studio-XPS-435MT running 64-bit Ubunt...
/** * 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...
#include <bits/stdc++.h> using namespace std; const int maxn = 2 * 1e5 + 10; char str[maxn]; int ans[maxn]; int main() { int n, a, b, k; while (scanf( %d%d%d%d , &n, &a, &b, &k) != EOF) { scanf( %s , str + 1); int m = 0, cnt = 0; for (int i = 1; i <= n; ++i) { if (str[i] == ...
#include <bits/stdc++.h> using namespace std; template <class T> ostream& operator<<(ostream& os, vector<T> V) { os << [ ; for (auto v : V) os << v << ; os << ] ; return os; } template <class T> ostream& operator<<(ostream& os, set<T> second) { os << { ; for (auto s : second)...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long mod = 998244353; int LIMIT; long long modpow(long long b, long long e) { long long ans = 1; for (; e; b = b * b % mod, e /= 2) if (e & 1) ans = ans * b % mod; re...
#include <bits/stdc++.h> #pragma optimise GCC(-O2) using namespace std; mt19937_64 rang( chrono::high_resolution_clock::now().time_since_epoch().count()); int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); } long long INF = LLONG_MAX; const long long M = 1000...
/** * 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 tb_spi_i2s_ipi_clk_div(); localparam TB_PARAM_CNT_WIDTH = 8; localparam TB_PARAM_STAGE_NUM = 3; function integer clogb2; input [31:0] value; reg div2; begin for (clogb2 = 0; value > 0; clogb2 = clogb2 + 1) value = value >> 1; end endfunction wire clkd_clk_out_o; wire clkd_time_base_o; reg [...
#include <bits/stdc++.h> using namespace std; int n, cnt, T; vector<int> g[128]; void input(int x) { if (g[x].size()) return; if (cnt == 16) { g[x].push_back(1), g[x].push_back(1); return; } cnt++; printf( ? %d n , x); fflush(stdout); int nw, y; scanf( %d , &nw); ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d %d , &n, &m); vector<int> v(n + 1); for (int i = 1; i <= n; i++) scanf( %d , &v[i]); double ans = 0.0; int a, b, w; for (int i = 1; i <= m; i++) { scanf( %d %d %d , &a, &b, &w); ans = max(ans, 1.0 ...
#include <bits/stdc++.h> using namespace std; const long long inf = 1000000000000000ll; long long b[230400], h[230400], d[230400], ans, t[230400], n, m; struct node { long long c, e; } a[230400]; struct seg { long long l, r, val, z; } s[230400 * 4]; bool cmp(node u, node v) { if (u.c == v.c)...
#include <bits/stdc++.h> using namespace std; using ll = long long; struct State { int bk; string fr; int pos; int cnt; }; bool operator<(State lhs, State rhs) { if (lhs.bk != rhs.bk) return lhs.bk < rhs.bk; if (lhs.fr != rhs.fr) return lhs.fr < rhs.fr; if (lhs.pos != rhs.pos) retu...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.3 (lin64) Build Wed Oct 4 19:58:07 MDT 2017 // Date : Tue Oct 17 19:49:33 2017 // Host : TacitMonolith running 64-bit Ubuntu 16.04.3...
#include <bits/stdc++.h> using namespace std; int K; long long p[21], a[21], aLeft[21]; long long N, Nq3; long long minArea = 3000000000000000000LL; long long ansA, ansB, ansC; long long curA; long long leftMul[21]; long long BCq, BC, nowBest; void dfs2(int cur, long long carry) { if (carry * le...
#include <bits/stdc++.h> using namespace std; struct LCA { int logn; vector<int> depth; vector<vector<int> > lca; vector<vector<int> > *edges; LCA(int n, vector<vector<int> > *edges) { logn = log(n) / log(2) + 1; depth.resize(n + 1, 0); lca.resize(n + 1, vector<int>(logn, 0)); ...
#include <bits/stdc++.h> using namespace std; template <class T> int size(const T &x) { return x.size(); } const int INF = ~(1 << 31); const double EPS = 1e-9; const double pi = acos(-1); template <class T> T smod(T a, T b) { return (a % b + b) % b; } int f(char c) { return c - a ; } ch...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/15/2016 01:13:48 PM // Design Name: // Module Name: Add_Subt // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
#include <bits/stdc++.h> using namespace std; vector<int> a[15]; vector<pair<int, int>> all; int rp[75000]; long long sum[15]; vector<pair<int, int>> loops; int path[16]; int plen = 0; bool vis[1 << 15] = {0}; int finstate; bool dfs(int state, int ps) { if (state == finstate) return true; ...
#include <bits/stdc++.h> using namespace std; inline int Find(string x) { if (x == rock ) return 1; if (x == scissors ) return 2; if (x == paper ) return 3; } int main() { string a, b, c; int sa, sb, sc; cin >> a >> b >> c; sa = Find(a), sb = Find(b), sc = Find(c); if (sa == 1...
// (C) 2001-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 doc...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n), B(n); vector<int> Ai(n - 1), Bi(n - 1); int t = 0; for (int i = 0; i < n; ++i) { cin >> A[i]; if (A[i] != 0) { Ai[t] = A[i]; t++; } } t = 0; for (int i ...
#include <bits/stdc++.h> using namespace std; int main() { char a; cin >> a; string str1, str2; cin >> str1 >> str2; int b1, b2; switch (str1[0]) { case T : b1 = 10; break; case J : b1 = 11; break; case Q : b1 = 12; break; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; const int maxm = 305; long long a[maxn]; long long c[11][maxn]; long long num[maxn]; long long n, m, v, k; int main() { cin >> n >> m >> k; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); long ...
/** * 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...
// -------------------------------------------------- // // Fake implementation specific memory // // Sample implementation specific memory with test ports // and 2-clock delay on output after read-enable asserted. // // -------------------------------------------------- module mem_16nm_ram4x64 ( input wire ...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; string a, b; cin >> a >> b; if (a.size() - 1 > b.size()) { cout << NO n ; return 0; } if (a == b) { cout << YE...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; int T, N; int a[MAX]; int main() { scanf( %d , &T); while (T--) { scanf( %d , &N); for (int i = 1; i <= N; i++) scanf( %d , &a[i]); sort(a + 1, a + 1 + N); int l = (N + 1) / 2, r = (N + 1) / 2; printf...
#include <bits/stdc++.h> using namespace std; long long int ans[100000]; int main() { long long int n, m, mx, mn, i, j, k, diff, flag = 0, flag1 = 0, flag2 = 0; cin >> n >> m >> mn >> mx; long long int arr[m + 5]; for (i = 0; i < m; i++) { cin >> arr[i]; if (arr[i] == mn) flag1 = 1; ...
#include <bits/stdc++.h> using namespace std; const int maxLog = 10; const int maxN = 1 << maxLog; const int INF = 0x3c3c3c3c; int f[333]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; string s; cin >> s; vector<int> a(n); f[ > ] = 1; f[ < ] = -1...
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // $Id: udp_reg_master.v 1965 2007-07-18 01:24:21Z grg $ // // Module: udp_reg_master.v // Project: NetFPGA // Description: User data path register master // // Note: Set TIMEOUT_RESULT to sp...
#include <bits/stdc++.h> using namespace std; int n; double r, v; double a, b; bool check(double l) { double arfa = l / r; double A = r * (1 - cos(arfa)); double B = r * sin(arfa); return l + sqrt(A * A + B * B) >= b - a; } int main() { cin >> n >> r >> v; while (n--) { scanf...
module ghrd_10as066n2_pb_lwh2f #( parameter DATA_WIDTH = 32, parameter SYMBOL_WIDTH = 8, parameter HDL_ADDR_WIDTH = 12, parameter BURSTCOUNT_WIDTH = 1, parameter PIPELINE_COMMAND = 1, parameter PIPELINE_RESPONSE = 1 ) ( input wire clk, // clk.clk ...
#include <bits/stdc++.h> using namespace std; long long total = 0; struct c { int can; int tru; }; int main() { double a, b, c; scanf( %lf%lf%lf , &a, &b, &c); printf( %.100f n , a * (b) / (b + c)); }
#include <bits/stdc++.h> using namespace std; char s[100005]; struct node { int x, op; } a[100005]; bool cmp(node q, node w) { return q.x < w.x; } int cnt; bool vis[100005]; int main() { int now, len, i; scanf( %d , &now); scanf( %s , s + 1); len = strlen(s + 1); s[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...
// file: Clk_Wizard.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 is not ...
// This top level module chooses between the original Altera-ST JTAG Interface // component in ACDS version 8.1 and before, and the new one with the PLI // Simulation mode turned on, which adds a wrapper over the original component. `timescale 1 ns / 1 ns module altera_avalon_st_jtag_interface ( clk, reset...
module ball_logic( input pxl_clk, input reset_n, input vsync, input h_collision, input v_collision, input start, output reg [9:0] ball_x, output reg [9:0] ball_y ); `inclu...
//Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2015.1 (lin64) Build Mon Apr 27 19:07:21 MDT 2015 //Date : Fri Jun 5 14:04:18 2015 //Host : ubuntu running 64-bit Ubuntu 14.04.2 LTS //Comma...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long SIZE = 100000; const int INF = 0x3f3f3f3f; const long long ll_INF = 0x3f3f3f3f3f3f3f3f; const long double PI = acos(-1); const long long MAXN = numeric_limits<long long>::max(); const long long MAX = 2000000; ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; const double EPS = 10e-11; class VagueDouble { public: double vd; VagueDouble() { vd = nan( ); } VagueDouble(const double d) { vd = d; } inline VagueDouble operator-() const { return VagueDouble(-vd); } inline VagueDouble operator+(const VagueD...
#include <bits/stdc++.h> using namespace std; int sol1, sol2, sol3, n; string str; int main() { cin >> n >> str; for (int i = 0; i < str.length(); i++) { if (str[i] == A ) sol1++; else if (str[i] == I ) sol2++; } sol3 = str.length() - sol1 - sol2; if (sol2 == 0)...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation 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 of source code ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sum = 0; for (int i = 0; i < n; i++) { int in; cin >> in; if (in < 0) in *= -1; sum += in; } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; const long long modulo = 998244353; const long long p = modulo; vector<int> edges[300005]; int father[300005]; long long rCount[300005]; long long oCount[300005]; long long eCount[300005]; pair<int, int> gcd(long long a, long long b) { if (b == 0ll) re...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int l = 1; int r = n; bool trn = 0; while (l <= r) { if (!trn) cout << l++; else cout << r--; cout << ; trn = !trn; } }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; wire [1:0] a = crc[1 +: 2]; wi...
//Legal Notice: (C)2013 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...
#include <bits/stdc++.h> using namespace std; map<int, int> m; vector<int> fr; int v[100100]; int main() { int n; scanf( %d , &n); int mf = 0; for (int i = 0; i < n; i++) { int t; scanf( %d , &t); v[i] = t; m[t]++; mf = max(mf, m[t]); } sort(begin(v), en...
`include "defines.vh" /** * @module lru_counter * @author sabertazimi * @email * @brief least recent use algorithm hardware implementation (counter implementation) * @param DATA_WIDTH data width * @input clk clock signal * @input rst reset signal * @input en enable signal * @input hit hit flag * @input hit_...
/* * 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 MAX_N = 2e5 + 4; int main() { vector<pair<long long, char> > ans; long long n, st[MAX_N], pr[MAX_N] = { 0, }; long long sum = 0; scanf( %lld , &n); for (int i = 0; i < n; i++) { scanf( %lld , &st[i]); ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int l, r, k; cin >> l >> r >> k; if (k < l) { cout << k << endl; } else { cout << (r / k + 1) * k << endl; } } 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 law...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:33:33 01/01/2017 // Design Name: // Module Name: Detector // 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 la...
#include <bits/stdc++.h> using namespace std; long long phi(long long x); const long long mod = 1e9 + 7; int main() { long long N, K; cin >> N >> K; while (K > 0 && N > 1) { N = phi(N); K -= 2; } cout << N % mod << endl; } long long phi(long long x) { int R = sqrt(x); ...
#include <bits/stdc++.h> using namespace std; int customCeil(int k, int s) { if (k % s == 0) return k / s; return k / s + 1; } int main() { long long int n; cin >> n; long long int arr[n]; for (int i = (0); i < (n); ++i) { cin >> arr[i]; } long long int m; cin >> m; ...
module ghrd_10m50da_top ( //Clock and Reset input wire clk_50, input wire fpga_reset_n, //QSPI // output wire qspi_clk, // inout wire[3:0] qspi_io, // output wire qspi_csn, //16550 UART input wire uart_rx, output wire uart_tx, output wire [4:0] user_led ); //...
`include "bsg_mem_1rw_sync_mask_write_byte_macros.vh" module bsg_mem_1rw_sync_mask_write_byte #( parameter `BSG_INV_PARAM(els_p ) , parameter `BSG_INV_PARAM(data_width_p ) , parameter addr_width_lp = `BSG_SAFE_CLOG2(els_p) ...
// Copyright 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013 // Date : Mon Mar 31 20:05:27 2014 // Host : macbook running 64-bit Arc...
#include <bits/stdc++.h> using namespace std; long long a[1000050]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); long long rec = 0; long long num = a[0]; long long have = 0; long long can = 0; for (int i = 0; i < n; i++) {...
/*checksum available 6 cycles after all inputs asserted*/ module binary_adder_tree(A, B, C, D, E, F, G, H, I, clk, checksum_reg); input [15:0] A, B, C, D, E, F, G, H, I; input clk; output reg [15:0] checksum_reg; wire [15:0] checksum; wire [16:0] sum_a_b, sum_c_d, sum_e_f, sum_g_h, sum_ab_cd, sum_e...
module wr_port_mux_9to1 (/*AUTOARG*/ // Outputs muxed_port_wr_en, muxed_port_wr_mask, muxed_port_wr_addr, muxed_port_wr_data, // Inputs wr_port_select, port0_wr_en, port0_wr_mask, port0_wr_addr, port0_wr_data, port1_wr_en, port1_wr_mask, port1_wr_addr, port1_wr_data, port2_wr_en, port2_wr_mask, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); multiset<int> b; int c[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { int z; cin >> z; b.insert(z); } for (int i = 0; i < n; i...
// hps_design_smp_hps_hps_io.v // This file was auto-generated from altera_hps_io_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.0 145 `timescale 1 ps / 1 ps module hps_design_smp_hps_hps_io ( output wire [14:0] mem_a, // memory.mem_a output...