text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { v.push_back(i); if (i != n / i) { v.push_back(n / i); } } } sort(v.begin(), v.end()); int ans = 0;...
// megafunction wizard: %LPM_MUX%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_MUX // ============================================================ // File Name: counter_bus_mux.v // Megafunction Name(s): // LPM_MUX // // Simulation Library Files(s): // lpm // ========================...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; else { return (gcd(b, (a % b))); } } int main() { int t; long long n; scanf( %d , &t); for (int i = 1; i <= t; i++) { cin >> n; long long a = (long lo...
#include <bits/stdc++.h> const int inf = 1e5 + 10; const long long mod = 998244353; const int LARGEST = 0x3f3f3f3f; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int dx[] = {0, 1, 1, 1, 0, -1, -1, -1}; int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}; int bx[] = {0, 1, 0, -1}; int by[] = {-1, 0, 1, 0}; ...
////////////////////////////////////////////////////////////////////// //// //// //// eth_random.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const int N = (int)1e6 + 7, mod = 1000000007, M = 2e9, lvl = 21; char s[N]; int n, c[10], x[4] = {1, 6, 8, 9}; vector<int> base, a; void push(int x) { a.push_back(x / 100); x %= 100; a.push_back(x / 10); x %= 10; ...
#include <bits/stdc++.h> using namespace std; using namespace std; int m, h, t, n, i, j, k; int a[200000], q[200000]; long long sum[200000], ans; long long pas[200000]; long long get(int i, int j) { return sum[j] - sum[i] + a[i]; } int main() { cin >> n; for (i = 0; i < n; i++) cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000 * 1000 * 1000 + 7LL; const double EXP = 1e-6; const int MAX = 100001; int main() { int n, k; while (cin >> n >> k) { int a[10001]; for (int i = 1; i <= n; i++) a[i] = 1; a[n] = 0; while (k--) { for...
/** * 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 la...
`timescale 1ns / 1ns module computer; // Inputs reg clk50; reg rst; reg RxD; // Outputs wire sram_sramEnable_o; wire sram_writeEnable_o; wire sram_readEnable_o; wire [19:0] sram_addr_o; wire flash_flashByte_o; wire flash_flashVpen_o; wire flash_flashRP_o; wire flash_flashSTS_o; wire flash_flashEnable_o...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; using arr2 = array<int, 2>; vector<arr2> binTrie; const int w = 30; binTrie.push_back({-1, -1}); vector<int> sz(1, 0); auto add = [&](int x) { int v = 0; for (int i = w - 1; i >= 0; --i) {...
#include <bits/stdc++.h> long long dx[8] = {0, 1, 0, -1, 1, 1, -1, -1}; long long dy[8] = {1, 0, -1, 0, -1, 1, 1, -1}; using namespace std; class pa3 { public: long long x; long long 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:26:11 07/23/2010 // Design Name: // Module Name: dac_test // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision:...
#include <bits/stdc++.h> const int maxn = 2e3 + 5; using namespace std; int arr[maxn]; int dp[maxn][maxn]; int check(int x, int lef, int rig) { return (lef <= x && x <= rig ? 1 : 0); } int main() { int n, h, l, r; scanf( %d %d %d %d , &n, &h, &l, &r); for (int i = 1; i <= n; i++) { scanf( ...
/* Semi Dual Port (SDP) memory have the following configurations: * Memory Config RAM(BIT) Port Mode Memory Depth Data Depth * ----------------|---------| ----------|--------------|------------| * B-SRAM_16K_SD1 16K 16Kx1 16,384 1 * B-SRAM_8K_SD2 16K 8Kx2 8,192 ...
#include <bits/stdc++.h> using namespace std; int ar[305][305]; vector<pair<int, int> > poss[90005]; int dp[305][305]; vector<int> col[305]; int vis[305]; int n, m, p; void pr() {} void solve() { memset(dp, 127, sizeof(dp)); ; scanf( %d %d %d , &n, &m, &p); for (int i = 0; i < (int)(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; void qmax(int &x, int y) { if (x < y) x = y; } void qmin(int &x, int y) { if (x > y) x = y; } inline long long read() { char s; long long k = 0, base = 1; while ((s = getchar()) != - && s != EOF && !(isdigit(s))) ; if (s == EOF) e...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long n; long long len[1000005]; long long pai[1000005]; string s; long long find(long long x) { if (pai[x] == x) return x; return pai[x] = find(pai[x]); } void merge(long lon...
#include <bits/stdc++.h> using namespace std; int const MAX = 2005; int mp[MAX][MAX]; int main() { int n; bool flag = true; scanf( %d , &n); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) scanf( %d , &mp[i][j]); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j+...
#include <bits/stdc++.h> using namespace std; int main() { int W, H, n; scanf( %d%d%d , &W, &H, &n); multiset<int> w, h; w.insert(-W); h.insert(-H); set<int> wa, ha; wa.insert(0); wa.insert(W); ha.insert(0); ha.insert(H); for (int i = 0; i < n; i++) { char t; ...
#include <bits/stdc++.h> using namespace std; int n, x, y, z, f[1000000], k, ans = 0, a, b, c, t; vector<long long> v; map<long long, long long> m; int main() { cin >> n >> a >> b >> c >> t; for (int i = 0; i < n; i++) cin >> f[i]; sort(f, f + n); for (int i = 0; i < n; i++) { x = a; ...
// // PCI Parity Generator. // // PCI Target generates PAR in the data phase of a read cycle. // The 1's sum on AD, CBE and PAR is even. // // Date Version Author Description // 2005-05-13 R00A00 PAU First alfa revision (eng) // // Copyright (C) 2005 Peio Azkarate, // // This...
#include <bits/stdc++.h> using namespace std; void init_code() { ios_base::sync_with_stdio(false); cin.tie(NULL); } int main() { init_code(); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> arr(n + 1, 0); map<int, int> mp; for (int i = 1; i <= n;...
#include <bits/stdc++.h> int a[1010], b[1010]; int n, k, inf = 0x0f0f0f0f; int test(int cur) { int i, ans = 0; if (cur <= 0) return inf; for (i = 0; i < n; i++) { if (a[i] != cur) ans++; cur += k; } return ans; } int main() { int i, j, cur; while (~scanf( %d%d , &n, &k)...
/** * 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() { int t; cin >> t; while (t--) { int k = 0; string a, b, c; cin >> a >> b >> c; for (int i = 0; i < a.size(); i++) { if (a[i] == c[i] || b[i] == c[i]) k++; else { k = -1; break;...
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 77, L = 17; int n, q, tim = 1, root = 1; int b[N], d[N], Par[N][L], St[N], En[N]; long long S[N << 2], lz[N << 2]; inline void Shift(int l, int r, int id) { long long x = lz[id]; lz[id] = 0; S[id] += (r - l) * x; if (r - l ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const double PI = 3.14159265359; int oneCt = 0, n; class File { public: string name; int type; bool isNum; int numVal; File(string _name, int _type) : name(_name), type(_type), isNum(true) { int sz = name...
#include <bits/stdc++.h> using namespace std; long long mul(long long a, long long b, long long p = 1000000007) { return ((a % p) * (b % p)) % p; } long long add(long long a, long long b, long long p = 1000000007) { return (a % p + b % p) % p; } void input(long long a[], long long sz) { for (lon...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. // ====================================================================== module sub ( input clk, input fastclk, input reset_l ); // Example c...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; struct node { double x, y; } po[1010]; double dis(node a, node b) { return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); } node mark; double cha(node a, node b, node c) { return (b.x - a.x) * (c.y - a.y)...
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (a == 0) { return b; } else { return gcd(b % a, a); } } long long int lcm(long long int a, long long int b) { return a * b / gcd(a, b); } int f(char c) { return (int)c - 48; } ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_misc_chunk5.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, x, y, aa; scanf( %I64d %I64d , &x, &y); if (y > x) { printf( -1 n ); return 0; } a = x / y; if ((x % y) && (a % 2)) a++; if (!(a % 2)) aa = a - 1; else aa = a; double cc = (doub...
module sin_lut (input [5:0] lookup, output [7:0] value); assign value = (lookup == 6'd0) ? 128 : (lookup == 6'd1) ? 140 : (lookup == 6'd2) ? 152 : (lookup == 6'd3) ? 165 : (lookup == 6'd4) ? 176 : (lookup == 6'd5) ? 188 : (lookup == 6'd6) ? 198 : (lookup == 6'd7) ? 208...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 10; const int inf = 1e9; struct node { int s, ind; } f[maxn]; int sum[maxn]; int cmp(node a, node b) { if (a.s == b.s) return a.ind < b.ind; return a.s < b.s; } int main() { int i, n, c, re = 0, value; scanf( %d%d...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int MAXN = 5 * 1e5 + 1, MODM = 1e9 + 7; int n; vector<int> g[MAXN]; int sz[MAXN]; int pr[MAXN]; int ans[MAXN]; int m1, m2; int now; int root = -1; void dfs(int v, int p = -1) { sz[v] = 1; pr[v] = p; for (...
module antiDroopIIR ( input clk, input trig, input signed [12:0] din, input signed [6:0] tapWeight, input accClr_en, input oflowClr, output reg oflowDetect = 1'd0, output reg signed [15:0] dout = 16'sd0); parameter IIR_scale = 15; // define the scaling factor for the IIR multiplier, eg for 0.002 (din = 63, IIR...
/** * 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 = 1005; int in[maxn]; int t1, t2; struct edge { int v, w; }; vector<edge> g[maxn]; void dfs(int u, int fa) { if (in[u] == 1) { if (!t1) t1 = u; t2 = u; } for (edge e : g[u]) { if (e.v == fa) continue; df...
#include <bits/stdc++.h> using namespace std; int i, j, k, n, m, p; int a[33], c[100010][33]; int fac[100010], inv[100010]; int l, r, L, R, len, Ans; inline int Pow(int x, int y) { int Ans = 1; for (; y; y >>= 1, x = 1ll * x * x % p) if (y & 1) Ans = 1ll * Ans * x % p; return Ans; } in...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int arr[4]; for (int i = 0; i < (int)4; i++) cin >> arr[i]; sort(arr, arr + 4); bool ok = 0; for (int mask = 0; mask < (1 << 4); mask++) { int sum1 = 0; int sum2 = 0; for (int bi...
#include <bits/stdc++.h> const int N = 1e3 + 10, O = 27; int cnt, n, m; bool v[O], ok[O], cur[O]; std::vector<int> empty, full; std::string s, temp; int main() { scanf( %d , &n); std::cin >> s; for (int i = 0; i < n; i++) { if (s[i] != * ) { v[s[i] - a ] = true; full.push...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > Dates; int n, x, y, ans, cur; int main() { std::ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; Dates.push_back(make_pair(x, y)); } sort(Dates.begin(), Dates.end()); ...
#include <bits/stdc++.h> using namespace std; int mark[2000010 * 2]; int tree[2000010 * 4]; bool emerged[2000010 * 2]; void insert(int l, int r, int i, int ind, int num) { tree[ind] += num; if (l == r) return; int mid = (l + r) / 2; if (i <= mid) insert(l, mid, i, ind * 2, num); if (i > mi...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n][3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { cin >> a[i][j]; } } int c = 1; for (int i = 0; i < 3; i++) { int sum = 0; for (int j = 0; j < n; j++) { ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int MAXN = 1e5 + 10; const int MAXK = 5 + 1; long long sumv[MAXK][MAXN << 2], setv[MAXN << 2]; long long prefix[MAXK][MAXN], C[MAXK][MAXK]; void Pushdown(int o, int lft, int rht) { if (setv[o] != -1) { setv[(o << 1)] = ...
#include <bits/stdc++.h> using namespace std; int n; long long L[500005]; char ch[500005]; class segtree { public: long long seg[(1 << 19) * 2]; long long lazy[(1 << 19) * 2]; void lazy_evaluate(int k) { if (k * 2 + 2 >= (1 << 19) * 2) return; lazy[k * 2 + 2] += lazy[k]; lazy[...
#include <bits/stdc++.h> using namespace std; template <typename T> bool chkmin(T &first, T second) { return second < first ? first = second, 1 : 0; } template <typename T> bool chkmax(T &first, T second) { return first < second ? first = second, 1 : 0; } template <typename T> void readint(T &...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; const long long inf = 1e18; int bcg[maxn]; struct Edge { int u, v, nxt; long long w; } edge[maxn * 2], edge1[maxn * 2]; vector<Edge> vec[maxn]; struct Node { long long p; int v; friend bool operator<(Node a, No...
// 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 May 18 23:18:58 2017 // Host : GILAMONSTER running 64-bit major release (...
// File: design.v // Generated by MyHDL 0.8 // Date: Tue Dec 3 04:33:14 2013 module d ( cos_z0, sin_z0, done, z0, start, clock, reset ); // Sine and cosine computer. // // This module computes the sine and cosine of an input angle. The // floating point numbers are represented as integers...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int INF = INT_MAX; const int NINF = INT_MIN; int n, q, l, r, curr; vector<int> vec, tv, Count; void Solve() { cin >> n >> q; vec = tv = vector<int>(n, 0); for (int i = 0; i <= n - 1; i++) cin >> vec[i]; for (int i...
#include <bits/stdc++.h> const int kM = 4e4 + 5; const int kN = 55; int M, n, m, k; long long T[kM << 3], tag[kM << 3], a[kN][kM], pre[kM], s[kM], f[kN][kM]; void Update(int cur) { T[cur] = std::max(T[cur << 1], T[cur << 1 | 1]); } void PushTag(int cur) { T[cur << 1] += tag[cur]; T[cur << 1 | 1] += ...
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014 // // integrates sound features: tapeout, beeper and covox /* This file is part of ZX-Evo Base Configuration firmware. ZX-Evo Base Configuration firmware is free software: you can redistribute it and/or modify it under the ...
#include <bits/stdc++.h> using namespace std; long long int nodes_size; long long int edge_size; class edge { public: long long int node; long long int cost; edge(long long int i, long long int j) { node = i; cost = j; } }; class graph { public: long long int node; ...
#include <bits/stdc++.h> using namespace std; int main() { long long pow = 1; long long L, R; cin >> L >> R; while (pow * 10 <= R) pow *= 10; if (L < pow) { if (R < pow * 5) cout << R * (pow * 10 - 1 - R) << endl; else cout << pow * 5 * (pow * 5 - 1) << endl; } el...
module module0(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 = 2; parameter poser_grid_depth = 1; parameter [poser_grid_width-1:0] cell...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int MOD = 1000000007; signed main() { cin.tie(0), cout.tie(0); ios::sync_with_stdio(0); int n, k; cin >> n >> k; int a, b, c, d; cin >> a >> b >> c >> d; if (k < n + 1 || n <= 4) cout << -1 << n ,...
/********************************************************************* * SYNOPSYS CONFIDENTIAL * * * * This is an unpublished, proprietary work of Synopsys, Inc., and * * is fully protected under copyrigh...
#include <bits/stdc++.h> using namespace std; template <class T> bool uin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> bool uax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { ios::sync...
/* Title: traffic_fsm.v * Author: Sergiy Kolodyazhnyy <> * Date: April 20, 2017 * Purpose: Implementation of traffic control system as Moore FSM * Developed on: Ubuntu 16.04 LTS , Quartus Prime Lite 16.1 * Tested on: DE1-SoC , Cyclone V , 5CSEMA5F31 * TODO: implement the pedestrian timer in cross_go and main_go s...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << { ; string sep; for (const auto &x : v) os << sep << x, sep = , ; return os << } ; } template <typename T, size_t size> ostream &operator<<(ostream &os, const ...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; long long a[N]; long long dp[N][20]; int main() { int n, m, k; cin >> n >> m >> k; a[0] = 0; for (int i = 1; i <= m; i++) dp[0][i] = -1e10; long long ans = 0; for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]);...
#include <bits/stdc++.h> #include <string> using namespace std; bool susp() { int n; cin >> n; string days; cin >> days; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if (days[j] == days[i] && days[j - 1] != days[i]) ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5, inf = 1e9 + 7; long long n, k, i, j; long long A[N], l[N], r[N], len[N]; set<pair<long long, long long> > st; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); long long i, j, a, b, ans = 0, cur; cin >> n;...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const int dir[8][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, -1}, {-1, 1}}; const int mod = 1e9 + 7, gakki = 5 + 2 + 1 + 19880611 + 1e9; const int MAXN = 1e6 + 5, MAXM = 1e6 + 5; const int MAX...
#include <bits/stdc++.h> using namespace std; const int N = 1100; const int M = 256; const int K = 26; const int INF = 2000000000; const double eps = 1e-12; int k, m, n, d[K], a[N]; char s[N]; bool ok; int F(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; ...
// Copyright (c) 2000-2009 Bluespec, Inc. // 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, pub...
#include <bits/stdc++.h> using namespace std; void run() { long long n; cin >> n; long long p[n]; for (long long i = 0; i < n; i++) cin >> p[i]; for (long long i = 0; i < n; i++) { if (p[i] == 0) p[i] = -1; if (p[i] != -1) p[i] %= 2; } long long ones = 0, zeros = 0; for (...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003-2008 by Wilson Snyder. module t (clk); input clk; integer cyc; initial cyc=1; integer sum; integer cpre; always @ (posedge clk) begin if (cyc!=0) begin cp...
#include <bits/stdc++.h> using namespace std; bitset<2005> a[2005]; int pos[2005]; int ans[2005]; bool gause(int n, int m) { int d = 1; for (int i = 1; i <= n; i++) { if (!a[d][i]) { for (int j = d + 1; j <= m; j++) if (a[j][i]) { swap(a[d], a[j]); break...
#include <bits/stdc++.h> using namespace std; int main() { int n1, n2, n3, n4; long long ans; unordered_map<char, int> m; string s; while (cin >> n1 >> n2 >> n3 >> n4) { ans = 0; m[ 1 ] = n1; m[ 2 ] = n2; m[ 3 ] = n3; m[ 4 ] = n4; cin >> s; for (int i = ...
module wb_upsizer_tb (input wb_clk_i, input wb_rst_i, output done); localparam aw = 32; localparam MEMORY_SIZE_WORDS = 2**10; localparam DW_IN = 32; localparam SCALE = 2; localparam DW_OUT = DW_IN * SCALE; wire [aw-1:0] wbm_m2s_adr; wire [DW_IN-1:0] wbm_m2s_dat; wire [DW_IN/8-1:...
//----------------------------------------------------------------------------- // // (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 ...
/** * 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 n, k; int main() { cin >> n >> k; long long falta = (n % k); long long ans = n + (k - falta); cout << ans << n ; return 0; }
#include <bits/stdc++.h> using ll = long long; const int MN = 1e5 + 100; const int MP = 1e4 + 100; const int MOD = 1e9 + 7; ll pw(ll b, int p) { ll r = 1LL; for (; p; p >>= 1, b = b * b % MOD) if (p & 1) r = r * b % MOD; return r; } int N, K; int p[MP], q[MN]; int t[MN], l[MN], T[MN]...
// Testbench for ltcminer_icarus.v `timescale 1ns/1ps `ifdef SIM // Avoids wrong top selected if included in ISE/PlanAhead sources module test_ltcminer (); reg clk = 1'b0; reg [31:0] cycle = 32'd0; initial begin clk = 0; while(1) begin #5 clk = 1; #5 clk = 0; end end always @ (posedge clk) ...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-6; double n, r; bool check(double R) { double x1 = r + R; double y1 = 0; double x2 = cos(2 * acos(-1) / n) * (r + R); double y2 = sin(2 * acos(-1) / n) * (r + R); double len = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y...
#include <bits/stdc++.h> using namespace std; long long a[200005], dp1[200005], dp2[200005]; int main() { long long n, k, x; int xx; cin >> n >> k >> x; for (int i = 1; i <= n; i++) { scanf( %d , &xx); a[i] = xx; } sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> bool commonDigits(long a, long b) { bool digits[10] = {0}; bool output(0); while (a > 0) { digits[a % 10] = 1; a /= 10; } while (b > 0) { if (digits[b % 10]) { output = 1; break; }; b /= 10; } return output; } int m...
#include <bits/stdc++.h> using namespace std; const int Nmax = 1e5 + 5, lg = 16; struct updates { int l, x, y, id; bool operator<(const updates &other) const { if (l != other.l) return l > other.l; return id < other.id; } }; vector<updates> upd; vector<int> v[Nmax]; struct Node { ...
/** * 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; void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); } long long dotproduct(vector<long long>& a, vector<long long>& b) { long long sum = 0; for (long long i = 0; i < a.size(); i += 1) { sum += a[i] * b[i]; } return sum; } ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, p[N]; deque<pair<int, int> > deq; bool mrk[N]; vector<int> dor[2]; int dfs(int v, int d) { mrk[v] = 1; if (!mrk[p[v]]) return dfs(p[v], d + 1); return d; } void add(int v, int l) { dor[l].clear(); int pnt =...
/** * 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> const int N = 200100; char a[N], b[N]; int cnt[330]; int main() { int la, lb, i; long long ans = 0; scanf( %s%s , a, b); la = strlen(a), lb = strlen(b); for (i = 0; i < lb - la; i++) cnt[b[i]]++; for (i = 0; i < la; i++) { cnt[b[lb - la + i]]++; if (a...
#include <bits/stdc++.h> const int T_DATA = 100000; const int N = 100000; int T; int a, b; char mp[N + 10]; int n, m; int l[N + 10], r[N + 10]; int dis[N + 10]; int main() { scanf( %d , &T); while (T--) { scanf( %d %d , &a, &b); scanf( %s , mp + 1); n = strlen(mp + 1); ...
// File: Up_CounterTBV.v // Generated by MyHDL 0.10 // Date: Tue Aug 14 06:51:20 2018 `timescale 1ns/10ps module Up_CounterTBV ( ); // myHDL -> Verilog Testbench for `Up_Counter` module reg clk = 0; reg rst = 0; wire Trig; wire [4:0] count; reg [4:0] Up_Counter0_0_count_i = 0; reg Up_Counter0_0_Trig_i = 0; alw...
#include <bits/stdc++.h> using namespace std; int dp[1 << 20], w[25][25]; string s[25]; pair<int, int> alph[25][26]; int ma[25][26]; int cost[1 << 20]; vector<pair<int, int> > rco; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:16:49 05/04/2013 // Design Name: mix16bitaddr // Module Name: D:/Xilinx_ISE_Pro/maju_ASIC_FPGA/assign3/mixAdderq2/testbnc.v // Project Name: mixAdderq2 // Target ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int ma = INT_MIN; string ans = nah ; while (n--) { string s; int s1, s2, a, b, c, d, e; cin >> s; cin >> s1 >> s2 >> a >> b >> c >> d >> e; ...
/* Legal Notice: (C)2007 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 assoc...
/***************************************************************************** * File : processing_system7_bfm_v2_0_arb_wr_4.v * * Date : 2012-11 * * Description : Module that arbitrates between 4 write requests from 4 ports. * *****************************************************************************/ modul...
#include <bits/stdc++.h> using namespace std; long long sum[400006] = {0}; long long Min[400006] = {0}; long long Max[400006] = {0}; void solve() { long long n; cin >> n; long long k; cin >> k; vector<long long> v(n); for (long long i = 0; i < n; i++) cin >> v[i]; for (long long i ...