text
stringlengths
59
71.4k
/* Copyright (c) 2015-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, distri...
/** * 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, pair<int, int> > A[2003 * 2003], B[2003 * 2003]; pair<int, int> a[2003], b[2003]; int m, n, r, s, x, y, i, j, asd; long long t1, t2, mn; bool h; int main() { cin >> m; for (i = 1; i <= m; i++) { cin >> a[i].first; t1 += a[i].first...
/** * 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 adc_ltc2308( clk, // max 40mhz // start measure measure_start, // posedge triggle measure_ch, measure_done, measure_dataread, // adc interface ADC_CONVST, ADC_SCK, ADC_SDI, ADC_SDO ); input clk; // start measure input measure_start; input [2:0] measure_ch;...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10, maxm = 2e6 + 10; const long long INF = 0x3f3f3f3f, mod = 1e9 + 7; int casn, n, m, k; namespace graph { vector<int> g[maxn]; int all, sz[maxn], root, maxt; bool vis[maxn]; int dfs_root(int now, int fa) { int cnt = 1; for (...
#include <bits/stdc++.h> int main() { int n; printf( YES n ); scanf( %d , &n); for (int i = 0; i < n; i++) { int x1, y1, x2, y2; scanf( %d %d %d %d , &x1, &y1, &x2, &y2); printf( %d n , ((12 + 2 * (x1 % 2) + (y1 % 2)) % 4) + 1); } return 0; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003-2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (clk); input clk; integer cyc; initial cyc=1; integer sum; integer cpre; alw...
#include <bits/stdc++.h> using namespace std; const int limit = 1000005; void die() { cout << NO << endl; exit(0); } void computereachable(int u, int code, vector<int> g[limit], int reachable[limit]) { if (reachable[u] & code) return; reachable[u] |= code; vector<...
#include <bits/stdc++.h> using namespace std; long long ar[100005]; long long N; int main() { cin >> N; for (long long i = 0; i < N; i++) cin >> ar[i]; long long ans = 0ll; for (long long i = 0; i < N; i++) { long long lft = (i == 0 ? 0 : ar[i - 1]); if (ar[i] < lft) ans += (ar[i]) *...
module decoder (cx,d); output [6:0] d; input [11:0] cx; reg [6:0] d; reg [4:0] s; reg [11:0] cx1; parameter s0 = 5'b11110; parameter s1 = 5'b10111; parameter s2 = 5'b01000; parameter s3 = 5'b00111; parameter s4 = 5'b01000; parameter s5 = 5'b11111; parameter s6 = 5'b10111; parameter s7 = 5'b10000; para...
#include <bits/stdc++.h> using namespace std; long long n, dp[30][30]; string s; long long ten[30]; string ans[30][30]; int main() { cin >> n >> s; reverse(s.begin(), s.end()); ten[0] = 1; for (int i = 1; i <= 20; i++) ten[i] = ten[i - 1] * 10; dp[0][0] = 0; dp[1][0] = s[0] - 0 ; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int ma[maxn]; int en[maxn]; int add = 0; int main() { std::ios::sync_with_stdio(false); int n, d; cin >> n >> d; int sum = 0; int mx = -40000000; int op = 0; for (int i = 0; i < n; i++) { int in; ...
// W bus (main internal bus) module bus_w( input mwc, mwb, mwa, input bwa, bwb, input [0:15] ir, input [0:15] kl, input [0:15] rdt, input [0:15] ki, input [0:15] at, input [0:15] ac, input [0:15] a, output [0:15] w ); always @ (*) begin case ({bwb, mwc, mwb, mwa}) 4'b0000 : w[0:7] = a[0:7]; 4'b0001...
#include <bits/stdc++.h> using namespace std; static inline void amin(int &a, int b) { if (a > b) a = b; } int main() { int N, M; scanf( %d%d , &N, &M); int A[N]; for (int i = 0; i < N; ++i) { scanf( %d , &A[i]); } pair<int, int> Q[M]; for (int i = 0; i < M; ++i) { sc...
// (c) Copyright 2011-2013 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not g...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2) { cout << contest n ; } else { cout << home n ; } }
#include <bits/stdc++.h> using namespace std; int n, A[100], B[100], t, r, x; string s = ; int main() { cin >> n; for (int i = 0; i <= n; i++) { r = 0; for (int j = 0; j <= n; j++) { if ((t + r) == n) { x = 1; break; } r = r + 7; } if...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////// //// //// //// //// //// Registro de solicitudes //// //// ...
#include <bits/stdc++.h> using namespace std; const long long linf = 1e18 + 5; const int mod = (int)1e9 + 7; const int logN = 17; const int inf = 1e9; const int N = 2e5 + 5; int s, n, m, h1[N], h, t, x, y, z; vector<int> v[N]; pair<int, int> e[N]; void print(int x, int y) { cout << YES n ; ...
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 1, -1, 0}; int dy[] = {1, 0, 0, -1}; long double PI = 3.14159265358979323846264338327950; pair<int, int> p[12000002]; int a[12000002], b[12000002]; int m, n, k; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, save, left, right; string A; while (cin >> A) { left = 0; right = 0; for (i = 0; i < A.size(); i++) { if (A[i] == ^ ) { save = i; } } i = save; i--; while (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 "mux2_1.sv" `include "shiftll.v" module shiftllTest (); // localize variables wire [31:0] busADD; wire [31:0] busA, busB; // declare an instance of the module shiftll shiftll (busADD, busA, busB); // Running the GUI part of simulation shiftlltester tester (busADD, busA, busB); // file for gtkwave ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; long long k[n]; pair<long long, long long> dt[m]; for (int i = 0; i < n; i++) cin >> k[i]; for (int i = 0; i < m; i++) cin >> dt[i].first >> dt[i].second; long long total = 0; for (int i = 0; i ...
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; long long l = -1, r = -1; for (long long i = 0; i < s.length(); i++) { if (s[i] == [ ) { l = i; break; } ...
#include <bits/stdc++.h> using namespace std; int n, k; int num[500005]; long long dp[500005]; int cnt[500005]; bool ok(int cost) { dp[0] = dp[1] = cnt[0] = cnt[1] = 0; for (int i = (2); i <= (n); i += (1)) { dp[i] = dp[i - 1]; cnt[i] = cnt[i - 1]; long long v = dp[i - 2] + num[i] ...
#include <bits/stdc++.h> using namespace std; long long f[200200], sum[200200]; long long n; void init() { f[0] = 1LL; for (int i = 1; i <= n; i++) f[i] = f[i - 1] * 10LL % 998244353; return; } void solve() { for (long long i = 1; i <= n; i++) { long long ans = 0; if (i == n) ...
#include <bits/stdc++.h> using namespace std; int solve(vector<int> &v, int pow) { if (pow == 20) { for (int j : v) { if (j) return 40; } return 0; } bool fnd = false; for (int i = 0; i < v.size(); i++) { if (v[i] % (1 << (pow + 1))) { fnd = true; } ...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); int n, m, w, a, b, v; cin >> n >> m >> a >> b >> v; set<int> s; set<int> l; for (int i = 0; i < a; ++i) { int x; cin >> x; s.insert(...
// 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 : Fri Jan 13 17:31:26 2017 // Host : KLight-PC running 64-bit major release (bu...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:55:21 05/03/2016 // Design Name: // Module Name: data_deal // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
// (C) 2001-2013 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 doc...
/* * 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> #pragma comment(linker, /STACK:100000000 ) #pragma GCC optimize( O3 ) using namespace std; const long long N = 1e5 + 10; const long long mod = 1e9 + 7; const long long INF = 1e18; const long long inf = -1e18; const long long M = 1e6; int n, x, y, a[5 * N]; bool us[1000010];...
#include <bits/stdc++.h> using namespace std; int dfn[200002], low[200002], tot, head[200002], num, f[200002]; int p[20][200002]; int deep[200002], n, m, q, st[200002], top, dep[200002]; bool vis[200002]; inline long long rd() { long long x = 0; char c = getchar(); bool f = 0; while (!isdigi...
#include <bits/stdc++.h> int main() { int l, i, flag = 0; char s[50]; scanf( %s , s); l = strlen(s); for (i = 0; i < l; i++) { if (s[0] == s[i]) flag = flag + 1; } if (flag == l) { printf( %d , 0); return 0; } flag = 0; for (i = 0; i < (l / 2); i++) { if...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 1; int n, sa[N], sb[N], a1[N], b1[N], suma, sumb, q[N]; struct nd { int w, id; } a[N], b[N]; bool cmp(nd a, nd b) { return a.w > b.w; } int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , &a[i].w), a[i]....
/////////////////////////////////////////////////////////////////////////////// // vim:set shiftwidth=3 softtabstop=3 expandtab: // // Module: router_op_lut_regs.v // Project: NF2.1 // Description: Demultiplexes, stores and serves register requests // /////////////////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, d, a, b, x, y; cin >> n >> d >> a >> b; pair<long long, long long> arr[n]; for (int i = 0; i < n; i++) { cin >> x >> y; x *= a; y *= b; arr[i] = {x + y, i...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a == 0) { return b; } if (b == 0) { return a; } return gcd(b % a, a); } int main() { long long ra, la, ta, rb, lb, tb; cin >> la >> ra >> ta; cin >> lb >> rb >> tb; long lo...
#include <bits/stdc++.h> using namespace std; void __print(int first) { cerr << first; } void __print(long first) { cerr << first; } void __print(long long first) { cerr << first; } void __print(unsigned first) { cerr << first; } void __print(unsigned long first) { cerr << first; } void __print(unsigned l...
/** * 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 am[20]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<long long> a(n); for (int i = 0, ThxDem = n; i < ThxDem; ++i) { cin >> a[i]; for (int j = 0, ThxDem = 20; j < ThxDem; ...
module j1soc#( //parameter bootram_file = "../../firmware/hello_world/j1.mem" // For synthesis parameter bootram_file = "../firmware/Hello_World/j1.mem" // For simulation )( sys_clk_i, sys_rst_i, miso, mosi, ss, sclk ); input sys_clk_i...
module CPLD_RS485(CPU_RXD1,CPU_RTS1,CPU_TXD1,TXD0,TXD1,TXD2,TXD3,TXD4,TXD5,TXD6,TXD7,RXD0, RXD1,RXD2,RXD3,RXD4,RXD5,RXD6,RXD7, ADD1,ADD2,ADD3,ADD4,RTS0,RTS1,RTS2,RTS3,RTS4,RTS5,RTS6,RTS7, CLK,NRST); output CPU_RXD1,TXD0,TXD1,TXD2,TXD3,TXD4,TXD5,TXD6,TXD7,RTS0,RTS1,RTS2,RTS3,RTS4,RTS5,RTS6,RTS7; input ...
module alucontrol(input [1:0] aluop, // alu op code input [5:0] funct, // function code output reg [2:0] alucontrol // generated control signals for the ALU ); // FUNCT field definitions parameter ADD = 6'b100000; parameter SUB = 6'b100010; parameter AND...
#include <bits/stdc++.h> using namespace std; vector<int> fibton; void Fib(int n) { int x = 0, y = 1, z = 0; fibton.push_back(0); for (int i = 0; i <= n; i++) { z = x + y; fibton.push_back(z); if (fibton[fibton.size() - 1] >= n) { break; } x = y; y = z; ...
/** * 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 ARM_CU_ALU( input MFC , Reset , Clk , MEMSTORE,MEMLOAD, input [31:0] MEMDAT, output [7:0] MEMADD, output MFA,READ_WRITE,WORD_BYTE); wire[31:0] IR; wire IR_CU, RFLOAD, PCLOAD, SRLOAD, SRENABLED, ALUSTORE, MFA, WORD_BYTE, READ_WRITE, IRLOAD, MBRLOAD, MBRSTORE, MARLOAD; wire [4:0] opcode; wire [3:0] CU; 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 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.4 (win64) Build Tue Nov 18 18:29:27 MST 2014 // Date : Tue Jun 30 15:19:07 2015 // Host : Vangelis-PC running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int fa[101000][20], h[101000], lev[101000], ans[101000]; int dp[101000]; struct EDGE { int to, nxt; } box[2 * 101000]; int top, K; void add(int u, int v) { box[top].to = v; box[top].nxt = h[u]; h[u] = top++; } void DFS(int u, int pre, int t...
#include <bits/stdc++.h> using namespace std; void fastio() { ios_base::sync_with_stdio(false); cin.tie(NULL); } long long fre[1000000]; int32_t main() { fastio(); long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (lon...
// 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 20 13:53:00 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int T, n, m, a[N], b[N], cnt, res[N << 1], v[N << 1], t, c[N << 1], pr[N], sf[N], p[N]; long long ans; void add(int x, int y) { for (int i = x; i; i -= i & (-i)) c[i] += y; } int query(int x) { int ans = 0; for (int 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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n, m, k; cin >> n >> m >> k; k = n * m / 2 - k; if (n % 2 == 1) { swap(n, m); k = n * m / 2 - k; } if...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2009 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. module t; sub a (.inst(1)); s...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `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 ba...
#include <bits/stdc++.h> using namespace std; const int maxn = 410, MOD = 10007; char s[maxn]; int n, m, mat_s; typedef long long Mat[maxn][maxn]; void print(Mat A) { for (int i = 0; i < (mat_s); i++) { for (int j = 0; j < (mat_s); j++) { cout << A[i][j] << ; } cout << 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...
#include <bits/stdc++.h> using namespace std; long long a[500005], inc[1002], n, q, d; vector<pair<long long, long long> > v[1002]; int main() { ios::sync_with_stdio(false); cin.tie(), cout.tie(); cin >> n >> q; d = sqrt(n); long long cnt = 1; for (int i = 1; i <= n; i++) { long lo...
//================================================================================================== // Filename : memory_bram_dp.v // Created On : 2014-09-24 20:12:03 // Last Modified : 2015-05-28 09:43:51 // Revision : // Author : Angel Terrones // Company : Universidad Simón Bolívar /...
/* Copyright (C) 2016 Cedric Orban 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 distributed in the ho...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
////////////////////////////////////////////////////////////////// // // // ECC Encoder for error correction and detection memory // // // // ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2012 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 /* Acceptable answer 1 created tag with scope = top.t.tag created tag with scope = top.t.b.gen[0].tag crea...
#include <bits/stdc++.h> using namespace std; vector<int> vv; int main() { int t, n, x, c1, c2; scanf( %d , &t); vv.clear(); c1 = c2 = 0; for (int i = 0; i < t; i++) { scanf( %d , &n); for (int j = 0; j < n / 2; j++) { scanf( %d , &x); c1 += x; } if (n %...
module memory( // input i_clk, i_reset_n, i_address, i_write, i_read, i_writedata, // output o_readdata, o_waitrequest ); input wire i_clk; input wire i_reset_n; input wire [17:0] i_address; input wire i_write; input wire i_read; input wire [35:0] i_writedata; output wire [35:0] o_readdata; output wire o_w...
////////////////////////////////////////////////////////////////////// //// //// //// WISHBONE SD Card Controller IP Core //// //// //// //// sd_controller_wb.v ...
#include <bits/stdc++.h> #pragma warning(disable : 6031) #pragma warning(disable : 4101) using namespace std; const int INF = 1e9; const long long LINF = 1e18; const double PI = acos(-1); const int MAXN = 1000006; int n, m, v1, v2, Deg[MAXN], visited[MAXN]; vector<unordered_set<int>> G; vector<int> ...
/* Copyright (C) 2000 Stephen G. Tell * * 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, or (at your option) * any later version. * * This program is distributed in the h...
/** * 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(void) { int n, m, c; cin >> n >> m >> c; vector<int> a(n), b(m); for (int i = 0; i < n; i++) cin >> a[i]; for (int j = 0; j < m; j++) cin >> b[j]; vector<int> beg(n); beg.assign(n, 0); vector<int> start(n), end(n); start.assi...
#include <bits/stdc++.h> using namespace std; char s[100000]; int n, m, x, y, i, sol, v[501][501]; int main() { cin >> n >> m >> x >> y; cin >> s; cout << 1 << ; int l = strlen(s); for (i = 0; i < l - 1; i++) { v[x][y] = 1; if (s[i] == R && y < m) y++; if (s[i] == L ...
module gpio_ctrl ( clk, reset_, leds, switches, up, down, left, right, addr, cs, req, rnw, wr_data, rd_data, rdy ); input clk; input reset_; output [7:0] leds; // 8 LEDs input [6:0] switches; // 7 toggle switches (eighth is tied to res...
/* * 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 uart_system #( // SYSTEM_CLOCK must be set to the frequency of the sys_clk input parameter SYSTEM_CLOCK = 144000000, // UART_CLOCK can technically be anything that evenly divides the system clock // but the receiving end needs to support that frequency. Standard speeds are // 1200, 240...
#include <bits/stdc++.h> using namespace std; const int max_n = 3e5 + 10, inf = 1000111222; struct node { int p0, p1; int cnt; node() { p0 = p1 = 0; cnt = 0; } }; int root = 1; node A[max_n * 33]; int last_used = 1; int new_node() { return ++last_used; } int a[max_n]; lon...
// part of NewGS project (c) 2007 NedoPC // // ramtest module main( clk_fpga, // clocks clk_24mhz, // clksel0, // clock selection clksel1, // warmres_n, // warm reset d, // Z80 data bus a, // Z80 address bus iorq_n, // Z80 control signals mreq_n, // rd_n, // wr_n, // ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int x, y, z; cin >> x >> y >> z; if (x > y) { if (x > y + z) cout << + ; else cout << ? ; } else if (x < y) { if (y > x + z) cout << - ; else...
#include <bits/stdc++.h> using namespace std; const long long MIN = numeric_limits<long long>::min(); class WindowHeap { public: WindowHeap() {} long long top() { if (_i >= _h.size()) return MIN; return _h[_i].first; } void erase(int idx) { if (!_h.empty() && _h[_i].second == ...
// (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 any of the foregoing (including device programming or simulation // files), and any associated docum...
#include <bits/stdc++.h> using namespace std; void init() { freopen( input.txt , r , stdin); } int abs(int x) { if (x < 0) { return -x; } return x; } int main() { int n, m, x1, y1, x2, y2; cin >> n >> m >> x1 >> y1 >> x2 >> y2; n = abs(x1 - x2) + 1; m = abs(y1 - y2) + 1; ...
/* Distributed under the MIT license. Copyright (c) 2011 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 rights to use, copy, mo...
//----------------------------------------------------------------------------- // // (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 ...
#include <bits/stdc++.h> using namespace std; int a[100001]; int main() { int n, x = 0; cin >> n; for (int i = 2; i <= n; i++) { if (a[i] == 0) { x++; a[i] = x; for (int j = i; j <= n; j += i) a[j] = x; } } for (int i = 2; i <= n; i++) cout << a[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 la...
#include <bits/stdc++.h> const int MAX_N = (int)1e5 + 123; const double eps = 1e-6; const int inf = (int)1e9 + 123; using namespace std; int n; vector<int> ans[MAX_N]; int k; int main() { cin >> n; ans[1].push_back(1), ans[2].push_back(1); for (int i = 3, now = 2;; i++) { if (n - now +...
// (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...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.1 (win64) Build Fri Apr 14 18:55:03 MDT 2017 // Date : Tue Aug 1 10:07:10 2017 // Host : ACER-BLUES running 64-bit major release (b...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const int iinf = 1 << 29; const long long llinf = 1ll << 60; const double PI = 3.14159265; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); long long mrand(long long B) { return (unsigned long long)rng() % ...
/* vim:set shiftwidth=3 softtabstop=3 expandtab: */ /* $Id$ */ `timescale 1ns/1ps module secret_flow #( parameter DATA_WIDTH = 64, parameter CTRL_WIDTH = DATA_WIDTH/8, parameter UDP_REG_SRC_WIDTH = 2 ) ( // --- data path interface output reg [DATA_WIDTH-1:0] out_data, ...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void solve() { long long n; cin >> n; vector<long long> a(n), b; for (long long i = 0; i < n; i++) { cin >> a[i]; } b = a; sort(b.begin(), b.end()); b.resize(uni...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2014, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WITHOUT THE // EXPRESSED WRITTEN CONSENT OF VIPcore Group // // VIPcore : http://soc.fudan.edu.cn/vip // IP Owner :...
/* * 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 = 1000 + 10; int n, m; int px[] = {0, 1, -1, 0}; int py[] = {1, 0, 0, -1}; bool dig[10]; char a[N][N]; bool inside(int x, int y) { return x >= 0 && y >= 0 && x < n && y < m; } bool alone(int x, int y) { int k, x2, y2; for (k = 0; k < 4;...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << [ ; for (auto u : v) { os << u; os << , ; } os << ] << n ; return os; } template <typename T> ostream& operator<<(ostream& os, const s...