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 la...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); long long t; cin >> t; while (t--) { long long n; cin >> n; string a; cin >> a; string last = a; for (long long i = 0; i <= n; ++i) { ...
module duram( data_a, data_b, wren_a, wren_b, address_a, address_b, clock_a, clock_b, q_a, q_b); parameter DATA_WIDTH = 36; parameter ADDR_WIDTH = 9; parameter BLK_RAM_TYPE = "AUTO"; parameter ADDR_DEPTH = 2**ADDR_WIDTH; input [DATA_WIDTH -1:0] data_a; input wren_a; input [A...
// Library - static, Cell - th44w322, View - schematic // LAST TIME SAVED: May 23 18:01:00 2014 // NETLIST TIME: May 23 18:01:20 2014 `timescale 1ns / 1ns module th44w322 ( y, a, b, c, d ); output y; input a, b, c, d; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "th44w322"; s...
////////////////////////////////////////////////////////////////////// //// //// //// Copyright (C) 2014 //// //// //// //// This source file may be used and distributed witho...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, i, j = 1, j2 = 0, j3, k, h = 1; string s; cin >> s; for (i = 1; i < s.length(); ++i) { if (j < h) j = h; if (h == s.length()) break; if (s[i - 1] != ...
#include <bits/stdc++.h> using namespace std; const int INF = 2e9 + 1; const long long INFLL = 1e18 + 1; struct Graph { struct edge { int c, f, link, to, ind; int c2 = 0; edge() {} edge(int c, int f, int link, int to, int ind) : c(c), f(f), link(link), to(to), ind(ind) {} ...
#include <bits/stdc++.h> int main(void) { int x1, y1, x2, y2, temp; int n; int x[1001], y[1001], r[1001]; int i, j; int people, blanket = 0; scanf( %d%d%d%d%d , &x1, &y1, &x2, &y2, &n); for (i = 0; i < n; i++) { scanf( %d%d%d , &x[i], &y[i], &r[i]); r[i] = r[i] * r[i]; } ...
/* -------------------------------------------------------------------------- Pegasus - Copyright (C) 2012 Gregory Matthew James. This file is part of Pegasus. Pegasus is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software ...
`timescale 1ns / 1ns ////////////////////////////////////////////////////////////////////////////////// // Company: franp.com // Engineer: Fran Pregernik <> // // Create Date: 12/30/2016 11:00:20 AM // Design Name: // Module Name: azimuth_signal_generator_sim // Project Name: // Target Devices: // Tool Versions: /...
// megafunction wizard: %CRC Compiler v11.0% // GENERATION: XML // ============================================================ // Megafunction Name(s): // check_ip_altcrc // ============================================================ // Generated by CRC Compiler 11.0 [Altera, IP Toolbench 1.3.0 Build 157] ...
/* * 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[100010], new_arr[100010], new_arr1[100010], arr[100010]; int x = 1000000; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { new_arr[i] = min((i + 1), (n - i)); new_arr1[i] = a...
#include <bits/stdc++.h> using namespace std; long long q, t; bool f(long long x) { for (long long i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } int main() { ios::sync_with_stdio(false); cin >> q; while (q--) { long long ans = 0; cin >> t; { ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; long long binPow(long long a, long long b) { long long x = 1, y = a; while (b) { if (b & 1) x = (x * y) % mod; y = (y * y) % mod; b >>= 1; } return x % mod; } long long inverserEuler(int n) { return binPow...
//----------------------------------------------------------------------------- // For reading TI tags, we need to place the FPGA in pass through mode // and pass everything through to the ARM //----------------------------------------------------------------------------- module lo_passthru( pck0, ck_1356meg...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:23:42 09/12/2015 // Design Name: Seven_seg // Module Name: Z:/share/ISE/CPUFly/tests/Seven_seg_test.v // Project Name: CPUFly // Target Device: // To...
`timescale 1ns / 1ps //__________________________________________________uart_tx `define RDY 2'b11 `define LOAD_BIT 2'b01 `define SEND_BIT 2'b00 `define STOP 2'b10 //__________Test Bench `define BIT_TMR_MAX 10'd869 // test bench <-- 115200 : tb #1738 //`define BIT_TMR_MAX 4'd10417//14'b101000101...
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { int k, n; cin >> n >> k; int val[100000]; int awake[100000]; for (int i = 0; i < n; ++i) { cin >> val[i]; } int sum = 0; int extra = 0; int max = 0; for (int i = 0; i < n; ++i) { cin ...
// megafunction wizard: %LPM_ABS% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_abs // ============================================================ // File Name: ABS.v // Megafunction Name(s): // lpm_abs // // Simulation Library Files(s): // lpm // ========================================...
// (C) 2001-2015 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
/** * 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 dp[55][2]; int main() { long long X, Y; scanf( %lld %lld , &Y, &X); dp[51][0] = 1; for (int i = 50; i >= 0; i--) { for (int flag = 0; flag <= 1; flag++) { bool x = (X >> i) & 1, y = (Y >> i) & 1; if (x) dp[i][f...
module TopLevel(clk, key_in, switch_in, switch_second, type_in, s_out, LCD_ON, LCD_BLON, LCD_EN, LCD_RW, LCD_RS, LCD_DATA ); input [3:0] key_in; input clk;// 50Mhz clock signal input switch_in; // switch of settime of countdowner input [15:0] switch_second;...
#include <bits/stdc++.h> using namespace std; long long last = -1; void dfs(long long s, vector<vector<pair<long long, long long>>> grf, vector<long long> &vis, long long &cost) { vis[s] = 1; last = s; for (auto x : grf[s]) { long long v = x.first, d = x.second; if (vis[v] == 0)...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9; struct node { int i, j, bal; char scoba; node() {} node(long long _i, long long _j, long long _k, char _scoba) : i(_i), j(_j), bal(_k), scoba(_scoba) {} }; node p[210][210][410]; int main() { ios_base::sync_...
module fx2_test( FX2_CLK, FX2_WU2, FX2_FIFOADR, FX2_FD, FX2_flags, FX2_PKTEND, FX2_SLOE, FX2_SLWR, FX2_SLRD, LED, Push_button, LASER0_EN, LASER1_EN, LASER2_EN, LASER3_EN ); input FX2_CLK; input [2:0] FX2_flags; input Push_button; output FX2_WU2; output [1:0] FX2_FIFOADR; outp...
#include <bits/stdc++.h> using namespace std; const int MAXN = 300000; int n, m, q, p[MAXN + 3], rk[MAXN + 3], dia[MAXN + 3], type, x, y, dist[MAXN + 3]; bool flag[MAXN + 3]; vector<int> adj[MAXN + 3]; int ceil(int n) { if (!n) return 0; return (n - 1) / 2 + 1; } int find(int x) { return (...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> const int N = 29; const int K = 10; const int MOD = 1e9 + 7; int n, m, k; int g[N][N]; int s[N][N][K]; int state[N][N]; int f[N]; bool ch[N]; int fac[N]; int inv[N]; int ans; inline void init() { scanf( %d%d%d , &n, &m, &k); if (n + m - 1 > k) { puts( 0 )...
#include <bits/stdc++.h> using namespace std; const float pi = acos(-1.0); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; t = 1; while (t--) { long long int n; cin >> n; cout << 0 << << 0 << << 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 la...
#include <bits/stdc++.h> using namespace std; typedef struct trie { char c; bool win, lose; struct trie *alphabet[26]; } trie; void addString(trie *T, char *s); trie *initTrie(char c); void dfs(trie *T); int main() { int i, n, k; char s[100005]; trie *T = initTrie( 0 ); scanf(...
(* *********************************************************************) (* *) (* The Compcert verified compiler *) (* *) (* Xavier Leroy...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (b != 0) { long long c = a % b; a = b; b = c; } return a; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } bool C() { long long n, k; cin >> n >> k; lo...
//---------------------------------------------------------------------------- // Copyright (C) 2009 , Olivier Girard // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must re...
#include <bits/stdc++.h> using namespace std; int arr[200005]; int ans[200005]; int n, m; bool vis[200005]; int s = 0, e = -1; int main() { scanf( %d %d , &n, &m); vector<pair<int, int> > q(m); for (int i = 0; i < n; ++i) scanf( %d , arr + i); for (int i = 0; i < m; ++i) scanf( %d %d , &q[...
#include <bits/stdc++.h> using namespace std; template <typename T> inline T abs(T t) { return t < 0 ? -t : t; } const long long modn = 1000000007; inline long long mod(long long x) { return x % modn; } const int MAXN = 312345; int n, m; vector<long long> s[4]; struct pd { long long x; 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...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; long long x[maxn], y[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long n; cin >> n; long long s = 0, sx = 0, sy = 0; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:10240000 ) using namespace std; const int MAXN = 100010; int a[MAXN], cnt[MAXN]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } memset(cnt, 0, sizeof(cnt)); int sta = 1, n...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string second, a = 1968 ; string rem[10]; cin >> second; int zero = 0; bool one = 0, six = 0, eight = 0, nine = 0; string alt = ; for (int i = 0; i < second.si...
/* Copyright (c) 2015-2016 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> using namespace std; int n, a[109], d; void nhap() { scanf( %d n , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); } void qs(int l, int r) { int x = a[(l + r) / 2]; int i = l; int j = r; while (i <= j) { while (a[i] < x) i++; while (a[j] > 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 la...
#include<bits/stdc++.h> typedef long long int ll; typedef long double ld; typedef std::vector<ll> vi; typedef std::vector<std::vector<ll> > vv; typedef std::vector<std::pair<ll,ll> > pii; #define mod 1000000007 #define IO ios_base::sync_with_stdio(false);cin.tie(NULL); #define fo(i,a,b) for(i=...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); long long n, w; cin >> n >> w; vector<long long> arr(n); for (long long i = 0; i < n; ++i) cin >> arr[i]; vector<long long> runsum(n); long long min_elem = arr[0]; long long ma...
#include <bits/stdc++.h> using namespace std; long long dp[2][100010]; long long MOD = 1000000007; int main() { string s1, s2; int k; while (cin >> s1 >> s2 >> k) { s1 = s1 + s1; int cntS = 0, cntD = 0; for (int i = 0; i < s2.size(); ++i) if (s1.substr(i, s2.size()) == s2) ...
//---------------------------------------------------------------------------- // 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> int main() { char s[105]; int i, n, j; scanf( %d , &n); getchar(); for (i = 0; i < n; i++) { scanf( %c , &s[i]); } for (i = 0; i < n; i++) { if (s[i] == o && s[i + 1] == g && s[i + 2] == o ) { printf( *** ); for (j = i + 3; j < n; j...
/** * 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> int n, i; char s[100005]; long long a[270], r; int main() { scanf( %s , s); n = strlen(s); for (i = 0; i < n; i++) a[s[i]]++; for (i = 0; i < 270; i++) r += a[i] * a[i]; printf( %I64d n , r); }
#include <bits/stdc++.h> using namespace std; const int N = 1001; const int M = 300000; int n, m, a[N], b[N]; vector<bool> g[M]; pair<int, int> p[N]; priority_queue<pair<int, int> > q; bool solve(int x) { if (x == 0) return true; for (int i = 1; i <= n; i++) b[i] = a[i] - x; int sum = 0; ...
#include <bits/stdc++.h> using namespace std; using lli = long long; using lld = long double; using ulli = unsigned long long int; using pll = pair<lli, lli>; using ttt = pair<lli, pll>; using vttt = vector<ttt>; using vll = vector<pll>; using vl = vector<lli>; using vi = vector<int>; using vvi = ...
/** * 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...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * adjusted to FML 8x16 by Zeus Gomez Marmolejo <> * * 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...
#include <bits/stdc++.h> using namespace std; string a, b; int nex[1000006], f1[1000006], f2[1000006]; long long xa[1000006], xb[1000006], mu[1000006]; const long long base = 1000000007; int main() { getline(cin, a); getline(cin, b); if (a.length() != b.length()) { cout << -1 -1 ; r...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( inline , fast-math , unroll-loops , no-stack-protector ) #pragma GCC target( popcnt,tune=native ) using namespace std; namespace io { const int SIZE = (1 << 21) + 1; char ibuf[SIZE], *iS, *iT, obuf[SIZE...
/** * 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...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 10, LOG = 23, MAX = 1e6 + 10, M = 1e9 + 7; long long n; long long mark[N], level[N], par[N][LOG + 10], arr[MAX], cnt[N], tavan[MAX]; vector<long long> g[N]; map<pair<long long, long long>, long long> mp; void DFS(long long v) { ma...
// (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; void solve() { int n, m; cin >> m >> n; map<int, vector<pair<int, int>>> matrix; vector<int> cnt(n, m), mag(m, n); int cnt2 = m; for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { int a; cin >> a; matrix[a]....
#include <bits/stdc++.h> using namespace std; const int N = 110000; int s1, s2; int n, a[N]; int mi[17][N * 2], ma[17][N * 2]; int BB[N * 2]; int getmi(int l, int r) { return min(mi[BB[r - l + 1]][l], mi[BB[r - l + 1]][r - (1 << BB[r - l + 1]) + 1]); } int getma(int l, int r) { ...
// // 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; void _fill_int(int* p, int val, int rep) { int i; for (i = 0; i < rep; i++) p[i] = val; } signed long long GETi() { signed long long i; scanf( %lld , &i); return i; } int N, A[100001]; void solve() { int f, i, j, k, l, x, y; cin >> ...
#include <bits/stdc++.h> #define maxn 10 using namespace std; int n, m; map<vector<int>, int> f, g; int a[maxn], b[maxn], c[maxn][maxn]; int main(){ scanf( %d%d , &n, &m); vector<int> v; for(int i = 1;i <= n;i++) scanf( %d , &a[i]); for(int i = 1;i <= m;i++) scanf( %d , &b[i]); for(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...
`default_nettype none `timescale 1ns / 1ps // Main board module. module s6atlys( // Global clock input wire CLK_100M, // onboard HDMI OUT //output wire HDMIOUTCLKP, //output wire HDMIOUTCLKN, //output wire HDMIOUTD0P, //output wire HDMIOUTD0N, //output wire ...
#include <bits/stdc++.h> using namespace std; int n; string col[1000]; int main() { cin >> n >> col[0]; for (int i = 1; i < 1000; ++i) col[i] = col[0]; for (int i = 0, a, b; i < n; ++i) { scanf( %d%d , &a, &b); char now = col[0][i]; for (int j = b; j < 1000; j += a) { now =...
#include <bits/stdc++.h> using namespace std; int c[100005], n, m; map<int, int> f; int lowbit(int x) { return x & (-x); } void add(int x, int j) { while (x < 100005) { c[x] += j; x += lowbit(x); } } int sum(int x) { int s = 0; while (x > 0) { s += c[x]; x -= lowbit...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool checkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool checkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const int MAXN = 2600 / 2; const int MAXM = 51; const int ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const char nl = n ; using vi = vector<int>; using vll = vector<ll>; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename... Args, template <typename...> typename T> strin...
// Copyright (c) 2000-2009 Bluespec, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, pub...
// // 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; void adskiy_razgon() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const int mxN = 1e+9 + 7; const long long INF = 1e+18 + 7; long long nod(long long a, long long b) { if (b > a) { swap(a, b); } while (b > 0) { a ...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5 + 5; const int INF = (int)1e9 + 9; const int MOD = (int)1e9 + 7; void go(int x) { cout << x; exit(0); } vector<int> g[N]; set<int> st[N]; int c[N]; bool used[N]; int main() { int n, m, cnt = -1, ans = -1; cin >> n...
// megafunction wizard: %In-System Sources and Probes%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsource_probe // ============================================================ // File Name: hps_reset.v // Megafunction Name(s): // altsource_probe // // Simulation Library Files(s): // ...
#include <bits/stdc++.h> using namespace std; char s[1111][1111]; int d[1111][1111]; queue<pair<int, int> > Q; vector<pair<int, int> > v; int n, m, lim; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; void check(int x, int y, int z) { if (x < 0 || x >= n || y < 0 || y >= m) return; if (s...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9 + 7; const int N = (int)1e5 + 10; struct qq { int l, r, i, w; }; int t[4 * N], ans[2 * N]; pair<int, int> p[2 * N]; vector<qq> qx[N], qy[N]; void upd(int pos, int val, int v = 1, int l = 1, int r = N - 10) { if (l == r) { ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: pcx_buf_pdr_even.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it ...
#include <bits/stdc++.h> using namespace std; struct node { int val; int type; } N[500000]; int main() { long long n, a, b, c, d, start, len; cin >> n >> a >> b >> c >> d >> start >> len; for (int i = 1; i <= n; i++) { cin >> N[i].val >> N[i].type; } long long s = 1, t = 1, sum...
#include <bits/stdc++.h> using namespace std; const long long p = 1e9 + 7; int n, a[2505], mx, s, ch, ans; long long f[100005]; long long ksm(long long x, int y) { long long sun = 1; x %= p; while (y) { if (y & 1) sun = sun * x % p; y >>= 1; x = x * x % p; } return sun; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; uint64_t getSeed() { auto ptr = new char; delete ptr; return (uint64_t)ptr + chrono::high_resolution_clock::now().time_since_epoch().count(); } mt19937 rnd(getSeed()); ll rndVal(uint64_t a, uint64_t b) { return un...
/* ͬ²½ FIFO 4*128 */ // Ò»ÖÖ4bit 128Éî¶ÈµÄ ͬ²½FIFOÉè¼Æ // @`13 // 2017Äê6ÔÂ6ÈÕ // ¹þ¶û±õ¹¤Òµ´óѧ£¨Íþº££© EDA¿Î³ÌÉè¼Æ module fifo(clock,reset,read,write,fifo_in,fifo_out,fifo_empty,fifo_full); parameter DEPTH = 128; // 128 Éî parameter DEPTH_BINARY = 7; // Éî¶ÈµÄ¶þ½øÖÆÎ»Êý parameter ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** * 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; static const double EPS = 1e-6; int ROUND(double x) { return (int)(x + 0.5); } bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; } bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); } double SQSUM(double ...
/** \file "inverters-watch2.v" Chain a bunch of inverters between VPI/VCS and prsim, shoelacing. $Id: inverters-watch2.v,v 1.2 2010/04/06 00:08:35 fang Exp $ Thanks to Ilya Ganusov for contributing this test. */ `timescale 1ns/1ps `include "clkgen.v" module timeunit; initial $timeformat(-9,1," ns",9); endmodu...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e9; const int SIZE = 2e5 + 5; const int MOD = 1e9 + 7; void solve(int CASE) { long long x; cin >> x; vector<long long> res; for (long long i = 1; i <= x; i *= 2LL) { res.push_back(i); x -= i; } if (x) res...
/** * 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, n, x; scanf( %d , &n); priority_queue<int, vector<int>, greater<int> > que; long long ans = 0; for (int i = 0; i < n; i++) { scanf( %d , &x); if (que.empty() || que.top() > x) que.push(x); else { ...
#include <bits/stdc++.h> using namespace std; int convert(int k) { if (k < 2) return k; else if (k < 5) return k - 1; else return k - 2; } int main() { string s[6]; int A[6][6] = {3, 3, 4, 4, 3, 3, 3, 3, 4, 4, 3, 3, 2, 2, 3, 3, 2, 2, 2, 2, 3, 3, 2, 2, 1, ...
`include "defines.v" module ex_mem ( input wire rst, input wire clk, input wire[`RegAddrBus] ex_waddr, input wire ex_we, input wire[`RegBus] ex_wdata, input wire ex_whilo, input wire[`RegBus] ex_hi, input wire[`RegBus] ex_lo, input wire[5:0] stall, input wire[`DoubleRegBus] hilo_i,...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int t, n, m, sum; int fa[1000010], sz[1000010]; vector<int> vec[1000010]; int find(int x) { if (x == fa[x]) return x; else return fa[x] = find(fa[x]); } int main() { ios_base::sync_with_stdio(false); ...
//Legal Notice: (C)2015 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 cmp(double x, double y) { if (fabs(x - y) < 1e-7) return 0; if (x < y) return -1; return 1; } float call(double a, double b) { double s1, s2; if (cmp(a / 4, b) <= 0) { s1 = b + a / 8; } else { double l1, l2, t1, t2; l1 =...
#include <bits/stdc++.h> using namespace std; bool yes(int x1, int x2, int x3, int x4) { int num1 = (x1 + x2 + x3 + x4) / 4, num2 = (x2 + x3) / 2, num3 = x4 - x1; if (((x1 + x2 + x3 + x4) % 4 != 0) || ((x2 + x3) % 2 != 0) || num1 != num2 || num1 != num3 || x1 == -1 || x2 == -1 || x3 == -1 || x4 == -...