text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 << 18; int a[MAXN]; long long s[MAXN << 2]; int h[MAXN << 2]; void build(int id, int l, int r) { if (l == r) { s[id] = a[l]; h[id] = 0; return; } int mid = (l + r) >> 1; build(id << 1, l, mid); build(id <<...
/* 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...
/* ** Copyright (C) 2009 Onno Kortmann <> ** ** 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 2 of the License, or ** (at your option) any later version. ** ** This program ...
#include <bits/stdc++.h> using namespace std; vector<unsigned int> vc; unsigned long long n, T; void LIS(unsigned int ll, unsigned int hh, unsigned long long &len, unsigned long long &offset) { vector<unsigned int> dp_nn; vector<unsigned int> dp_nn_plus_n; dp_nn.resize(ll); dp_nn_plus...
// (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...
#include <bits/stdc++.h> using namespace std; const long long N = 1e3 + 10; const long long M = 1e9 + 7; long long Max(long long a, long long b) { if (a > b) return a; return b; } long long Min(long long a, long long b) { if (a > b) return b; return a; } long long big_mul(long long a, lo...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, p, q, x = 0, y = 0, ans; cin >> n >> k; p = q = n; while (p % 2 == 0) { p /= 2; x++; } while (q % 5 == 0) { q /= 5; y++; } p = k - x; q = k - y; if (p < 0) p = 0; if (q < 0)...
#include <bits/stdc++.h> using namespace std; int main() { int v; cin >> v; if (v == 2) { cout << 2 << endl; return 0; } cout << 1 << endl; return 0; }
// (C) 2001-2017 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> using namespace std; const long long N = 1e7; vector<long long> primes; vector<long long> p(N, 1); signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, p, w, d; cin >> n >> p >> w >> d; long long l = 0, r = n; while (r - l...
//***************************************************************************** // DISCLAIMER OF LIABILITY // // This file contains proprietary and confidential information of // Xilinx, Inc. ("Xilinx"), that is distributed under a license // from Xilinx, and may be used, copied and/or disclosed only // pursuant to the...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
/* * 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...
//Legal Notice: (C)2012 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 la...
#include <bits/stdc++.h> int main() { int T; scanf( %d , &T); while (T--) { int n; scanf( %d , &n); int sum = 0; for (int i = 0; i < n; i++) { int t; scanf( %d , &t); if (t <= 2048) { sum += t; } } printf( %s n , sum >= 2048 ? ...
`timescale 1ns / 1ps module InstructionMem(Pc,clk,OpCode,RS,RT,RD,IMM,JADDR,UsableInstruc,NEWPC); input clk; input [31:0] Pc; output [4:0] OpCode; output [4:0] RS, RT, RD; output reg [31:0] UsableInstruc; output [31:0] NEWPC; output [16:0] IMM; output [31:0] JADDR; reg [0:0] ended; reg [31:0]...
#include <bits/stdc++.h> int main() { int n, k, i, j, swap; scanf( %d %d , &n, &k); int ara[n + 1][3]; for (i = 1; i <= n; i++) { scanf( %d , &ara[i][1]); ara[i][2] = i; } for (i = 1; i <= n; i++) { for (j = 1; j <= (n - i); j++) { if (ara[j][1] > ara[j + 1][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; double maxoo(double, double); int main() { int p1, p2, t1, t2; cin >> p1 >> p2 >> t1 >> t2; double p11, p12, p21, p22, misha, vasya; p11 = (3 * p1) / 10; p12 = (p1 - (p1 / 250) * t1); p21 = (3 * p2) / 10; p22 = p2 - (p2 / 250) * t2; mis...
/* * 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...
#include <bits/stdc++.h> const int N = 1000001; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; vector<pair<int, int>> a[n + 1]; int ans = 0; for (int i = 0; i < n - 1; i++) { int u, v; cin >> u >> v; ...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5 + 123; const long long INF = (long long)1e18 + 123; const int inf = (int)1e9 + 123; const int MOD = (int)1e9 + 7; int n; int main() { cin >> n; if (n % 2 == 0) { cout << white n ; cout << 1 2 ; } else cout...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_clk_cl_ccx_cmp.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it...
#include <bits/stdc++.h> using namespace std; struct Dinic { struct Edge { int to, flow, next; }; vector<Edge> edges; vector<int> head, act, h; int S, D; void AddEdge(int from, int to, int f, int rev_f = 0) { edges.push_back({to, f, (int)edges.size()}); swap(edges.back().ne...
#include <bits/stdc++.h> int t, n, a[200010], tot, cnt[200010]; int f[200010]; int find_f(int x) { return f[x] ^ x ? f[x] = find_f(f[x]) : x; } int main() { scanf( %d , &t); for (int _ = 0; _ < t; ++_) { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , a + i); for (int i = 1; ...
/**************************************** Adder Unit - 32bit Adder Make : 2010/12/07 Update : ****************************************/ `default_nettype none `include "core.h" module adder_n #( parameter N = 32 )( //iDATA input [N-1:0] iDATA_0, input [N-1:0] iDATA_1, input [4:0] iADDER_CM...
// megafunction wizard: %ALTSYNCRAM% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: altera_dpram_16x32.v // Megafunction Name(s): // altsyncram // ============================================================ //...
#include <bits/stdc++.h> using namespace std; int main() { long long sum = 0; int d[1000000 + 1] = {0}; for (int i = 1; i <= 1000000; i++) { for (int j = i; j <= 1000000; j += i) { d[j]++; } } int a, b, c; cin >> a >> b >> c; for (auto(i) = (1); (i) < (a + 1); ++(i)) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, temp, prev, A[100005]; bool f = false; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> A[i]; } for (int i = 0; i < k; i++) { cin >> temp; } if (k == 1) { if (n == 1) { cout << Yes ; ...
#include <bits/stdc++.h> using namespace std; const int N = 512345, lgN = 20, rootN = 1123; const double eps = 1e-18; int r[N], w[N]; vector<double> positive, negative; double p[N]; int main() { int n, c, d; cin >> n >> c >> d; for (int i = 1; i <= n; ++i) { cin >> r[i] >> w[i]; r[...
#include <bits/stdc++.h> using namespace std; inline long long int gcd(long long int a, long long int b) { return b ? gcd(b, a % b) : a; } inline long long int fast_pow(long long int a, long long int b, long long int mod) { long long int res = 1; a %= mod; while (...
#include <bits/stdc++.h> using uint64 = unsigned long long; const int N = 100, seed = 65537; char s[N]; std::unordered_map<uint64, int> words; std::unordered_set<uint64> mark; int dfs(int d, uint64 hs) { if (s[d] == 0) { if (mark.count(hs)) return 0; mark.insert(hs); auto it = words.fi...
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; long long ln, lk, lm; char s[100005]; void fmain() { scanf( %d%d%d , &n, &m, &k); scanf( %s , s + 1); for (int ty, l, r, x, i = 0; i < m + k; i++) { scanf( %d%d%d%...
module dv_top (); parameter DW = 64; // Memory width parameter MAW = 15; // Memory address width //regs/wires reg [1023:0] filename; wire [DW-1:0] ext_packet; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire nreset; ...
#include <bits/stdc++.h> using namespace std; const int M = 100100; long long mabs(long long x) { return x < 0 ? -x : x; } int n, m; long long a[M], h[M]; long long q[M], c[M], qf, qs, sum; void read() { cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> h[i]; } for (int i = 0; i + ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e2 + 10; const int maxm = 22; const int mod = 1e9 + 7; vector<int> G[maxn]; int dp[maxn][maxn][maxm]; int sum[maxn][maxn][maxm]; int n, k; void init() { for (int i = 0; i <= n; ++i) G[i].clear(); } void addEdge(int a, int b) { ...
#include <bits/stdc++.h> using namespace std; long long a[100500]; vector<long long> pfx[100500], vtx[100500]; long long proc(long long x, long long sum) { int n = vtx[x].size(); int mid = n / 2; long long res = sum; for (int i = mid, _n = n; i < _n; i++) res += vtx[x][i] - vtx[x][mid]; for ...
#pragma GCC optimize( Ofast , unroll-loops , no-stack-protector ) #include <bits/stdc++.h> using namespace std; #define all(a) (a).begin(), (a).end() #define sz(a) (int)(a).size() using ll = long long; using ld = long double; // using ld = __float128; using pii = pair<int, int>; using...
#include <bits/stdc++.h> using namespace std; int a[400100]; int b[400100]; int main() { int n; cin >> n; int k = 0; for (int i = 1; i <= n; i++) { int l; cin >> l; if (l == 0) { k = 1; } else { if (k == 1) a[i - 1] = l; else a[...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, l, r; cin >> n >> l >> r; long long int dp[n][3]; long long int a = r / 3 - (l - 1) / 3; long long int b = (r + 2) / 3 - (l + 1) / 3; long long int c = (r + 1) / 3 - l / 3; dp[0][0] = r / 3 - (l - 1) / 3; dp[...
#include <bits/stdc++.h> using namespace std; int dp[1010][1010]; vector<int> arr; int m; int solve(int idx, int mod) { if (idx == (int)arr.size()) return (mod == 0); else if (dp[idx][mod] != -1) return dp[idx][mod]; int ret = solve(idx + 1, mod); if (ret) return (dp[idx][mod] = re...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_MATLAB_Function_block2.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a > b) return a; else return b; } long long int min(long long int a, long long int b) { if (a < b) return a; else return b; } const int dx[4] = {-1, 1, 0, 0}; con...
`timescale 1 ns / 1 ns ////////////////////////////////////////////////////////////////////////////////// // Company: Rehkopf // Engineer: Rehkopf // // Create Date: 01:13:46 05/09/2009 // Design Name: // Module Name: address // Project Name: // Target Devices: // Tool versions: // Description: Address logic w/ S...
// -------------------------------------------------------------------- // Copyright (c) 2007 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
/* * 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() { string a, b; cin >> a >> b; for (int i = 0; i < a.size(); i++) { a[i] = tolower(a[i]); b[i] = tolower(b[i]); } if (a.compare(b) == 0) cout << 0 << n ; else { for (int i = 0; i < a.size(); i++) {...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.1 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1...
#include <bits/stdc++.h> using namespace std; int main() { long long r; vector<long long> a; cin >> r; for (int i = 0; i < r; i++) { long long aux; cin >> aux; a.push_back(aux); } a.push_back(a[0]); long long n = 0, m = 1; long long min = abs(a[0] - a[1]); for (...
module Hipercubo ( input RST, // Reset maestro input CLK, // Reloj maestro input[3:0] A00,A01, // Coef Matriz A input[3:0] A10,A11, input[3:0] B00,B01, // Coef Matriz B input[3:0] B10,B11, input[7:0] ENa, // Habilitaciones Ra input[7:0] ENb, // Habilitaciones Rb input[7:0] ENc, // ...
module Uart_top( input clk, input rst_n, input rs232_rx, output rs232_tx ); wire rx_en; wire sel_data,sel_data_rx,sel_data_tx; wire tx_en; wire [3:0] num,num_rx,num_tx; wire [7:0] rx_data; Bps_select Bps_rx( .clk (clk), //系统时钟50MHz .rst_n (rst_n), ...
#include <bits/stdc++.h> using namespace std; long long n, k; vector<long long> v; long long dp[1001][2001][4]; long long rec(long long i, long long mask, long long comp) { if (i == n && comp == k) return 1; else if (i == n) return 0; else if (comp > k) return 0; if (dp[i][co...
#include <bits/stdc++.h> using namespace std; long long i, n, m, a[1000001], t1, t2, sum; int main() { cin >> n >> m; for (i = 0; i < m; i++) { scanf( %I64d %I64d , &t1, &t2); a[t1]++; a[t2]++; } for (i = 1; i <= n; i++) sum += a[i] * (n - 1LL - a[i]); sum /= 2LL; cout <<...
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; void solve() { int n; cin >> n; int adad[n]; map<int, int> cnt; for (int i = 0; i < n; i++) { cin >> adad[i]; cnt[adad[i]]++; } int mini; mini =...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; for (int i = 0; i < n; i++) { cout << 1 << ; } cout << endl; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout << setprecision(32); int t; cin >> t; while (t--) solve(...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long n, u, v, w, res = 0, par[N]; vector<pair<long long, long long> > a[N]; long long root(long long x) { if (par[x] < 0) return x; return (par[x] = root(par[x])); } void Merge(long long u, long long v) { long long...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return x * f; } const int N = 500005, INF = 1e9; const doubl...
/* * 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 queue_param_1r_1w( in_wr_en, in_wr_addr, in_wr_data, in_rd_addr, out_rd_data, clk, rst ); parameter BITS = 2; para...
#include <bits/stdc++.h> #pragma GCC optimize( 03 ) using namespace std; int n, m, q, x[200100], y[200100], dad[400100]; bool viz[400100]; int find(int p) { if (dad[p] == p) return p; return dad[p] = find(dad[p]); } void join(int a, int b) { dad[find(a)] = find(b); } int main() { ios_base::s...
//====================================================================== // // blake2_G.v // ----------- // Verilog 2001 implementation of the G function in the // blake2 hash function core. This is pure combinational logic in a // separade module to allow us to build versions with 1, 2, 4 // and even 8 parallel compr...
module counter_n (clk,sig,n_clk_out); /*This module takes an input signal and implements a period counter, taking the reciprocal to deliver the frequency in kHz. USAGE: counter c(clk,sig,f); clk and sig are 1-bit inputs representing the clock and RF signal whose frequency is to be measured. f is a 4-bit output corre...
// megafunction wizard: %RAM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: fb_block.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===========================...
#include <bits/stdc++.h> using namespace std; set<long long> f, l, s; long long sf = 0, sl = 0; long long ksum = 0, cnt = 0, kmin = 0; void update(long long b, long long t) { int c = l.size(); if (t == 1) s.insert(b); else s.erase(b); if (c == 1 && cnt == 0) { ksum = kmin = *...
#include <bits/stdc++.h> using namespace std; const long long N = 11111111; const long long INF = (long long)(1e12); const long long mod = 998244353; const double eps = 1e-9; long long n, mx = -1, inv[N], a[N], k, all, cnt, ans; map<long long, long long, greater<long long> > M, S; long long get(long lon...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:02:42 05/13/2015 // Design Name: processor_16 // Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_processor.v // Project Name: processor // Target De...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long power(long long x, int y) { long long res = 1; x = x % mod; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1; x = (x * x) % mod; } return res; } int m...
// (c) Copyright 1995-2016 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 ...
/** # SmallBsf - 2-pole IIR Bandstop Filter # Small 2-Pole IIR band-stop filter, made using just adders and bit shifts. Set the frequency using the K0_SHIFT and K1_SHIFT parameters. It can be slowed down by strobing the `en` bit to run at a lower rate. By using power of two feedback terms, this filter is alsways st...
#include <bits/stdc++.h> using namespace std; string text; map<int, int> cache; string to_bin(int v) { string res = ; for (int i = 128; i >= 1; i /= 2) { if (v - i >= 0) { res += 1 ; v -= i; } else { res += 0 ; } } return move(res); } int reverse...
#include <bits/stdc++.h> using namespace std; const int INF = 100000005; const int p = 31; const int mod = (1 << 8) - 1; char s[200005]; const int siz = 5; struct node { public: int c[5][5]; void out() { for (int i = 0; i < siz; i++) { for (int j = 0; j < siz; j++) { pri...
#include <bits/stdc++.h> int main() { double n, r; std::cin >> n >> r; double ang = 180 / n; ang = 3.1415926536 * ang / 180.0; double R = sin(ang) / (1 - sin(ang)) * r; printf( %0.7lf n , R); return 0; }
// Cutiepie is a hoe! #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize ( Ofast ) #pragma GCC target ( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx ) #include <bits/stdc++.h> using namespace std; #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template ...
/** * 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() { long long int j, i, k, n, m, x; float d[6000], a[5008], b[5009]; cin >> n >> m; for (i = 0; i < n; i++) { cin >> a[i] >> b[i]; d[i] = (float)(1.0 * a[i]) / b[i]; } sort(d, d + n); printf( %.8f , d[0] * m); return ...
/* * 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...
/** * 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...
// (c) Copyright 1995-2017 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 ...
// -------------------------------------------------------------------- // Copyright (c) 2007 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Ter...
#include <bits/stdc++.h> using namespace std; long long vectorMult(pair<int, int> a, pair<int, int> b, pair<int, int> c) { return (c.first - a.first) * 1ll * (b.second - a.second) - (c.second - a.second) * 1ll * (b.first - a.first); } bool cmp(pair<int, int> a, pair<int, int> b) { return a.fi...
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<std::vector<std::pair<int, int>>> g(n); for (int i = 1; i < n; ++i) { int u, v, w; std::cin >> u >> v >> w; --u; --v; g[u].push_back(st...
#include <bits/stdc++.h> using namespace std; const long long mo = 998244353; const long long g = 3; const int N = 500000; int n, ax, bx, rev[N + 10]; long long aa[N + 10], bb[N + 10], c[N + 10], fac[N + 10], inv[N + 10]; long long mul(long long x, long long y) { long long z = 1; while (y) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2017/07/04 09:50:20 // Design Name: // Module Name: pwm // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision:...
`timescale 1 ns / 1 ps module s2mm_adv # ( // Users to add parameters here parameter integer C_PIXEL_WIDTH = 8, parameter integer C_IMG_WBITS = 12, parameter integer C_IMG_HBITS = 12, parameter integer C_DATACOUNT_BITS = 12, parameter integer C_PIXEL_STORE_WIDTH = 8, parameter integer C_IMG_STRIDE_SIZE = 1024, ...
#include <bits/stdc++.h> using namespace std; const double long EPS = 1e-10; struct wor { double long x = 0, y = 0; }; double long dist(wor a, wor b) { double long answer = sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); return answer; } pair<vector<double long>, vector<lo...
#include <bits/stdc++.h> using namespace std; const int M = 1e5 + 50; int ch(char a) { if (a == tolower(a)) return a - a ; else return a - A + 26; } int get_ans(int n) { char s[M]; scanf( %s , s); int cnt[52], mm = 0, len = strlen(s); memset(cnt, 0, sizeof(cnt)); for...
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-15; const long double PI = 3.14159265358979323846; inline int lg2(long long n) { int h = 0; while ((1ll << h) < n) ++h; return h; } struct configio { configio() { cin.tie(nullptr); ios_base::sync_with_stdio(...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define M 1000000007 int main() { std::ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--) { string s; cin>>s; for(i...
`timescale 1ns / 1ps module TX #( parameter stateA = 'b00001, parameter stateB = 'b00010, parameter stateC = 'b00100, parameter stateD = 'b01000, parameter stateE = 'b10000) (input clk, input baud_rate, input [7:0]d_in, input tx_start, output reg tx, output reg tx_done); reg [4:0] state...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int n, m, a, b, g; int dis[N]; long long ans, c[N]; long long sum(int u) { return 1LL * u * (u + 1) / 2; } long long query(int u) { return sum(u / g + 1) * g - 1LL * (u / g + 1) * ((g - ((u + 1) % g)) % g); } int gcd(int u, int v...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * T...
#include <bits/stdc++.h> using namespace std; const long long N = (long long)(2e5 + 1); bool bipartite = true; vector<long long> colour; vector<long long> adj[N]; vector<long long> visited; void dfs(long long node, long long par, long long col) { visited[node] = 1; colour[node] = col; for (aut...
/** * 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 c1, c2, c3, c4, n, m, bus[1009], tre[1009], x, z1, z, l, l1, y; int main() { cin >> c1 >> c2 >> c3 >> c4; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> bus[i]; if (l == 0) { if (x + bus[i] * c1 < x + c2) x += bus[i]...