text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; bool test_cases_exist = false; void solve() { long long int i, j, n, m, k, x, y, ans; cin >> n; vector<long long int> v(n); for (auto &z : v) cin >> z; long long int bit = 23; long long int oneall = (1 << 23) - 1; vector<long long int> dp((...
/** * 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 = 10; char g[maxn][maxn]; long long dp[1 << maxn][1 << maxn]; int main() { int n, mask1, mask2, i, j, m, k, a, b, count; long long ans; cin >> n >> m >> k; for (i = 0; i < m; i++) { cin >> a >> b; a--; b--; g[...
/* * 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 a[110]; int gcd(int x, int y) { if (!x) return y; else return gcd(y % x, x); } int main() { int n, mx = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; mx = max(mx, a[i]); } int g = a[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...
// ============================================================== // 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...
module ISpm(input clk, input [11:0] io_core_r_addr, input io_core_r_enable, output[31:0] io_core_r_data_out, input [11:0] io_core_rw_addr, input io_core_rw_enable, output[31:0] io_core_rw_data_out, input io_core_rw_write, input [31:0] io_core_rw_data_in, input [11:0] io_bus_addr,...
/* * sram_ctl - Push and pull data to/from the SRAM * * This allows the supervisor to put data in the SRAM memory and read it out again. * Note that this operation halts the CPC clock and so affects CPC timing * * Part of the CPC2 project: http://intelligenttoasters.blog * * Copyright (C)2017 * * This prog...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2004 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; reg [41:0] aaa; wire [41:0] bbb; // verilator publi...
/* * 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> using namespace std; int n, x[1042], y[1042]; double eps = 0.00000001; int dist2(int x1, int y1, int x2, int y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } double dist(double x1, double y1, double x2, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) ...
module scheduler1(clk, reset, wen, enablein, datain, dataout, full, empty, enableout); parameter data_width = 32; //parameter data_width1 = 34; // parameter data_width1 = 36; parameter address_width = 5; parameter FIFO_depth = 1024; input clk,reset,wen,enablein; input [data_width-1:0] datain; output [data_width1-1:...
// (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 no...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: cpx_dp_macb_l.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...
module SIS ( input clk, input rst, output wire[ADD_WIDTH-1:0] ram_w_address, input ram_w_waitrequest, output wire[BYTE_ENABLE_WIDTH-1:0] ram_w_byteenable, output wire ram_w_write, output wire[DATA_WIDTH-1:0] ram_w_writedata, output wire[BURST_WIDTH_W-1:0] ram_w_burstcount, output wire[ADD_WIDTH-1:...
#include <bits/stdc++.h> using namespace std; const long long INF = 2000000000000000000LL; const int inf = 0x3f3f3f3f; const long double EPS = 1e-9; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long x, i, j, n = 0, t; cin >> x; while (x / 2 != 0) {...
#include <bits/stdc++.h> using namespace std; long long a1, b1, a2, b2; int main() { cin >> a1 >> b1 >> a2 >> b2; long long t1, t2, t3, t4; t1 = a1 * b1; t2 = a2 * b2; int c12, c13; int c22, c23; c12 = c13 = c22 = c23 = 0; while (t1 % 2LL == 0LL) { c12++; t1 /= 2LL; ...
#include <bits/stdc++.h> using namespace std; const int inf = INT_MAX; const int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; int arr[2][n]; int sum[2][n]; for (int i = 0; i < 2; i++...
#include <bits/stdc++.h> using namespace std; string t; vector<string> query(3); void ask(string &q) { cout << ? << q << n ; fflush(stdout); cin >> q; } int main() { ios_base::sync_with_stdio(false); ; cin >> t; for (int i = 0; i < t.length(); i++) { query[0] += (char)...
/** * 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) 2001-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 associated doc...
#include <bits/stdc++.h> using namespace std; long long mx(long long a, long long b) { return a >= b ? a : b; } long long mn(long long a, long long b) { return a <= b ? a : b; } string a[3] = {( twone ), ( two ), ( one )}; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long lon...
/** * 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, temp; cin >> n; long long int sum = 0, sum2 = 0; for (int i = 0; i < n; i++) { cin >> temp; sum += temp; } for (int i = 0; i < n - 1; i++) { cin >> temp; sum2 += temp; } cout << sum - sum2 << en...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sc_0_1_dbg_rptr.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 a...
// file: ddr3_clkgen_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 di...
`define CYCLE_TIME 50 module TestBench; reg Clk; reg Reset; reg Start; integer i, outfile, outfile2, counter; reg flag; reg [26:0] address; reg [23:0] tag; reg [4:0] index; wire [256-1:0] mem_cpu_data; wire mem_cpu_ack; wire [256-1:0] cpu_mem_data; wire [32-1:0] cpu_mem_addr; wire ...
module flash_writer( input p_ready, input WE_CLK, input iFLASH_RY_N, input iOSC_28 , input iERASE , input iPROGRAM , input iVERIFY , input iOK , input iFAIL, input iRESET_N , output oREAD_PRO_END, output oVERIFY_TIME, output [21:0] oFLASH_ADDR, output reg [3:0] oFLASH_CMD, outp...
#include <bits/stdc++.h> using namespace std; long long x, y, m; int main() { cin >> x >> y >> m; if (x >= m || y >= m) cout << 0 << n ; else { if (x <= 0 && y <= 0) cout << -1 << n ; else { long long cc = 0; if (x > y) swap(x, y); if (x < 0) { ...
module foo; `ifdef LABEL_A CHIP CPU ( .clkin(clkin), `ifdef LABEL_B .bclko(bclko), `endif .cmode(cmode), ); input sysclk; `ifdef LABEL_B input bclko; `endif input cmode; `endif // instead of: `ifdef LABEL_A CHIP CPU ( ...
#include <bits/stdc++.h> using namespace std; char F1[2000000]; char F2[2000000]; void computeLPSArray(string pat, int M, int* lps); void KMPSearch(string pat, string txt, vector<int>& st, vector<int>& end) { int M = pat.size(); int N = txt.size(); int lps[M]; computeLPSArray(pat, M, lps); ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. module t(/*AUTOARG*/ // Inputs clk ); input clk; reg _ranit; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-...
#include <bits/stdc++.h> const int mn = 10100, mm = 5010000; char st[mm], ans[mm]; int f[mm], s[mm], L[mn], R[mn]; int n, m, K, i, j, d, len, now; void del(int p) { for (; p <= m; p += p & (-p)) --s[p]; } int query(int v) { int i = 1, l = m >> 1; for (; l; l >>= 1) if (s[i + l - 1] < v) ...
#include <bits/stdc++.h> int min(int a, int b) { return a < b ? a : b; } int max(int a, int b) { return a > b ? a : b; } unsigned int X; void srand_() { struct timeval tv; gettimeofday(&tv, NULL); X = tv.tv_sec ^ tv.tv_usec | 1; } int rand_() { return (X *= 3) >> 1; } int *ej[1000], eo[1000]; ...
module autoinst_bits_lba_gi // ==xxxxxxx== // xxxxxxxxx 1997-1998, xxxxx xxx. // xxx xxxxxx xxxxxxxx // ****************************************************************** / // ****************************************************************** / // xxxxx, xxxxxxxxxxxx // xxxxxxx: xxx-408...
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b; cin >> a >> b; long long ans = abs(a - b) / 5; a = abs(a - b) % 5; if (a == 4) cout << ans + 2; if (a == 3) cout << ans + 2; if (a == 2) cout << ans + 1; if (a == 1) cout << ans + 1; if (a == 0) cout << ...
#include <bits/stdc++.h> using namespace std; int read(); int n; char t[102]; int w[102][102], rnk[102][102], pos[102]; vector<int> p[102]; queue<int> q; void init(int t) { for (int i = 1; i <= n; ++i) { p[i].clear(), p[i + n].clear(); for (int j = 1; j <= n; ++j) p[i].push_back(j + n), ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long inf = 1e16; const long long ninf = LLONG_MIN; const double eps = 1e-12; const long long N = 1000005; const double PI = 3.14159265358979323846; const long long LOGN = 19; long long n, m; long long s[N], t[...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Tue Sep 19 00:31:32 2017 // Host : DarkCube running 64-bit major release ...
`timescale 1ns / 1ps /* This file is part of JT12. JT12 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. JT12 program is di...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; long long int power(long long int a, long long int x) { long long int res = 1; while (x > 0) { if (x & 1) { res *= a; } a *= a; x = x / 2; } return res; } int main() { long long int n; scanf( %lld , &n); 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...
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-9, PI = acos(-1.); const int INF = 0x3f3f3f3f, MOD = 1e9 + 7; const int N = 2e5 + 5, SQ = 500; int n, q, a[N], l[N], r[N], p[N]; long long ans[N], c[1000005], s; void add(int x) { int v = a[x]; s -= c[v] * c[v] * v; c[v]+...
/** * 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 double pi = acos(-1.0); const double eps = 1e-9; const long long INF = 1000000000; const int MAXN = 128; int points[] = {0, 25, 18, 15, 12, 10, 8, 6, 4, 2, 1}; int t, n; map<string, vector<int> > places; map<string, int> score; struct T { strin...
/* * 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() { long long a, b, c; cin >> a >> b >> c; long long power = 0, l = 0, emp = 1, aa = 0; for (long long i = 0; i > -1; i++) { if (i != 0) { for (long long j = 0; j < i; j++) { emp = emp * c; } } if (emp...
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { long long n, k; cin >> n >> k; if (k % 3 != 0) { if (n % 3 == 0) cout << Bob << endl; else cout << Alice << endl; } else { n %= (k + 1); ...
#include <bits/stdc++.h> using namespace std; long long s[200005], e[200005]; long long win(long long s, long long e) { if (e & 1) { if (s & 1) return 0; return 1; } if (s > e / 2) { if (s & 1) return 1; return 0; } if (s > e / 4) return 1; return win(s, e >> 2); ...
// // Pseudo Random Number Generator interface. // Uses the xoroshiro128+ PRNG. // `include "inc/timescale.vh" module prng ( // Bus interface input wire clk, input wire resetn, input wire enable, input wire mem_valid, output wire mem_ready, input wire mem_instr, in...
`timescale 1ns / 1ps /* Instruction decode pipeline stage */ module id_stage( input clk, rst, input reg_write, input [4:0] wreg_addr, // write register number input [31:0] wreg_data, // data to write i...
module alt_mem_ddrx_ecc_decoder # ( parameter CFG_DATA_WIDTH = 40, CFG_ECC_CODE_WIDTH = 8, CFG_ECC_DEC_REG = 1, CFG_ECC_RDATA_REG = 0, CFG_MMR_DRAM_DATA_WIDTH = 7, CFG_MMR_LOCAL_DATA_WIDTH = 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; int main() { long long int n, h, a, b, k; cin >> n >> h >> a >> b >> k; for (long long int i = 0; i < k; i++) { long long int t1, f1, t2, f2; cin >> t1 >> f1 >> t2 >> f2; long long int ans; if (t1 == t2) { cout << abs(f1 - f2)...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; struct point { double x, y; }; struct segment { double a, b, c; }; point operator+(point a, point b) { return (point){a.x + b.x, a.y + b.y}; } point operator-(point a, point b) { return (point){a.x - b.x, a.y - b.y}; } dou...
`timescale 1 ns / 1 ps module decoder_axi_m_v1_0 # ( // Users to add parameters here // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Master Bus Interface M00_AXI parameter integer C_M00_AXI_BURST_LEN = 16, parameter integer C_M00_AXI_ID_WIDTH = 1, ...
#include <bits/stdc++.h> using namespace std; int n, m, h, k, i, j, s2, H[2][3000], H2[2][3000], s, a, x, y, z, l[2], top; vector<pair<int, int> > v[2]; int main() { cin >> n >> m; for (i = 0; i < n; i++) { cin >> x >> y >> z; v[x].push_back(make_pair(z, y)); } h = m; sort(v[0].b...
/* ** -----------------------------------------------------------------------------** ** encoderDCAC353.v ** ** RLL encoder for JPEG compressor ** ** Copyright (C) 2002-2008 Elphel, Inc ** ** -----------------------------------------------------------------------------** ** This file is part of X353 ** X353...
/** * 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 = 1e6 + 2; long long int i, j, n, m, s, ans = 0, cnt = 0; vector<pair<long long int, long long int> > nf; vector<long long int> graph[maxn]; bool foundd[maxn]; void dfs(long long int u, bool found[]) { if (!foundd[u]) ++ans; found[u] = t...
#include <bits/stdc++.h> using namespace std; int main() { pair<long long, int> p[400005]; int n, m; cin >> n; for (int i = 0; i < n; i++) { cin >> p[i].first; p[i].second = 1; } cin >> m; for (int i = 0; i < m; i++) { cin >> p[i + n].first; p[i + n].second = 2; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; char a[N], b[N]; int s[N][26]; void init() { int n = strlen(a + 1); memset(s, 0, sizeof(s)); for (int i = n; i >= 1; i--) { for (int j = 0; j < 26; j++) { s[i - 1][j] = s[i][j]; } s[i - 1][a[i] - a ] =...
`define Alu_NOP 4'h0 `define Alu_LDI 4'h1 `define Alu_ADD 4'h2 `define Alu_SUB 4'h3 `define Alu_NOT 4'h4 `define Alu_AND 4'h5 `define Alu_IOR 4'h6 `define Alu_XOR 4'h7 `define Alu_SHL 4'h8 `define Alu_SHR 4'h9 `define Alu_EQL 4'hA `define Alu_NEQ 4'hB `define Alu_LTS 4'hC `define Alu_LTE 4'hD `define Alu_GTS 4'hE `defi...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:13:59 09/03/2013 // Design Name: // Module Name: display_time_parameters // Project Name: // Target Devices: // Tool versions: // Description: // // Depe...
#include <bits/stdc++.h> int K; int main() { scanf( %d , &K); if (K % 2) { puts( YES ); if (K == 1) { puts( 2 1 n1 2 ); return 0; } int i, j, N = (K << 1) + 4, M = (3 * K - 2 + (K - 1) * (K - 2) / 2 - K / 2) * 2 + 1, tmp1 = K + 1, tmp2 ...
#include <bits/stdc++.h> using namespace std; template <typename T> void tk_input(vector<T> &arr) { for (T &i : arr) cin >> i; } void solve() { int n, k; cin >> n >> k; string s; cin >> s; priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int>...
////////////////////////////////////////////////////////////////////////////////// // InterChannelELPBuffer.v for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Jinwoo Jeong <> // Ilyong Jung <> // Yong Ho Song <> // // This file is part of Cosmos OpenSS...
#include <bits/stdc++.h> int main(void) { int n; int i, i2; int a[100000] = {0}; int flag = 0; int max = -1000001; int min = 1000001; int sum = 0; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &a[i]); if (a[i] > 0) { if (a[i] < min && a[i] % 2 != 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int count = 0; while ((count * (count + 1)) / 2 <= n) { ++count; } --count; int val = (count * (count + 1)) / 2; int diff = n - val; cout << count << n ; for (int i = 1; i <= count; ++i) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:26:11 07/23/2010 // Design Name: // Module Name: dac_test // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision:...
//rgmii-gmii,gmii-139,rx check,rx gen `timescale 1ns/1ns module rx_tx_1000( clk_125m_core, clk_25m_core, clk_25m_tx,//100M RGMII TX CLK clk_125m_tx,//1000M RGMII TX CLK reset, rgmii_txd, rgmii_tx_ctl, rgmii_tx_clk, ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. module t (clk); input clk; reg [7:0] a,b; wire [7:0] z; mytop u0 ( a, b, clk, z ); integer cyc; initial cyc=1; always @ (posedge clk) be...
#include <bits/stdc++.h> int main() { int t, n, *arr, i, a, odd, even; scanf( %d , &t); while (t--) { scanf( %d , &n); arr = (int*)malloc(n * sizeof(int)); for (i = 0; i < n; i++) scanf( %d , &arr[i]); even = 0; odd = 0; for (i = 0; i < n; i++) { if (arr[i] % 2 ...
#include <bits/stdc++.h> const int mod = 1e9 + 7; const int N = 3e5 + 1; using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << ; err(++it, args...); } long l...
#include <bits/stdc++.h> using namespace std; const long long A = 100000000000000LL, N = 300005; long long p, d, limit; long long cal(long long p) { int x = 0; if (p % 10 != 9) return 0; while (p % 10 == 9) { x++; p /= 10; } return x; } int main() { cin >> p >> d; lim...
// Copyright (c) 2000-2009 Bluespec, Inc. // 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, pub...
#include <bits/stdc++.h> long double PI = 3.141592653589793238462643383279502884197; using namespace std; int b[1001][1001]; int r[1001][1001], rn[1001][1001]; int c[1001][1001], cn[1001][1001]; int main() { int n, m; scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) { for (int j = 0; j ...
#include <bits/stdc++.h> using namespace std; int dp[11][1001], a[11], b[11], c[11], d[11], n, m; int main() { a[0] = 100000, b[0] = 0; scanf( %d %d %d %d , &n, &m, &c[0], &d[0]); for (int i = 1; i <= m; i++) scanf( %d %d %d %d , &a[i], &b[i], &c[i], &d[i]); for (int i = 0; i <= m; i++) dp[i][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 law...
#include <bits/stdc++.h> using namespace std; namespace IO { inline char gc() { static char buf[1000000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++; } template <typename T> inline void read(T &x) {...
module main(H0,H1,H2,H3,H4,H5,H6,H7,SW,KEY,LED); input wire [3:0]KEY; input wire [17:0]SW; output wire [6:0]H0; output wire [6:0]H1; output wire [6:0]H2; output wire [6:0]H3; output wire [6:0]H4; output wire [6:0]H5; output wire [6:0]H6; output wire [6:0]H7; output wire [17:0]LED; //CANCEL USELESS PINS ass...
/* 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,...
#include <bits/stdc++.h> using namespace std; int const maxn = (int)2e6 + 1, inf = (int)2e9 + 1; map<char, int> pidr; int n, m, ans, cur, sz, a[maxn], b, l[maxn], r[maxn], x[maxn]; bool used[maxn]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++)...
// nios_dut_mm_interconnect_0_avalon_st_adapter_011.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module nios_dut_mm_interconnect_0_avalon_st_adapter_011 #( parameter ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL); ; int n, m; cin >> n >> m; set<long long> s; long long ans = 0; long long a[n]; long long b[m]; long long mx = 0; map<long long, long long> mp; ...
#include <bits/stdc++.h> using namespace std; int f[100010], r[2][100010]; vector<int> mat[2][100010]; void DFS(int a, int x) { r[x][a] = 1; if (x == 1 && f[a] == 1) return; for (int i = 0; i < mat[x][a].size(); i++) { int b = mat[x][a][i]; if (!r[x][b]) DFS(b, x); } } int main()...
#include <bits/stdc++.h> using namespace ::std; const int V = 1e5 + 25; int arr[V]; map<int, int> mmap; int main() { int n; cin >> n; int mx = INT_MIN; int mn = INT_MAX; for (int i = 0; i < n; i++) { cin >> arr[i]; mx = max(mx, arr[i]); mn = min(mn, arr[i]); mmap[ar...
#include <bits/stdc++.h> using namespace std; int n, m, y, Y, it = 1, x1[100001], x2[100001], d[100001], u[100001]; int dist(int x, int y) { return abs(x - y); } int main() { scanf( %d%d%d%d , &n, &m, &y, &Y); for (int i = 1; i <= n; i++) scanf( %d , &x1[i]); for (int i = 1; i <= m; i++) { sca...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n, greater<int>()); for (int i = 0; i < n; i++) cout << a[i] << ; cout ...
#include <bits/stdc++.h> int main() { int a, b, c, d; scanf( %d%d%d%d , &a, &b, &c, &d); int ans = 0; if (a == b) { ans++; } else if (b == c) { ans++; } else if (b == d) { ans++; } if (a == c) { ans++; } else if (c == d) { ans++; } if (a == d) ...
#include <bits/stdc++.h> using namespace std; long long N, K, dp[501][501]; long long p2[501]; void pre() { long long i; p2[0] = 1; for (i = 1; i < 501; ++i) p2[i] = (p2[i - 1] * 2) % 1000000007; } long long rec(long long maxinc, long long cur) { if (maxinc > K) return 0; if (cur > N) re...
#include <bits/stdc++.h> using namespace std; int n, p; char a[20000]; int b[20000]; int main() { cin >> n >> p; scanf( %s , a); memset(b, -1, sizeof(b)); for (int i = 0; i < n; ++i) { if (a[i] == . ) { if (i - p >= 0 && b[i - p] != -1) { b[i] = b[i - p] ^ 1; }...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; const int M = 22; const long long mod = 1e9 + 7; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; long l...
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/unisims/IBUF.v,v 1.9 2009/08/21 23:55:43 harikr Exp $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // All Right Reserved. ////////////////////////////////////////////////////...