text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f, oo = inf; inline long long read() { register long long x = 0, f = 1; register char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (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; const int inft = 1000000009; const int MAXN = 1000006; const int T = 1024 * 1024; int drz[2][2 * T]; vector<int> X; pair<int, int> Q[MAXN]; char C[MAXN]; bool used[MAXN]; int ask(int a, int nr) { int ans = -1; a += T; while (a) { ans = ...
#include <bits/stdc++.h> using namespace std; double ans = 0.0F; int n, d, m[101] = {0}, r[101] = {0}; int tmp = 0; int main(int argc, char** argv, char** env) { cin >> n; for (int i = 1; i <= n; ++i) { cin >> m[i]; } for (int i = 1; i <= n; ++i) { cin >> r[i]; } for (int i...
#include <bits/stdc++.h> using namespace std; const int M = 1000000007; int n, f[405][405]; int main() { scanf( %d , &n); f[1][0] = f[1][1] = 1; for (int i = 2; i <= n; i++) { for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) { int t = 1ll * f[i - 1][j] * f[i - 1][k] ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char s[1007][1007]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> s[i][j]; } } if (n < 3) { cout << 0 ; } else { int res = 0; for (int i = 1; i <= n; ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 7; const string alpha = abcdefghijklmnopqrstuvwxyz ; long long power(long long x, long long y) { long long res = 1; x = x; while (y > 0) { if (y & 1) res = (res * x); y = y >> 1; x = (x * x); } return ...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module fei4_rx #( parameter BASEADDR = 32'h0000,...
`define WIDTH_P 8 // unused for now... `define NUM_ADGS_P 1 `include "bsg_tag.vh" module test_bsg; import bsg_tag_pkg::bsg_tag_s; localparam bsg_num_adgs_lp = `NUM_ADGS_P; localparam bsg_ds_width_lp = `WIDTH_P; localparam bsg_tag_els_lp = 2; `declare_bsg_clk_gen_osc_tag_payload_s(bsg_num_adgs_l...
#include <bits/stdc++.h> using namespace std; const int N = 111111; const int INF = 1000000000, mod = 1000000007; const long long LLINF = 1000000000000000000ll; long long n, k, d1, d2; bool try_solve(long long d1, long long d2) { if (n % 3) return 0; if ((k - d1 + d2) % 3) return 0; long long x2...
/** * 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...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> long long int oddsum[100020], evensum[100020]; int main() { memset(oddsum, 0, sizeof(oddsum)); memset(evensum, 0, sizeof(evensum)); int n, i; long long int x, ans = 0, sum; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %lld , &x); if (i & 1) o...
/** * 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 NAME : ex_stage.v -- DESCRIPTION : EX¥¹¥Æ©`¥¸ -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito ÐÂҎ×÷³É -- =============...
/** * 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; double f(double m, vector<int> &v) { int n = v.size(); vector<long double> v2(n); for (int i = 0; i < (n); i++) v2[i] = v[i] - m; long double mx_otr = 0; long double mn_otr = 0; long double cur = 0; for (int i = 0; i < (n); i++) { cur +...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 50; vector<int> g[maxn]; int n, k; int ans = 0; int dfs(int u, int p) { if (g[u].size() == 1) return 0; vector<int> vt; for (auto it : g[u]) { if (it != p) { vt.push_back(dfs(it, u) + 1); } } sort(vt...
#include <bits/stdc++.h> using namespace std; long long w, m, k; long long comp; long long getpre(long long a) { long long tmp = 1, ct = 0; while (a >= tmp) tmp *= 10, ++ct; tmp /= 10; long long t = 1; long long ans = 0; for (long long i = 1; i < ct; ++i) ans += i * 9 * t, t *= 10; a...
module CONTROLLER( input clock, input [15:0] In, input Zero, output reg [3:0] alu_cmd, output reg rf_write_back_en, output reg write_back_result_mux, output reg mem_write_en, output reg rf_write_dest_mux, output reg add_2_mux, output r...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string a; cin >> a; int ans = 0; vector<int> vc; for (size_t i = 0; i < a.size(); i++) { if (a[i] == w && a[i - 1] == t && a[i + 1] == o && a[i + 2] == o &&...
//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; vector<string> numbers; unsigned n = 2; unsigned k = 5; int taken[100]; void print(unsigned i) { unsigned l; string str = ; for (l = 0; l <= i - 1; l++) str += (taken[l] + 1) + 0 ; numbers.push_back(str); } void variate(unsigned i) { u...
// *************************************************************************** // *************************************************************************** // Copyright 2013 (c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // ar...
#include <bits/stdc++.h> const long long md = 1e9 + 7; const int Inf = 1e9; const long long Inf64 = 1e18; const long long MaxN = 1e6 + 100; const long double eps = 1e-15; using namespace std; long long Tree[4 * MaxN]; long long getSum(long long l, long long r, long long x, long long y, ...
#include <bits/stdc++.h> using namespace std; struct trip { int l; int len; int t; int id; }; const int INF = 1e9; int main() { int n, p; scanf( %d%d , &n, &p); vector<trip> trips(n); for (int i = 0; i < n; i++) { scanf( %d%d%d , &trips[i].l, &trips[i].len, &trips[i].t); ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; long long int n, a, cnt = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a; v.push_back(a); } for (int i = 1; i < n - 1; i++) { if (v[i] < v[i - 1] && v[i] < v[i + 1]) cnt++; else if ...
/* * 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...
// 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, fastclk ); input clk /*verilator sc_clock*/; input fastclk /*verilator sc_clock*/; reg reset_l; in...
#include <bits/stdc++.h> using namespace std; struct treenode { long long a, b, c; treenode(long long a, long long b, long long c) : a(a), b(b), c(c) {} }; int n, mm, s[111111], m[111111], r[111111], zero[111111], *add; vector<treenode> tree1[4 * 111111], tree2[4 * 111111], *tree; set<pair<int, int>...
//====================================================================== // // mulacc2.v // --------- // Another experimental implementation. This time with a simple // multiply-accumulate kernel. This kernel would be instantiated. // and used iteratively in a Poly1305 core. // Note that there are hold registers for th...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; class FKuroniAndThePunishment { public: vector<long long> primes; void pre(int n) { vector<bool...
`define AND 0000 `define OR 4'b0001 `define ADD 4'b0010 `define SUB 4'b0110 `define SLT 4'b0111 `define NOR 4'b1100 `define AND_FUNCT 6'b100100 `define OR_FUNCT 6'b100101 `define ADD_FUNCT 6'b100000 `define SUB_FUNCT 6'b100010 `define SLT_FUNCT 6'b101010 `define NOR_FUNCT 6'b100111 `define SLL_FUNCT 6'b000000 `define...
////////////////////////////////////////////////////////////////////////////////// // Company: RMIT University // Engineer: Matthew Myungha Kim // , // // Create Date: 17:37:00 18/03/2014 // Design Name: stimulus_gen // Module Name: stimulus_gen // Project Name: Streaming Media on Null Convention Logic // ...
#include <bits/stdc++.h> using namespace std; int n, p; long long u, v, w, res; map<long long, long long> a; void cal(long long u, long long v, long long w) { res = 0; while (u != v) { if (u < v) swap(u, v); a[u] += w; if (w == 0) res += a[u]; u >>= 1; } } int main() { ...
#include <bits/stdc++.h> const double EPS = 1e-7; const double PI = 3.1415926535897932384626; const int MAXN = 100001; int n, a[MAXN]; int main() { std::cin >> n; for (int i = 1; i <= n; i++) { std::cin >> a[i]; } long long answer = 0; for (int i = 1; i <= n; i++) { answer += a...
/* * 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...
//----------------------------------------------------------------------------- //-- Baudrate generator //-- It generates a square signal, with a frequency for communicating at the given //-- given baudrate //-- The output is set to 1 only during one clock cycle. The rest of the time is 0 //----------------------------...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, maxi, mini; cin >> n; int z[n], o = 0; for (i = 0; i < n; i++) { cin >> z[i]; if (i == 0) { maxi = z[i]; mini = z[i]; } if (i > 0) { if (z[i] > maxi) { o++; maxi =...
module full_adder(input a, input b, input in_carry, output sum, output carry); wire sum0; wire carry0; wire carry1; xor (sum0, a, b); and (carry0, a, b); xor (sum, sum0, in_carry); and (carry1, sum0, in_carry); ...
#include <bits/stdc++.h> int main() { int m, s, c, i; std::cin >> m >> s; c = s; if (m == 1 && c == 0) std::cout << 0 << << 0; else { if (c == 0 || c > (9 * m)) { std::cout << -1 << << -1; } else { for (i = m; i > 0; i--) { if (c <= 9 * (i - 1)) ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:56:56 09/28/2014 // Design Name: // Module Name: fifo // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09.10.2016 17:20:34 // Design Name: // Module Name: fifo_testbench // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // /...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); string s1 = hello ; int n1 = s1.size(); int i = 0, j = 0; int count = 0; while (j < n1 && i < n) { if (s1[j] == s[i]) { j++; count++; } i++; } i...
module top( input PACKAGEPIN, output [1:0] PLLOUTCORE, output [1:0] PLLOUTGLOBAL, input EXTFEEDBACK, input [7:0] DYNAMICDELAY, output LOCK, input BYPASS, input RESETB, input LATCHINPUTVALUE, //Test Pins output SDO, input SDI, input SCLK ); SB_PLL40_2F_PAD #( .FEEDBACK_PATH("DELAY"),...
#include <bits/stdc++.h> using namespace std; inline int max2(int a, int b) { return ((a > b) ? a : b); } inline int min2(int a, int b) { return a < b ? a : b; } inline int max3(int a, int b, int c) { return max2(a, max2(b, c)); } long long int gcd(long long int a, long long int b) { while (b) { lon...
#include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<bitset> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; typedef long long LL; typedef double DB; const int N = 222222; ...
#include <bits/stdc++.h> using namespace std; long long int __gcd(long long int a, long long int b) { return (a % b) ? __gcd(b, a % b) : b; } bool prime(long long int k) { for (long long int i = 2; i * i <= k; i++) if (k % i == 0) { return false; } return true; } void pdash(i...
#include <bits/stdc++.h> const int MAX_N = 1e5 + 5; int n, m; char str[MAX_N], nxt[256]; bool chk[256], vis[256], not_root[256], flag; std::vector<char> ans; void dfs(char c) { if (!vis[c]) { vis[c] = true; ans.push_back(c); if (nxt[c]) dfs(nxt[c]); } else flag = true; } ...
module erx (/*AUTOARG*/ // Outputs rxo_wr_wait_p, rxo_wr_wait_n, rxo_rd_wait_p, rxo_rd_wait_n, rxwr_access, rxwr_packet, rxrd_access, rxrd_packet, rxrr_access, rxrr_packet, erx_cfg_wait, rx_lclk_div4, erx_reset, timeout, mailbox_full, mailbox_not_empty, // Inputs soft_reset, sys_reset, sys_clk, tx_...
#include <bits/stdc++.h> using namespace std; int n, m, x; vector<pair<int, int> > leti[26]; vector<pair<int, int> > shift; vector<int> dis[26]; int main() { cin >> n >> m >> x; int d = x * x; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { char t; cin >> t; ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &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; ...
#include <bits/stdc++.h> using namespace std; inline int IN() { int x = 0, ch = getchar(), f = 1; while (!isdigit(ch) && (ch != - ) && (ch != EOF)) ch = getchar(); if (ch == - ) { f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + ch - 0 ; ch = g...
#include <bits/stdc++.h> using namespace std; const int maxn = 500; const int maxm = 500000 + 10; struct Edge { int next, v; Edge() {} Edge(int next, int v) : next(next), v(v) {} } e[maxm << 1]; int n, m, timer, num, len; int head[maxm], cnt; int dfn[maxn], low[maxn], belo[maxn]; bool inst...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; int x1, x2, y1, y2; cin >> n >> m >> k; map<int, vector<pair<int, int> > > cols; map<int, vector<pair<int, int> > > rows; map<int, int> sc; map<int, int> sr; for (int i = 0; i < k; i++) { cin >> x1 >> y1 >>...
module top; localparam string = "ab"; localparam rg_res = string & 9'h1ff; reg passed; integer fd, res; reg [8:0] rg; reg [7:0] mem [31:0]; initial begin passed = 1'b1; fd = $fopen("ivltests/fread.txt", "r"); res = $fread(rg, 0); // Try to read from an invalid fd. if (res != 0) begin ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long maxn = 1e5 + 5; void solve() { long long k; cin >> k; long long first = pow(2, 17); cout << 2 << << 3 << n ; cout << first + k << << first << << 0 << n << k << << first ...
//***************************************************************************** // (c) Copyright 2008-2009 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 // ...
/* ######################################################################## EPIPHANY eLink TX Protocol block ######################################################################## This block takes standard eMesh protocol (104-bit transactions) and encodes the bytes into 8-byte parallel outputs for the output ...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; ; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); int current = 1; for (int i = 0; i < n; i++) { if (a[i] < cu...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int inf = 0x3f3f3f, maxn = 5e5 + 500; long long gcd(long long x, long long y) { if (y == 0) return x; else return gcd(y, x % y); } long long ksm(long long a, long long b) { long long r = 1; while (b) { ...
/************************************************/ /* sseg_decode */ /* 2011, */ /* */ /* decodes 8-bit number to hexadecimal display */ /************************************************/ // bits // 0 // ___ // ...
#include <bits/stdc++.h> using namespace std; const long long OO = (long long)5e3 + 555; void ndr() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); } int divi(long long N) { int cnt(0); for (long long i = 1; i <= sqrt(N); i++) { if (N % i == 0) { if (N / i == i) cnt++; ...
#include <bits/stdc++.h> using namespace std; long long int INF = 9223372036854775807; const long long int mod = 1000000007; long long int MOD(long long int a, long long int b) { if (a > b) return a - b; else return b - a; } long long int max3(long long int a, long long int b, long long ...
#include<bits/stdc++.h> using namespace std; #define fo(a,b,c) for(int a=b;a<=c;++a) #define fr(a,b,c) for(int a=b;a>=c;--a) #define ll long long #define pq priority_queue int t,n,a[30010]; int cnt[3]; bool check() { if(cnt[1]==cnt[2]&&cnt[1]==cnt[0]) return false; return true; } int ma...
/** * 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; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long N = 2e5 + 100; const long long INF = 1e18; long long x[N], p[N], a[N]; struct node { long long ans = 0, pref = 0, suff = 0, sum = 0; node() {} node(long long x) { ...
// // Copyright 2015 Ettus Research // module noc_block_ex1layer #( parameter NOC_ID = 64'hABCD000101A7E200, parameter STR_SINK_FIFOSIZE = 11) ( input bus_clk, input bus_rst, input ce_clk, input ce_rst, input [63:0] i_tdata, input i_tlast, input i_tvalid, output i_tready, output [63:0] o_tdata, output o_...
#include <bits/stdc++.h> using namespace std; int A[1000010]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for (int i = 0; i < n; i++) cin >> A[i]; string s; cin >> s; int la = -1e9, ha = 1e9, lb = -1e9, hb = 1e9; multiset<int> fg; for (int i = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d %d , &n, &m); vector<int> att, def, my(m); for (int i = 0; i < n; i++) { char a, b, c; int s; scanf( %c%c%c %d , &a, &b, &c, &s); if (a == A ) att.push_back(s); else def.pus...
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
#include <bits/stdc++.h> using namespace std; static const int len = 1000010; struct event { int t, x, y, tip, num; event() {} event(int _t, int _x, int _y, int _tip, int _num) : t(_t), x(_x), y(_y), tip(_tip), num(_num) {} }; bool compar(event one, event two) { return ((one.x < two.x)...
#include <bits/stdc++.h> using namespace std; int d8x[8] = {1, -1, 0, 0, 1, 1, -1, -1}; int d8y[8] = {0, 0, 1, -1, 1, -1, 1, -1}; const int M = 1e9 + 7; const int N = 1e3, Nx = 500; int a[N + 1], c[N + 1]; bool isPrime[N + 1]; void sieve(int x) { for (int i = 0; i <= x; i++) isPrime[i] = true; i...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n, m, t; vector<int> e[maxn]; int ecnt[maxn]; queue<int> q; bool vis[maxn]; int dep[maxn]; int ec[maxn]; bool flag; int f[maxn]; int g[maxn]; int cnt[maxn]; int read() { int x; scanf( %d , &x); return x; ...
/* * 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 (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference // which...
#include <bits/stdc++.h> const int MOD = (int)1e9 + 7; using namespace std; stack<long long> st; int main() { long long n, num; cin >> n; long long sum = 0; int over = 0; st.push(1); for (int i = 1; i <= n; i++) { string s; cin >> s; if (over == 1) continue; if (s...
#include <bits/stdc++.h> using namespace std; int main() { int x, a, b, i, j, k, siz, cnt = 0, p, q, s, t, z, h, po; string str; cin >> str; cin >> x; siz = str.size(); for (i = 0; i < siz; i++) { if (str[i] != * && str[i] != ? ) cnt++; } p = siz - cnt; q = cnt - p; ...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); ...
// synthesis VERILOG_INPUT_VERSION SYSTEMVERILOG_2005 // // This file is part of multiexp-a5gx. // // multiexp-a5gx 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 ...
`include "timescale.v" module orpsoc_tb; vlog_tb_utils vlog_tb_utils0(); //////////////////////////////////////////////////////////////////////// // // JTAG VPI interface // //////////////////////////////////////////////////////////////////////// wire tms; wire tck; wire tdi; ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:2000000 ) #pragma comment(linker, /HEAP:2000000 ) using namespace std; void print_width(long long x) { std::cout << std::fixed; std::cout << std::setprecision(x); } long long power(long long x, long long y, long long p = 1000000007) { lon...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(1919810); int T, n, K, zr; inline char qry(int la, int ra, int lb, int rb) { cout << ? << ra - la + 1 << << rb - lb + 1 << endl; for (int i = la; i <= ra; i++) cout << i << (i == ra ? n : ); for (int i = lb; i <= rb; i++) cout <<...
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=1 clk0_duty_cycle=50 clk0_multiply_by=2 clk0_phase_shift="0" clk1_divide_by=5 clk1_duty_cycle=50 clk1_multiply_by=2 clk1_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone III" inclk0_input_frequency=20000 intended_device_fa...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> p(n); for (auto& i : p) cin >> i; vector<long long> dp(n, 1); vector<int> exist(n, false); for (long long i = 0; i < (n); ++i) { exist[p[i] - 1] = true; if (p[i] != 1) ...
#include <bits/stdc++.h> using namespace std; int ans[2010][2], n; bool vis[510][510]; bool query(int x1, int y1, int x2, int y2) { printf( ? %d %d %d %d n , x1, y1, x2, y2); fflush(stdout); char ch[5]; scanf( %s , ch); if (ch[0] == Y ) return 1; else return 0; } void ou...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i,n) for(int i=0;i<n;i++) #define endl ( n ) #define pb push_back #define mp make_pair #define pl pair<ll, ll> #define vl vector<ll> #define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL); #define M 1000000007 ...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long x) { cout << x; } void __print(unsigned long long x) { cout << x; } void __prin...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); ; long long x, y; cin >> x >> y; long long n; cin >> n; long long ans; switch (n % 6) { case 1: ans = x; break; case 2: ...
#include <bits/stdc++.h> const int MAXN = 300011; int N; struct Pair { int Val; long long Mask; } P[MAXN]; long long Sum; int main() { scanf( %d , &N); for (int i = 1; i <= N; ++i) { scanf( %d%I64d , &P[i].Val, &P[i].Mask); Sum += P[i].Val; } if (Sum < 0LL) { for (i...
/* ORSoC GFX accelerator core Copyright 2012, ORSoC, Per Lenander, Anton Fosselius. PER-PIXEL COLORING MODULE This file is part of orgfx. orgfx is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; int ans = 1e9; for (long long i = 0; i < n; i++) { int j = max(n - i - 1, i); int k; if (i - j < 0) k = min(a[n - 1], a[i]); el...
#include <bits/stdc++.h> using namespace std; const int maxm = 6e5 + 5; int l[maxm], r[maxm]; int c[maxm]; int pos[maxm]; int n, m; int max(int a, int b) { if (a > b) return a; else return b; } int lowbit(int i) { return i & -i; } void add(int i, int t) { while (i < maxm) { ...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1, c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f ^= 1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return f ? x : -x; } int tar; int val[26]; int tp[26]; int ans; char c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); string s1, s2; cin >> s1 >> s2; if (s1.size() > s2.size()) cout << s1.size(); else if (s2.size() > s1.size()) cout << s2.size(); else if (s1 == s2) ...
/** * 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 N = 1e5 + 5; const int K = 12; int n, k, q; int arr[K][N]; int who[N][K]; int nrr[N * K][K]; int siz; vector<int> lol[N]; int when[1 << K]; int parent[N * K]; bitset<1 << K> bit[N + K]; int idx[N * K]; int main() { scanf( %d %d %d ,...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, q, a[N], s1[N], t1, s2[N], t2; vector<int> ans1[N], ans2[N]; bool tag[N]; inline void down(int &x, const int y) { x > y ? x = y : 0; } int main() { scanf( %d%d , &n, &q); for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); ...
#include <bits/stdc++.h> using namespace std; clock_t start; void Time(bool timeIt) { if (!timeIt) return; clock_t end = clock(); double elapsed_time = ((long double)end - (long double)start) / (long double)CLOCKS_PER_SEC; fprintf(stderr, Time elapsed = %0.4lf n , elapsed_time); } con...