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...
module jt10_test( input rst, // rst should be at least 6 clk&cen cycles long input clk, // CPU clock input cen, // optional clock enable, if not needed leave as 1'b1 input [7:0] din, input [1:0] addr, input cs_n, input ...
/** * 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...
/* * 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 NAME : if_stage.v -- DESCRIPTION : IF¥¹¥Æ©`¥¸ -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito ÐÂҎ×÷³É -- =============...
#include <bits/stdc++.h> using namespace std; string s[6]; vector<string> res; void draw(vector<string> &w, int x, int y, int dx, int dy, string s) { for (int k = 0; k < s.size(); k++, x += dx, y += dy) { w[x][y] = s[k]; } return; } int main() { for (int i = 0; i < 6; i++) cin >> s[i];...
`include "../network_params.h" module mult_adder( input clock, input reset, input [`MULT_ADDER_IN_BITWIDTH:0] in, input [`MULT_ADDER_IN_BITWIDTH:0] kernal, input [`CONV_ADD_BITWIDTH:0] bias, output [`CONV_ADD_BITWIDTH:0] out ); // wire declarations wire [`CONV_PRODUCT_BITWIDT...
#include <bits/stdc++.h> using namespace std; inline long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } signed main() { std::ios::sync_with_stdio(false); cin.tie(N...
#include <bits/stdc++.h> using namespace std; const int M = 1500 + 10; int n, x, y; struct node { int xx, yy, id; bool operator<(const node &a) const { if (xx - x >= 0 && a.xx - x <= 0) return 1; if (xx - x <= 0 && a.xx - x >= 0) return 0; return (yy - y) * (long long)(a.xx - x) < (a.y...
`include "macros.vh" //////////////////////////////////////////////////////////////////////////////////////////////////// // 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 // ...
#include <bits/stdc++.h> using namespace std; int main() { int n, first, last, ans, flag; cin >> n; if (n <= 2) { cout << 0 << endl; return 0; } ans = flag = 0; first = 1; last = n; for (int i = 1; i < n; i++) { ans += (first + last) % (n + 1); if (!flag) { ...
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> data(n + 1); for (int i = 1; i <= n; i++) cin >> data[i]; int i = 1, j = n; while (j > i && data[j] == data[1]) j--; while (i < j && data[i + 1] == data[1])...
#include <bits/stdc++.h> using namespace std; template <typename T> std::ostream &operator<<(std::ostream &out, vector<T> &v) { for (typename vector<T>::size_type i = 0; i < v.size(); ++i) out << v[i] << ; out << n ; return out; } template <typename T> std::ostream &operator<<(std::os...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Sun May 28 18:34:35 2017 // Host : GILAMONSTER running 64-bit major release (...
module microblaze (clk, reset_, led); input clk, reset_; output [7:0] led; wire reset; wire [31:0] tr_instruction; wire tr_valid_instruction; wire [31:0] tr_pc; wire tr_reg_write; wire [4:0] tr_reg_addr; wire [14:0] tr_msr_reg; wire [31:0] tr_new_reg_val; wire tr_jump_take...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; int i = n / 2 - 1, j = n / 2; sort(arr, arr + n); int x = 0; int ans[n]; if (n % 2) ans[0] = arr[n / 2], x++, j++; for (; i >= 0 && j < n; i--,...
#include <bits/stdc++.h> using namespace std; int a[100]; int main() { long long n, m; cin >> n >> m; int L = 0, R = n - 1; --m; long long sum = 0; for (int i = 1; i < n; ++i) { sum <<= 1; if (m & 1) sum += 1; m >>= 1; } m = sum; for (int i = 1; i <= n; m >>= ...
#ifdef Prateek #include Prateek.h #else #include <bits/stdc++.h> using namespace std; #define debug(...) 42 #endif #define int ll #define all(c) begin(c),end(c) using ll = long long; const int MOD = 1e9+7, N = 1e5 + 10; struct edge{ int u, v, w; }; int32_t main(){ io...
#include <bits/stdc++.h> using namespace std; using u64 = unsigned long long; const int mod = 1e9 + 7, N = 2e3 + 10; char mp[N][N]; int f[N][N]; bool st[N][N]; unordered_map<char, pair<int, int>> mv = { { L , {0, -1}}, { R , {0, 1}}, { U , {-1, 0}}, { D , {1, 0}}}; int main(void) { int t; ...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int main() { string s; cin >> s; int cnt0, cnt1, len = s.size(); string t(len, 0 ); cnt0 = cnt1 = 0; for (int i = len - 1; i >= 0; --i) { if (s[i] == 0 ) ++cnt0; else { if (cnt0 != cnt1) ...
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; double n; long int sum = 0; for (int i = 0; i < q; i++) { cin >> n; long long int a; for (int j = 0; j < n; j++) { cin >> a; sum += a; } cout << fixed << setprecision(0) << c...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: tlu_addern_32.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 and...
#include <bits/stdc++.h> using namespace std; const long long inf = 0x3f3f3f3f; const int N = 5e5 + 10; int a[8008]; int n, ans = 0; string s, ss, sss; map<string, int> mp; void str() { cin >> ss; int sum = 0; string x = ; for (int i = 0; i < ss.length(); i++) { if (ss[i] == & )...
#include <bits/stdc++.h> using namespace std; double pi = M_PI; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { long long n; cin >> n; n = n * 2; double angle = ((n - 2) * M_PI) / (2 * n); cout << fixed << set...
#include <bits/stdc++.h> const int inf = 2 * 1e9; const int mod = 1e9 + 7; const long long infll = (long long)1e18; const long double eps = 1e-9; const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, -1, 0, 1}; const int MAXY = 1005000; using namespace std; int n, m; vector<vector<pair<int, int>>> g;...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * T...
#include <bits/stdc++.h> using namespace std; const long long N = 22; long long a[N]; long long dp[N][N][N]; long long DP(long long pos, long long sum, long long limit) { if (!pos) return 1; if (!limit && dp[pos][sum][limit] != -1) return dp[pos][sum][limit]; long long high = limit ? a[pos] : 9; ...
/** * 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 MX = 1e5 + 5; int n; int M[9][2] = {{0, 0}, {-1, -1}, {1, 1}, {0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, -1}, {-1, 1}}; int compute(vector<int> Arr, int A0, int A1, int val) { Arr[0] = A0; Arr[1] = A1; int d = Arr[1] - Arr[0]; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long modexpo(long long x, long long p) { long long res = 1; x = x % 1000000007; while (p) { if (p % 2) res = res * x; p >>= 1; x = x * x % 1000000007; res %= 1000000007; } return res; } struct compare { bool opera...
////////////////////////////////////////////////////////////////////////////// /// Copyright (c) 2014, Ajit Mathew <> /// All rights reserved. /// // Redistribution and use in source and binary forms, with or without modification, /// are permitted provided that the following conditions are met: /// /// * Redistribut...
module lcd_display ( input [63:0] f1, // 1st row input [63:0] f2, // 2nd row input [15:0] m1, // 1st row mask input [15:0] m2, // 2nd row mask input clk, // 100 Mhz clock input rst, // Pad signals output reg lcd_rs_, output reg lcd_rw_, output reg ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double eps = 1e-9; const int inf = 2000000000; const long long infLL = 9000000000000000000; inline bool checkBit(long long n, int i) { return n & (1LL << i); } inline long long setBit(long long n, int i) { return n | (1LL ...
/** * 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 n, i, j = 0; char d; cin >> n; string s; cin >> s; char a[n][n + 1]; for (i = 0; i < n; i++) { s.copy(a[i], n - i, i), s.copy(a[i] + (n - i), i), a[i][n] = 0; d = ( 9 - a[i][0] + 1) % 10; for (j = 0; j < n;...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n & n - 1) puts( NO ); else puts( YES ); return 0; }
#include <bits/stdc++.h> using namespace std; struct Edge { int x; int y; int w; }; const int N = 200 + 7; const int INF = (int)1e9; int n; int m; int d[N][N]; struct T { int f; int s; }; bool operator<(T a, T b) { return a.s - a.f < b.s - b.f; } int solve(int x, int y, int w...
#include <bits/stdc++.h> using namespace std; template <class T> inline void gn(T &first) { char c, sg = 0; while (c = getchar(), (c > 9 || c < 0 ) && c != - ) ; for ((c == - ? sg = 1, c = getchar() : 0), first = 0; c >= 0 && c <= 9 ; c = getchar()) first = (first << 1) +...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
#include <bits/stdc++.h> using namespace std; int p[1001000]; int main() { int a, b, k; cin >> a >> b >> k; for (int i = 2; i <= b + 20; i++) p[i] = 1; for (int i = 2; i <= b + 20; i++) if (p[i]) for (int j = i + i; j <= b + 10; j = j + i) p[j] = 0; for (int i = 1; i < b + 10; 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2019 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define stop $stop `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int i, j, k; int n; cin >> n; int x = n / 4; string s = abcd ; string ans = ; if (n % 4 == 0) for (i = 0; i < x; i++) ans += s; else { if (n % 4 == 1) ...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e16 + 3; const int mod = 1e9 + 7; const int lim = 2e5 + 2; int q, ni; string str; void solve() { cin >> q; while (q--) { cin >> ni >> str; if (ni > 2) { cout << YES << n ; cout << 2 <<...
#include <bits/stdc++.h> using namespace std; const int N = 400005; multiset<int> S; int x, y, n, m, k; map<pair<int, int>, int> flag; struct Tree { int l, r, num, flag; } T[N * 4]; void build(int x, int l, int r) { T[x].l = l; T[x].r = r; if (l == r) { T[x].num = l - 1; retu...
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; int arr[n], brr[m]; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 0; i < m; i++) { cin >> brr[i]; } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ...
module convolution(outr,outi,a,b); input [15:0] a, b; output [17:0] outr, outi; wire signed [7:0] a_rea, a_ima, b_rea, b_ima; assign a_rea = a[15:8]; assign a_ima = a[7:0]; assign b_rea = b[15:8]; assign b_ima = b[7:0]; assign outr = a_rea*b_rea - a_ima*b_ima; assign outi = a_re...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); function<long long(long long, long long)> power = [&](long long x, long long y) { if (y == 0) { return 1LL; } else ...
`default_nettype none module TMDSify( input clkin, input val, hsync, vsync, inframe, output [3:0] gpdi_dp ); wire pixclk; wire tmds_clk; reg pix; tmds_pll pll(.clkin, .clkout0(tmds_clk), .clkout1(pixclk)); always @(posedge pixclk) pix <= val; wire [9:0] TMDS_grn, TMDS_blu;...
#include <bits/stdc++.h> using namespace std; long long exp(long long a, long long n) { if (n == 0) return 1; long long residue = 1, result = a % 1000000007LL; while (n > 1LL) { if (n % 2LL == 1LL) residue = residue * result % 1000000007LL; result = result * result % 1000000007LL; n = ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> const int N = 1e5 + 1; const int INF = 1e9 + 9; int n; int d[N]; std::vector<int> a[N]; int dfs(int v) { for (int u : a[v]) { d[v] += dfs(u); } if (d[v] == 0) return d[v] = 1; return d[v]; } int main() { scanf( %d , &n); for (int i = 1; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; int N, M, K, dp[505][505]; char g[505][505]; bool check(int r, int c) { int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, -1, 1}; if (r < 0 || c < 0) return false; if (g[r][c] == 0 ) return false; for (int i = 0; i < 4; ++i) { int nextR = r + dx...
#include <bits/stdc++.h> using namespace std; void enable_comma() {} string tostring(char c); string tostring(long long x); template <class A, class B> string tostring(pair<A, B> p); template <class A> string tostring(vector<A> v); string tostring(char c) { string s = ; s += c; return s;...
#include <bits/stdc++.h> using namespace std; int main() { int n; int a; int count = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a == 1) count += 1; } if (n != 1) { if (count == (n - 1)) cout << YES << endl; else cout << NO << end...
#include <bits/stdc++.h> using namespace std; long long a[200200], b[200200]; set<pair<long long, long long> > s; set<pair<long long, long long> >::iterator it, it2; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long n, i; cin >> n; for (i = 0; i < n; i++) c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int arr[30] = {}, n, i = 0; cin >> n; while (n > 0) arr[i] = n % 2, n /= 2, i++; for (i = 29; i >= 0; i--) if (arr[i]) cout << i + 1 << ; cout << n ; return 0; }
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; class DSU { public: vector<long long> p; DSU() {} DSU(long long n) { p.resize(n + 1); for (long long i = 1; i <= n; i++) p[i] = i; } void join(long long a, long long b) { p[find(b)] = find(a); } long long find(long long a) { return...
#include <bits/stdc++.h> using namespace std; int main() { long long n, x, y; cin >> n >> x >> y; if (y < n) { cout << -1 << endl; return 0; } long long a = y - n + 1; unsigned long long ans = 0; ans += n - 1 + a * a; if (ans < x) { cout << -1 << endl; ret...
#include <bits/stdc++.h> using namespace std; const int N = 200005; int cycl[N], set_val[N], cycl_size[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int h, m, n; cin >> h >> m >> n; vector<int> strt; bool vis[h]; memset(vis, false, sizeof vis); int kk = 0; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_dtl_bscl1.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 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 la...
#include <bits/stdc++.h> using namespace std; int main() { int n, p; string A; cin >> n >> p >> A; int i = n - 1; while (i >= 0 && i < n) { A[i]++; if (A[i] - 96 > p) { A[i] = 96; i--; continue; } if (i > 0 && A[i] == A[i - 1]) continue; if (...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.2 (lin64) Build Fri Jun 26 16:35:25 MDT 2015 // Date : Tue Nov 10 13:18:32 2015 // Host : centennial.andrew.cmu.edu running 64-bit Re...
#include <bits/stdc++.h> using namespace std; struct hero { int power; int nr; }; int main() { int n, m; int board[100]; hero heroes[100]; vector<int> left, right; cin >> n >> m; for (int i = 0; i < n; ++i) heroes[i].nr = -1; int l_ind = n; int r_ind = -1; for (int si...
/* * PS2 Mouse without FIFO buffer * Copyright (C) 2010 Donna Polehn <> * * This file is part of the Zet processor. This processor is free * hardware; 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...
/** * 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 V = 0; struct Node { int id; long long num, sum; Node *l, *r; Node() { num = -1; sum = 0; l = r = nullptr; id = V++; } }; int N; string s; Node* build(int& n) { Node* node = new Node(); if (s[n] == ( ) {...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vii = vector<vector<int>>; const ll LINF = 1LL << 60; const int INF = 1 << 29; const int MOD = 1e9 + 7; int main() { int n; cin >> n; vector<pii> v(n); for (int...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 4, inf = 1e9 + 7; vector<int> vec[N]; vector<pair<int, int> > qry[N]; int col[N], cnt[N], frq[N]; int vis[N], siz[N], Res[N]; void dfs(int u, int p) { siz[u] = 1; for (auto v : vec[u]) { if (v == p) continue; dfs(v, u); ...
// file: Clock50MHz_exdes.v // // (c) Copyright 2008 - 2011 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...
#include <bits/stdc++.h> using namespace std; const int IN = 2e5 + 7; int sum[IN]; int main() { string str; cin >> str; int n; scanf( %d , &n); memset(sum, 0, sizeof(sum)); if (str[0] == str[1]) sum[0] = 1; else sum[0] = 0; int k = str.size(); for (int i = 1; i < ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. `timescale 1ns / 1ps module t_inst(/*AUTOARG*/ // Outputs passed, // Inputs clk, fastclk ); input clk; input fastclk; output passed; r...
#include <bits/stdc++.h> using namespace std; const long long int maxn = 1e6 + 500; const long long int mod = 998244353; int dep[maxn], low[maxn], ans[maxn], dp[maxn]; int head[maxn], cnt; int n, k; struct C { int next, to; } E[maxn]; void add(int x, int y) { E[cnt].to = y; E[cnt].next = h...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////// // // This file is part of Descrypt Ztex Bruteforcer // Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com> // // This program is free software: you can redistribute it and/or modify // it under the terms of ...
/* 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> using namespace std; int n, m, q, w[15]; char s[15]; int cnt[5005]; int sum[5000][105]; int tot2[15]; int main() { scanf( %d%d%d , &n, &m, &q); tot2[0] = 1; for (int i = 1; i <= 14; i++) tot2[i] = tot2[i - 1] * 2; for (int i = 1; i <= n; i++) scanf( %d , &w[i]); ...
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using ii = pair<int, int>; using ld = long double; const int N = 5e5; bool flip[N], still[N]; int par[N], asdjashsgggg[N], x[N]; int find(int v, bool& b) { b = flip[v]; while (par[v] != v) { v = par[v]; b ^= flip[v...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, n1, n2, c, b; cin >> n >> n1 >> n2; c = n1; b = n2; long double sum = 0, sum1 = 0; long long int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a,...
#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 F[100009], arr[100009], ans[100009...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using D = double; using uint = unsigned int; template <typename T> using pair2 = pair<T, T>; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; mt19937 rng(chrono::steady_clock...
/** * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11/07/2015 06:38:17 PM // Design Name: // Module Name: m_port_ultra // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // ...
/** * 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() { long long second = 0; int r, m; cin >> m >> r; long long koef = 0, koef2 = 0; for (int i = 1; i <= m; ++i) { long long lef = i - 2, rig = m - i - 1; if (lef < 0) lef = 0; if (rig < 0) rig = 0; koef2 += i != 1; ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; pair<int, pair<int, int> > matrix[71][71][71]; int cost[71][71][71]; vector<string> colors; int n; void initialize() { colors.clear(); for (int i = 0; i < 71; i++) { for (int j = 0; j < 71; j++) { for (int k = 0; k < 71; k++) { ma...
// // Copyright 2011 Ettus Research LLC // // 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 3 of the License, or // (at your option) any later version. // // This program is dis...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
`timescale 1ns / 1ps /* Group Members: Kevin Ingram and Warren Seto Lab Name: Traffic Light Controller (Lab 3) Project Name: eng312_proj3 Design Name: Traffic_Test_H_eng312_proj3.v Design Description: Verilog Test Bench to Implement Test H (Rush Hour) */ module Traffic_Test; // In...
#include <bits/stdc++.h> using namespace std; int N, K, ma; int A[1000005]; int dp[10000005]; bool ok(int val) { int nr = 0; for (int i = 1; i <= ma; i++) { dp[i] = 0; if (val <= i) dp[i] = 1; if (i % 2) dp[i] = max(dp[i], dp[i >> 1] + dp[(i + 1) >> 1]); else dp...
// (C) 1992-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 simulati...
#include <bits/stdc++.h> using namespace std; const int N = 1000001; int eu[N], ev[N]; vector<pair<int, int> > g[N]; bool vis[N]; bool be[N]; int dfn[N], low[N], vbel[N], ebel[N], dfc, ebcc; int sz[N]; int dfs_ebcc(int u, int f) { static int s[N], t; s[++t] = u; dfn[u] = low[u] = ++dfc; ...
#include <bits/stdc++.h> using namespace std; int n, nxt[200010], a[200010], sz[200010][31]; long long ans = 0; map<int, int> mp; inline char gc() { static char *S, *T, buf[1 << 16]; if (T == S) { T = (S = buf) + fread(buf, 1, 1 << 16, stdin); if (T == S) return EOF; } return *S++;...
/** * 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...