text
stringlengths
59
71.4k
/* * 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; const int MAXN = 5e5; vector<int> G[MAXN]; int happiness[MAXN], f[MAXN], tmpAns = 0, ans = 0; void dfs(int u, int par) { int oldTmpAns = -1, oldF = -1, oldFPos = -1; if (~par && f[tmpAns] < happiness[u]) oldTmpAns = tmpAns, f[++tmpAns] = happiness[u]...
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e6 + 10, mod = 1e9 + 7, inf = 2e9, lg = 22, maskm = (1 << lg) - 1, maxm = (1 << lg) + 7; long long a[maxn], dp[maxm]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; ...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; } inline int sub(int x, int y) { x -= y; return x < 0 ? x + mod : x; } inline int mul(int x, int y) { return 1ll * x * y % mod; } int quick_pow(i...
#include <bits/stdc++.h> using namespace std; int n, m, t; int data[105][3]; bitset<50> mark; set<pair<long long, long long> > ss; struct Node { pair<long long, long long> g; void reset() { g.first = g.second = 0; } void set(int x) { if (x < 50) g.first |= 1ll << x; else ...
module hdu( d_raddr1, d_raddr2, d_addrselector, d_jr_or_exec, d_immonly, e_isLoad, e_wreg, //nop_alu_stall, nop_lw_stall, nop_sw_stall, // this doesn't seem to be required for this pc_stall, ifid_stall ); // d_addrselector is lhb_llb_regcon, it gives addr fof [11:8] in raddr2 when 1 OR [7:4] in raddr2 when 0 //...
//================================================================================================== // Filename : memory.v // Created On : 2014-09-28 20:35:52 // Last Modified : 2015-05-31 21:18:35 // Revision : // Author : Angel Terrones // Company : Universidad Simón Bolívar // Email...
////////////////////////////////////////////////////////////////////////////////// // d_KES_PE_DC_2MAXodr.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 OpenSSD....
#include <bits/stdc++.h> using namespace std; const int N = 105; const int mod = 1e9 + 7; inline void MOD(int &x) { if (x >= mod) x -= mod; } int n, m, k; int dp[2][N][N][N], C[N][N], r; int ans; int main() { for (int i = 0; i <= 100; i++) { C[i][0] = 1; for (int j = 1; j <= i; j++...
/* * * Copyright 2015, Stephen A. Rodgers. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later vers...
/** * 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...
// // timing.v -- timing generator // module timing(clk, pixclk, txtrow, txtcol, chrrow, chrcol, blank, hsync, vsync, blink); input clk; output pixclk; output [4:0] txtrow; output [6:0] txtcol; output [3:0] chrrow; output [2:0] chrcol; output blank...
/* * Copyright 2018-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 to in...
module var21_multi (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, valid); input A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U; output valid; wire [8:0] min_value = 9'd120; wire [8:0] max_weight = 9'd60; wire [8:0] max_volume = 9'd60; wire [8:0] total_value = ...
/** * 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::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<vector<long long> > PRE(32, vector<long long>(n + 2, 0)), ZEROS(32, vector<long long>(n + 2, 0)); vector<long long> L(m), R(m), Q(m); for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; int main() { int a[3]; int x[3]; int last = 0; cin >> a[0] >> a[1] >> a[2]; cin >> x[0] >> x[1] >> x[2]; for (int i = 0; i < 3; ++i) { int t = a[i] - x[i]; if (t > 0) t /= 2; last += t; } if (last < 0) cout << No ...
// 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 : Mon Sep 18 12:31:45 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
//-------------------------------------------------------------------------------- // Project : SWITCH // File : eth_rcr_unpack.v // Version : 0.2 // Author : Shreejith S // // Description: Ethernet Rx Module Unpacker // //-------------------------------------------------------------------------------- ...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version: P.20...
#include <bits/stdc++.h> using namespace std; const int MAXW = 1000000; const int INF = 0x3f3f3f3f; const int MOD = 1000000007; const char test[] = test n ; int in(); int tr[100010]; int ls[100010]; int n, m, k; int hav[100010]; int lowbit(int x) { return (-x) & x; } void updata(int in, int val...
/* * 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> std::priority_queue<std::pair<long long, int> > que; long long dis[2005]; int w[2005][2005]; int main() { int n, mn = 1e9; scanf( %d , &n); for (int i = 0; i < n - 1; i++) { for (int j = 1; j < n - i; j++) { int x; scanf( %d , &x); w[i][i + j] =...
#include <bits/stdc++.h> using namespace std; const int N = 6e5; const long long mo = 1e9 + 7; const long long inf = 1e9; const long long Inf = 1e18; int lz[N], a[N], ls[N], rs[N], mi[N], mx[N]; bool ok[N]; char s[N]; void f(int x, int l, int r, int y, int z, int L, int R) { if (l == L && r == R &...
//Logarithm function evaluation module log(u0, e, clk); input [47:0]u0; input clk; output [30:0]e; reg [30:0]e; reg [7:0]exp_e; reg [47:0]x_e; reg [113:0]y_e1, y_e_2, y_e_3, y_e; reg [65:0]y_e2; reg [15:0]ln2; reg [18:0]e_e; reg [33:0]e_e_, y_e_; reg [34:0]e0; reg [16:0]c_e_1; reg [16:0]c_e_2,...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int n, count = 1; cin >> n; while (n > 0) { if (count % 3 != 0 && count % 10 != 3) { count++; n--; } else { count++; } }...
/* Decode Unit Testbench*/ `timescale 1ns / 100ps `include "../decode_32.v" module decode_test(); localparam MEM_SIZE = 32; /* Clocks */ reg clk; always #10 clk = ~ clk; //100MHz /* Input signals to drive */ reg reset; reg stall; reg [31:0] insn; reg [31:0] insn_address; //integer insn_address; reg [7:0] sy...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE rev.B2 compliant I2C Master byte-controller //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; int n, k, ans = -1, dist[2020]; vector<int> adj[2020], vet; int main() { scanf( %d%d , &n, &k); for (int(i) = (0); (i) < (k); (i)++) { int v; scanf( %d , &v); vet.push_back(v - n); } sort((vet).begin(), (vet).end()); vet.resize(...
/* * 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[100005]; int cmp(int x, int y) { int x1 = 10 - x % 10; int y1 = 10 - y % 10; return x1 < y1; } int main() { int i, n, m; cin >> n >> m; for (i = 1; i <= n; i++) { scanf( %d , &a[i]); } sort(a + 1, a + 1 + n, cmp); fo...
/* * 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 maxn = 1e5 + 2; int a[maxn << 1]; long long vis[maxn]; int main(void) { std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int n, m; while (cin >> n >> m) { int k = 0; int t; vector<int> a(n + m + 1); vec...
module CPU ( clk_i, rst_i, start_i, mem_data_i, mem_ack_i, mem_data_o, mem_addr_o, mem_enable_o, mem_write_o ); //input input clk_i; input rst_i; input start_i; // // to Data Memory interface // input [256-1:0] mem_data_i; input mem_ack_i; output [256-1:0] mem_data_o; output [32-1:0] mem_...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: adc_data_fifo.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // =========================================...
/* * 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; mt19937 mt_rand(time(0)); const int N = 3e5 + 5; int q, n, s[N], maks[N], dp[N]; map<int, int> mapa[N]; int main() { scanf( %d , &q); while (q--) { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &s[i]); for (int i = 0; i < n; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 102; int w, h, n, qs, qt; int area[maxn], areath; pair<int, int> q[1000006]; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; bool vis[maxn][maxn]; bool cut[maxn][maxn][4]; int bfs(int stx, int sty) { qs = 0; qt = 1; q[0...
//Legal Notice: (C)2020 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 do...
#include <bits/stdc++.h> using namespace std; int main() { int n, p, ans(0); cin >> n; map<string, int> mp; string s; while (n--) { cin >> s; mp[s]++; } for (auto x : mp) { if (x.first == Tetrahedron ) p = 4; else if (x.first == Cube ) p = 6; ...
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define int long long #define double long double #define pb push_back #define mp make_pair #define endl n #define all(x) x.begin(),x.end() #define fill(a,b) memset(a,b,sizeof(a)) #define sz(x) (int)x.size() #define ff first ...
#include <bits/stdc++.h> using namespace std; void init_code() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { init_code(); long long t; cin >> t; while (t--) { long long x1, y1, z1; long long x2, y2, z2; cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2; ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1000000000 ) using namespace std; inline void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); } string abc = abcdefghijklmnopqrstuvwxyz ; string ABC = ABCDEFGHIJKLMNOPQRSTUVWXYZ ; string digits = ...
#include <bits/stdc++.h> using namespace std; set<pair<pair<long long int, long long int>, long long int> > ev; vector<long long int> cnt, len; multiset<pair<long long int, long long int> > flug; void expand( set<pair<pair<long long int, long long int>, long long int> >::iterator it, long long int...
#include <bits/stdc++.h> using namespace std; template <class T> bool umin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> bool umax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } int arr[100009], val[100009], n, k; ...
// ==================================================================== // Radio-86RK FPGA REPLICA // // Copyright (C) 2011 Dmitry Tselikov // // This core is distributed under modified BSD license. // For complete licensing information see LICENSE.TXT. // ------------------------------------...
// (C) 2001-2016 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; const int MD = 1000000007; long long A[100000 + 1], dp[100000 + 1]; long long exp(long long a, long long b) { long long r = 1; while (b > 0) { if (b & 1) r = r * a; b /= 2; a = a * a; } return r; } int main() { ios_base::syn...
// (C) 2001-2016 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; int main() { int H, W, K; cin >> H >> W >> K; vector<string> photo(H); for (int h = 0; h < int(H); ++h) cin >> photo[h]; vector<vector<char> > star(H, vector<char>(W, 0)); for (int r = 1; r < int(H - 1); ++r) for (int c = 1; c < int(W - 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 law...
#include <bits/stdc++.h> using namespace std; const long long maxn = 205; long long dp[maxn][maxn][maxn]; long long n; string s, t; long long recur(long long pos, long long changes, long long sum) { if (pos == n) return 0; if (dp[pos][changes][sum] != -1) return dp[pos][changes][sum]; long long ...
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
// D6LUT, C6LUT, B6LUT, A6LUT == W6LUT // A fracturable 6 input LUT. Can either be; // - 2 * 5 input, 1 output LUT // - 1 * 6 input, 1 output LUT module {N}LUT(A1, A2, A3, A4, A5, A6, O6, O5); input wire A1; input wire A2; input wire A3; input wire A4; input wire A5; input wire A6; output wire O6; output wi...
#include <bits/stdc++.h> using namespace std; int n, k, m; int times[45]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k >> m; for (int i = 0; i < k; i++) cin >> times[i]; int s = 0; for (int i = 0; i < k; i++) s += times[i]; sort(begin(times), begin(times) + k); ...
#include <bits/stdc++.h> #pragma GCC omptimize( unroll-loops ) #pragma optimize( SEX_ON_THE_BEACH ) #pragma GCC optimize( no-stack-protector ) #pragma comment(linker, /STACK:1000000000 ) using namespace std; using ll = long long int; using ull = unsigned long long int; using dd = long double; using l...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n; cin >> n; vector<int> list; int maxx, ma; for (int i = 0; i < n; i++) { int u; cin >> u; list.push_back(u); } int u1, u2, u3; int...
#include <bits/stdc++.h> using namespace std; const int MAXN = 3010; int a[MAXN], b[MAXN], c[MAXN]; int d[MAXN][2]; int main() { int n; while (~scanf( %d , &n)) { for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); for (int i = 1; i <= n; ++i) scanf( %d , &b[i]); for (int i = 1; i <= n;...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 9; const int MAXN = 3e5 + 1; int l[MAXN], r[MAXN]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> v(n); fo...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long int ops = 0; long long int x, y, m; cin >> x >> y >> m; if (x >= m || y >= m) { cout << 0 << endl; return 0; } if (x <= 0 && y <= 0) { cout << -1 << endl; return 0; } long long int m...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const double EPS = 1e-9; const int INF = INT_MAX; const long long INFLL = (long long)1e18; const double PI = acos(-1.0); template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <class T> T lcm(T a...
#include <bits/stdc++.h> using namespace std; template <class T1, class T2, class T3> bool _IN(T1 x, T2 y, T3 z) { return x <= y && x >= z || x <= z && x >= y; } unsigned long long gcd(unsigned long long a, unsigned long long b) { if (!b) return a; while (b ^= a ^= b ^= a %= b) ; return ...
#include <bits/stdc++.h> using namespace std; vector<long long> a; struct SegTree { struct Node { long long left, right, mid, size; }; Node combine(const Node& A, const Node& B, long long m) { Node C; if (A.left < A.size) { C.left = A.left; } else { if ((a[m - 1...
module IDELAYE2 (/*AUTOARG*/ // Outputs CNTVALUEOUT, DATAOUT, // Inputs C, CE, CINVCTRL, CNTVALUEIN, DATAIN, IDATAIN, INC, LD, LDPIPEEN, REGRST ); parameter CINVCTRL_SEL = "FALSE"; // Enable dynamic clock inversion parameter DELAY_SRC = "IDATAIN"; // Delay input paramet...
//====================================================================== // // cmac_core.v // ----------- // CMAC based on AES. Support for 128 and 256 bit keys. Generates // 128 bit MAC. The core is compatible with NIST SP 800-38 B and // as used in RFC 4493. // // // Author: Joachim Strombergson // Copyright (c) 2018...
#include <bits/stdc++.h> using namespace std; int arr[4], sum; string s; int main() { cin >> arr[0] >> arr[1] >> arr[2] >> arr[3] >> s; for (int i = 0; i < s.size(); i++) { sum += arr[s[i] - 49]; } cout << sum; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, h; cin >> n >> m >> h; long long r[n], c[m], a[n][m]; for (long long i = 0; i < m; i++) { cin >> c[i]; } for (int i = 0; i < n; i++) { cin >> r[i]; } for (int i = 0; i < n; i++) { for (int j ...
// megafunction wizard: %ROM: 2-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: cm_rom_shared.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ==========...
#include <bits/stdc++.h> using namespace std; inline long long rd() { long long x = 0; bool f = 0; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = 1; c = getchar(); } while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return ...
/* Copyright (c) 2020 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,...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: fpu_rptr_min_global.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 ...
// 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 16:52:31 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, sum = 0; cin >> n; sum = n; for (int i = 2; i <= n; i++) { while (n % i == 0) { sum += n / i; n /= i; } } cout << sum << endl; return 0; }
// // `aclass.v' // Asynchronous class tech. cell description // // 2013 Shin'ya Ueoka `define gate_delay 0.090 // VCC and GND module VCC (Z); output Z; supply1 vdd; assign Z= vdd; endmodule module GND (Z); output Z; supply0 gnd; assign Z = gnd; endmodule // Combinational Gates module AN2(Z,A,B); inp...
`include "bsg_mem_3r1w_sync_macros.vh" module bsg_mem_3r1w_sync #( parameter `BSG_INV_PARAM(width_p ) , parameter `BSG_INV_PARAM(els_p ) , parameter read_write_same_addr_p = 0 , parameter addr_width_lp = `BSG_SAFE_CLOG2(els_p) ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: sfifo_14x16.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ===========================================...
/* * 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; double n, l, v1, v2, k; bool c(double x) { int num; if ((int)n % (int)k == 0) num = n / k; else num = n / k + 1; if (num * x + (num - 1) * x * (v2 - v1) / (v2 + v1) <= x + (l - x * v2) / v1) return 1; return 0; } int main() { ...
#include <bits/stdc++.h> using namespace std; const long long N = 1000006, MOD = 1e9 + 7, INF = 1e16; long long a[N], b, n, m, k, g[105][105], q, x, ans, Ans, pre[N], l, r; string s; pair<int, int> p[N]; int main() { ios_base::sync_with_stdio(false), cin.tie(0); cin >> n >> m; for (int i = 1; i ...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > v[100005]; bool visit[100005]; int n; vector<int> ans; bool dfs(int i, int last) { visit[i] = true; bool flag = false; for (int j = 0; j < v[i].size(); j++) { if (!visit[v[i][j].first]) { if (v[i][j].second == 2)...
#include <bits/stdc++.h> using namespace std; int n, m; int p[2 * 100001], rnk[2 * 100001]; int cnt[2 * 100001]; long long pref[2 * 100001 + 5]; long long ans[2 * 100001 + 5]; vector<pair<int, int> > q; struct Edge { int a, b; int w; Edge(int a, int b, int w) : a(a), b(b), w(w) {} }; vec...
module main; int unsigned foo, bar = 10; int signed foos, bars = 10; int unsigned wire_sum; int wire_sums; assign wire_sum = foo + bar; assign wire_sums = foos + bars; function int unsigned sum(input int unsigned a, b); sum = a + b; endfunction function int unsigned sums(input i...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:200000000 ) using namespace std; long long step(long long a, long long n) { if (n == 0) return 1; else if (n % 2 == 0) return step(a * a, n / 2); else return a * step(a, n - 1); } int main() { ios_base::sync_with_stdio(...
#include <bits/stdc++.h> int main() { int p, q, l, r; scanf( %d %d %d %d , &p, &q, &l, &r); std::vector<std::pair<int, int> > fixed; std::vector<std::pair<int, int> > changing; for (int k = 0; k < p; k++) { int a, b; scanf( %d %d , &a, &b); fixed.push_back(std::pair<int, int>(a, ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int sg[N]; int main() { int T, n, k; scanf( %d , &T); while (T--) { scanf( %d %d , &n, &k); bool flag = true; if (k % 3 == 0) { int t = (k / 3 - 1) * 3 + 4; int s = n % t; if (s == t - 4) ...
`timescale 1ns/1ps module testadd(); reg clk; reg reset; reg [7:0] snoopa; reg [7:0] snoopd; reg snoopp; discus dcs(.clk(clk), .reset(reset), .snoop_clk(clk), .snoopa(snoopa), .snoopd(snoopd), .snoopq(), .snoopm(1'b...
#include <bits/stdc++.h> using namespace std; const int N = 111111; vector<int> g[N]; bool s[N], f[N], used[N], foo[N], bar[N]; int q[N], qb, qe; int main() { int n; cin >> n; for (int i = 1; i < n; i++) { int u, v; cin >> u >> v; g[u].push_back(v); g[v].push_back(u); ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distribut...
//******************************************************************************************* // Description: Netlist for FLPv3L's Layer Controller Register File // Generated by genRF (Version 1.01) 08/25/2017 00:09:00 // // [NOTE] This is a subset of the entire Register File. See Log file or MBus Register File ...
#include <bits/stdc++.h> using namespace std; int main() { int n, s; cin >> n >> s; int *sa = new int[s + 1]; for (int i = 0; i < s + 1; i++) { sa[i] = 0; } for (int i = 0; i < n; i++) { int tm, tp; cin >> tm >> tp; if (sa[tm] < tp) { sa[tm] = tp; } ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; cin >> n >> k; n /= k; if (n % 2) cout << YES << endl; else cout << NO << endl; return 0; }
module foo (/*AUTOARG*/ // Outputs aa ); /*AUTOOUTPUTEVERY*/ // Beginning of automatic outputs (every signal) output [Y:X] aa; // From inst of autoinst_signed_fubar2.v, ..., Couldn't Merge // End of automatics /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated...
/** * 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 x, y, m, cnt = 0; int main() { scanf( %lld%lld%lld , &x, &y, &m); if (x >= m || y >= m) { printf( 0 ); return 0; } if (x <= 0 && y <= 0) { printf( -1 ); return 0; } while (x < m && y < m) { if (x > y) swa...
#include <bits/stdc++.h> using namespace std; int n, k, a, rev[132001 * 2], g[2][132001 * 2], ntt[132001], v1[132001], v2[132001], fr[132001], ifr[132001], as[132001], fg = 255, inv[132001], vl[132001]; int pw(int a, int p) { int as = 1; while (...
// file header here // `timescale 1ns/100ps // Switch between FSDB or VCD format of output waveform `define FSDB // Option to dump the entire memory content `define DEBUG_MEM // Option to trace read/write access to the data memory from the top level `define DEBUG_DATAMEM_RW // Option to trace memory read/write /...
#include <bits/stdc++.h> using namespace std; int a[200002]; pair<int, int> b[200002]; int main() { int n, k, max = 0; for (int i = 0; i < 200001; i++) { a[i] = 2147483647; } scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d %d , &b[i].first, &b[i].second); } sort(...
#include <bits/stdc++.h> using namespace std; const int N = 1005, mod = 1e9 + 7; int yh[N][N], a[N]; long long kpow(long long a, long long b) { long long ans = 1; while (b) { if (b & 1) ans = ans * a % mod; a = a * a % mod; b >>= 1; } return ans; } int main() { for (int...
#include <bits/stdc++.h> using namespace std; using ll = long long int; void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main() { fast(); int t, b, p, f, h, c; cin >> t; while (t--) { cin >> b >> p >> f; cin >> h >> c; int bun =...