text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int N = 300 * 1000 + 20; int n, a[N]; multiset<int> e; long long ans; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (e.size(...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_exu_reg.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 and...
#include <bits/stdc++.h> using namespace std; int t = 0; int ans = 1; long long int prime(long long int n) { while (n % 2 == 0) { if (t == 2) break; n = n / 2; t++; ans *= 2; } for (int i = 3; i <= sqrt(n); i += 2) { while (n % i == 0) { if (t == 2) break; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int count25 = 0; int count50 = 0; int ans = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] == 25) { count25++; } else if (arr[i] == 50) { if (count25 > 0)...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e; while (e--) { long long int A, B, C, D; cin >> A >> B >> C >> D; if (A == C) { cout << max(B, D) - min(B, D) << endl; } else { if (B <= c && D ...
// synopsys translate_off `timescale 1 ps / 1 ps // synopsys translate_on module data_fifo ( data, rdclk, rdreq, wrclk, wrreq, q, rdempty, wrfull); parameter WIDTH = 24; input [WIDTH-1:0] data; input rdclk; input rdreq; input wrclk; input wrreq; output [WIDTH-1:0] q; ...
#include <bits/stdc++.h> using namespace std; int main() { int s, v1, v2, t1, t2; cin >> s >> v1 >> v2 >> t1 >> t2; int res1 = (s * v1) + (t1 * 2); int res2 = (s * v2) + (t2 * 2); if (res1 < res2) { cout << First ; } if (res1 > res2) { cout << Second ; } if (res1 ==...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10; int n, u, v, dp[maxn], d[2]; long long f[maxn], ans, sum; vector<int> a[maxn]; void dfs(int nod, int pa, int x) { d[x]++; for (int i : a[nod]) { if (i != pa) { dfs(i, nod, x ^ 1); dp[nod] += dp[i]; ...
`timescale 1ns / 1ps module square_root_comb #(parameter N = 8, M = 16)( input [N-1:0] A, output [N/2-1:0] O ); wire [N/2-1:0] Y[0:M]; wire [N/2-1:0] Y0[0:M]; assign Y[0] = {1'b1,{(N/2-1){1'b0}}}; assign Y0[0] = {1'b1,{(N/2-1){1'b0}}}; assign O = Y[M]; genvar gv; generate for (gv = 0; g...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e5 + 5; const long long mod = 1e9 + 7; long long fact[MAXN]; long long invfact[MAXN]; bool sieve[MAXN]; long long powe(long long x, long long y, long long mod) { long long res = 1; while (y > 0) { if (y & 1) res = (res * x...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; scanf( %d%d , &a, &b); if (a < b) { for (int i = b + 1; i <= (a + b + 1); i++) printf( %d , i); for (int j = b; j >= 1; j--) printf( %d , j); } else { for (int i = 1; i <= a; i++) printf( %d , i); for (in...
/** * 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 law...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long arr[n]; for (long long i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); bool f = 1; for (long long i = 1; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int c = 0, r, d, a, s; a = n; while (n) { if (n >= 10) { r = n / 10; n -= r * 10; n += r; c += r * 10; } else {...
#include <bits/stdc++.h> using namespace std; void Yahia74() {} const int N = 1e5 + 74, M = 1e5 + 74, OO = 0x3f3f3f3f; int main() { Yahia74(); int n, cnt[N] = {}; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; if (i < n / 2) { if (x - i >= 0) cnt[x - 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; template <typename T> inline string tostring(const T &x) { ostringstream os; os << x; return os.str(); } inline int toint(const string &s) { istringstream is(s); int x; is >> x; return x; } inline int todecimal(string s) { int a...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 50, mo = 998244353; int head[N], nn[N << 1][2], cnt; void link(int u, int v) { nn[++cnt][1] = v, nn[cnt][0] = head[u], head[u] = cnt; nn[++cnt][1] = u, nn[cnt][0] = head[v], head[v] = cnt; return; } int f[N][3]; void dfs(int x, ...
/* * Copyright 2013, Homer Hsing <> * * 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 by applicable law or agreed to ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:54:44 10/08/2014 // Design Name: pwm // Module Name: /home/bjones/src/fpga-led-counter/test/pwm_tb.v // Project Name: fpga-led-counter // Target Device: // Tool...
/* Copyright (c) 2018 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,...
////////////////////////////////////////////////////////////////////// //// //// //// CLK_SWITCH.v //// //// //// //// This file is part of the Eth...
/** * 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 under the Creative Commons Public Domain, for // any use, without warranty, 2005 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc = 0; reg [7...
/** * 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; using ll = long long; int mode, t; const int INF = 1e9 + 7; void solve() { int n, k; cin >> n >> k; string s; cin >> s; int rot = 0; if (s[0] == s[n - 1]) { int start = -1; for (int i = 0; i < n - 1; i++) { if (s[i] != s...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 06:59:45 11/30/2014 // Design Name: // Module Name: ALUNeuronalNetwork // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int x; cin >> x; while (x--) { int n, m, ans = 0; cin >> n >> m; char a[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cin >> a[i][j];...
#include <bits/stdc++.h> using namespace std; const int maxn = 4e4; long long a[maxn]; int v[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); for (long long i = 1; i < maxn; i++) { a[i] = i * (i - 1) / 2; } int T; cin >> T; while (T--)...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); vector<int> w(n, 0); w[0] = v[0]; for (int i = 1; i < n; i++) w[i] = w[i - 1] + v[i]; int score = 0, penalty = 0; f...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; reg [1:0] in; /*AUTOWIRE*/ // Beg...
/** * 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...
// "flop_it-c.v" // @vcs-flags@ -P pli.tab `timescale 1ps / 1ps // `include "standard.v" `include "standard.v-wrap" `include "clkgen.v" //----------------------------------------------------------------------------- module timeunit; initial $timeformat(-9,1," ns",9); endmodule module TOP; reg a; wire clk; wire ...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. ...
/** * 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> using namespace std; long long arr[100005], tree[100005], used[100005], l[100005], r[100005], d[100005], b[100005], query[100005], x, y, n, m, k; template <class T> inline T lowbit(T n) { return (n & -n); } void update(long long s[], int index, long long val) { while (...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int result = 0; for (int i = 0; i < n; i++) { int k, a; cin >> k >> a; long x = k * a; int c = 0; if (a % 4 == 0) a--; while (a) { a /= 4; c++; } result = (((re...
module stimulus (output reg A, B); initial begin {A, B} = 2'b00; #10 {A, B} = 2'b01; #10 {A, B} = 2'b10; #10 {A, B} = 2'b11; end endmodule module scoreboard (input Y, A, B); function truth_table (input a, b); reg [1:0] gate_operand; reg gate_output; begin gate_operand[1:0] = {a, ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:37:23 10/06/2014 // Design Name: // Module Name: uart // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
#include <bits/stdc++.h> using namespace std; int main() { long long s, xo; cin >> s >> xo; if ((s - xo) % 2 != 0 || (s < xo)) { cout << 0 << endl; return 0; } if ((((s - xo) / 2) & xo) != 0) { cout << 0 << endl; return 0; } if (xo == 0) { cout << 1 << endl;...
#include<bits/stdc++.h> using namespace std; #define il inline #define rg register #define int long long #define M 998244353 const int P=3,Pn=332748118; il int read() { int re=0,k=1;char ch=getchar(); while(ch> 9 ||ch< 0 ){if(ch== - )k=-1;ch=getchar();} while(ch<= 9 &&ch>= 0 ){re=re*10+...
// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // 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) an...
#include <bits/stdc++.h> using namespace std; clock_t __stt; inline void TStart() { __stt = clock(); } inline void TReport() { cerr << fixed << setprecision(3) << nCurrent Case Taken Time : << (double)(clock() - __stt) / CLOCKS_PER_SEC << sec n ; } template <typename T> T MIN(T a, T b) {...
module sevenseg(input [15:0] value, input clk, output reg [3:0] an, output [6:0] seg); // Duty Cycle controls the brightness of the seven segment display (0..15) parameter SEVEN_SEG_DUTY_CYCLE = 0; reg [15:0] counter; reg [3:0] binary; reg [6:0] sseg; always @(posedge clk) begin co...
#include <bits/stdc++.h> using namespace std; int n, k; int Time = 0; string s; bool dp[2][(int)1e5 + 10]; struct Node { int nxt[26]; bool leaf; Node() { for (int i = 0; i < 26; i++) nxt[i] = -1; leaf = 1; } } trie[(int)1e5 + 10]; void dodaj(string s) { int niz[100010]; ...
/** * 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 a[8], pro[1 << 8]; int bit_cnt[1 << 8]; vector<long long> pp; bitset<1000000> p; map<long long, int> H; int N, an; int qq(long long x) { if (H.count(x)) return H[x]; long long X = x; int res = 0; for (int i = 0; i < ((int)(pp).size(...
/* * Copyright (c) 2015-2016 The Ultiparc Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list...
// 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 : Tue May 30 22:30:26 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; vector<int> g[100010]; int us[100010], w[3][100010], z1, z2, dooc; void dfs(int v, int in = 1) { us[v] = in; for (int i = 0; i < g[v].size(); i++) if (us[g[v][i]] == 0) { dfs(g[v][i], (in == 1 ? 2 : 1)); } else if (us[g[v][i]] == in) { ...
// -- (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...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 9; vector<int> ans[N]; vector<char> arr; int k, n, q, a, hash[N][50], ar[N], s; char c; string str; bool flag; int main() { cin >> k; cin >> str; int n = str.size(); for (int i = 1; i <= k; i++) for (int j = 0; j <...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { char c; bool nega = 0; while ((!isdigit(c = getchar())) && (c != - )) ; if (c == - ) { nega = 1; c = getchar(); } x = c - 48; while (isdigit(c = getchar())) x = x * 10 + c -...
#include <bits/stdc++.h> using namespace std; int t; long long x, y; int main() { cin >> t; while (t--) { cin >> x >> y; if (x == y) cout << x << endl; else if (x > y) cout << x + y << endl; else cout << y - y % x / 2 << endl; } }
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_ddr_pad_txrx.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 i...
// Verilog netlist produced by program LSE : version Diamond (64-bit) 3.1.0.96 // Netlist written on Wed May 14 14:43:33 2014 // // Verilog Description of module Lolhi // module Lolhi (A, B, C, AnalogLDir, AnalogRDir, Len, Ldir, Ren, Rdir) /* synthesis syn_module_defined=1 */ ; // c:/lscc/diamond/3.1_x...
#include <bits/stdc++.h> using namespace std; vector<long long> per, obs; long long n, k, p; bool check(long long t) { long long i = 0; for (long long j = 0; j <= obs.size() - 1; j++) { if (abs(per[i] - obs[j]) + abs(p - obs[j]) <= t) { i++; if (i == n) return 1; } } ...
/* _______________________________________________________________________________ Copyright (c) 2012 TU Dresden, Chair for Embedded Systems (http://www.mr.inf.tu-dresden.de) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the follo...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int Maxn = 600010, Maxm = 300005, Mo = 1000000007, sp[8][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}, {1, 1}, {-1, -1}, {1, -1}, {-1, 1}}; const long long oo = (1LL << 6...
#include <bits/stdc++.h> using namespace std; int n, k; string s; int main() { cin >> n >> k >> s; int del = (n - k) / 2; stack<int> st; for (char ch : s) { if (ch == ( ) { if (del) { st.push(1); del--; } else { st.push(0); putchar( ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.3 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
module mac_tb; parameter INTERMEDIATOR_DEPTH = 1024; parameter LOG2_INTERMEDIATOR_DEPTH = log2(INTERMEDIATOR_DEPTH - 1); parameter MATRIX_FILENAME = "../../src/tmp/cant/cant.mtx"; reg clk, rst, wr; reg [LOG2_INTERMEDIATOR_DEPTH - 1:0] row; reg [63:0] v0, v1; wire push_out; wire [63:0] v...
// file: Clock48MHZ_exdes.v // // (c) Copyright 2008 - 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 dis...
#include <bits/stdc++.h> using namespace std; long long n, num, m; map<long long, bool> isInsert; priority_queue<long long, vector<long long>, greater<long long> > pq; vector<string> vs; vector<long long> vi; int main() { m = 0; cin >> n; while (n--) { string s; cin >> s; if ...
/** * processor.v - Microcoded Accumulator CPU * Copyright (C) 2015 Orlando Arias, David Mascenik * * 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, o...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int n; struct vec { long long x, y, idx; } a, b; long double pos_ang_with_x_axis(vec a) { long double res = atan2(a.y, a.x) * 180 / acos(-1); if (res < 0) res += 360; return res; } int dot(vec a, vec b) { return a.x...
// Filename: mersenne.v // // Author: Andrew Wild <> // // Version: 1.0 // Description: Verilog synthesizable implementation of the Mersenne Twister // Originally developed for hardware based Monte Carlo simulator // `define MERSENNE_N 624 //...
#include <bits/stdc++.h> using namespace std; int main() { map<int, int> m1, m2, m3; int n, m; cin >> n >> m; int a, b, c; for (int i = 0; i < m; i++) { cin >> a >> b >> c; if (m1[a] == 0 && m1[b] == 0 && m1[c] == 0) { m1[a] = 1; m1[b] = 2; m1[c] = 3; } ...
#include <bits/stdc++.h> using namespace std; int read() { int f = 1, x = 0; char c = getchar(); while (c < 0 || 9 < c) { if (c == - ) f = -1; c = getchar(); } while ( 0 <= c && c <= 9 ) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return f * x; } const int...
module testbench (); `include "c_constants.v" parameter width = 4; parameter index = 0; parameter Tclk = 2; wire [0:width-1] feedback; c_fbgen #(.width(width), .index(index)) fbgen (.feedback(feedback)); reg clk; reg reset; reg com...
module opc2cpu( inout[7:0] data, output[9:0] address, output rnw, input clk, input reset_b); parameter FETCH0=0, FETCH1=1, RDMEM=2, RDMEM2=3, EXEC=4 ; parameter LDBP=4'b11_00, LDBI=4'b10_00, LDB=4'b10_01, STAP=4'b10_10; parameter JPC =4'b01_00, JPZ=4'b01_01, STA =4'b01_10, JAL=4'b01_11; parameter ADC =4'b00...
//================================================================================================== // Filename : RKOA_OPCHANGE.v // Created On : 2016-10-26 23:25:59 // Last Modified : 2016-10-31 02:55:00 // Revision : // Author : Jorge Esteban Sequeira Rojas // Company : Instituto Tec...
// soft_tbm.v `timescale 1 ns / 1 ps module soft_tbm ( input clk, input sync, input reset, input [4:0]trg_in_tbm, input [4:0]trg_in_ctr, input [3:0]trg_pos, output tin, input tout, output deser_ena, output ctr, output daq_write, output reg [15:0]daq_data, input [15:0]token_timeout, inpu...
#include <bits/stdc++.h> using namespace std; const int N = 53e4, mod = 998244353; int n, nn, L, A, B, ans, fac[N], inv[N], a[N], b[N], c[N], R[N]; int C(int a, int b) { return 1ll * fac[a] * inv[b] % mod * inv[a - b] % mod; } int qpow(int a, int b) { int ret = 1; while (b) { if (b & 1) ret = 1l...
/* * Copyright (c) 1998-2000 Stephen Williams () * * 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...
module transmision (input enable, input clk_in, input reset, input wire [7:0] din, output busy, output reg done, output reg tx); parameter count = 8; initial begin tx <= 1'b1; done=0; en...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Thu Sep 28 11:37:19 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n; scanf( %d , &n); if (n == 1 || n == 2) printf( 1 n ); else if (n == 3) printf( 2 n ); else { if (n % 2 == 1) printf( %d n , (n - 1) / 2 ...
#include <bits/stdc++.h> long long a[1001]; using namespace std; int main() { long long n, cnt = 0; cin >> n; for (long long i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cnt++; } if (n == 1) { if (a[i] == 0) { cout << NO ; return 0; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n, m; cin >> n >> m; long long sum = 0, cyl = 0; long long k = (n / m); for (int i = 1; i <= 10; ++i) { cyl += (m * i) % 10; } sum = (k / 10) * cyl; ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Apr 18 23:18:55 2017 // Host : DESKTOP-I9J3TQJ running 64-bit major re...
#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; #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define PB(x, v) x.push_back(v); #define M_P(a, b) make_pair(a, b) #define pll pair<ll, ll> #define ll long long int #define mll map<ll, ll> #define vl vector<ll> #define fa(x, v) fo...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000007; int main() { int a, b; cin >> a >> b; long long S = 0; for (int e = 1; e < b; e++) { long long s1 = ((long long)a * (a + 1) / 2) % INF; long long s2 = (s1 * b) % INF; s2 = (s2 + a) % INF; S = (S + ((s...
// part of NeoGS project (c) 2008-2013 NedoPC // dma sequencer /* input interface of every DMA end-user clocks: ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ reqN _______/```````````\______________/`````````````````\______________/`````````````````` ackN ____________...
/** * 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; constexpr long long MOD = 1e9 + 7; struct { int val, lazy; } tree[4 * 1000010]; int bal(int p) { return tree[p].val + tree[p].lazy; } void ins(int S, int val, int L = 1, int R = 1000000, int p = 1) { if (S < L || R < 1) return; if (1 <= L && R <= S) ...
#include <bits/stdc++.h> using namespace std; constexpr static int MAXN = 1e6; int main() { int k, a, b; cin >> k >> a >> b; if (a > b) swap(a, b); int x = a / k; int y = b / k; if (x == 0 && y == 0) { cout << -1 << endl; return 0; } if (x == 0 && b % k > 0) { cou...
/** * 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 = 100010; const int M = 55; const int K = 200010; const int LIT = 2500; const int INF = 1 << 30; const int dir[6][2] = {{2, 0}, {-2, 0}, {1, 1}, {-1, 1}, {1, -1}, {-1, -1}}; bool check(long long x, long long y, long long n) { long long dist =...
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/unisims/KEEPER.v,v 1.5 2007/05/23 21:43:39 patrickp Exp $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2009 Xilinx, Inc. // All Right Reserved. ////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; string vow = aeiou ; long long month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const long long dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2}; const long long dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1}; const long long dx4[] = {-1, 0, 1, 0}; const lon...
// Copyright (c) 2013-2015, Intel Corporation // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the followin...
/***************************************************************************** ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2012, Aeroflex Gaisler ------------...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const int inf = (1 << 30) - 1; const long long inf64 = ((long long)1 << 62) - 1; const long double pi = 3.1415926535897932384626433832795; template <class T> T sqr(T x) { return x * x; } template <class T> T abs(T x) { ...