text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while (t--) { unsigned long long int a, b, c, d; cin >> a >> b >> c >> d; unordered_map<unsigned long long int, unsigned long long int> mp, mp1; fo...
#include <bits/stdc++.h> using namespace std; multiset<long long> h[1000005]; int main() { int q; scanf( %d , &q); while (q--) { char op, s[20]; long long a; scanf( %c , &op); if (op == + ) { scanf( %lld , &a); int idx = 0, k = 0; for (long long x = a;...
module sub1 (/*AUTOARG*/ // Inputs bus1 ); input [0:3] bus1; endmodule module sub2 (/*AUTOARG*/ // Inputs bus2 ); input [0:3] bus2; endmodule module sub3 (/*AUTOARG*/ // Outputs bus1, bus2 ...
/* * Copyright 2012, Homer Hsing <> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
/* * 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> int du[100010], fa[100010], s1[100010], s2[100010]; int find(int x) { if (x != fa[x]) fa[x] = find(fa[x]); return fa[x]; } int main() { int n, m, x, y, i, j, k, sum; scanf( %d%d , &n, &m); for (i = 1; i <= n; i++) fa[i] = i; memset(du, 0, sizeof(du)); memset(...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: LKB // Engineer: Leonhard Neuhaus // // Create Date: 18.02.2016 11:42:49 // Design Name: // Module Name: red_pitaya_lpf_block // Project Name: // Target Devices: // Tool Versions: // Description: /...
/** * 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 mod = 1000000000; long long powmod(long long a, long long b) { long long res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } const int N = 201000; struct node { ...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:102400000,102400000 ) const int INF = 0x3f3f3f3f3f, mod = 1e9 + 7; const double eps = 1e-6, PI = acos(-1); template <typename T> inline void read(T &x) { x = 0; T f = 1; char ch; do { ch = getchar(); if...
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1); struct point { long double x, y; point(long double x = 0, long double y = 0) : x(x), y(y) {} point operator+(const point &o) const { return point(x + o.x, y + o.y); } point operator-(const point &o) const { return point...
// 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 : Sun Sep 22 02:34:37 2019 // Host : varun-laptop running 64-bit Service Pac...
#include <bits/stdc++.h> int main(void) { int n; int a[1100]; while (scanf( %d , &n) == 1) { for (int i = 0; i < n; i++) scanf( %d , a + i); int cnt = 1, ans = 0; int j = 0; if (n <= 2) { printf( %d n , ans); break; } if (a[0] > a[1]) j = -1; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, c[N], k = 1e5; char a[N], b[N]; void solve(int p, int coef) { if (a[p - 1] + coef < 0 || a[p - 1] + coef > 9 ) { solve(p - 1, -coef); } a[p - 1] += coef; a[p] += coef; printf( %d %d n , p - 1, coef); ...
#include <bits/stdc++.h> using namespace std; int n, m, k, i, dis = 10000000, temp, a[1000]; int main() { cin >> n >> m >> k; for (i = 0; i < n; ++i) cin >> a[i]; for (i = 0; i < n; ++i) { if (a[i] != 0 && a[i] <= k) { if (m <= i) temp = (i - m + 1) * 10; else ...
#include <bits/stdc++.h> using namespace std; int main() { int n, sum = 0; cin >> n; bool isLR = false; char a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == L || a[i] == R ) isLR = true; } bool flag = false; int count = 0; for (int i = 0; i < n; i++) {...
#include <bits/stdc++.h> using namespace std; const int N = 50010; string g[N]; int q, n, m, ro[N], co[N]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> q; while (q--) { cin >> n >> m; for (int i = 0; i < n; ++i) cin >> g[i]; for (int i = 0; i < n; ++i) { ...
//----------------------------------------------------------------------------- // Title : 10/100/1G Ethernet FIFO for 8-bit Client Interface // Project : Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper // File : eth_fifo_8.v // Version : 1.3 //-----------------------------------------------------...
#include <bits/stdc++.h> using namespace std; int n; int ans[400] = { 1, 9, 245, 126565, 54326037, 321837880, 323252721, 754868154, 328083248, 838314395, 220816781, 893672292, 166441208, 251255697, 114256285, 118775501, 482714697, 11784725, 460862131, 550384565, 106742...
// // Copyright 2011-2012 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 i...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long arr[n]; for (long long i = 0; i < n; i++) cin >> arr[i]; long long p = 0; while (p < n) { if (arr[p] < p) break; p++; ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; bool flag = 0; int by1, by2; int x, y; for (int i = 0; i <= a; i++) { x = a - i; y = i; by1 = b - x; by2 = c - y; if (by1 == by2 and by1 >= 0) { flag = 1; ...
#include <bits/stdc++.h> int main() { long long n; while (~scanf( %I64d , &n)) { long long m = sqrt(n); long long m1 = sqrt(m); long long i; long long sum; int flag = 0; for (i = m + 1; i >= m + 1 - 100; i--) { sum = 0; long long b = i; while (b) { ...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated docum...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1123456; template <typename T> T sqr(T x) { return x * x; } template <typename T> void vout(T s) { cout << s << n ; exit(0); } long long bp(long long a, long long n) { long long res = 1; while (n) { if (n ...
#include <bits/stdc++.h> using namespace std; struct vec { long double x, y; bool operator==(const vec &a) const { return x == a.x && y == a.y; } bool operator<(const vec &a) const { if (a.x != x) return x < a.x; return y < a.y; } vec operator+(const vec &a) const { return {x + a.x, ...
/* * Copyright (c) 2001 Stephen Williams () * * 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; const double PI = 3.14159265358979323846; const double eps = (1e-9); int dcmp(double x, double y) { return fabs(x - y) <= eps ? 0 : x < y ? -1 : 1; } int n, m; int mem[200000]; int minMoves(int x) { if (x == m) return 0; int& ret = mem[x]; if (ret ...
// Library - static, Cell - th24w2, View - schematic // LAST TIME SAVED: May 23 16:48:28 2014 // NETLIST TIME: May 23 16:48:54 2014 `timescale 1ns / 1ns module th24w2 ( y, a, b, c, d ); output y; input a, b, c, d; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "th24w2"; specpar...
#include <bits/stdc++.h> using namespace std; bool comp(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } long long gcd(long long a, long long b) { if (!b) return a; return gcd(b, a % b); } int main() { long long n, k; cin >> n >> k; long long lx[43]...
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return + s + ; } string to_string(const char* s) { return to_string((string)s); } string to_string(bool b) { return (b ? true : false ); } template <typename A, typename B> string to_string(pair<A, B> p) { return ( + ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2008 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; reg toggle; initial toggle=0; integer cyc; initial cyc=1; wire [7:0] cyc_copy = cyc[...
/* * Copyright (c) Mercury Federal Systems, Inc., Arlington VA., 2009-2010 * * Mercury Federal Systems, Incorporated * 1901 South Bell Street * Suite 402 * Arlington, Virginia 22202 * United States of America * Telephone * FAX * * This file is part of OpenCPI (www.opencpi.org). * ...
/** * 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...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: ROM_Sin.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015 // Date : Fri Jul 8 09:16:27 2016 // Host : jalapeno running 64-bit unknown // Command ...
#include <bits/stdc++.h> using namespace std; template <class T> using vc = vector<T>; template <class T> using vvc = vc<vc<T>>; template <class T> void mkuni(vector<T>& v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); } long long rand_int(long long l, long long r) ...
#include <bits/stdc++.h> using namespace std; template <typename... T> inline void inp(T &...args) { ((cin >> args), ...); } template <typename T> inline istream &operator>>(istream &in, vector<T> &a) { for (auto &x : a) in >> x; return in; } template <typename T, typename U> inline istrea...
/* This file is part of JT51. JT51 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. JT51 is distributed in the hope tha...
/* * 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; int N, K; int hardcode[11] = {0, 1, 0, 1, 2, 0, 2, 0, 1, 0, 1}; int get_sprague_1(int val) { int tmp = val; while (tmp % 4 == 0) { tmp /= 4; } if (val <= 10) { return hardcode[val]; } else if (tmp == 6 || (val % 4 == 0 && tmp % 2 == 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...
#include <bits/stdc++.h> using namespace std; int n; int main() { ios_base::sync_with_stdio(false); int n, x[10], y[10], nx[10], ny[10]; cin >> n; for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> nx[i] >> ny[i]; int mnx = 1000000, mny = 1000000, mxx = 0, mxy = 0; for (int i = 0; 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...
#include <bits/stdc++.h> using namespace std; class sparse_table { vector<int> values; vector<int> maxk; vector<vector<int> > st; void build(const vector<int>& a) { values = a; int n = a.size(); st.resize(maxk[n] + 1); st[0].resize(n); for (int i = 0; i < n; i++) st[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; int n; bool ison[100010]; char temp[100]; int q, t; int isprime[100010]; int prime[100010]; vector<int> pr[100010]; void preprocess() { fill(isprime, isprime + 100010, 0); fill(ison, ison + 100010, false); fill(prime, prime + 100010, -1); f...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-6; const double pi = acos(-1); int sign(double k) { if (k > eps) return 1; else if (k < -eps) return -1; return 0; } int cmp(double k1, double k2) { return sign(k1 - k2); } int inmid(double k1, double k2, double k3...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Power Management //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; using namespace std; int k; string ad; vector<string> c(string s) { vector<string> ans; int last = 0; for (long long i = 0; i < (s.size()); i++) { if (s[i] == || s[i] == - || i == s.size() - 1) { ans.push_back(s.substr(last, i - las...
/** * 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 "defines.v" /**** * Compares 4 input ports based on their age and source * and outputs 4 priorities. The priorities contain the * port number that is that priority with p0 being the * highest and p3 being the lowest. Compares based on age * with highest more priority and then based on source * in the cas...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while (t--) { long long n, k; cin >> n >> k; long long n1 = n - (k - 1); if (n1 > 0 && n1 % 2 == 1) { cout << YES n ; for (l...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; long long v[n + 10]; for (long long i = 0; i < n; i++) { cin >> v[i]; } sort(v, v + n); k--; long long div = k / n; long long cnt = 0; long long val = v[div]; for (long long 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 long long inf = (1LL << 60) - 1; int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, -1, 1}; void solve() { long long n, x, y, k, c = 0; cin >> n >> x >> y; for (long long i = 0; i < n; i++) { cin >> k; if (k <= x) c++; } if (x > y) ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long MOD = 1e9 + 7; const int N = 1e6; int T, n, r, A[1005]; void solve() { cin >> n >> r; for (int i = 1; i <= n; i++) { cin >> A[i]; } int ans = 0; int z; for (int i = 1; i <= n; i = z + r) {...
/** * 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> #pragma comment(linker, /STACK:128777216 ) const int null = 0; using namespace std; template <class T> int size(const T &a) { return int(a.size()); } template <class T> T abs(const T &a) { return (a < 0 ? -a : a); } template <class T> T sqr(const T &a) { retur...
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; const long double E = 1e-7; unsigned char ccc; bool _minus = false; template <typename T> inline T sqr(T t) { return (t * t); } inline void read(long long &n) { n = 0; _minus = false; while (true) { ccc = getc...
#include <bits/stdc++.h> bool fun(long long a); using namespace std; int main() { long long num, num1, num2; cin >> num; if (num % 2 == 0) { num1 = num / 2; num2 = num / 2; while (!fun(num1) || !fun(num2)) { num1 -= 1; num2 += 1; } } else { num1 = num ...
#include <bits/stdc++.h> using namespace std; int mod = 1e9 + 7; int base[2] = {31, 33}; int pw[2][1000005], a[2][1000005]; char s[1000005]; int n, ans[1000005]; bool func(int x, int y, int xx, int yy) { for (int i = 0; i <= 1; i++) { if (((a[i][y] - 1ll * a[i][x - 1] * pw[i][y - x + 1]) % mod +...
#include <bits/stdc++.h> const long long mod = 1000000007; using namespace std; int main() { long long ax, ay, bx, by, tx, ty; scanf( %I64d , &(ax)); scanf( %I64d , &(ay)); scanf( %I64d , &(bx)); scanf( %I64d , &(by)); scanf( %I64d , &(tx)); scanf( %I64d , &(ty)); long long n; ...
#include <bits/stdc++.h> using namespace std; int main() { long long t, i, j, k, l, m, n, p, q, r, s = 0, a, b, c, d, ans = 0, x, y; cin >> n >> k; string s1; cin >> s1; for (i = 0; i < n; i++) { if (s1[i] == G ) { p = i; } else if (s1[i] == T ) { q = i; } ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int n, m; unsigned long long A, B, C; struct E { int u, v; E(int u, int v) : u(u), v(v) {} }; struct Graph { int n, m, deg[maxn], cur[maxn]; unsigned long long hash_[maxn]; vector<E> edge; vector<int> small[max...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:02:05 12/03/2016 // Design Name: // Module Name: animation // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
module xillyvga_core ( input S_AXI_ACLK, input [31:0] S_AXI_ARADDR, input S_AXI_ARESETN, input S_AXI_ARVALID, input [31:0] S_AXI_AWADDR, input S_AXI_AWVALID, input S_AXI_BREADY, input S_AXI_RREADY, input [31:0] S_AXI_WDATA, input [3:0] S_AXI_WSTRB, input S_AXI_WVALID, input clk_in, i...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in ...
#include <bits/stdc++.h> using namespace std; int mirror(int num) { int res = 0; for (int i = 0; i < 4; ++i) { res |= (num & (1 << i)) << (7 - i - i); res |= (num & (1 << (7 - i))) >> (7 - i - i); } return res; } int main() { int num; string s; vector<int> res; getlin...
/** * 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; template <class T> inline int size(const T& c) { return c.size(); } template <class T> inline int length(const T& c) { return c.length(); } unsigned long long l, r, k, m; vector<unsigned long long> can; struct matrix { unsigned long long val[...
// -*- mode: Verilog; verilog-auto-lineup-declaration: nil; -*- //----------------------------------------------------------------------------- // Title : Synchronous FIFO // Project : Common //----------------------------------------------------------------------------- // File : sync_fifo.v //-...
#include <bits/stdc++.h> using namespace std; struct pp { long long cost; bool operator<(const pp &temp) const { return cost < temp.cost; } }; map<pp, int> hs; int n, c[2]; pp now; map<pp, int> solve(int n) { map<pp, int> ret, ms; map<pp, int>::iterator it; pp u, now; ret.clear(); ...
#include <bits/stdc++.h> struct node { int x, y; int dir, len; } arr[1100 * 1100], st[1100]; int n, m, tot, vis[1100][1100], cnt; int srow[1100][1100], scol[1100][1100]; int dir[4] = {1, -1, -1, 1}; char mmap[1100][1100]; void Initial() { int i, j, k; for (i = 1; i <= n; ++i) for (j ...
/* A alu module*/ module ALU(inputA, inputB, ALUop, result, zero); input [31:0] inputA, inputB; input [2:0] ALUop; output [31:0] result; reg [31:0] result; output zero; reg zero; /*whenever input or ALUop changes*/ always @(inputA or inputB or ALUop) begin /*it supports AND, OR, ADD, SLT with a zero output*/ cas...
#include <bits/stdc++.h> using namespace std; long long GI(long long &a) { return scanf( %I64d , &a); } long long n, i, j, k, tmp, m; long long arr[100100]; string s, s1; int32_t main() { getline(cin, s1); getline(std::cin, s); k = 0; for (long long i = 0; i < s1.length(); i++) k = k * 10 + ...
#include <bits/stdc++.h> using namespace std; long long t = 1, T; void print2d(vector<vector<long long>> &v) { for (long long i = 0; i < v.size(); i++) { for (long long x : v[i]) { cout << x << ; } cout << n ; } } void print(vector<long long> &a) { for (long long 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> using namespace std; const long long inf = 0x3f3f3f3f3f3f3f3f; template <typename T> inline void read(T& X) { X = 0; int w = 0; char ch = 0; while (!isdigit(ch)) { w |= ch == - ; ch = getchar(); } while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 4...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int i, j; int arr1[n], arr2[n], p[n]; for (i = 1; i <= n; i++) cin >> arr1[i]; for (i = 1; i <= n; i++) cin >> arr2[i]; for (i = 1; i <= n; i++) p[arr1[i]] = arr2[i]; for (i = 1; i <= n; i++) cout << p[i] << ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; long long a3, b3; bool check1(long long a1, long long b1, long long a2, long long b2) { if ((a2 * a3 + b2 * b3 + a1 * b3 - a3 * b1) % (a3 * a3 + b3 * b3)) return false; if ((a2 * b3 - b2 * a3 - a1 * a3 - b1 * b3) % (a3 * a3 + b3...
#include <bits/stdc++.h> using namespace std; const int SIZE = 100011; const int MAX = 1e9; int mi[SIZE << 2], a[SIZE]; void init(int L, int R, int id) { mi[id] = MAX; if (L == R) return; int mm = (L + R) >> 1; init(L, mm, id << 1); init(mm + 1, R, (id << 1) + 1); } void ins(int L, int...
//----------------------------------------------------- // Design Name : encoder_using_case // File Name : encoder_using_case.v // Function : Encoder using Case // Coder : Deepak Kumar Tala //----------------------------------------------------- module encoder_using_case( binary_out , // 4 bit binary Output...
/** * 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...
// ====================================================================== // DES encryption/decryption testbench // tests according to NIST 800-17 special publication // Copyright (C) 2012 Torsten Meissner //----------------------------------------------------------------------- // This program is free software; you ca...
#include <bits/stdc++.h> using namespace std; void solve() { long long int n, m; cin >> n >> m; long long int st = n / 2; if (n & 1) st++; for (long long int i = (st); i < n + 1; i++) { if (i % m == 0) { cout << i; return; } } cout << -1; } signed main() {...
#include <bits/stdc++.h> using namespace std; long long n, a, b, dp[300][300]; long long s; vector<pair<long long, long long> > v; long long r, tr; long long gs(long long a, long long b, long long c) { long long s = 0; s = (v[b].first - v[a].first) * (v[c].second - v[a].second) - (v[b].secon...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License...
#include <bits/stdc++.h> using namespace std; vector<int> adj[500010], ar; bool vis[500010]; int u, v, n, m, s, res = 0; void dfs(int cur) { vis[cur] = true; for (auto i : adj[cur]) if (!vis[i]) dfs(i); ar.push_back(cur); } int main() { scanf( %d%d%d , &n, &m, &s); for (int i = 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 law...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 1; for (int i = 6; i <= n; i++) { if (n % i == 0) { int k1 = 0, k0 = 0; int f = 0; int x = i; while (x > 1 and f == 0) { int x2 = x % 2; if (x2 == 1 and k0 ...
#include <bits/stdc++.h> using namespace std; queue<int> fila[100000 + 10]; int bit[100000 + 10]; int rsp[100000 + 10]; pair<pair<int, int>, int> q[100000 + 10]; int v[100000 + 10]; int ls[100000 + 10]; void add(int p, int v) { if (p == 0) return; for (; p <= 100000; p += (p & (-p))) bit[p] += v...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base...
`ifndef __DEFINE__ `define __DEFINE__ `ifndef intN `define intN 32 `endif `ifndef symN `define symN 1 `endif `ifndef anyN `define anyN `intN `endif `ifndef addrN `define addrN 16 `endif `define intT [`intN-1:0] `define symT [`symN-1:0] `define anyT [`anyN-1:0] `define addrT [`addrN-1:0] `define sync_ports \ ...
/* * University of Illinois/NCSA * Open Source License * * Copyright (c) 2007-2014,The Board of Trustees of the University of * Illinois. All rights reserved. * * Copyright (c) 2014 Matthew Hicks * * Developed by: * * Matthew Hicks in the Department of Computer Science * The University of Illinois at...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_ddr_6sig_x2_async.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 redistrib...
/** * 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...
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; int a[MAXN]; int b[MAXN]; int tmp[MAXN]; int main() { int n; cin >> n; int aidx; for (int i = 0; i < n; i++) { cin >> tmp[i]; if (tmp[i] == 0) aidx = i; } for (int i = 0; i < n; i++) a[i] = tmp[(i + ai...