text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int INF = 2 * int(1e9); const long long INFll = 1ll * int(1e9) * int(1e9); const int MOD = 1000000007; template <typename T> ostream& operator<<(ostream& out, pair<T, T>& a) { out << a.first << << a.second; return out; } template <typename ...
`define bsg_xor_macro(bits) \ if (harden_p && (width_p==bits)) \ begin: macro \ bsg_rp_tsmc_40_XOR2D1BWP_b``bits xor_gate (.i0(a_i),.i1(b_i),.o); \ end module bsg_xor #(parameter `BSG_INV_PARAM(width_p) , parameter harden_...
#include <bits/stdc++.h> using namespace std; long long siv[1000006]; long long prime[1000006]; void seive() { for (long long i = 2; i < 1000006; i++) { prime[i] = prime[i - 1]; if (!siv[i]) { prime[i]++; for (long long j = i + i; j < 1000006; j += i) siv[j] = 1; } } ...
////////////////////////////////////////////////////////////////////// //// //// //// MP3 demo SRAM init //// //// //// //// This file is part of the MP3 d...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n, f = 0, ans = 0; cin >> n; long long a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { if (a[i + 1] < a[i]) ans += (a[i] - a[i + 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 la...
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n, m; cin >> n >> m; vector<long long int> G[N]; for (long long int i = 0; i < m; ++i) { long long int a, b; ...
#include <bits/stdc++.h> using namespace std; long long a, i, high, low, mid, nstr, ninte; int main() { scanf( %lld , &a); long long ans[a], str[a], inte[a], exp[a]; for (i = 0; i < a; i++) { scanf( %lld %lld %lld , &str[i], &inte[i], &exp[i]); } for (i = 0; i < a; i++) { high = ex...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; scanf( %d%d%d , &a, &b, &c); int m; scanf( %d , &m); string s; int val, ans = 0; vector<int> u, p; for (int i = 0; i < int(m); i++) { cin >> val >> s; if (s[0] == U ) u.push_back(val); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 180 + 10; const int oo = 1000000000; int opt[maxn][maxn * 2]; int c[maxn][maxn * 2], cc[maxn][maxn * 2]; int e[maxn][maxn]; int n, kk, d[maxn]; int father[maxn]; int res[maxn]; void dp(int u) { for (int v = 1; v <= n; v++) if (...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, flag = 0, j; cin >> n; while (n--) { int x; cin >> x; flag = 0; for (i = 0; i <= 33; i++) { for (j = 0; j <= 14; j++) { if (i * 3 + j * 7 == x) { cout << YES << endl; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module ICAP_config ( input fastclk, output [7:0] test, // DIP switches in and out input [3:0] sw_in, output [3:0] sw_out, // Tube interface input [2:0] h_addr, input h_cs_b, inout [7:0] h_data, input h_phi2, input h_rdnw, input h_rst_b ); ...
//Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2015.4 (win64) Build Wed Nov 18 09:43:45 MST 2015 //Date : Fri Feb 05 15:23:13 2016 //Host : WK116 running 64-bit major release (build 9200)...
/** * 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 = 2020 + 1; int vis[MAXN], par[MAXN], orig[MAXN], match[MAXN], aux[MAXN], t, N; vector<int> conn[MAXN]; queue<int> Q; void addEdge(int u, int v) { conn[u].push_back(v); conn[v].push_back(u); } void init(int n) { N = n; t = 0; ...
#include <bits/stdc++.h> void Solve(); int main() { Solve(); } using namespace std; const int INF = 1e9; const int N = 20; const double e = 1E-10; int hm, am, dm; int check(int ay, int dy) { int m = max(0, ay - dm), y = max(0, am - dy); if (!m) return -1; return (hm / m + (hm % m != 0)) * y ...
#include <bits/stdc++.h> using namespace std; int t; long long n; int main() { cin >> t; while (t--) { cin >> n; long long num; for (long long i = 1; i < n; i++) { if (i * i > n) { num = i - 1; break; } else if (i * i == n) { num = i; ...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) (* \VV/ **************************************************************) (* // * Th...
#include <bits/stdc++.h> using namespace std; bool f(int n, int h, int c, int t) { return (2 * n + 1ll) * abs(1ll * n * (h + c - 2 * t) + t - c) <= (2 * n - 1ll) * (1ll * n * (h + c - 2 * t) + h - t); } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); long long t = 1; cin...
#include <bits/stdc++.h> #define ll long long using namespace std; void solve(){ ll n, i; cin >> n; ll u, r, d, l; ll u1=0, r1=0, d1=0, l1=0; cin >> u >> r >> d >> l; if(u==n) r1++,l1++; if(d==n) r1++,l1++; if(r==n) u1++,d1++; if(l==n) u1++,d1++; ...
#include <bits/stdc++.h> using namespace std; const long long infl = 0x3f3f3f3f3f3f3f3fLL; const long long infi = 0x3f3f3f3f; const long long mod = infl; long long mygcd(long long a, long long b) { if (b == 0) { return a; } return mygcd(b, a % b); } long long mypow(long long a, long long...
#include <bits/stdc++.h> using namespace std; int n, a[201], dp[201][201][1001]; const long long int MOD = 1e9 + 7; int solve(int i, int g, int k) { if (g < 0 || k < 0) return 0; if (i == n) return (g == 0); if (dp[i][g][k] != -1) return dp[i][g][k]; long long int ret = 0; int nk = k - g * (...
#include <bits/stdc++.h> using namespace std; char a[1000005]; char c[1000005]; bool H(char a[], char c[], int i, int x) { int d = 0; for (int q = 0; q < i; q += x) { int s = 0; for (int o = 0; o < x; o++) { if (a[o + q] > c[o]) return 1; else if (a[o + q] == c[o]) ...
//Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2016.1 (lin64) Build Fri Apr 8 15:45:23 MDT 2016 //Date : Tue Jun 21 17:23:01 2016 //Host : darkin-UX303LN running 64-bit elementary OS Frey...
#include <bits/stdc++.h> using namespace std; int dir4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; int dir8[8][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}, {-1, 1}, {1, -1}, {1, 1}, {-1, -1}}; int dir8h[8][2] = {{2, 1}, {-2, -1}, {-1, 2}, {1, -2}, {1, 2}, {-2, 1}, {2, -1}, ...
#include <bits/stdc++.h> using namespace std; int hashCh = 31; struct HashCh { string code; int number; }; long long getHash(string text) { long long hash = 0; int size = text.size(); for (int i = 0; i < size; i++) { int ch = static_cast<int>(text[i]); hash += pow(hashCh, 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 law...
#include <queue> #include <cstdio> #include <cstring> using namespace std; const int Maxn=200000; const int Inf=0x3f3f3f3f; int n,k; int head[Maxn+5],arrive[Maxn<<1|5],nxt[Maxn<<1|5],tot; void add_edge(int from,int to){ arrive[++tot]=to; nxt[tot]=head[from]; head[from]=tot; } queue<int> q; ...
#include <bits/stdc++.h> using namespace std; const int N = 500023; bool vis[N]; vector<int> adj[N]; void solve() { long long int n; cin >> n; vector<long long int> v; for (long long int i = 0; i < n; i++) { long long int c; cin >> c; v.push_back(c); } sort((v).begin(...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) using namespace std; template <typename T1, typename T2> void ckmin(T1 &a, T2 b) { if (a > b) a = b; } template <type...
//====================================================================== // // shl32.v // ------- // 32bit left shift with carry in / carry out // // // Author: Peter Magnusson // Copyright (c) 2015, NORDUnet A/S All rights reserved. // // Redistribution and use in source and binary forms, with or without // modificati...
#include <bits/stdc++.h> using namespace std; int n, a[100100]; map<int, int> m; int mi(int a, int b, int c) { return min(min(a, b), c); } int mx(int a, int b, int c) { return max(max(a, b), c); } int md(int a, int b, int c) { return 0LL + a + b + c - mi(a, b, c) - mx(a, b, c); } int main() { io...
`include "constants.vh" `include "rv32_opcodes.vh" `include "alu_ops.vh" `default_nettype none module decoder( input wire [31:0] inst, output reg [`IMM_TYPE_WIDTH-1:0] imm_type, output wire [`REG_SEL-1:0] rs1, output wire [`REG_SEL-1:0] rs2, output wire [`REG_SEL-1:0...
/***************************************************************************** ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2012, Aeroflex Gaisler ------------...
// -*- Mode: Verilog -*- // Filename : ahb2wb.v // Description : this module makes up the interface between the AMBA // AHB slave and the Wishbone slave // Author : Thomas Ameseder // Created On : Mon Mar 01 13:55:59 2004 // // CVS entries: ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5, inf = 1e9 + 7; long long n, k, f[30]; string s, t, r; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); long long i, j, a, b, ans = 0; cin >> s >> t; r = s; sort(r.begin(), r.end(), greater<long long...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** \file "inverters-backwards.v" Chain a bunch of inverters between VPI/VCS and prsim, shoelacing. $Id: inverters.v,v 1.3 2010/04/06 00:08:35 fang Exp $ Thanks to Ilya Ganusov for contributing this test. */ `timescale 1ns/1ps `include "clkgen.v" module timeunit; initial $timeformat(-9,1," ns",9); endmodule m...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; template <typename T> void chmin(T &a, T b) { if (a > b) a = b; } template <typename T> void chmax(T &a, T b) { if (a < b) a = b; } template <typename T> void add(T &a, T b) { a += b; if (a < 0) a += MOD; ...
#include <bits/stdc++.h> using namespace std; int main() { long long tc, n, i, o, l, j; string s; cin >> tc; while (tc--) { long long one = 0; vector<long long> v; cin >> s; getchar(); s = s + 0 ; for (i = 0; i < s.size(); i++) { if (s[i] == 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 la...
/** * bsg_mul_array_row.v * * @author Tommy Jung */ `include "bsg_defines.v" module bsg_mul_array_row #(parameter `BSG_INV_PARAM(width_p) , parameter `BSG_INV_PARAM(row_idx_p) , parameter `BSG_INV_PARAM(pipeline_p)) ( input clk_i , input rst_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...
/* * 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...
module fifo( consumer_data, consumer_req, producer_data); //inout and output types of data that will be used input consumer_req; output consumer_data; input producer_data; //data types of variables that will be used wire [3:0] producer_data; wire consumer_req; reg consumer_data; ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_32_24.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ============================================...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; int rev(int a) { bitset<8> bs(a); string s = bs.to_string(); reverse((s).begin(), (s).end()); return bitset<32>(s).to_ulong(); } int main() { string line; getline(cin, line); for (int i = 0; i < (int)(line.length()); i++) { int p = ...
#include <bits/stdc++.h> int main() { char t[50], s[50]; scanf( %s , t); int l = strlen(t), k = l / 2, j = 0; if (l % 2 == 0) { k = l / 2 - 1; } for (int i = 0; i < l; i++) { s[i] = t[k]; j++; if (i % 2 == 0) { k = k + j; } else { k = k - j; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, t, c; cin >> n >> t >> c; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int count = 0; int ans = 0; for (int i = 0; i < n; i++) { if (arr[i] <= t) { count++; if (i == n - 1) { ...
(* begin hide *) From mathcomp Require Import ssreflect ssrfun ssrbool. (* end hide *) (** Convincing Coq that a function terminates can be frustrating. When modeling programming languages with subtyping, in particular, you might run into situations where the _contravariance_ of function types forces you to swap the a...
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014 // // fetches video data for renderer /* 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 terms of the GNU...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, a; cin >> n; vector<int> c(3 * 1e5, 0); for (int i = 1; i <= n / 2; i++) { cin >> a; if (a >= i) c[1e5 + a - i]++; } if (n % 2) { cin >> a; if (a >= n /...
Require Import Coq.Lists.List. Import ListNotations. From OakIFC Require Import Lattice Parameters ModelTypes State Events TraceLowEq. (* This is the top-level candidate security condition. This is a "possibilistic security condition". A possibilistic security condition says that two executions ...
#include <bits/stdc++.h> using namespace std; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, 1, 0, -1}; int dx2[] = {1, -1, -1, 1, 0, 0, -1, 1}; int dy2[] = {1, -1, 1, -1, 1, -1, 0, 0}; int kmx[] = {-1, -1, 1, 1, 2, -2, 2, -2}; int kmy[] = {2, -2, 2, -2, -1, -1, 1, 1}; int bishopX[] = {-1, 1, -1, 1}; int bi...
#include <bits/stdc++.h> using namespace std; long long solve(long long n, long long x, long long y) { if (y == 0) return 0; if (y == x / 2 + 1) return n / 2 + (n % 2); long long res = 0; if (y > x / 2 + 1) { res += n / 2; res += n % 2; res += solve(n / 2, x / 2, y - x / 2 - 1); ...
#include <bits/stdc++.h> using namespace std; int n, k, a, lev[16], loy[16], suf; double ret; double dp[16][(2 << 8)]; double calc(int pos, int mask) { if (pos == n) { int need = suf - __builtin_popcount(mask); if (need <= 0) return 1.0; else { int b = 0; for (int...
/** * 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...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of n0 // // Generated // by: wig // on: Tue Apr 1 13:31:51 2008 // cmd: /cygdrive/c/eclipse/MIX/mix_0.pl -strip -nodelta ../noassign.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $A...
module ScoreDecoder(in, Hex2, Hex1); input [4:0]in; output reg [6:0] Hex2,Hex1; parameter zero = 7'b1000000; parameter one = 7'b1111001; parameter two = 7'b0100100; parameter three = 7'b0110000; parameter four = 7'b0011001; parameter five = 7'b0010010; parameter six = 7'b0000010; parameter seven = 7...
package mypackage; bit [7:0] pkg_addr; bit [7:0] pkg_data; endpackage module times (); time x; initial x = 33ns; // Note no space endmodule : times interface itf #(parameter num_of_cli = 0); logic blabla; logic [7:0] addr, data[9]; modport Master(input data, date_delayed, output addr); endinterfa...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, p, b = 0; cin >> n >> p; vector<long long> v; for (int i = 0; i < n; ++i) { string s; cin >> s; if (s == half ) { v.push_back(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; int main() { int n, b, p; cin >> n >> b >> p; int a[10 + n], useP = 0, i, useB = 0; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n; i++) { if (a[i] == 1) useB++; else { if ((p - useP) <= 0) ...
/////////////////////////////////////////////////////////////////////////////// // $Id: small_fifo.v 4761 2008-12-27 01:11:00Z jnaous $ // // Module: small_fifo.v // Project: UNET // Description: small fifo with no fallthrough i.e. data valid after rd is high // // Change history: // 7/20/07 -- Set nearly full to 2^M...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( avx,avx2,fma ) using namespace std; using ll = long long; using ld = long double; const ld eps = (ld)1e-11; const long long INF = 4e18; long long n, q; vector<long long> a, b; vector<arr...
#include <bits/stdc++.h> using namespace std; int a[200005]; int b[200005]; int c[200005]; char str1[200005]; char str2[200005]; int main() { int n; while (scanf( %d , &n) != EOF) { cin >> str1 >> str2; int i; for (i = 0; i < n; i++) { a[i] = str1[i] - a ; b[i] =...
#include <bits/stdc++.h> using namespace std; double EPS = 1e-9; int INF = 1000000005; long long INFF = 1000000000000000005ll; double PI = acos(-1); int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1}; int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1}; long long MOD = 1000000007; template <typename T_vector> void out...
/* * 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 n, a[200000], x, y, ans; multimap<int, int> M; pair<int, int> P; int main() { scanf( %d , &n); for (int i = 1; i <= (n); ++i) scanf( %d , &a[i]); scanf( %d%d , &x, &y); sort(a + 1, a + n + 1); n = unique(a + 1, a + n + 1) - a - 1; for (...
// Copyright (C) 2005 Peio Azkarate, // // This source file 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; // either version 2.1 of the License, or (at your option) any // later 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 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...
module S4L2(clock_50mhz, clock_1hz, segmentos, anodo,estado); input clock_50mhz; //entrada de oscilacion del cristal externo output reg clock_1hz; //clock 1 segundo output reg [6:0] segmentos = 7'h3F; //apagar segmentos output reg anodo = 0; //encender display1 output reg [3:0] estado = 0; //estado inicial para conect...
/******************************************************* MIST32 GCI Special Memory : Device Using Make : 2011/09/27 Update : 2011/0 *******************************************************/ `default_nettype none module gci_std_display_device_special_memory #( parameter USEMEMSIZE = 32'h00000000, parameter ...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // Author: Lars-Peter Clausen <> // // All rights reserved. // // Redistribution and use in source and binary forms, ...
#include <bits/stdc++.h> using namespace std; long long n, m, a[100005]; long long dfn[100005], head[100005], idx, rev[100005], cnt, size[100005], top[100005], dep[100005], fa[100005], son[100005]; long long sum[100005 << 2], tag[100005 << 2]; void push_tag(long long p, long long l, long long r, long lo...
/** * 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...
`define SMV `include "ovl_delta_wrapped.v" `include "ovl_ported/ovl_delta.v" //`include "globalDefines.vh" /* * File: ovl_delta_wrapped_tb.v * Test bench for ovl_delta_wrapped.v * Includes assertions for verification. * Created 2013-10-16 * * Verified with the following parameters: * test_expr width min/m...
/* * 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 T, n, a[30005], b[30005]; long long sum[2]; int main() { scanf( %d , &T); while (T--) { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); a[n + 1] = 0; for (int i = 1; i <= n + 1; i++) b[i] = a[i] - a[i - 1]; ...
/////////////////////////////////////////////////////////////////////////////// // // File name: axi_protocol_converter_v2_1_9_b2s_incr_cmd.v // /////////////////////////////////////////////////////////////////////////////// `timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module ax...
/* Default memory map: 0 - INITIAL PC 0 - 65535 : SRAM (an actual RAM may be lower) 65536 - 131071 : DEVICES (UART, debug, comm channels, DRAM, user-defined, etc.) 65536: debug print (Verilator only) 65537: UART IN READY (READ) 65538: UART OUT READY (READ) 65539: UART IN (READ) / UART O...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); double fRand(double fMin, double fMax) { double f = (double)rand() / RAND_MAX; return fMin + f * (fMax - fMin); } template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); } template <class T> T max(T a, ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template <class T> inline bool Min(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> inline bool Max(T &a, T b) { re...
#include <bits/stdc++.h> using namespace std; struct Node { long long val, pos; }; deque<long long> dq; bool flag = false; void go(long long a, long long b) { if (a > b) return; if (a == b) { cout << YES << endl; dq.push_back(b); cout << dq.size() << endl; flag = true; ...
#include <bits/stdc++.h> using namespace std; long long n, m; int main() { cin >> n >> m; if (n > m) swap(n, m); if (n == 1) { cout << 6 * (m / 6) + 2 * max(m % 6 - 3, (long long)0); return 0; } if (n == 2) { if (m == 2) { cout << 0; return 0; } if...
//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...
/* Copyright (c) 2017 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, distribute,...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { int s, f, t; cin >> s >> f >> t; int x = t % (2 * (m - 1)); int y = t - x; int ans = 0; if (s == f) { ans = t; } else if (s < f) { i...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, l, q, num, ll; cin >> n >> m >> l; vector<long long> len(n); vector<bool> is_long(n, false); long long prev_long = 0; long long count = 0; bool was_long = false; for (long long i = 0; i < n; ++i) { cin >...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-2010 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...
//############################################################################ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // (C) Copyright // All Right Reserved //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // 2015 DLAB Course // La...
#include<bits/stdc++.h> #define FOR(i,a,b) for( int i=(a); i<(b); ++i) #define REP(i,a,b) for( int i=(a); i<=(b); ++i) #define SHOW(x) for(auto i:(x)){ cout << i << ;} cout << endl; #define MAXN 25 using namespace std; typedef long long LL; typedef pair<int,int> PII; typedef vector<int> VI; void...
#include <bits/stdc++.h> using namespace std; void ga(int N, int *A) { for (int i(0); i < N; i++) scanf( %d , A + i); } long long pw(long long n, long long k, long long MOD) { long long r(1); while (k) { if (k & 1) r = r * n >= MOD ? r * n % MOD + MOD : r * n; n = n * n >= MOD ? n * n % ...
#include <bits/stdc++.h> long long gi() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) f ^= ch == - , ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f ? x : -x; } std::mt19937 rnd(time(NULL)); template <class T> void cxk(T& a, T b) {...
// file: system_mon.v // (c) Copyright 2009 - 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 lic...