text
stringlengths
59
71.4k
// 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 : Mon Feb 13 12:47:54 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; int getDiff(int n, string s1, string s2) { int cnt = 0; for (int i = 0; i < n; i++) { if (s1[i] != s2[i]) { cnt++; } } return cnt; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const int len = 700, MAX = 1e7 + 10; int n, m, k, a[maxn]; int f[MAX], g[MAX]; long long ans[maxn]; struct query { int l, r, id; } q[maxn]; bool operator<(const query &a, const query &b) { if ((a.l - 1) / len != (b.l - 1)...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 9; const long long INF = 1e12; int n = 100000; long long a[MAXN]; long long f[20][MAXN]; void init() { for (int i = 1; i <= n; i++) { a[i] = i; } for (int i = 1; i <= n; i++) { for (int j = i + i; j < MAXN; j += i...
#include <bits/stdc++.h> using namespace std; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, 1, 0, -1}; const long long MOD = 1e9 + 7; const long long INF = 1e9; const double EPS = 1e-11; class UnionFind { private: vector<long long> p, rank, setSize; int numSets; public: UnionFi...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; int n, a, b, c; string s; map<pair<int, pair<int, int> >, int> dic; bool bo1 = false, bo2 = false, bo3 = false; void dfs(int a, int b, int c) { pair<int, pair...
/* * 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; inline long long read() { long long ret = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) ret = ret * 10 + ch - 0 , ch = getchar(); return ret * f;...
#include <bits/stdc++.h> int arr1[500005]; using namespace std; int main() { int t; cin >> t; for (int i = 1; i <= t; i++) { int a; cin >> a; arr1[a] = i; } long long int sum = 0; for (int i = 1; i < t; i++) { sum += abs(arr1[i] - arr1[i + 1]); } cout << 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...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.1 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps m...
#include <bits/stdc++.h> using namespace std; int x[500500], y[500500]; long long minl[500500], maxl[500500], minr[500500], maxr[500500], ll, rr; int n; pair<long long, long long> a[500500]; bool ok(long long M) { int j = 0; for (int i = 0; i < n; i++) { while ((j < n) && (a[j].first - a[i].fi...
/* * 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 2017 Damien Pretet ThotIP // // 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 // // http://w...
module top(); reg consumer_iclk; reg producer_iclk; wire cr; wire [3:0] cd; wire [3:0] pd; reg clk; always@(posedge clk) begin #10 assign consumer_iclk = ~consumer_iclk; #5 assign producer_iclk = ~producer_iclk; end always #1 assign clk ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: data_fifo.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // =================================...
#include <bits/stdc++.h> using namespace std; long long n; long long N[100006]; long long sum[1000006], S[1000006]; long long t[1000006]; long long t1[1000006]; long long lowbit(long long u) { return u & (-u); } void add(long long u, long long w) { while (u <= n) { t[u] += w; u += lowbit...
#include <bits/stdc++.h> #define rep(i,a,b) for(int i = (a); i < (b); ++i) #define rrep(i,a,b) for(int i = (b); i --> (a);) #define sz(v) int(v.size()) using namespace std; string inf, zero; string add(string x, string y, int init){ string res(sz(x), ? ); int todo = init; rrep(i,0,sz(x)){ ...
#include <bits/stdc++.h> using namespace std; const long MAX_N = 1e3 + 1; long n, m, h; long aw[MAX_N]; long bw[MAX_N]; vector<long> g[MAX_N]; bool v[MAX_N]; vector<long> st; vector<pair<pair<long, long>, long> > ans; void add_edge(long a, long b) { g[a].push_back(b); g[b].push_back(a); } ...
#include <bits/stdc++.h> using namespace std; const int N = 100005; inline int in() { int x; scanf( %d , &x); return x; } inline long long lin() { long long x; scanf( %I64d , &x); return x; } vector<int> G[N + N]; pair<int, int> edg[N + N]; int n, k, start; int inp[N + N]; ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/* * 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...
/* **************************************************************************** This Source Code Form is subject to the terms of the Open Hardware Description License, v. 1.0. If a copy of the OHDL was not distributed with this file, You can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt Description: mo...
module decoder(INST, DR, SA, SB, IMM, MB, FS, MD, LD, MW, BS, OFF, HALT); input [15:0] INST; output [2:0] DR; output [2:0] SA; output [2:0] SB; output [5:0] IMM; output MB; output [2:0] FS; output MD; output LD; output MW; output [2:0] BS; output [5:0] OFF; output HALT; reg...
#include <bits/stdc++.h> using namespace std; const int maxn = 5010; int n; int a[maxn], f[maxn]; long long b[maxn]; int main() { int i, ans = 0, j; long long w; scanf( %d , &n); for (i = 1; i <= n; ++i) { scanf( %I64d , &w); while (w % 2 == 0) ++a[i], w /= 2; b[i] = w; ...
// This module interfaces the minimig's synchronous bus to the asynchronous sram // on the Minimig rev1.0 board // // JB: // 2008-09-23 - generation of write strobes moved to clk28m clock domain module minimig_sram_bridge ( //clocks input clk, // 28 MHz system clock input c1, // clock enable signal inp...
//----------------------------------------------------------------- // AltOR32 // Alternative Lightweight OpenRisc // V2.0 // Ultra-Embedded.com // Copyright 2011 - 2013 // // Email: // // ...
#include <bits/stdc++.h> using namespace std; int n, k; char ch[111111]; int main() { scanf( %d%d , &n, &k); scanf( %s , ch); int pos = 0; for (int act = 0; act <= 1000000 && act < k && pos < n - 1; ++act) { if (act >= 1000000 && act % 2 == k % 2) break; while (pos < n - 1 && !(ch[po...
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<int, int> > H; vector<int> Ans[1000010]; int S[1000010]; int main() { scanf( %d%d , &n, &m), H.resize(m); int tot = 0; for (int i = 0; i < m; i++) scanf( %d , &H[i].first), tot += H[i].first, H[i].second = i + 1; if (t...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int x = 0; int n; cin >> n; for (int i = 0; i < n; i++) { string statement; cin >> statement; if (statement.find( + ) != std::string::npos) { x += 1; } else { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e6 + 10; const int mod = 998244353; long long a[maxn], b[maxn], n, m, sum1, sum2, res1, res2; long long dp[3030][3030]; inline long long qm(long long a, long long b, long long res = 1) { for (a %= mod; b; b >>= 1, a = a * a % mod) if ...
#include <bits/stdc++.h> using namespace std; bool bad[105]; string A[105]; bool check(string a, string b) { if ((int)a.size() != (int)b.size()) return false; for (int i = 0; i < (int)a.size(); i++) if (tolower(a[i]) != tolower(b[i])) return false; return true; } int main() { int n, i,...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
// 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 : Mon Feb 13 12:45:00 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; struct Point { int x; int y; int z; int id; }; bool compY(Point a, Point b) { if (a.y != b.y) { return a.y < b.y; } return a.z < b.z; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullpt...
#include <bits/stdc++.h> using namespace std; int main() { int n, d; cin >> n >> d; int a[n]; int x = 0; for (int i = 0; i < n; i++) { cin >> a[i]; x += a[i]; } if (x + (n - 1) * 10 > d) { cout << -1; } else { cout << 2 * n - 2 + (d - x - (n - 1) * 10) / 5; ...
// // Copyright 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
// 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 18:54:13 2017 // Host : TacitMonolith running 64-bit Ubuntu 16.04.3...
//wb_master_test.v /* Distributed under the MIT license. Copyright (c) 2015 Dave McCoy () 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 righ...
#include <bits/stdc++.h> using namespace std; const int maxn = 405; const int maxm = 5005; const int INF = 1000000000; const int mod = 1000000; struct EDGE { int cap, cost, v, next; } edge[mod]; int head[maxn], E, q[mod]; bool used[maxn]; int pre[maxn], cur[maxn], dis[maxn]; void add_edge(int ...
// // Spartan-3E on-chip RAM interface. // // Author(s): // - Serge Vakulenko, // // This source file may be used and distributed without // restriction provided that this copyright statement is not // removed from the file and that any derivative work contains // the original copyright notice and the associated discl...
//Legal Notice: (C)2010 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; void OUT_TST(string s, istream_iterator<string> it) { cerr << s; } template <typename T, typename... Args> void OUT_TST(string s, istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << ; OUT_TST(s, ++it, args...); } template <cla...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; if (n <= min(m, k)) cout << YES ; else cout << NO ; }
#include <bits/stdc++.h> using namespace std; int main() { int n, i; cin >> n; string s; cin >> s; if (n == 24) { if (s[0] == 2 && s[1] > 3 ) { s[0] = 1 ; } else if (s[0] > 2 ) { s[0] = 1 ; } } else { if (s[0] == 1 && s[1] > 2 ) { s[0]...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; char s[N]; int m, n; void sol() { int b[26] = {0}; scanf( %d %d , &n, &m); int a[N] = {0}; scanf( %s , s); int t; for (int i = 0; i < m; i++) { scanf( %d , &t); a[t - 1]++; } a[n - 1] = 1; for ...
`timescale 1ns / 1ps module test_engine_tb(); reg clk; reg reset; reg start_strobe; reg [63:0] wordA; reg [63:0] wordB; wire done_strobe; wire active_test_engine; wire [63:0] wordC; wire [63:0] wordD; test_engine #( .ROUNDS(5) ) test_engine ( .clk (clk), .reset (reset), // -- inputs ----------...
/* * Microcode instruction generator for Zet * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by the Free Software * Foundati...
// ----------------------------------------------------------------------- // // Copyright 2004,2007,2008 Tommy Thorn - All Rights Reserved // // 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 Foun...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int MAX_BUF_SIZE = 16384; char BUFOR[MAX_BUF_SIZE]; int BUF_SIZE, BUF_POS; char ZZZ; const int MXN = 100010; const int C = 262144; const int INF = 1000000001; string a[MXN]; int aa; int typ[MXN], gender[MXN]; string fem[3] = { liala , etra , ...
module sockit_test ( input CLOCK_50, input [3:0] KEY, output [3:0] LED, output [14:0] hps_memory_mem_a, output [2:0] hps_memory_mem_ba, output hps_memory_mem_ck, output hps_memory_mem_ck_n, output hps_memory_mem_cke, output hps_memory_mem_cs_n...
#include <bits/stdc++.h> using namespace std; const int N = 5005; int n, a, b, k; int d[3][N]; int sum[N]; int ans = 0; int cur = 1; int main() { scanf( %d%d%d%d , &n, &a, &b, &k); d[0][a] = 1; for (int cnt = 1; cnt <= k; ++cnt) { for (int i = 1; i <= n; ++i) sum[i] = (sum[i - ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; pair<int, int> a; int main(int argc, char *argv[]) { int n; cin >> n; if (n == 1) { cout << 1; return 0; } if (n == 2) { cout << 1 << << 2; return 0; } if (n == 3) { cout << 1 << << 1 << << 3; ...
`timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be...
#include <bits/stdc++.h> using namespace std; const int R = 1000; int main() { ios_base::sync_with_stdio(0), cin.tie(0); int n, s, d; cin >> n >> s >> d; vector<bitset<R>> a(s); for (int i = 0, k, x; i < s; ++i) { cin >> k; while (k--) cin >> x, a[i][x - 1] = 1; } vector<pa...
/* * 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 N = 1e6; vector<long long int> adj[N]; long long int depth[N]; void dfs(long long int n, long long int p) { for (auto x : adj[n]) { if (x != p) { depth[x] = depth[n] + 1; dfs(x, n); } } } void solve() { long lo...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:66777216 ) using namespace std; int RAND() { return (rand() << 16) + rand(); } const long long MOD = 1000000007; const int N = 2000007; int n; long long f[N]; long long power(long long a, long long b) { if (b == 0) return 1; if (b & 1) ret...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, p, q, r; cin >> n >> p >> q >> r; long long int a[n], ans = LLONG_MIN; for (long long int i = 0; i < n; i++) cin >> a[i]; long long int prefixMax[n], suffixMax[n]; prefixMax[0] = p * a[0]; suffixMax[n - 1] = r * ...
/* * 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 example 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 // ====================================================================== // This is intended to be a 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; long long f[800][800][3][3]; int b[400][2], c[800]; int main() { string s; while (cin >> s) { memset(f, 0, sizeof(f)); int t[800]; for (int i = 0, x = 0, k = 0; i < s.size(); i++) { if (s[i] == ( ) { b[++x][0] = i + 1; ...
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(0); long long n, m, k, x, y; cin >> n >> m >> k >> x >> y; long long ti = (n * m) + ((n - 2) * m); if (n == 1 || n == 2) ti = n * m; long long upd = 0, mid = 0; long long a[110][110]; long long num =...
module pdm(clk, level, O); parameter N = 16; /* The resolution in bits */ input wire clk; input wire [N-1:0] level; output wire O; /* * A completely ridiculous side project. Pulse Density Modulation * for controlling led intensity. The theory is pretty simple: ...
#include <bits/stdc++.h> using namespace std; long long i, j, n, c[123456], a[1111234], b[1125678], d[123456], l, ll, s, t, k, m, xh, x, x1, y, z; string p, r, w; map<string, long long> q; int main() { cin >> n >> k >> m; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); cout << a[m] ...
#include <bits/stdc++.h> using namespace std; template <class T1> void deb(T1 e1) { cout << e1 << endl; } template <class T1, class T2> void deb(T1 e1, T2 e2) { cout << e1 << << e2 << endl; } template <class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3) { cout << e1 << << e...
// -- (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...
//Legal Notice: (C)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 do...
#include <bits/stdc++.h> using namespace std; long long a[1010]; long long b[1010]; long long c[2020]; long long d[1010]; long long mex(long long m) { sort(b, b + m); long long j = 0; long long k = 0; long long ans = m; while (j < m) { if (b[k] > j) { ans = j; break...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:29:26 11/16/2014 // Design Name: // Module Name: vCounter2BCD // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
`include "assert.vh" module cpu_tb(); reg clk = 0; // // ROM // localparam MEM_ADDR = 4; localparam MEM_EXTRA = 4; reg [ MEM_ADDR :0] mem_addr; reg [ MEM_EXTRA-1:0] mem_extra; reg [ MEM_ADDR :0] rom_lower_bound = 0; reg [ MEM_ADDR :0] rom_upper_bound = ~0; wire [2...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_window (clock, reset, enable, start_event, test_expr, end_event, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter property_type = `OVL...
/** * 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, 2019 by Peter Monsson. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; Test test (/*AUTOINST*/ ...
/////////////////////////////////////////////////////////////////////////////// // // Module: unencoded_cam_lut_sm.v // Project: NF2.1 // Description: controls an unencoded muli-match cam and provides a LUT. // Matches data and provides reg access // ////////////////////////////////////////////////////////////////////...
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const long long inf = 1e18 + 9; long long ans = inf...
// Code generated by Icestudio 0.8.1w202112300112 `default_nettype none //---- Top entity module main ( input [1:0] vc83501, input [1:0] v78d66e, output [1:0] vbb8263, output [1:0] v6f5c59 ); wire [0:1] w0; wire [0:1] w1; wire [0:1] w2; assign w0 = vc83501; assign vbb8263 = w0; assign w1 = v78d66e; assign ...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 5, nax = 1e6 + 5; char rodz[25]; int id[25]; int res[2 * nax]; int cob(int a) { if (a) return (a % 2 ? 1 : 0) + cob(a / 2); return 0; } int pro() { int n; cin >> n; vector<int> w; for (int _ = 1, _n = (n); _ <= _...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int q[N]; int n; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n; for (int i = 1; i <= n; i++) cin >> q[i]; if (n & 1) { cout << YES << n ; cout << n - 1 << 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:43:45 02/20/2015 // Design Name: // Module Name: Fetch // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
`timescale 1 ps / 1 ps module onetswitch_top( inout [14:0]DDR_addr, inout [2:0]DDR_ba, inout DDR_cas_n, inout DDR_ck_n, inout DDR_ck_p, inout DDR_cke, inout DDR_cs_n, inout [3:0]DDR_dm, inout [31:0]DDR_dq, inout [3:0]DDR_dqs_n, inout [3:0]DDR_dqs_p, inout DDR_odt, inout DDR_ras_n...
#include <bits/stdc++.h> using namespace std; const int maxn = 2000 + 5; vector<int> g[maxn]; bool used[maxn][maxn]; int v[maxn], stk[maxn]; void dfs(int z, int m, int x, bool eq) { stk[z] = x; if (z == m) { if (eq) return; for (int i = 0; i < m + 1; ++i) printf( %d , stk[i] + 1); ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:200000000 ) using namespace std; const int INF = (int)1E8; const long long INF64 = (long long)1E18; const double EPS = 1E-9; const double PI = acos((double)0) * 2; const int MAXN = 160; int n, cost[MAXN]; string s; bool read() { if (!(cin ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) using namespace std; vector<vector<int> > vec; set<vector<int> > myset, vis; map<vector<int>, int> p; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, t, a, b; cin >> n >>...
(* Copyright (c) 2008-2012, Adam Chlipala * * This work is licensed under a * Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 * Unported License. * The license text is available at: * http://creativecommons.org/licenses/by-nc-nd/3.0/ *) Require Import Coq.Logic.Eqdep Coq.Lists.List. Requi...
#include <bits/stdc++.h> using namespace std; const int NN = 111 * 1000; int n, a, d; int t[NN], v[NN]; int main() { ios::sync_with_stdio(false); cin >> n >> a >> d; for (int i = 0; i < n; i++) { cin >> t[i] >> v[i]; } double Max = -1.; for (int i = 0; i < n; i++) { double ...
#include <bits/stdc++.h> using namespace std; int n, m, aa[300005], bb[300005], v[1000005], q; int x[4000005], y[4000005], dx; void build(int l, int r, int i) { if (l + 1 == r) { y[i] = v[l]; return; } int mi = (l + r) / 2; build(l, mi, i * 2); build(mi, r, i * 2 + 1); y[i] =...
// (C) 2001-2016 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 any of the foregoing (including device programming or simulation // files), and any associated docum...
#include<bits/stdc++.h> using namespace std; typedef long long int lli; const lli N = 1000009, K = z - a + 1; string s, t; lli n, k, a[K], b[K]; void Solve() { for(int i = 0; i < K - 1; i++) { while(a[i] > b[i] && a[i] >= k) { a[i] -= k; a[i + 1] += 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Samuel A. Falvo II // // Create Date: 18:16:26 10/30/2011 // Design Name: UXA 1A // Module Name: M_uxa_ps2_wrtlgc // Project Name: Kestrel-2 // Target Devices: Nexys2 // Tool versi...
#include <bits/stdc++.h> using namespace std; double PI = 3.141592653589793; const int P = 1e9 + 9; class mint { public: static int init_siz; static vector<mint> inverse, factorial; static int mintP; int n; static mint exp(mint a, long long e) { mint res = 1; while (e) { ...