text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; bool sort_d(long long x, long long y) { return x > y; } int gcd(long long x, long long y) { if (!y) return x; else return gcd(y, x % y); } int lcm(long long x, long long y) { return (x * y) / gcd(x, y); } int main() { int n, m, a, b; ...
#include <bits/stdc++.h> namespace myland { using namespace std; namespace _abbr { const double EPS(1e-8); const double PI(acos(-1.0)); const int INF(0x3f3f3f3f); const long long INFL(0x3f3f3f3f3f3f3f3fll); const int MOD(1e9 + 7); } // namespace _abbr using namespace _abbr; namespace _solve {} ...
#include <bits/stdc++.h> using namespace std; long long a[100001]; long long b[100001]; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; map<int, int> cnt; vector<int> q; int loc = 0; for (int ...
/* 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...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; template <class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T b; ss >> b; return b; } template <class T> void print(T a, int p...
#include <bits/stdc++.h> using namespace std; int main() { int N; ios_base::sync_with_stdio(0); cin >> N; string K; cin >> K; int zm = N; for (int i = 1; i < N; i++) { if (K[i] != K[i - 1]) { zm--; if (i < N - 1) K[i] = K[i + 1]; } } cout << zm; }
/* * 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...
// nios_mm_interconnect_0_avalon_st_adapter_002.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_mm_interconnect_0_avalon_st_adapter_002 #( parameter inBitsPe...
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } x *= f; } const int N = ...
#include <bits/stdc++.h> using namespace std; void file_io() { freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); } void PLAY() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); } int main() { PLAY(); int n; cin >> n; int x[1000000] = {0}; fo...
/* * Milkymist VJ SoC fjmem flasher * Copyright (C) 2010 Michael Walle * * 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 distributed in the ...
#include <bits/stdc++.h> using namespace std; bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { int n, i, j, alp[27] = {0}, flg = 1; ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; s = 00 + s; int l = s.length(); int fi = 0, fj = 0, i, j, k, num; for (i = 0; i < l; i++) { for (j = i + 1; j < l; j++) { for (k = j + 1; k < l; k++) { num = 100 * (s[i] - 0 ) + 10 * (s[...
#include <bits/stdc++.h> using namespace std; int up_div(int a, int b) { return a / b + (a % b != 0); } int down_div(int a, int b) { return a / b; } int main() { int a, b; cin >> a >> b; int res = 0; for (int k = 1; k <= a + b; ++k) { int d = (a + b) / k; int min_k = k; int max...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of lp // // Generated // by: lutscher // on: Fri Jun 26 13:24:43 2009 // cmd: /tools/mix/1.9//mix_1.pl -vinc global_project.i -nodelta LP-blue-pin-list.xls LP-paris-pin-list.xls LP-reallity-pin-list.xl...
`timescale 1ns / 1ps //----------------------------------------------- // Company: agh // Engineer: komorkiewicz // Create Date: 23:14:48 04/19/2011 // Description: vga generator //----------------------------------------------- module hdmi_in ( //hdmi outputs output reg hdmi_clk, output hdmi_de, output hdmi_h...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used * * solely for design, simulation, implementation and creation of * * design files limited to Xilinx devices or technologies. Use ...
/** * 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 "assert.vh" module cpu_tb(); reg clk = 0; // // ROM // localparam MEM_ADDR = 4; localparam MEM_EXTRA = 4; reg [ MEM_ADDR :0] mem_addr; reg [ MEM_EXTRA-1:0] mem_extra; reg [ MEM_ADDR :0] rom_lower_bound = 0; reg [ MEM_ADDR :0] rom_upper_bound = ~0; wire [2...
#include <bits/stdc++.h> using namespace std; int r1, r2; int c1, c2; int b, e, k; int main() { ios_base::sync_with_stdio(0); b = e = k = 0; cin >> r1 >> c1; cin >> r2 >> c2; if (r1 > r2) { swap(r1, r2); swap(c1, c2); } b = (r1 == r2 || c1 == c2) ? 1 : 2; e = ((((r1...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int TC; cin >> TC; while (TC--) { int N; cin >> N; string s; cin >> s; int ans = 0; int cnt = 0; for (int i = N - 1; i >= 0; i--) { if (s[i] == P ) ...
#include <bits/stdc++.h> using namespace std; struct nom { int i, a, l; }; long long po(int a, int n) { if (n == 0) return 1; if (n == 1) return a; if (n & 1) return a * po(a * a, n / 2); else return po(a * a, n / 2); } struct rec { int x, y, x1, y1; }; int main() { ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: pkt_gen_fifo.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ==============================...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); bool F = 1; for (int i = 2; (long long)i * i <= n; i++) { if (n % i == 0) { F = 0; break; } } bool F2 = 1; for (int i = 2; (long long)i * i <= n - 2; i++) { if ((n - 2) % ...
/** * 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 INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; unordered_map<int, int> dp; int msb(int x) { return __builtin_clz(1) - __builtin_clz(x); } int solve(int mask) { if (mask <= 1) return 0; if (dp.count(mask)) return dp[mask]; in...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); long long t; cin >> t; while (t--) { long long n; cin >> n; set<long long> s; for (long long i = 0; i < n; i++) { long long x; cin >> x; s.inser...
#include <bits/stdc++.h> using namespace std; int s, t; int psum[100005]; vector<int> pos[2][2]; int cost[100005]; long long dp[100005]; int chosen[100005]; int mx; bool ok(int c) { dp[0] = 0; chosen[0] = 0; for (int i = (1); i <= (s); i += (1)) { dp[i] = dp[i - 1]; chosen[i] =...
`timescale 1ns/1ns // IN (device->host) endpoint FIFO module in_fifo( ifclk, fifoadr, data, wr, pktend, full, // "Host" interface recvd_data, recvd_rdy ); parameter FIFOADDR = 2'b00; // FPGA interface input ifclk; input wr; input [1:0] fifoadr; input pktend; input [7:0] data; output full; // "Host" inte...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int MAX = (int)(2e5) + 7; const int MOD = (int)(1e9) + 7; const int INF_I = (int)(1e9) + 7; const ll INF_LL = (ll)(1e18); template <typename T> void info(T& v) { for (const auto& i : v) cout << 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...
/** *@file bcode_generator.v *@brief Generate IRIG-B code using TAI time *@author LUAN Yuezhen *@date Origin 2016.11.23 *@tab Tab size = 4 spaces */ module bcode_generator( input clk, input rst_n, input clk_reload_n, input pps_in, input [63 : 0] tai_sec_in, input [15 : 0] leap_sec_in, i...
#include <bits/stdc++.h> inline int getInt() { int s; scanf( %d , &s); return s; } using namespace std; struct Node { long long highest; int mxL; int mxR; int idxL; int idxR; Node(long long h, long long l, long long r, int il, int ir) : highest(h), mxL(l), mxR(r), idx...
//Legal Notice: (C)2018 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...
/* * Frame Generator * * Generate the replied package from Tag to Reader * including Preamle, Replied Data, End-of-Signaling * * Support FM0 Encoder and Miller Encoder in M = 2, 4, 8 * the forms of encoding is depends on M * * Two forms of preamble, which is depends on Trext */ `timescale 1us / ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); deque<long long int> b, g; long long int n; cin >> n; for (long long int i = 0; i < n; i++) { long long int temp; cin >> temp; b.push_back(temp); } cin >> n; for (long long int ...
`timescale 1ns/100ps // Actel Corporation Proprietary and Confidential // Copyright 2008 Actel Corporation. All rights reserved. // ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN // ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED // IN ADVANCE IN WRITING. // Revision Information:...
/* ----------------------------------------------------------------------- * * Copyright 2008 Tommy Thorn - 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, In...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k, a; scanf( %I64d%I64d%I64d , &n, &m, &k); if (n + m - 2 < k) printf( -1 ); else { if (n > m) { a = n; n = m; m = a; } if (n >= k + 1) { printf( %I64d , max((m / (k + 1...
#include <bits/stdc++.h> using namespace std; int n; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { scanf( %d , &n); if (n == 1) { printf( 0 n0 n0 n ); return 0; } for (int t = 1; t <= n - 1; t++) if (gcd(t, n) == 1 && gcd(t + 1, n) == 1) { fo...
#include <bits/stdc++.h> using namespace ::std; const int maxn = 1e5 + 5; map<long long, int> mp; long long sum[maxn], ans; int n, k; void solve() { long long maxx = 0, minn = 0; scanf( %d%d , &n, &k); mp[0] = 1; for (int i = 1; i <= n; i++) { long long tmp; scanf( %I64d , &tmp);...
#include <bits/stdc++.h> using namespace std; const long long INF = 1 << 28; const long long LINF = 1ll << 61; inline long long getnum() { register long long r = 0; register bool ng = 0; register char c; c = getchar(); while (c != - && (c < 0 || c > 9 )) c = getchar(); if (c == - )...
#include <bits/stdc++.h> using namespace std; vector<int> v; int main() { int n, k, l, r, sall, sk, i, res, ext, j, a, b; while (scanf( %d %d %d %d %d %d , &n, &k, &l, &r, &sall, &sk) == 6) { v.clear(); if (sk % k == 0) { res = sk / k; for (i = 0; i < k; i++) { v.push...
/* * Copyright 2010, Aleksander Osman, . All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * con...
/** * 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 std::cin; using std::cout; using std::vector; int main() { long long n; cin >> n; int t = 0; while (n > 0) { if (n % 2 != 0) t++; n = n / 2; } cout << t; int h; cin >> h; return 0; }
// Model a reset synchronizer circuit (active low reset) // // Notes: // - Reset synchronizer creates a "predictable reset // from an asynchronous reset input. Async resets are // notorious for their unpredictability - reset assertion // /removal can happen anytime near the clock edge. // Reset assertion/remov...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/); // IEEE: integer_atom_type byte d_byte; shortint d_shortint; int d_int; longint d_longint; ...
module alt_vipitc131_IS2Vid_calculate_mode( input [3:0] trs, input is_interlaced, input is_serial_output, input [15:0] is_sample_count_f0, input [15:0] is_line_count_f0, input [15:0] is_sample_count_f1, input [15:0] is_line_count_f1, input [15:0] is_h_front_porch, input [15:0] is_h_s...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017 // Date : Fri Sep 22 14:41:49 2017 // Host : EffulgentTome running 64-bit major re...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(NULL); int m, n; cin >> m >> n; set<int> v[m]; for (int i = 0; i < m; i++) { int s; cin >> s; for (int j = 0; j < s; j++) { int x; cin >> x; ...
#include <bits/stdc++.h> using namespace std; vector<string> split(const string& s, const string& delim = ) { vector<string> res; string t; for (int i = 0; i != s.size(); i++) { if (delim.find(s[i]) != string::npos) { if (!t.empty()) { res.push_back(t); t = ; ...
/** * 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 = 1e5 + 5; int n, m, t; vector<int> e[maxn]; vector<int> ans; stack<int> s; bool vis[maxn]; int dep[maxn]; int N; bool v[maxn]; int dfs(int x, int fr) { vis[x] = true; s.push(x); for (auto y : e[x]) { if (y == fr) conti...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int n, a[100000]; long long cost, mn; int main() { cin >> n; for (int i = 0; i < n; ++i) scanf( %d , a + i); sort(a, a + n); for (int i = 0; i < n; ++i) mn += a[i] - 1; if (n > 40) return cout << mn, 0; for (int i = 2; i <= 1e5; ++i) { ...
#include <bits/stdc++.h> using namespace std; int n, Mod, p[100010], a[200010], nxt[200010], w[200010], tot, root, size[100010], son[100010], cnt; bool vis[100010]; long long ans, mul[100010]; struct record { int dep, step; record(int D = 0, int S = 0) { dep = D; step = S; } } ...
#include <bits/stdc++.h> const long long inf = 1e18; using namespace std; int n; long long x[100005]; long long lb, ub, mid; long long sum, S; long long cnt[3]; int main(void) { cin >> n; for (int i = 1; i <= n; i++) cin >> x[i]; lb = inf, ub = -inf; for (int i = 1; i <= n; 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 law...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.4 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
// // TV80 8-Bit Microprocessor Core // Based on the VHDL T80 core by Daniel Wallner () // // Copyright (c) 2004 Guy Hutchison () // // 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 witho...
/* * 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() { int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; string temp = s; sort(s.begin(), s.end()); int count = 0; for (int i = 0; i < s.size(); i++) if (s[i] != temp[i]) count++...
#include <bits/stdc++.h> using namespace std; int main() { int a[21], n; cin >> a[0] >> a[1] >> n; for (int i = 2; i <= n; i++) a[i] = a[i - 1] + a[i - 2]; cout << a[n]; return 0; }
// -*- Mode: Verilog -*- // Filename : gpio_bit.v // Description : A single GPIO bit // Author : Philip Tracton // Created On : Sat May 23 23:15:07 2015 // Last Modified By: Philip Tracton // Last Modified On: Sat May 23 23:15:07 2015 // Update Count : 0 // Statu...
`include "adder_subtractor.v" `include "flag.v" `include "mux2_1.sv" `include "adder16b.v" `include "adder4b.v" `include "fullAdder1b.v" `include "lookAhead4b.v" `include "subtract.v" `include "setLT.v" module setLTtest (); // localize variables wire [31:0] busADD; wire [31:0] busA, busB; // declare an instance o...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n + 1, 0); vector<vector<int> > g(n + 1); int i, j, k; for (i = 1; i <= n; i++) { cin >> j >> k; v[i] = k; if (j != -1) { g[j].push_back(i); } } vector<int> ans; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:15:51 10/19/2015 // Design Name: // Module Name: UART_TestModule // Project Name: // Target Devices: // Tool versions: // Description: // //...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:20000000 ) using namespace std; int ri() { int x; scanf( %d , &x); return x; } long long rll() { long long x; scanf( %lld , &x); return x; } int mas[200500]; int tmas[200500]; int d1[100500]; int d2[100500]; int cnt[2...
#include <bits/stdc++.h> std::string colors( RGBYW ); struct Card { int color; int number; bool operator<(const Card& rhs) const { if (color == rhs.color) return (number < rhs.number); else return color < rhs.color; } }; int mapColor(char color) { size_t pos = col...
#include <bits/stdc++.h> using namespace std; long long n, u, r; long long a[40], b[40], k[40], p[40]; long long maxx = (long long)1 << 63; long long eval() { long long val = 0; for (int i = 0; i < n; i++) { val += a[i] * k[i]; } return val; } void gen(int now, int last) { if (no...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; long long arr[36] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64...
#include <bits/stdc++.h> using namespace std; const int INF = 1000 * 1000 * 1000; const double PI = acos(-1.0); const int MAX = 150005; int n, len, h; pair<int, int> a[MAX]; int b[MAX]; pair<int, int> T[MAX * 8]; int lazy[MAX * 8]; bool pzdc[MAX]; void push(int v) { T[v].first += lazy[v]; ...
#include <bits/stdc++.h> using namespace std; const int prime[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}; int main() { int n; cin >> n; vector<int> res; int limit = 2 * n * n; for (int i = 0; i < 15; i++) { res.clear(); res.push_back(1); for (int j = 0; j ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2012 by Iztok Jeras. module t (/*AUTOARG*/ // Inputs clk ); input clk; // parameters for array sizes localparam WA = 4; localparam WB = 6; localparam WC = 8;...
#include <bits/stdc++.h> using namespace std; int n; pair<int, int> a[2][100010]; bool used[100010]; int fat[100010]; int main() { int i, j, c, v; scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d %d , &c, &v); a[c][++a[c][0].first] = make_pair(v, i); } sort(a[0] + 1, a[0...
`timescale 1ns / 1ps //this code was generated by cReComp module sensor_ctl( input clk, input rst_32, input [31:0] din_32, input [0:0] wr_en_32, input [0:0] rd_en_32, output [31:0] dout_32, output [0:0] full_32, output [0:0] empty_32, inout [0:0] sig, output [3:0] led ); // //copy this instance to top module //sensor...
#include <bits/stdc++.h> using namespace std; const int P = 10, N = 1e5 + 10; inline int inverse(int a, int m) { if (a <= 1) return a; int ans = (1 - (long long int)inverse(m % a, a) * m) / a; return ans + m; } int fact[N], ifact[N], pot[N][P]; int sz, p[P]; inline void primes(int n) { for...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 1000005; long long f[5010][5]; int _prev[5010][5], n; int a[MAXN]; long long sum[MAXN]; int main() { scanf( %d , &n); for (int i = (1); i < (n + 1); i++) scanf( %d , a + i); for (int i = (1); i < (n + ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17 + 7; const long long maxn = 5e5 + 700; const int mod = 998244353; const int up = 1e9; template <typename T> inline void read(T &a) { char c = getchar(); T x = 0, f = 1; while (!isdigit(c)) { if (c == - ) f = -1; ...
#include <bits/stdc++.h> using namespace std; long long check(long long x) { long long i = 0, ans = 0; while (x > 0) { if ((x & (1)) == 1) { ans = max(ans, i); } x = x >> 1; i++; } return ans; } void solve() { long long n; cin >> n; long long a[n + 1];...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (n > m) swap(n, m); switch (n) { case 1: cout << m / 6 * 6 + 2 * max(m % 6 - 3, 0); break; case 2: switch (m) { case 2: cout << 0; break; ...
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018 // Date : Mon Sep 16 04:58:12 2019 // Host : varun-laptop running 64-bit Service Pac...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long INFLL = 1e18 + 1; const int MAX = 100001; const long long MOD = 1000000007; const int SZ = 300100; const double PI = 3.14159265358979323846264338327; long long inq(long long k, long long q, long long mod) { if (q == 0...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, sum = 0, q; vector<int> v; vector<int>::iterator it; scanf( %d , &n); while (n--) { scanf( %d , &x); sum += x; v.push_back(sum); } int sz = v.size(); scanf( %d , &q); while (q--) { scanf(...
#include <bits/stdc++.h> using namespace std; void c_p_c() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:43:14 03/25/2015 // Design Name: fifo_top // Module Name: S:/Xilinx/assignment5/fifo_top_tb.v // Project Name: assignment5 // Target Device: // Tool versions: ...
// file: design_1_clk_wiz_0_0.v // // (c) Copyright 2008 - 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 disclaime...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:57:12 11/07/2014 // Design Name: // Module Name: top // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencie...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int MAX = 2e5 + 5; long long dis[MAX]; int a[MAX], ans[MAX]; int pos[MAX]; vector<pair<int, int> > adj[MAX]; void dfs(int x, int idx, long long d) { pos[idx] = x; dis[idx] = d; int len = lower_bound(dis, dis + idx +...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { string s; cin >> s; int l[3005], r[3005]; memset(l, -1, sizeof(l)); memset(r, -1, sizeof(r)); int cnt = 0, t1 = 0, t2 = 0; for (int i = 0; i < n; ++i) { if (s[i] == L ) { ...
#include <bits/stdc++.h> using namespace std; const int num = 200001; long long a[401]; int main() { int t, n; cin >> t; int str, cur; int fl = 0; while (t--) { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) a[n + i] = a[i]; cur = 2 * n...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_b_e // // Generated // by: wig // on: Mon Oct 23 16:54:16 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver2006.xls // // !!! Do not edit this file! Autogenerated by MIX ...
module test; reg a, b1, b2; submod m1 (a, b1, c1); submod m2 (a, b2, c2); task set; input [2:0] bits; reg t1; begin t1 <= a; #1 {a,b1,b2} <= bits; end endtask initial begin $dumpfile("work/vcd-dup.vcd"); $dumpvars(2, test); // test, test.m1, test.m2 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a1, t1, a2, t2, n1 = 0, n2 = 0; cin >> n >> a1 >> a2 >> t1 >> t2; n1 += t1 * 2; n2 += t2 * 2; n1 += a1 * n; n2 += a2 * n; if (n1 > n2) cout << Second ; if (n2 > n1) cout << First ; if (n1 == n2) cout << Friendsh...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:31:27 03/28/2014 // Design Name: // Module Name: sccpu_cpu // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...