text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int arr[20]; int mem[20][20][20]; int n, a, b; int calc(int ind, int p, int c) { int x0 = arr[ind - 1] - p, x1 = arr[ind] - c, x2 = arr[ind + 1]; int& res = mem[ind][p][c]; if (res != -1) return res; if (ind == n - 2) { res = 0; while (...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; int n; long long a[N]; long long b[N]; int main() { int t; scanf( %d , &t); while (t--) { vector<pair<long long, long long> > v; scanf( %d , &n); v.clear(); for (int i = 0; i < n; i++) { long lo...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pl = pair<ll, ll>; using vll = vector<ll>; using vpl = vector<pl>; using mat = vector<vll>; const ll MAX = 1e5; const ll mod = 1e9 + 7; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto...
/** * This file containsn the arithmetic logic unit with following features: * * - Addition => 0x0 * - Substraction => 0x1 * - Shift left => 0x2 * - Bitwise OR => 0x3 * - Bitwise AND => 0x4 * - Bitwise XOR => 0x5 * - Rotate right => 0x6 * - Equals => 0x7 * - Greater than => 0x8 * - Smaller th...
#include <bits/stdc++.h> namespace in { char buf[1 << 21], *p1 = buf, *p2 = buf; inline int getc() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++; } template <typename T> inline void read(T &t) { t = 0; int f = 0; ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int _inf = 0xc0c0c0c0; const long long INF = 0x3f3f3f3f3f3f3f3f; const long long _INF = 0xc0c0c0c0c0c0c0c0; const long long mod = (int)1e9 + 7; const int Z = 100; const int N = Z * Z; const int M = Z * Z * Z; int px[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; int n, m, x, ans, h[5010], a[5010][5010], b[5010][5010]; int main() { scanf( %d , &n); m = (n + 1) / 2; for (int i = (1); i <= (n); i++) scanf( %d , &h[i]); for (int i = (0); i <= (n); i++) for (int j = (0); j <= (m); j++) a[i][j] = b[i][j] = 100...
/////////////////////////////////////////////////////////////////////////////// /// Andrew Mattheisen /// Zhiyang Ong /// /// EE-577b 2007 fall /// VITERBI DECODER /// pmsm module (Path Metric State Memory) /// /** * @modified by Zhiyang Ong on November 1, 2007 * The reset values for the 2nd to the 4th * registe...
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; for (int i = 0; i < q; i++) { int a, b, c; cin >> a; cin >> b; cin >> c; int p1, p2; cin >> p1; cin >> p2; int min_no = min(b, c); if (a <= 1) { cout << 0 << n ; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 9; const int L = 301; const int INF = 1e9 + 239; int n; int a[N]; int cnt[N]; vector<int> pos[N]; int mn[2 * N]; void solve(vector<pair<int, int>> v, int &ans) { v.push_back({n - 1, 0}); int prev = -1; int c = 0; mn[N]...
#include <bits/stdc++.h> using namespace std; int t, n, a[100005]; vector<int> v[100005]; int val[100005]; int k[100005]; int main() { for (int i = 2; i <= 100000; i++) { v[i].push_back(1); for (int j = i + i; j <= 100000; j += i) { v[j].push_back(i); } } scanf( %d , &t...
#include <bits/stdc++.h> using namespace std; vector<pair<string, string>> taken; int main() { int n; scanf( %d , &n); int ans = 0; for (int i = 1; i <= n; ++i) { string s, t; cin >> s >> t; bool flag = 1; for (auto [x, y] : taken) { if (x == s && y == t) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int a[100009]; cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i]; int t = 0; long long sum1 = 0; sort(a, a + n); int m = 0, l = 0, token = 0; for (int i = n - 1; i >= 0; i--) { if (a[i] > k) { ...
// file: clk_gen.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 a 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 la...
#include <bits/stdc++.h> using namespace std; const int N = 50010; const int inf = 1e9; inline int read() { int p = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { p = p * 10 + c...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; double gmin = 100000000000000017; int a, b; int Y1[100005], Y2[100005], L[100005]; double dist(double x1, double y1, double x2, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } double f(int i, int j) { ...
/*------------------------------------------------------------------------------ * 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...
/** * Generic ROM memory * * (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan) * GPL license * * Memory with the next parameters: * - AW: Number of bits for directions * - DW: Number of bits for data * - ROMFILE: File to be used to load the memory */ module genrom #( // Parameters parameter AW =...
//------------------------------------------------------------------- //-- txstr_tb.v //-- Testbench for the simulation of the txstr.v example //------------------------------------------------------------------- //-- (c) BQ December 2015. Written by Juan Gonzalez (Obijuan) //-------------------------------------------...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f, maxn = 200007; const long long MOD = 998244353; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const long long P = 19260817; char nc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(...
#include <bits/stdc++.h> using namespace std; inline int read() { int sum = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) { sum = (sum << 1) + (sum << 3) + (c ^ 48); c = getchar(); } return sum; } int n, k, a, m; set<int> s; set<int>::iterat...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; const long long mod = 1e9 + 7; const long long inf = 1e9; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; sor...
module modexp_test_2N_NN(); parameter N = 8; parameter CC = 2*N*N; reg clk; reg rst1; reg rst2; reg [N-1:0] m; reg [N-1:0] e; reg [N-1:0] d; reg [N-1:0] n; wire [N-1:0] c; reg [N-1:0] creg; wire [N-1:0] mout; function [N-1:0] modexp_f; input [N-1:0] m; input [N-1:0] e; input [N-1:0...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Tue Sep 19 09:38:22 2017 // Host : DarkCube running 64-bit major release ...
/** * 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 // This module implements the set of 31 64-bit wide registers for the CPU. // // Note that reading the register bank is _synchronous_, not asynchronous. // This means you must present the desired register address prior to a clock // edge, and the contents of the indicated register will appear afte...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; template <typename T> using pair2 = pair<T, T>; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; mt19937_64 rng(chr...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:06:59 11/16/2014 // Design Name: // Module Name: serial // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
#include <bits/stdc++.h> using namespace std; void solve() { long long n, m, i, j; cin >> n >> m; int x, y; vector<vector<int> > adj(n); vector<int> ncon(n, 0); for (i = (0); i < (m); i++) { cin >> x >> y; adj[x - 1].push_back(y - 1); adj[y - 1].push_back(x - 1); ncon...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > v(14 + 1); int go[1001][14], fail[1001], weight[1001], nxt, maxLength; pair<int, long long> a[1001]; long long dp[1001][(1 << 14)]; const long long negativeInfinity = LLONG_MIN / 2; void AddStringToAhoCorasick(string s, int val) { int ...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int N = 2e5 + 6; int cnt[666], dp[777][777]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int _, n; cin >> _; while (_--) { cin >> n; for (int i = 0; i <= n - 1; i++) c...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t > 0) { string s1, s2; cin >> s1 >> s2; long long int f = 0; if (s1.length() > s2.length()) { cout << NO << endl; f = -1; } else { long long int i = 0, j ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) const long long INF = 0x3f3f3f3f3f3f3f3f; const long long llinf = LLONG_MAX; const int inf = INT_MAX; const int nmax = 1e6 + 5; const int mod = 1e9 + 7; using namespace std; int i, ans, x; string s; int main() { ios_base::sync_with_stdio(false)...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of avfb_pad_mux // // Generated // by: wig // on: Tue Apr 25 19:40:28 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver.xls // // !!! Do not edit this file! Autogenerated by MIX ...
/** * 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(void) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (n % 2 == 0) cout << a[n / 2 - 1]; else cout << a[(n + 1) / 2 - 1]; 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...
/* Copyright (c) 2015-2016 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
#include <bits/stdc++.h> using namespace std; int prime(int n) { int val = sqrt(n), counter = 0; ; if (n == 1) return false; for (int i = 2; i <= val; i++) { if (!(n % i)) counter++; } if (counter) return -1; return n; } int root(int n) { int val = sqrt(n); int x = n, f...
#include <bits/stdc++.h> using namespace std; string nb; int main() { int N; cin >> N; cin >> nb; string m; m.append(N, 9 ); string act = nb; for (int shift = 0; shift < N; shift++) { for (int p = 0; p <= 9; p++) { m = min(m, act); for (int i = 0; i < N; i++) act...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int k = 0; k < t; k++) { int x, y, d = 0; cin >> x >> y; if (x >= y || x > 3) { cout << YES << endl; d = 1; } if (d == 0) { if (x == 1) { cout << NO << end...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e4 + 5; int a[MAXN]; int dp[MAXN][2005]; int solve(int n) { int len = 2005; for (int i = 1; i <= n; ++i) for (int j = 0; j < len; ++j) dp[i][j] = INT_MAX; for (int j = 0; j < len; ++j) dp[0][j] = j; for (int i = 1; i <= n; +...
#include <bits/stdc++.h> using namespace std; string s; int x, y, len, a, b; int main() { cin >> s; len = s.length(); for (int i = 0; i < len; ++i) { if (s[i] == ( ) ++x; else if (s[i] == ) ) --x; else if (s[i] == # ) --x, ++y; if (x < 0) { ...
// Library - static, Cell - th22r, View - schematic // LAST TIME SAVED: May 23 16:33:04 2014 // NETLIST TIME: May 23 16:33:10 2014 `timescale 1ns / 1ns module th22r ( y, a, b, rsb ); output y; input a, b, rsb; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "th22r"; specparam CD...
#include <bits/stdc++.h> using namespace std; int a[500500], n, len, ans; int main() { scanf( %d , &n); ans = 0; for (int i = 0; i < n; i++) scanf( %d , &a[i]); for (int i = 0; i < n; i++) { int k = i; len = 0; while (a[k + 1] != a[k] && k < n - 1) { len++; 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...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Fri Oct 27 14:51:03 2017 // Host : Juice-Laptop running 64-bit major relea...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int MOD = 1e9 + 7; string ans = What are you doing at the end of the world? Are you busy? Will you save us? ; string a = What are you doing while sending ; string b = ? Are you busy? Will you send ; string c ...
module TestDriver(); //This module tests the driver module, which functions by listening for changes in the state, waiting for the state to settle, and then setting HIGH the level of the enable flag. // //Things to test are: // (1) driver responds to changes in state and waits the appropriate number of clock cycles bef...
#include <bits/stdc++.h> using namespace std; template <typename T> bool mmax(T &m, const T q) { if (m < q) { m = q; return true; } else return false; } template <typename T> bool mmin(T &m, const T q) { if (m > q) { m = q; return true; } else return false...
/** * 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; template <typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } inline int read() { int res = 0, fl = 1; char r = getchar(...
/* * 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 la...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2006 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=0; reg [63:0] crc; wire [65:0] outData; // From fifo of fif...
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b) { long long ans = 1; while (b > 0) { if (b % 2 != 0) { ans = (ans * a) % 1000000007; } a = (a * a) % 1000000007; b >>= 1; } return ans; } int main() { std::ios::sync_with_s...
/** * 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 a[6] = {3, 3, 3, 2, 2, 1}; const int b[6] = {2, 1, 0, 1, 0, 0}; const int inf = 1000000000; const double eps = 1e-6; int Dist[6]; double X[7]; int Round(double X) { int T = (int)X; if (T + 1 - X < eps) T++; return T; } bool Check(in...
//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 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 law...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1,...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int l, r; cin >> l >> r; if (l * 2 <= r) { cout << l << << l * 2 << endl; } else { cout << -1 << << -1 << endl; } } return 0; }
#include <bits/stdc++.h> void sort(int a[], int begin, int mid, int end) { int i = begin, j = mid + 1, k = 0, temp[end - begin + 1]; while (i <= mid && j <= end) { if (a[i] <= a[j]) temp[k++] = a[i++]; else temp[k++] = a[j++]; } for (; i <= mid; ++i) temp[k++] = a[i]; f...
/* * 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 il[5]; int wyn = 0; void printState() {} int n; int main() { ios::sync_with_stdio(0); cin >> n; while (n--) { int tmp; cin >> tmp; il[tmp]++; } int tmp; if (il[1] > il[2]) { wyn += il[2]; il[3] += il[2]; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; const int inf = 0x3f3f3f; char s[maxn]; char str[4] = RGB ; int main() { int q; scanf( %d , &q); while (q--) { int n, m; scanf( %d%d , &n, &m); scanf( %s , s); int minn = inf; n -= m; for...
#include <bits/stdc++.h> using namespace std; int n, q; vector<int> l, r, x, y; vector<long long> sum; double ans(int x1, int y1, int x, int y) { long long a = y1 - y; long long b = x - x1; long long c = -a * x - b * y; double xs = -1.0 * c / a; int ll = 0, rr = n - 1; while (ll <= rr)...
#include <bits/stdc++.h> using namespace std; struct candy { candy(int t, int h, int m) { this->type = t; this->height = h; this->mass = m; } int type; int height; int mass; bool operator<(const candy &c) const { return this->mass < c.mass; } bool operator>(const candy ...
#include <bits/stdc++.h> using namespace std; string doen() { char c; string waarde; while (cin.get(c) && c != n ) { waarde += c; } int aantal = stoi(waarde); string iets; getline(cin, iets); for (int i = 0; i < iets.length(); i = i + 2) { if (iets[i] == 1 ) { ...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 5e5 + 5; struct Node { long long t, h, m; } a[MAXN]; bool cmp(Node x, Node y) { return x.m > y.m; } long long n, x; long long vis[MAXN]; long long solve(long long now) { memset(vis, 0, sizeof(vis)); long long ans = 0; l...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, x, y, i, j, k, l; cin >> n >> m >> x >> y; cout << x << << y << n ; for (i = 1; i <= m; i++) if (i != y) cout << x << << i << n ; int c; for (i = 1, j = m;...
module Mux4_1( input [31:0] Data0,Data1,Data2,Data3, input [1:0] Sel, output [31:0]Data ); assign Data = (Sel[1] == 1'b0)?((Sel[0] == 1'b0)?(Data0):(Data1)):((Sel[0] == 1'b0)?(Data2):(Data3)); endmodule module MIPS_Shifter( input[31:0] Data_in, input [4:0] Count, input [1:0] Sel, output [31:0]Data_out ); wire[31:...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 9; set<pair<int, int> > len, pos; int n, m; void add_seg(int L, int R) { if (L > R) return; int sz = R - L + 1; pos.insert(make_pair(L, sz)); if (L != 1 && R != n) sz = (sz + 1) / 2; len.insert(make_pair(sz, L)); } ...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int B = 250; int p1 = 5000000, p2 = 0; char buf[5000005], wbuf[5000005]; int gc() { if (p1 >= 5000000) fread(buf, 1, 5000000, stdin), p1 = 0; return buf[p1++]; } int rd() { int x = 0, ch = gc(); while (!isdigit(c...
#include <bits/stdc++.h> using namespace std; int main() { bool v[60], h[60]; int a, b, n; while (cin >> n) { memset(v, false, sizeof(v)); memset(h, false, sizeof(h)); for (int i = 1; i <= n * n; i++) { cin >> a >> b; if (i == 1) { cout << 1; h[a] = ...
/************************************************************************** Async Fifo -parameter N Queue data vector width Example : DATA[3:0] is N=4 -parameter DEPTH Queue entry depth Example DEPTH 16 is DEPTH=16 -parameter D_N Queue entry depth n size Example PARAMETER_DEPTH16 is 4 -SDF Settings Asynchr...
// (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 any output // files any of the foregoing (including device programming or simulati...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Sun May 28 18:34:41 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> int compare(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main() { int n, k; scanf( %d%d , &n, &k); int i; if ((n == 1 && k == 1)) { printf( -1 n ); return 0; } if (n == k) { printf( -1 n ); return 0; } if ((n - k...
#include <bits/stdc++.h> using namespace std; struct hashed_str { long long n; vector<long long> hs; vector<long long> pows; long long p = 61; long long mod = 1e9 + 7; hashed_str(string &s) { n = s.size(); long long n1 = (int)s.size(); pows = {1}; for (int i = 1; i < ...
#include <bits/stdc++.h> using namespace std; int x[2000], y[2000], c[2000]; vector<int> poss; multiset<int> xx[2000]; vector<pair<int, int> > events; map<pair<int, int>, int> M; long long int sum = 0, ans = 0; int update(int e, int m) { if (e < 0) return 0; auto it = M.upper_bound(make_pair(e, ...
/** * 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> h[100010], h1[100010]; long long cnt[100010], pre[100010], sum[100010]; int num[100010], mx[100010], n, tt, t1; inline int rd() { int x = 0; char ch = getchar(); for (; ch < 0 || ch > 9 ; ch = getchar()) ; for (; ch >= 0 &...
`define MAXQ 2 module uut ( input clk, input d, r, e, output [`MAXQ:0] q ); reg q0; always @(posedge clk) begin if (r) q0 <= 0; else if (e) q0 <= d; end reg q1; always @(posedge clk, posedge r) begin if (r) q1 <= 0; else if (e) q1 <= d; end reg q2; always @(posedge clk, negedge r) begin...
// (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 ...
#include <bits/stdc++.h> using namespace std; inline int max(int a, int b) { return a > b ? a : b; } inline int min(int a, int b) { return a < b ? a : b; } map<int, int> mp; int main() { int n, x; cin >> n; mp.clear(); for (int i(0); i < (n); ++i) { cin >> x; ++mp[x]; } lon...
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve() { int n, m; cin >> n >> m; vector<string> f(n); for (int i = 0; i < n; ++i) { cin >> f[i]; } vector<int> v(m); for (int j = 1; j < m; ++j) { for (int i = 1; i < n; ++i) { if (f[i - 1][j...
#include <bits/stdc++.h> using namespace std; void input(vector<int>& v, int n) { int i, io; for (i = 0; i < n; i++) { cin >> io; v.push_back(io); } } void output(vector<long long> v) { long long i; for (i = 0; i < v.size(); i++) cout << v.at(i) << ; } int main() { ios...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const int N = 100005; int i, n, k, x, y, lvl[N]; vector<int> g[N]; queue<int> q; int main() { ios_base::sync_with_stdio(0); memset(lvl, -1, si...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<vs> vvs; typedef vector<pii> vpii; typedef set<int> si; typede...
#include <bits/stdc++.h> using namespace std; int i, t, n, ciel, jiro, aux, a[10005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); for (cin >> t; t; --t) { cin >> n; for (i = 1; i <= n; ++i) { cin >> aux; if (n & 1) if (i == n / 2 + 1) a[++a[...
//================================================================-- // Design Unit : sn74151 (behaviour) // // File Name : sn74151.v // // Purpose : SN74151 // // Author : Daniel Guenther, Vancouver Island University // // Environmant : Icarus //------------------------------------------------------------------- // R...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using pii = pair<int, int>; constexpr int ALPHABET_SIZE = z - a + 1; constexpr int MAX_SIZE = 256; constexpr int INF = 1e8; int n; string s; string as, bs, cs; vector<int> next_pos[ALPHABET_SIZE]; int calced_pos[MAX_SIZE][...
#include <bits/stdc++.h> char T[1 << 21]; int n, m, ar[21][21]; int U[21], V[21], P[21], way[21], minv[21]; int hungarian(int n, int m, int ar[21][21]) { memset(way, 0, sizeof(way)), memset(U, 0, sizeof(U)), memset(V, 0, sizeof(V)), memset(P, 0, sizeof(P)); int i, j, i0, i1, j0, j1, x, y, cur, d...
#include <bits/stdc++.h> using namespace std; struct event { int t, l, r, v; }; void solve() { int n, q; cin >> n >> q; vector<event> e(q); vector<int64_t> a(n, INT_MAX), upd(n, 0); for (int i = 0; i < q; ++i) { cin >> e[i].t; cin >> e[i].l; cin >> e[i].r; cin >> ...
#include <bits/stdc++.h> using namespace std; int main() { int in, x = 0; int cnt = 0, p = 1, ans = 0; cin >> in; for (int i = in; i > 0; i /= 10) { if (i % 10 == 7) ans += p; p *= 2; cnt++; } if (cnt != 0) x = pow(2, cnt) - 2; cout << ans + x + 1; }