text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const long long inf = 1000000000000000000; int c[1001][1001]; int main(void) { int n, m; scanf( %d %d , &n, &m); long long s = 0, sij = 0, si = 0, sj = 0; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { int p = (i - 1) * 4...
#include <bits/stdc++.h> using namespace std; long long n, cr; bool f = 0; pair<long long, long long> a[25], b[25], c[25]; void gen(long long i, long long s1, long long s2) { if (i == n) { if (s1 != s2) cr++; } else { gen(i + 1, s1 + a[i].first, s2 + c[i].first); gen(i + 1, s1, s2); ...
#include <bits/stdc++.h> using namespace std; unsigned long xor128() { static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123; unsigned long t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } double...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Data TLB //// //// //// //// This file is part of the OpenR...
//-------------------------------------------------------------------------------- // flags.vhd // // Copyright (C) 2006 Michael Poppitz // // 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 Foundat...
#include <bits/stdc++.h> using namespace std; int a[200020], b[200020], c[200020]; int main(void) { int n, k; int m; int i; int o; scanf( %d %d , &n, &k); for (i = 1; i <= n; i++) scanf( %d , &a[i]); for (i = 1; i <= n; i++) scanf( %d , &b[i]); for (i = 1, m = o = 0; i <= n; i++) ...
`include "defines.v" module data_ram( input wire clk, input wire ce, input wire we, input wire[`RegBus] addr, input wire[3:0] sel, input wire[`RegBus] data_i, output reg[`RegBus] data_o ); // 定义四个字节数组 reg[`ByteWidth] data_mem0[0:`DataMemNumber - 1]; reg[`ByteWidth] data_mem1[0:`DataMemNumber ...
#include <bits/stdc++.h> using namespace std; map<string, int> mp; int t, x; string s; char ch; string transform(string x) { string s = ; for (char ch : x) if ((ch - 0 ) % 2) s += 1 ; else s += 0 ; while (s.size() < 20) s = 0 + s; return s; } int main()...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 7; int n, m; vector<int> d[MAXN]; int r[MAXN]; vector<pair<int, int> > g[MAXN]; inline void add_edge(int u, int v, int c) { g[u].push_back(make_pair(c, v)); g[v].push_back(make_pair(c, u)); } int col[MAXN]; inline bool dfs(...
module hydra_pll(PACKAGEPIN, PLLOUTCORE, PLLOUTGLOBAL, DYNAMICDELAY, RESET, LOCK); input PACKAGEPIN; input [7:0] DYNAMICDELAY; input RESET; /* To initialize the simulation properly, the RESET signal (Active Low) must be asserted at...
#include <bits/stdc++.h> using namespace std; int main() { int i, u, v, a, b, A, B, C; A = B = C = 0; cin >> a >> b; for (i = 1; i <= 6; i++) { u = abs(i - a); v = abs(i - b); if (u < v) A++; else if (u == v) B++; else C++; } cout << A <<...
`timescale 1ns / 1ps module quick_spi_hard_le_msb_testbench; reg clk; reg rst_n; wire end_of_transaction; wire[7:0] incoming_data; reg[15:0] outgoing_data; wire mosi; reg miso; wire sclk; wire[1:0] ss_n; reg enable; reg start_transaction; reg operation; integer sclk_toggle_count; reg[8:0] incoming_data_buffer; reg sp...
////////////////////////////////////////////////////////////////////// //// //// //// uart_tfifo.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; int main() { ios_base::sync_with_stdio(0); cin.tie(); string s, mx; cin >> s; int len = s.length(); for (int i = 1; i < 1 << len; i++) { string foo; for (int j = 0; j < len; j++) if (i & (1 << j)) foo += s[j]; bool flag ...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const int M = 2e5 + 100; int a[M], b[M]; int n, x, y; int di[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; bool check(int xx, int yy) { if (xx < 1 || xx > x || yy < 1 || yy > y) return 0; return 1; } bool bfs() { queue<int> q; int l = 0; q....
/** * 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...
/*************************************************************************************************** ** fpga_nes/hw/src/cpu/sprdma.v * * Copyright (c) 2012, Brian Bennett * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the fol...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const int MOD = 1e9 + 7; int aa[N]; int tree[4 * N]; int query(int v, int l, int r, int L, int R) { if (l > r || l > R || r < L) return 0; if (L <= l && r <= R) return tree[v]; int v1 = 2 * v + 1; int v2 = 2 * v + 2; i...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_implication (clock, reset, enable, antecedent_expr, consequent_expr, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter property_type = ...
#include <bits/stdc++.h> using namespace std; long long t, n, i, j, k, b[200005], a[200005], x, m, l, r, mid, ans, s; vector<long long> u, v; int main() { ios::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); cin >> n; for (i = 0; i < n; i++) { cin >> x; if (x % 2) v.push_...
#include <bits/stdc++.h> using namespace std; vector<int> a = vector<int>(10, 0); vector<int> b; int main() { srand(time(NULL)); for (int i = 0; i < 6; i++) { int x; cin >> x; a[x]++; } bool f = false; for (int i = 0; i < 10; i++) { if (a[i] != 0) { b.push_bac...
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define ll long long #define all(x) x.begin() , x.end() #define rep(i,s,e) for (int i = s; i < e; ++i) #define rev(i,s,e) for (int i = s; i > e; --i) const int N = 2e5 + 99 ; int main() { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 50; deque<int> dq; bool is[N], can[N]; vector<vector<int> > adj(N); int n, m, d, cur, mx, ans[N], x; void dfs(int u, int p) { ans[u] = ans[p] + 1; can[u] &= (ans[u] <= d); if (ans[u] > mx && is[u]) mx = ans[u], x = u; for (a...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long N = 1e6 + 1; long long pre[N], sub[N]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; string str; cin >> str; long long a = 0, b = 0, c = 0; for (long long i = 0; i ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { long long n, s = 0; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; s += a[i]; } sort(begin(a), end(a)); if (s % 2 == 0 && 2 * a[n - 1] <= s) cout << YES ; else cout << NO ; ...
#include <bits/stdc++.h> using namespace std; int a[300005]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); int Sum = 0; for (int i = 1; i <= n; i++) Sum += a[i]; int indx = 0; int Taken = 0; while (Sum > 2 * Taken) { indx++; Taken...
/* * 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; #define ll long long #define ull unsigned long long #define uint unsigned int #define loop(n) for(int i=1;i<=n;i++) int main() { ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL); uint t; cin>>t; while(t--) { int...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1005; const int MOD = 1000000007; int N, P; int dp[MAXN][4]; int a[MAXN], b[MAXN]; int cnt[3]; void load() { scanf( %d%d , &N, &P); } inline int add(int x, int y) { x += y; if (x >= MOD) x -= MOD; else if (x < 0) x ...
#include <bits/stdc++.h> using namespace std; const int maxn = 400010; inline int max(int a, int b) { return a > b ? a : b; } int head[maxn], cnt, sz[maxn], n, mx_sz, top[maxn], ans[maxn]; vector<int> vt; struct ed { int to, next; } e[maxn * 2]; void ad(int x, int y) { e[cnt] = (ed){y, head[x]};...
//-------------------------------------------------------------------------------- // Project : SWITCH // File : v7_enet_top.v // Version : 0.2 // Author : Shreejith S // // Description: Merged Ethernet Controller Top File for V7 // //---------------------------------------------------------------------...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int N = 5e5 + 5; long long l[N], r[N], x[N], d[N], s[N], pre[N], dp[N]; int n, m; inline long long solve(int u) { for (int i = 1; i <= n; i++) d[i] = s[i] = pre[i] = 0; for (int i = 1; i <= m; i++) { if (x[i] >> u &...
/** * 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; vector<string> cards; map<vector<string>, bool> used; void rec(vector<string>& x) { if (x.size() == 1) { puts( YES ); exit(0); } if (used[x] == true) return; used[x] = true; int p = x.size() - 1; if (x[p][0] == x[p - 1][0...
`timescale 1ns/10ps module soc_system_pll_stream( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'locked' output wire locked ); altera_pll #( .fractional_vco_multiplier("true"), .reference_clock_frequency("50.0 M...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/17/2016 05:20:59 PM // Design Name: // Module Name: Priority_Codec_64 // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: ...
#include <bits/stdc++.h> using namespace std; int n, s; const int N = 1e5 + 10; int v[N]; int ans; bool check(int x, int &res) { int k[n]; for (int i = 0; i < n; i++) { k[i] = v[i] + (i + 1) * x; } sort(k, k + n); for (int i = 0; i < x; i++) if (res <= s) res += k[i]; ret...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); int R, C; string t[2222]; int s1[2222][2222]; int main() { memset(s1, 0, sizeof(s1)); cin >> R >> C; for (int r = 0; r < (int)R; r++) { cin >> t[r]; for (int c = 0; c < (int)C; c++) { if (t[r][c] == ...
/** * 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; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } r...
#include <bits/stdc++.h> using namespace std; double x[101010], y[101010]; double maxn[101010], minn[101010]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %lf , &maxn[i]); for (int i = 1; i <= n; i++) scanf( %lf , &minn[i]); for (int i = n - 1; i >= 1; i--) minn[i...
#include <bits/stdc++.h> using namespace std; int main() { int a[1000]; int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int res = 0; int sum = 10; int ress = 0; for (int i = 0; i < n; i++) { sum += a[i]; if (sum <= 720) { res++; ...
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 3e5+10, oo = 1e9+10; void solve() { int n; cin >> n; vector<ll> a(n+1); ll ans = 0; vector<ll> answers; answers.reserve(n-1); for(int i = 1; i <= n; ++i) { cin >> a[i]; ans += a[i]; } answers.push...
module peripheral_crc_7(clk , rst , d_in , cs , addr , rd , wr, d_out ); //entradas y salidas j1 input clk; input rst; input [15:0]d_in; input cs; input [3:0]addr; // 4 LSB from j1_io_addr input rd; input wr; output reg [15:0]d_out; //------------------------------------ regs and wires----...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `ifdef OVL_XCHECK_OFF //Do nothing `else `ifdef OVL_IMPLICIT_XCHECK_OFF //Do nothing `else wire valid_test_expr; assign valid_test_expr = ~((^test_expr) ^ (^test_expr)); `endif // OVL_...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); double h, w; cin >> h >> w; int ans1, ans2, mx = 0; long long int i = 1; while (i * 2 <= h && i * 2 <= w) { i *= 2; } ans1 = min((long long int)h, (long...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Thu May 1 14:18:52 2014 // Host : macbook running 64-bit Arch Linux // ...
#include <bits/stdc++.h> using namespace std; typedef struct edge { int a; int b; int c; }; int n, m; edge roads[10000]; vector<int> out[200]; double matrix[200][200]; double const eps = 1e-10; double val[200]; bool isZero(double r) { return r < eps && r > -eps; } void flip(int r1, int...
`timescale 1ns / 1ps module rx_tb(); reg reset; wire [7:0] data_out; wire data_out_enable; wire data_out_start; wire data_out_end; wire error; reg clock; reg rx_data_valid; reg rx_error; reg [7:0] rx_data; reg fifo_full; reg [7:0] packet [0:151...
/** * 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; int n, A[100001], Ans[100001]; bool k[100001]; int solve(int x) { if (Ans[x]) return Ans[x]; int tmp = 0, cnt = 0, pre = 1; for (int i = 1; i <= n; i++) { if (!k[A[i]]) { if (cnt == x) { tmp++; cnt = 1; for (in...
#include <bits/stdc++.h> using namespace std; long long a[200010]; int main() { long long n, k; cin >> n >> k; n -= k * (k + 1) / 2; if (n < 0) { cout << NO << endl; return 0; } for (int i = 0; i < k; i++) { a[i] = i + 1 + n / k + (i >= (k - n % k)); } bool ok =...
#include <bits/stdc++.h> using namespace std; const int NM_MAX = 82; const int U_MAX = 6404; int U; vector<int> edges[U_MAX]; short int C[U_MAX][U_MAX]; short int R[U_MAX][U_MAX]; short int F[U_MAX][U_MAX]; int dist[U_MAX]; int parent[U_MAX]; queue<int> q; bool BellmanFord() { for (int i = 1...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); int ji = 0; while (t--) { int n; scanf( %d , &n); int arr[n + 1]; int brr[n + 1]; memset(arr, 0, sizeof(arr)); memset(brr, 0, sizeof(brr)); int ls; int size = 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 law...
#include <bits/stdc++.h> using namespace std; signed main() { long long n, k; cin >> n >> k; if (k <= (n + 1) / 2) { cout << 2 * k - 1; } else { cout << 2 * (k - (n + 1) / 2); } return 0; }
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// megafunction wizard: %LPM_COUNTER%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_COUNTER // ============================================================ // File Name: four_digit_counter_enable.v // Megafunction Name(s): // LPM_COUNTER // // Simulation Library Files(s): // lpm // ==============...
#include <bits/stdc++.h> using namespace std; int min_dist[3005][3005]; vector<int> furthest_out[3005]; vector<pair<int, int> > X; vector<pair<int, int> > furthest_in[3005]; vector<int> E[3005]; int n; void bfs(int source) { for (int j = 1; j <= n; j++) min_dist[source][j] = 1 << 30; min_dist[so...
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); int n; cin >> n; int i, j; vector<int> vec1, vec2, vec3; vec1.push_back(0); vec2.push_back(1); vec1.push_back(1); n--; for (j = 0; j < n; j++) { vec3.push_back(0); for (i ...
/////////////////////////////////////////////////////////////////////////////// // // Project: Aurora 64B/66B // Company: Xilinx // // // // (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected unde...
//------------------------------------------------------------------------------------------------- // I2S CODEC slave module: The I2S bus is over-sampled using the FPGA clock to allow the logic run // in the FPGA clock domain. Note FPGA clock must be at least 2x the I2S. Clock to synchronize // the signals using the...
module ram0( // Read port input rdclk, input [9:0] rdaddr, output reg [15:0] do); (* ram_style = "block" *) reg [15:0] ram[0:1023]; genvar i; generate for (i=0; i<1024; i=i+1) begin initial begin ram[i] <= i; end end endge...
#include <bits/stdc++.h> struct Edge { int u, v, next; } edge[100000]; int head[105], num[105]; bool visited[105]; int en, cnt, tt; void add_edge(int u, int v) { edge[en].u = u; edge[en].v = v; edge[en].next = head[u]; head[u] = en++; } void DFS1(int u) { int v; visited[u] = ...
#include <bits/stdc++.h> using namespace std; struct wektor { int roz; int *tab; int roztab; wektor() { tab = new int[1]; roz = 0; roztab = 1; } ~wektor() { delete[] tab; } int size() { return roz; } bool empty() { return roz == 0; } void pop_back() { roz--; } ...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-10; struct Tpoint { long double x, y; void input() { double _x, _y; scanf( %lf%lf , &_x, &_y); x = _x; y = _y; } } C, H, S; double t1, t2; long double T1, T2; long double ret; long double Fabs(lo...
//############################################################################# //# Purpose: DMA registers # //############################################################################# //# Author: Andreas Olofsson # ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 4000010; long long f[MAXN], sum[MAXN], MOD; int main() { int n; scanf( %d %lld , &n, &MOD); f[n] = 1; sum[n] = 1; for (int i = n - 1; i; --i) { f[i] = (f[i] + sum[i + 1]) % MOD; for (int j = 2; j * i <= n; ++j) { ...
#include <bits/stdc++.h> using namespace std; char s[12000]; int n, i, j; vector<int> ans; int cek(int v, int t, string e) { if (v >= strlen(s) - 1) return v; int i = v; do { string tmp = ; for (i = i;; i++) { tmp.push_back(s[i]); if (s[i] == > ) break; } ...
//------------------------------------------------------------------- //-- counter_tb.v //-- Banco de pruebas para el contador //------------------------------------------------------------------- //-- BQ August 2015. Written by Juan Gonzalez (Obijuan) //-----------------------------------------------------------------...
//Legal Notice: (C)2016 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...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n], b[n], c = 0, d = 0, e = 0, i; for (i = 0; i < n; i++) { cin >> a[i] >> b[i]; if (a[i] > b[i]) c++; else if (b[i] > a[i]) d++; else e++; } if (c > d) cou...
#include <bits/stdc++.h> using namespace std; int main() { double v1, v2, s1, s2, t, f, c; double m; int co; while (cin >> v1 >> v2 >> t >> f >> c) { if (v2 <= v1) cout << 0 << endl; else { s1 = t * v1; s2 = 0; m = v2 - v1; co = 0; while (s...
#include <bits/stdc++.h> using namespace std; void solve() { string S; cin >> S; int M; cin >> M; for (int i = 0; i < M; i++) { int l, r, k; cin >> l >> r >> k; l--; rotate(S.begin() + l, S.begin() + r - k % (r - l), S.begin() + r); } cout << S << n ; } int ...
#include <bits/stdc++.h> int next[1 + (1000 * (1000 - 1)) * 2], hh[1 + (1000 * (1000 - 1)) * 2], l_; int link(int l, int h) { next[l_] = l; hh[l_] = h; return l_++; } int ij[(1000 * (1000 - 1))], ww[(1000 * (1000 - 1))], ao[1000]; long long ww_[1000][1000]; int pq[1 + 1000], iq[1000], cnt; lon...
#include <bits/stdc++.h> using namespace std; signed main() { long long n; cin >> n; n /= 2; vector<long long> x(n); for (long long i = 0; i < n; ++i) { cin >> x[i]; } vector<vector<pair<long long, long long>>> as(n); for (long long i = 0; i < n; ++i) { for (long long a =...
#include <bits/stdc++.h> using namespace std; vector<long long int> odds; int main() { int n; scanf( %d , &n); long long int sum = 0; int length_odds = 0; for (int x = 0; x < n; x++) { long long int num; scanf( %lld , &num); if (num % 2 == 0) { sum += num; } els...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; } template <typename T, typename U> inline ostream &operator<<(ostream...
#include <bits/stdc++.h> const int N = 3200; using namespace std; int n, l; int a[N][3], b[N][3]; int dp[N][105][3]; void add(int &a, int &b) { a += b; if (a >= 1000000007) a -= 1000000007; } int main() { ios_base::sync_with_stdio(0); cin >> n >> l; for (int i = 1; i <= n; i++) { ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_ab // // Generated // by: wig // on: Mon Oct 24 10:52:44 2005 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../verilog.xls // // !!! Do not edit this file! Autogenerated by MIX !!! /...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int maxdp[27]; int dp[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; string str; cin >> n >> str; for (int i = 0; i < n; ++i) { for (int c = 26; c > str[i] - a ; --c) maxdp[str[i] - a...
`timescale 1 ps / 1 ps module mux_2_to_1 ( input sel_i, input [1:0] dat_i, output dat_o ); assign dat_o = sel_i && dat_i[1] || ~sel_i && dat_i[0]; endmodule module mux_n_to_1 #( parameter sel_w = 4, parameter n_inputs = 2**sel_w ) ( input [n_inputs-1:0] inputs_i, input [sel_w...
module muladd_wrap ( input ck, input rst, input [63:0] i_a, i_b, i_c, //a + b * c input i_vld, output o_rdy, output [63:0] o_res, output o_vld ); parameter ENTRY_DEPTH = 32; wire ef_afull; wire ef_pop; wire ef_empty; wire [63:0] ef_a, ef_b, ef_c; fifo #( ...
#include <bits/stdc++.h> int ways[37 * 2 + 1][37 * 2 + 1], k; void init() { int i, j; ways[0][0] = 1; for (i = 0; i <= k * 2; i++) for (j = 0; j <= k * 2; j++) ways[i][j] = i == 0 || j == 0 ? 1 : (ways[i - 1][j] + ways[i][j - 1]) % 998244353; } int oo[1 + (4000 - 1) * 4], o...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_stack (clock, reset, enable, push, push_data, pop, pop_data, full, empty, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter depth ...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Mark_Extract_Bits_block.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // -----------------------------------------------------...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007LL; long long large = 2000000000000000000LL; vector<int> dp; vector<vector<int> > adj; int f(int u) { if (dp[u] != -1) return dp[u]; vector<int> ch; for (int j = 0; j < (int)adj[u].size(); j++) { int v = adj[u][j]; ...
#include <bits/stdc++.h> using namespace std; const long long MAX = 100005; const long long mod = 1000000007; const double PI = 2 * acos(0.0); const double EPS = 0.00000000001; int main() { long long n; cin >> n; string a, b; cin >> a >> b; long long OO = 0, II = 0, IO = 0, OI = 0; f...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) const long long INF = 1e9 + 7; const long long maxn = 2e5 + 7; using namespace std; void solve() { long long a, b, c, d; cin >> a >> b >> c >> d; long long ans = 0; for (long long z = c; z < d + 1; z++) { long long r1 = z - c + 1; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; int cnt = 0; string ans = 1 ; for (int i = 0; i < n; i++) { string str; cin >> str; while (str.size() && str.back() == 0 ) str.pop_back(), cnt++; if (str.size()...
// 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 : Tue Sep 19 14:35:07 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; const int N = 1000 + 7; int n; char s[N]; struct edge { int to, nex, wei; } e[N << 1]; int fir[N], eid; int deg[N], dis[N]; int fa[N]; queue<int> q; int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); } void addedge(int u, int v, int...
#include <bits/stdc++.h> using namespace std; pair<long long, long long> sn[100005], sp[100005]; bool myfunction(pair<long long, long long> i, pair<long long, long long> j) { return (i.first > j.first); } int main() { int n, p, a, first = 0, second = 0; scanf( %d , &n); for (int i = 1; i <= n;...
/* * 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-2022 F4PGA 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...