text
stringlengths
59
71.4k
module msg_cmd_dec( input [0:7] cmd, output r, w, in, pa, ok, pe, en, output cpd, cpr, cpf, cps ); wire [0:10] bus; always @ (*) begin case (cmd) { `MSG_REQ, `CMD_R, 3'b110 } : bus = 11'b10000000000; { `MSG_REQ, `CMD_W, 3'b111 } : bus = 11'b01000000000; { `MSG_REQ, `CMD_IN, 3'b101 } : bus = 11'...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: cmp_sram_redhdr.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 a...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; int a[105], n, K, sn; struct Mat { int a[105][105]; Mat() { memset(a, 0, sizeof(a)); } Mat operator*(const Mat &b) const { Mat c = Mat(); for (int i = 0; i <= sn; i++) for (int j = 0; j <= sn; j++) ...
`timescale 1ns/1ps /* * It is just a placeholder for a real testbench. Made from 333, not everything updated */ module testbench(); parameter CLK_PER = 6.25;// 160MHz parameter CLK2WA= 1; parameter WA2WD= 1; ///AF: parameter aaaa=0; ///AF: parameter aaaa=1; reg sclk,xclk; ...
#include <bits/stdc++.h> using namespace std; int n, m; char s[100005]; vector<int> p, star; void input() { scanf( %s , s); p.clear(), star.clear(); int l = strlen(s); for (int i = 0; i < l; i++) { if (s[i] == P ) p.push_back(i); if (s[i] == * ) star.push_back(i); } n = p...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long ans = LONG_LONG_MAX; for (int i = 1; i * i <= n; i++) { ans = min(ans, ((i - 1) + ((n + i - 1) / i) - 1)); } cout << ans << 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...
/* * 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> namespace io { const char endl = n ; template <typename T> inline void chkmin(T &a, T b) { a > b ? a = b : 0; } template <typename T> inline void chkmax(T &a, T b) { a < b ? a = b : 0; } struct Stream { template <class T> Stream operator>>(T &x) { x = 0...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:14:21 06/30/2015 // Design Name: // Module Name: ps2_mouse_kempston // Project Name: // Target Devices: // Tool versions: // Descri...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> v(n); for (auto &i : v) cin >> i; int q; cin >> q; vector<int> idx(n, 0); vector<int> ops(q, 0); ...
/* * Simple debouncer module. * * FSM is used to check, whether the instance is in one of the three states: * * - initial state, where output is being zerod * * - counting state: it's where we decide how long button needs to be * pressed to generate a state change on the output * * - do state, where actual ...
/* * 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) 1995/2014 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Vers...
/** * 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...
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); int n; std::cin >> n; std::vector<int> data(n); for (int i = 0; i < n; i++) { std::cin >> data[i]; } int s; int t; std::cin >> s; std::cin >> t; --s; --t; if (s > t) { std::swap(s, t...
#include <bits/stdc++.h> using namespace std; vector<string> vs, vs2; set<string> st; map<string, int> mp, mp1; long long i, j, k, x, y, m, n, a, b, c, d, e, f, g, h, l, o, p, q, t, u, v, w, z, r, ln, neg, pos, sm, ar[500000 + 5], br[500000 + 5], fr[60], cnt; string s, s1, s2, s3; int main() { w...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5010; int f[MAXN]; string s; int l; int ans[MAXN]; int help[MAXN]; int nim[MAXN]; int start[MAXN]; void init() { f[0] = 0; f[1] = 1; for (int i = 2; i <= l; ++i) { memset(nim, 0, sizeof(nim)); nim[f[i - 2] ^ f[0]]...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); // surefire lint_off _NETNM // surefire lint_off STMINI input clk; integer _mode; initial _mode ...
// (C) 2001-2018 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files from any of the foregoing (including device programming or simulation // files), and any associated ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int INF = 1000001000; const long long INFLL = INF * 1LL * INF; const int mod = 1000 * 1000 * 1000 + 7; const int mod9 = 1000 * 1000 * 1000 + 9; const int modr = 99990001; const long double PI = 3.141592653589...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
`timescale 1 ns / 1 ps module axis_pps_counter # ( parameter integer AXIS_TDATA_WIDTH = 32, parameter integer CNTR_WIDTH = 32 ) ( // System signals input wire aclk, input wire aresetn, input wire pps_data, // Master side output w...
// *************************************************************************** // *************************************************************************** // 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; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin...
#include <bits/stdc++.h> using namespace std; int N, M; string grid[1000]; vector<vector<pair<int, char>>> startAdj; vector<bool> visited; vector<int> merged; vector<vector<pair<int, char>>> adj; vector<int> value; vector<int> greaterCount; void flood(int start, int pos) { if (visited[pos]) retu...
(* * Copyright 2019 Jade Philipoom * * 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 or agreed...
`timescale 1ns / 1ps //********************************************************************** // File: spi_master.v // Module:spi_master // by Robin zhang //********************************************************************** module spi_master_reduced( clk,rst_n, spi_miso,spi_mosi,spi_clk, spi_tx_en,s...
/* Instruction Word 15: 0, First Word 31:16, Second Word */ module DecOp( clk, istrWord, regCurSr, idRegD, idRegS, idRegT, idImm, idStepPc, idUopPc, idUopWord ); input clk; //clock input[31:0] istrWord; //source instruction word input[31:0] regCurSr; //current SR output[6:0] idRegD; output[6:0] idRe...
//----------------------------------------------------------------- // FPGA Audio Project SoC IP // V0.1 // Ultra-Embedded.com // Copyright 2011 - 2012 // // Email: // // License: LGPL // // If you wo...
// -- (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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
/* ORSoC GFX accelerator core Copyright 2012, ORSoC, Per Lenander, Anton Fosselius. TRANSFORMATION PROCESSING MODULE This file is part of orgfx. orgfx is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, ...
#include <bits/stdc++.h> using namespace std; long long n, sz, i, ans, j, a[200001], t[531172], op; void upd(int x) { for (j = x / 2; j >= 1; j /= 2) t[j] = max(t[j * 2], t[j * 2 + 1]); } long long finds(int l, int r) { long long sum = -1; while (l <= r) { if (l % 2 == 1) sum = max(sum, t[l]...
`timescale 1ns / 100ps module QMFIR_uart_top(/*AUTOARG*/ // Outputs uart_tx, // Inputs uart_rx, clk, arst_n ); // output [3:0] cnt; output uart_tx; input uart_rx; input clk; input arst_n; wire arst_n; wire [15:0] MEMDAT; ...
#include <bits/stdc++.h> using namespace std; class Solver { public: void solve() { cin >> n; long long sign = 1; long long C = n; long long three_to_i = 1; for (long long i = 1; i <= n; i++) { long long term = 2LL * (sign < 0 ? sign + mod : sign) * C; term %= mo...
//Legal Notice: (C)2015 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; const int N6 = 1e6 + 6; using namespace std; long long n, m, x, y, sum1, sum2, ans1, ans2; int main() { cin >> n >> x >> y; if (n > y) { cout << -1; return 0; } sum1 = y - n + 1; sum1 *= sum1; sum1 += (n - 1); if (sum1 >= x)...
`include "elink_regmap.vh" module elink_cfg (/*AUTOARG*/ // Outputs txwr_gated_access, etx_soft_reset, erx_soft_reset, clk_config, chipid, // Inputs clk, nreset, txwr_access, txwr_packet ); parameter RFAW = 6; // 32 registers for now parameter PW = 104; // 32 reg...
#include <bits/stdc++.h> using namespace std; int main() { string s; char mi, ma; int max = 0, min = INT_MAX; pair<int, char> p[4]; for (int i = 0; i < 4; ++i) { cin >> s; p[i].first = s.length() - 2; p[i].second = s[0]; } sort(p, p + 4); int flag1 = 0, flag2 = 0; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 300005; int n, m, ans, two, one, l, r, k, a[N], dp[N][205]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); a[i] /= 100; } memset(dp, 127, sizeof(dp)); dp[0][0] = 0; for (int i = 0; i...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, x, y; cin >> n >> x >> y; int a[n]; int c = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] <= x) c++; } if (x > y) cout << n << endl; else { if (c % 2 == 0) cout << c /...
/* * 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 = 5000000 + 10; const int mod = 51123987; int n; long long p[maxn], sum; char s1[maxn], s[maxn]; long long min(int a, int b) { return a < b ? a : b; } inline void init() { s[0] = $ ; for (int i = 1; i <= n; ++i) s[2 * i] = s1[i], s[2 ...
#include <bits/stdc++.h> using namespace std; int main() { int sol = 0; int n; cin >> n; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= i; ++j) { for (int k = i - j; k <= j; ++k) { if (((k ^ j) ^ i) == 0 && k + j > i) ++sol; } } } cout << sol << n...
#include <bits/stdc++.h> using namespace std; int DEBUG = 0; bool isss(vector<int> s1, vector<int> s2) { int si1, si2; si1 = s1.size(); si2 = s2.size(); for (int i = 0; i < si1; i++) { bool ttt = false; for (int j = 0; j < si2; j++) { if (s1[i] == s2[j]) { ttt = true;...
#include <bits/stdc++.h> using namespace std; map<int, int> M; long long posSum[300001]; int A[300001]; int main() { int N; cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; posSum[0] = 0; for (int i = 1; i <= N; i++) { if (A[i] < 0) posSum[i] = posSum[i - 1]; else ...
// timerInterrupts.v module timer( pclk, nreset, bus_write_en, bus_read_en, bus_addr, bus_write_data, bus_read_data, fabint ); input pclk, nreset, bus_write_en, bus_read_en; input [7:0] bus_addr; input [31:0] bus_write_data; output reg [31:0] bus_read_data; output reg fab...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int a[205], b[105]; set<int> st; int n; void solve() { cin >> n; for (int i = 1; i <= n; i++) cin >> b[i]; st.clear(); for (int i = 1; i <= 2 * n; i++) st.insert(i); for (int i = 1; i <= n; i++) { st.erase(b[...
#include <bits/stdc++.h> using namespace std; const int N = 1000; const int inf = (int)1e9 + 1; const long long big = (long long)1e18 + 1; const int P = 239; const int MOD = (int)1e9 + 7; const int MOD1 = (int)1e9 + 9; const double eps = 1e-9; const double pi = atan2(0, -1); const int ABC = 26; in...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; bool remove = true; int ans = 0; while (remove) { remove = false; int idx; char c = 0 ; if (s.size() > 1) { for (int i = 0; i < s.size(); i++) { if ...
`include "project_defines.v" module nh_lcd #( parameter BUFFER_SIZE = 12 )( input rst, input clk, output [31:0] debug, //Control Signals input i_enable, input i_reset_display, input i_data_command_mode, input ...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 3; int last[22][22]; int a[maxn], dp[20][maxn]; int main() { ios_base::sync_with_stdio(false); int n, q; cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; int l = 19; memset(last, 63, sizeof last); memset(d...
#include <bits/stdc++.h> using namespace std; const int N = 1010; int vis[N]; vector<int> a[N], tmp; int main() { int n; scanf( %d , &n); int x = 1; for (int i = 2; i <= n; i++) { if (n - (n + i - 1) / i - i + 1 > n - (n + x - 1) / x - x + 1) x = i; } int ans = n - (n + x - 1) / ...
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 10, mod = 1e9 + 7; int rd() { int x = 0, w = 1; char ch = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + (ch ^ 48); ch = getchar()...
#include <bits/stdc++.h> using namespace std; unsigned long long int Gcd(unsigned long long int a, unsigned long long int b) { if (b == 0) return a; else return Gcd(b, a % b); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); unsigned long long int l, r, gcd, lcm; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e3; int n, x[N], d[N], i, j; int main() { cin >> n; for (i = 0; i < n; i++) cin >> x[i] >> d[i]; for (i = 0; i < n; i++) for (j = i + 1; j < n; j++) if (x[i] + d[i] == x[j] && x[j] + d[j] == x[i]) return cout << YES , 0; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:54:36 07/27/2013 // Design Name: // Module Name: bench // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // R...
#include <bits/stdc++.h> using namespace std; int main() { int n; int m; cin >> n >> m; vector<int> zahlen(n); for (int i = 0; i < n; i++) cin >> zahlen[i]; for (int i = 0; i < m; i++) { int l, r, x; cin >> l >> r >> x; l--; x--; r--; int tr = zahlen[x]; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int u, v, w; cin >> u >> v; if (u > v || (u + v) % 2 != 0) cout << -1 << endl; else if (u == v && u == 0) cout << 0 << endl; else if (u == v) cout << 1 ...
/* * 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) 1991-2003 Altera Corporation //Any megafunction design, and related netlist (encrypted or decrypted), //support information, device programming or simulation file, and any other //associated documentation or information provided by Altera or a partner //under Altera's Megafunction Partne...
#include <bits/stdc++.h> using namespace std; template <typename T> T id(T b) { return b; }; template <class It> bool all(It f, It l) { return std::all_of(f, l, id<bool>); } template <class It> bool any(It f, It l) { return std::any_of(f, l, id<bool>); } template <typename T> void ch...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; // verilator lint_off GENCLK reg [7...
#include <bits/stdc++.h> using namespace std; const int maxd = 1e6 + 10; int a[maxd]; long long sum, ans = 1e18; vector<long long> b; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) sum += a[i]; if (sum == 1) { prin...
#include <bits/stdc++.h> using namespace std; int N; int arr[51][51]; bool checkSum(int num, int row, int col) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (arr[row][i] + (long long int)arr[j][col] == num) { return true; } } } 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 law...
#include <bits/stdc++.h> using namespace std; vector<long long int> adj[200005]; vector<int> visited(200005, 0); vector<long long int> ans; void topo(long long int s) { visited[s] = 1; long long int sz = adj[s].size(); for (long long int i = 0; i < sz; i++) { if (visited[adj[s][i]] == 0) top...
#include <bits/stdc++.h> const int LIM = 1e5 + 5; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> x(n), y(n); for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; if (n % 2) { cout << NO ; return 0; } else { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m, i, j; cin >> n >> m; char a[200][200]; for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) cin >> a[i][j]; vector<vector<long long> > b(200, vector<lo...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 100; int head[maxn], cnt; vector<int> pos[maxn]; int len[maxn]; int val[maxn], pre[maxn], vis[maxn]; char str[1100]; char pat[1100]; struct edge { int from, to, flow, next, cost; } e[2 * maxn]; void addedge(int from, int to, ...
#include <bits/stdc++.h> using namespace std; int n, r, R, k, l, A[100005]; string cad, aux; char x, y; map<int, int> M; struct Res { int X, Y, Z; Res() {} Res(int a, int b, int c) { int F[5]; F[0] = a; F[1] = b; F[2] = c; sort(F, F + 3); X = F[2]; Y = F...
#include <bits/stdc++.h> using namespace std; template <typename T, typename T1> ostream &operator<<(ostream &out, pair<T, T1> obj) { out << ( << obj.first << , << obj.second << ) ; return out; } template <typename T, typename T1> ostream &operator<<(ostream &out, map<T, T1> cont) { typenam...
#include <bits/stdc++.h> using namespace std; inline int read() { int f = 1, x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) f = (ch == - ) ? -1 : 1, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return f * x; } const int N = 500 + 5; const...
#include <bits/stdc++.h> using namespace std; int N, C, cnt; int A[33], P[33]; double dp[33][33][222], sol; inline int f(int l, int r, int i) { if (i < l || i > r) return i; int ret = i - l + 1; int len = r - l + 1; ret = len - ret + 1; ret = l + ret - 1; return ret; } int main() {...
/** * 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) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none // Closed loop solution module cdc_reset_sync ( ...
/* * 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...
/* * BCH Encode/Decoder Modules * * Copyright 2015 - Russ Dill <> * Distributed under 2-clause BSD license as contained in COPYING file. */ `timescale 1ns / 1ps `include "config.vh" `include "bch_defs.vh" /* Reduced chien search for cases with only 1 bit error */ module bch_error_one #( parameter [`BCH_PARAM_SZ...
#include <bits/stdc++.h> using namespace std; long long dp[55][55][55][55]; long long ara[55]; double f[55]; long long cnt(long long i, long long k, long long sum, long long zawad) { if (i == 0) return (k == 0 && sum == 0); if (k > i || sum < 0) return 0; if (dp[i][k][sum][zawad] != -1) return dp[...
#include <bits/stdc++.h> using namespace std; int main() { long long int j, t; cin >> t; for (j = 0; j < t; j++) { long long int n; cin >> n; long long int a[n], i; for (i = 0; i < n; i++) cin >> a[i]; long long int p = a[0], sum = a[0]; for (i = 1; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353, N = 20, M = 1 << 5; int n, m; int f[2][N][N][N][N][2][2], (*nxt)[N][N][N][2][2] = f[1], (*cur)[N][N][N][2][2] = *f; int snx[M], sny[M], spx[M], spy[M], A; void add(int &x, int y) { x += y - mod; x ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Case Western Reserve University // Engineer: David Ariando // // Create Date: 22:22:00 01/31/2018 // Project Name: EECS301 Digital Design // Design Name: Lab #2 Project // Module Name: ...
#include<bits/stdc++.h> #define X first #define Y second #define sz(a) (int)a.size() #define ll long long //#define int long long using namespace std; const int mod = 1e9 + 7; const int N = 3e5; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; ...
#include <bits/stdc++.h> using namespace std; using llint = long long; using par = pair<int, int>; const int MAXN = 200100; llint w[MAXN]; vector<par> edges[MAXN]; int p[MAXN], in[MAXN], out[MAXN], idx[MAXN], id; void dfs(int u) { in[u] = ++id; for (const auto& edge : edges[u]) { if (edge....
#include <bits/stdc++.h> using namespace std; long long s1[2100][2100], sum[2100][2100], cnt[2100][2100], cnt1[2100][2100]; int main() { int n, m, i, j; long long res; scanf( %d%d , &n, &m); for (i = 2; i <= m; i++) { for (j = 1; j <= n; j++) { cnt[i][j] = sum[i][j - 1] + 1; ...
// (c) Copyright 2012-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 license and does not g...
#include <bits/stdc++.h> using namespace std; template <class T> struct lazy_seg { public: vector<T> st, lazy; lazy_seg(int n) { st.resize(4 * n + 1, 0), lazy.resize(4 * n + 1, 0); } lazy_seg() = default; void push(int l, int r, int curr) { if (lazy[curr] != 0) { st[curr] += lazy[...
/** * 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...
`default_nettype none module sdi_interface_control( input wire iCLOCK, input wire inRESET, //Interface Select input wire iIF_SELECT, //(0)UART | (1)PARALLEL //UART input wire iDEBUG_UART_RXD, output wire oDEBUG_UART_TXD, //Parallel input wire iDEBUG_PARA_REQ, output wire oDEBUG_PARA_BUSY, ...
#include <bits/stdc++.h> using namespace std; int n, a[100050], cnt = 0; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) if (a[i] > cnt) cnt++; cout << cnt + 1; return 0; }
#include <bits/stdc++.h> using namespace std; template <typename First> void debug_print_in(First first) { cerr << first << endl; return; } template <typename First, typename... Rest> void debug_print_in(First first, Rest... rest) { cerr << first << ; debug_print_in(rest...); return; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 * 1000 + 10; int ans[MAXN][MAXN]; int main() { ios::sync_with_stdio(false); int n, d, k; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; } sort(a.begin(), a.end(), [...
module note2dds_2st_gen(CLK, NOTE, ADDER); input wire CLK; input wire [6:0] NOTE; output reg [31:0] ADDER; reg [31:0] ADDER_tbl [12:0]; // note div 12 ( * 0,08333333333333333333333333333333) //; Add input / 16 to accumulator //; Add input / 64 to accumulator initial begin ADDER_tbl[ 4'd0] <= 32'd0359575; ADDER_tbl...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N, M; vector<int> g[maxn]; long long out[maxn], in[maxn]; int main() { cin >> N >> M; for (int i = 1; i <= N; ++i) { g[i].clear(); out[i] = in[i] = 0; } for (int i = 1; i <= M; ++i) { int a, b; ...
#include <bits/stdc++.h> using namespace std; int m[200]; int n; int S, E; bool is_ok(int lim) { int s = 0, e = 0; for (int i = 0; i < lim; ++i) s += m[i]; for (int j = lim; j <= n; ++j) e += m[j]; return s <= E && e <= E && s >= S && e >= S; } int main() { cin >> n; for (int i = 1...
#include <bits/stdc++.h> using namespace std; const int N = 3010; long long a[N], b[N], n, m; long long sa = 0, sb = 0, bestSa, bestSb; pair<int, int> ansOne, ansTwo; vector<long long> va, vb; void add(long long *arr, int size, vector<long long> &v) { for (int i = 0; i < size; ++i) for (int j = ...
#include <bits/stdc++.h> using namespace std; const int c = 100002, k = 6; long long s[7], n, ans = 1e9, mini = 1e9, t[c]; priority_queue<pair<int, pair<int, int> > > q; void pb(int a, int b) { q.push({t[a] - s[b], {a, b}}); mini = min(mini, t[a] - s[b]); } int main() { ios_base::sync_with_std...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distri...