text
stringlengths
59
71.4k
// *************************************************************************** // *************************************************************************** // Copyright 2014(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
#include <bits/stdc++.h> using namespace std; int n; double V1; double V2[100005]; double L[100005]; double D[100005]; double X[100005]; bool check(double T) { bool ok1 = false; bool ok1b = false; bool ok2 = false; bool ok2b = false; double l = 0; double r = 1000000; vector<p...
/** * 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...
// // Every HW component class has to be derived from :class:`hwt.synthesizer.unit.Unit` class // // .. hwt-autodoc:: // module Showcase0 ( input wire[31:0] a, input wire signed[31:0] b, output reg[31:0] c, input wire clk, output reg cmp_0, output reg cmp_1, output reg cmp_2, o...
/* Copyright (c) 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, distribute,...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int SZ = 110; const int INF = 1000 * 1000 * 1000; double start, finish; void prepare(string s) { if ((int)s.size() != 0) { freopen((s + .in ).c_str(), r , stdin); freopen((s + .out ).c_str(), ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6; int pref[MAXN + 1]; string S; int n, k; void fast_io() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } pair<int, int> query(int s) { int lo = s, hi = n; int res = -1; while (lo <= hi) { int ...
#include <bits/stdc++.h> using namespace std; inline void boost() { ios_base::sync_with_stdio(); cin.tie(0); } const long long MAX = 1e5 + 111; const long long mod = 1e9 + 7; map<string, int> maap; vector<int> g[MAX]; int main() { boost(); int n; bool ans = false; cin >> n; s...
#include <bits/stdc++.h> using namespace std; int main() { string s; while (cin >> s) { string integer; string decimal; bool isnegative = false; bool isdecimal = false; int pos = 0; if (s[0] == - ) { isnegative = true; pos++; } for (; pos < s....
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; reg [7:0] cyc; initial cyc = 0; reg ...
/* Distributed under the MIT license. Copyright (c) 2015 Dave McCoy () 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, mo...
#include <bits/stdc++.h> using namespace std; long long n, s, a[100005], p, w[100005], ans; multiset<long long> st; int main() { cin >> n >> s; for (int k = 1; k <= n; k++) cin >> a[k]; cin >> p; for (int k = 1; k <= n; k++) cin >> w[k]; for (int k = 1; k <= n; k++) { st.insert(w[k]); ...
module nios_tester ( audio_in_data, audio_in_valid, audio_in_ready, audio_out_data, audio_out_valid, audio_out_ready, dummy_export, io_ack, io_rdata, io_read, io_wdata, io_write, io_address, io_irq, io_u2p_ack, io_u2p_rdata, io_u2p_read, io_u2p_wdata, io_u2p_write, io_u2p_address, io_u2p_irq, jta...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4.1 (win64) Build Thu Feb 19 16:23:09 MST 2015 //Date : Fri Nov 10 02:35:34 2017 //Host : aCentauri running 64-bit Service Pack 1 (buil...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (lin64) Build Wed Dec 14 22:35:42 MST 2016 // Date : Sat Jan 21 14:33:05 2017 // Host : natu-OMEN-by-HP-Laptop running 64-bit Ubunt...
/** * 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 int n; cin >> n; cout << n / (2520LL); return 0; }
#include <bits/stdc++.h> using namespace std; struct point { int n; int value; vector<int> next; } p[100010]; queue<struct point> q; int main() { int n, m, x, y, flag = 1, t; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d %d , &x, &y); p[x].next.push_back(y)...
#include <bits/stdc++.h> using namespace std; const double EPS = 1E-9; const int INF = 1000000000; const long long INF64 = (long long)1E18; const double PI = 3.1415926535897932384626433832795; long long gcd(long long a, long long b) { if (a < b) return gcd(b, a); if (b == 0) return a; return gcd...
/** * 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...
`timescale 1ns / 1ps module Lab8(LCD_ENABLE, LCD_RW, LCD_DI, LCD_CS1, LCD_CS2, LCD_RST, LCD_DATA, rst_n, clk, DIGIT, DISPLAY, ROW, COLUMN); input clk, rst_n; output [3:0] DIGIT; output [8:0] DISPLAY; output [3:0] ROW; input [3:0] COLUMN; output LCD_ENABLE, LCD_RW, LCD_DI, LCD_CS1, LCD_CS2, LCD_RST; outpu...
#include <bits/stdc++.h> using namespace std; int n; long long a[200010] = {}; vector<int> e[200010]; long long t[200010] = {}; long long q[200010] = {}; int s, b; long long ans = -222147483600ll; bool cmp(long long x, long long y) { return x > y; } void dfs(int x, int y) { vector<long long> w; ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Fri Sep 22 23:00:32 2017 // Host : DarkCube running 64-bit major release ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009 Xilinx, Inc. // This design is confidential and proprietary of Xilinx, All Rights Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ /...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(0); string s; cin >> s; int c[2]; c[0] = c[1] = 0; const int m[] = {2, 1}; for (int i = 0; i < s.size(); i++) { int d = s[i] - 0 ; cout << ((c[d]++ * m[d]) % 4) + 1 << <<...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int N = 2e5 + 5; int dist[N]; vector<int> open[N], close[N]; int n, k; bool done[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for (auto i = 0; i < (long long)(n); i++) { int ...
/** * 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 pr[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53}; const int m = 16; const int INF = 1e9; int n, d[110], por[110], vv[110], opr[110]; int f[110][65560], to[110][65560], pi[110][65560]; void init() { scanf( %d , &n); for (int...
#include <bits/stdc++.h> using namespace std; bool prime[1000001]; const double gr = 1.6180339887; void SieveOfErat(long long int mn) { memset(prime, true, sizeof(prime)); for (long long i = 2; i * i <= mn; i++) { if (prime[i] == true) { for (long long j = i * 2; j <= 1000000; j += i) prim...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2009 Xilinx, Inc. // // 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 // //...
#include <bits/stdc++.h> using namespace std; namespace FGF { const int N = 1e5 + 5, mo = 1e9 + 7, inv2 = (mo + 1) / 2; int a[N], b[N], pre[N], lst[N], nxt[N], sum[N << 2][4], ta[N << 2][2], n, st[N], tp, mi[N], mx[N], ans, cnt[N]; void pushtag(int ro, int l, int r, int x, int o) { sum[ro][3] = 1ll ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T = 1; while (T--) { int n, u; cin >> n >> u; vector<int> v; for (int i = 0; i < n; i++) { int t; cin >> t; v.push_back(t); ...
module VGA_Controller ( // Host Side iRed, iGreen, iBlue, oCurrent_X, oCurrent_Y, oAddress, oRequest, // VGA Side oVGA_R, oVGA_G, oVGA_B, oVGA_HS, oVGA_VS, oVGA_SYNC, oVGA_BLANK, oVGA_CLOCK, // Control Signal iCL...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using pll = pair<ll, ll>; const int N = 100010; int m, n, q[N], a[N]; int main() { scanf( %d , &m); for (int i = 0; i < m; i++) scanf( %d , &q[i]); scanf( %d , &n); for (int i = 0; i < n; i++) sc...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ // Behavioral model for the 32-bit program counter module program_counter2 (next_pc,rst,clk); // Output signals... // Incremented value of the program counter output [0:31] next_pc; // ======...
#include <bits/stdc++.h> using namespace std; const int M = 11, N = 2e5 + 5; int n, k; int a[N]; map<int, int> rem[M]; long long solve() { long long ans = 0; for (int i = 0; i < n; ++i) { unsigned long long f = 10; int ln = ((int)(to_string(a[i])).size()); for (int l = 1; l < M; ++...
/** * 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 = 110, M = 10010; int n; long double x; int c[N], all; long double binom[N][N]; long double f[N][M]; int main() { cin >> n >> x; for (int i = 1; i <= n; i++) scanf( %d , &c[i]), all += c[i]; f[0][0] = 1; for (int i = 0; i <= n; i+...
#include <bits/stdc++.h> int main() { int n, s, k = 0; scanf( %d %d , &n, &s); while (s > 0) { s -= n; k++; } printf( %d , k); return 0; }
#include <bits/stdc++.h> using namespace std; const int inf = 1e5 + 9, lg = 20; int n, q, timer = 1; vector<int> adj[inf], level[inf]; int depth[inf], in[inf], out[inf], parent[inf][lg]; void dfs(int u, int par) { in[u] = timer++; level[depth[u]].push_back(in[u]); for (auto v : adj[u]) if ...
`timescale 1ns / 1ps /* -- Module Name: DES Sbox 5 -- Description: Sbox 5 del algoritmo DES -- Dependencies: -- none -- Parameters: -- none -- Original Author: Héctor Cabrera -- Current Author: -- Notas: -- History: -- Creacion 05 de Junio 2015 */ module des_sbox5 ...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> arr(n); vector<pair<int, int>> sorted_arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; sorted_arr[i] = {arr[i], i}; } sort(sorted_arr.begin(), sorted_arr.end()); vector<int> pos(...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 50, M = 55; int B, bl[N]; vector<int> bcc[N]; inline void update(int &a, int b) { a = max(a, b); } int n, m, d; int dp[N * M]; char op[N][M]; vector<int> G[N], G2[N], G3[N]; void add(int u, int v, vector<int> G[]) { G[u].push_back(v);...
#include <bits/stdc++.h> using namespace std; const int M = 1000000007; const int MM = 998244353; template <typename T, typename U> static inline void amin(T &x, U y) { if (y < x) x = y; } template <typename T, typename U> static inline void amax(T &x, U y) { if (x < y) x = y; } int _runtime...
#include <bits/stdc++.h> using namespace std; int main() { int n, i; int a[3007]; while (~scanf( %d , &n)) { for (i = 0; i < n; i++) scanf( %d , &a[i]); sort(a, a + n); for (i = 0; i < n; i++) if (a[i] != i + 1) break; printf( %d n , i + 1); } return 0; }
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e5 + 10, tsz = 5 * maxn, offset = 1e5; vector<int> graph[maxn]; int sz[maxn]; bool big[maxn]; int a[maxn], b[maxn]; long long dp[maxn]; struct Line { int m; long long c; } tree[tsz]; int Left[tsz], Right[tsz], idn = 1, tra...
#include <bits/stdc++.h> using namespace std; char bb[111][111]; int in[111][111]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) scanf( %s , bb[i]); vector<pair<pair<int, int>, int>> stars; for (int i = 1; i < n - 1; i++) { for (int j = 1; j < m - 1; j++) { ...
#include <bits/stdc++.h> int main() { long i, n, d = 0; scanf( %ld , &n); for (i = 1; i <= n / 2; i++) { if (n % i == 0) d++; } printf( %d , d); 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...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none //`include "mono_data_rx/mono_data_rx_core.v" modu...
// (c) Copyright 1995-2017 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; long long s, x; string S, X; long long dp[64][2]; long long d__p(int i, int st) { if (i == S.size() && st) return 0; else if (i == S.size()) return 1; long long &res = dp[i][st]; if (res != -1) return res; res = 0; int x = S[i] ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, d; cin >> n >> d; int t; cin >> t; while (t--) { long long int x, y; cin >> x >> y; long long int eq1 = y * (n - d) - ((n - d) * (x - d)); long long int eq2 = (y - (n - d)) + (x - (n)); long...
#include <bits/stdc++.h> using namespace std; const long double EPS = (long double)1e-7; const long double PI = acos(0) * 2; bool isZero(const long double& x) { return abs(x) <= EPS; } int sign(const long double& x) { return isZero(x) ? 0 : (0 < x ? 1 : -1); } long long gcd(long long a, long long b) { f...
/** * 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, m, len; int arr[110]; int brr[110]; int main() { int i, j, k, t, a, b; ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (i = 0; i < m; i++) { memset(arr, 0, sizeof(arr)); for (j = 0; j < n; ...
`timescale 1ns / 1ps /* All files are owned by Kris Kalavantavanich. * Feel free to use/modify/distribute in the condition that this copyright header is kept unmodified. * Github: https://github.com/kkalavantavanich/SD2017 */ ////////////////////////////////////////////////////////////////////////////////// // Creat...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, ans = 0; string s; cin >> n; while (cin >> s) { int cnt = 0; for (int i = 0; i < s.length(); ++i) { if (s[i] >= A && s[i] <= Z ) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; cout << 0 0 << endl; int l = 1, r = (int)1e9, mid = l + (r - l) / 2; string s; cin >> s; int first; if (s[0] == b ) { first = 0; } else { fi...
#include <bits/stdc++.h> using namespace std; const int N = 1e3, MOD = 1e9 + 7, UNDEF = -1; int readInt() { bool minus = false; int result = 0; char ch; ch = getchar(); while (true) { if (ch == - ) break; if (ch >= 0 && ch <= 9 ) break; ch = getchar(); } if (ch ==...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> a(n); long long sum = 0; for (int& x : a) { scanf( %d , &x); sum += x; } if (sum != 0) { puts( YES ); puts( 1 ); printf( %d %d n , 1, n); exit(0); } ...
#include <bits/stdc++.h> using namespace std; const int N = 100100; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int tree[N << 2]; void pushup(int ind) { tree[ind] = gcd(tree[ind << 1], tree[ind << 1 | 1]); } int a[N]; void build(int ind, int ll, int rr) { if (ll == ...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n; if (n % 2 == 0) { x = n / 2; cout << x * (x + 1); } else { x = (n + 1) / 2; cout << (x - 1) * x + x; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); printf( %d n , (n + 1) / 2); return 0; }
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009, 2010 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 distri...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2020 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() { int n; cin >> n; if (n & 1) { cout << Ehab ; } else { cout << Mahmoud ; } return 0; }
#include <bits/stdc++.h> using namespace std; int dist[600 + 15][600 + 15]; int start[200 + 15]; int MAX_ = INT_MAX / 2 - 5; vector<pair<int, int> > sas[1000]; int cap[250000 + 15]; int v, e, n, k; int pop_w[1000]; int pop_kr[1000]; int group[1000]; int last_checked[1000]; int dead[1000]; int ...
module Computer( inout [WORD_WIDTH-1:0] ADDR_bus_inout, inout [WORD_WIDTH-1:0] DATA_bus_inout, input CLK_in, input RST_in ); parameter WORD_WIDTH = 16; parameter DR_WIDTH = 3; parameter SA_WIDTH = DR_WIDTH; parameter SB_WIDTH = DR_WIDTH; parameter OPCODE_WIDTH = 7; parameter FS_WIDTH = 4; parameter CNTRL_FLAGS_WI...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t > 0) { t--; string s, x; cin >> s; x.push_back(s[0]); for (int i = 1; i < s.size(); i++) { if (i % 2 != 0) x.push_back(s[i]); } cout << x << endl; } return 0; ...
#include <bits/stdc++.h> using namespace std; char a[500001 + 10], b[500001 + 10], s[(500001 << 1) + 10]; int n, m; struct BIT { long long c[500001 << 1]; long long query(int x) { if (x <= 0) return 0; long long ans = 0; for (int i = x; i; i -= (i & -i)) ans += c[i]; return ans; ...
#include <bits/stdc++.h> using namespace std; double esp = 1e-11; const double PI = acos(-1.0); const long long int INF = 0x3f3f3f3f; const long long int MOD = 1e9 + 7; const int maxn = 200010; int main() { int a, b, c; scanf( %d%d%d , &a, &b, &c); long double x = (-b + sqrt((long double)b * b...
#include <bits/stdc++.h> using namespace std; int main() { int v, e; cin >> v >> e; vector<set<int> > g(v); int a, b; for (int i = 0; i < e; i++) { cin >> a >> b; g[a - 1].insert(b - 1); g[b - 1].insert(a - 1); } int ans = 0; while (1) { vector<int> ve; ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of avfb_top_rs // // Generated // by: wig // on: Tue Apr 25 19:40:28 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver.xls // // !!! Do not edit this file! Autogenerated by MIX !...
#include <bits/stdc++.h> using namespace std; void min_self(int& a, int b) { a = min(a, b); } void max_self(int& a, int b) { a = max(a, b); } const int NAX = (int)(2e5 + 5); int v[NAX], visited[NAX]; int component_size; void visit(int i) { if (!visited[i]) { ++component_size; visited[i] = ...
#include <bits/stdc++.h> using namespace std; class Constellation { static const long long N = 100010; inline long long sign(long long x) { return x > 0 ? 1 : x == 0 ? 0 : -1; } struct point { long long x, y, num; } b[N]; long long n; long long cross(const point &a, const point &b, con...
#include <bits/stdc++.h> using namespace std; int arr[11][11]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { arr[1][i] = 1; } for (int i = 2; i <= n; i++) { for (int j = 1; j <= n; j++) { arr[i][j] = arr[i - 1][j] + arr[i][j - 1]; } } cout << ar...
#include <bits/stdc++.h> using namespace std; long double eps = (long double)1 / 1e9; long long inf = LLONG_MAX, mod1 = 1e9 + 7, mod2 = 998244353; long long sqr(long long a) { return a * a; } long long qb(long long a) { return a * a * a; } long long gcd(long long a, long long b) { return !a ? b : gcd(b % a,...
#include <bits/stdc++.h> using namespace std; long long dr[] = {-1, 1, 0, 0, -1, 1, -1, 1}; long long dc[] = {0, 0, -1, 1, -1, -1, 1, 1}; int main() { long long T; cin >> T; while (T--) { string a, b; cin >> a >> b; if (a < b) { cout << a << n ; continue; } ...
/** * 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...
// part of NeoGS project // // (c) NedoPC 2013 // // mp3 data dma controller module dma_mp3 ( input wire clk, input wire rst_n, output wire [ 7:0] md_din, // mp3 data interface output wire md_start, // input wire md_rdy, // input wire md_dreq, // // signals for ports.v // inpu...
/* servo controller Based on code from Mojo tutorial https://embeddedmicro.com/tutorials/mojo/servos takes an 8-bit position as an input output a single pwm signal with period of ~20ms pulse width = 1ms -> 2ms full scale. 1.5ms is center position approximate scaling. position = 0 -> 42,240 (should be 5...
/** Abstract: библиотека триггеров и регистров */ `include "vconst_lib.v" /* триггер пока что с разрешением работы и асинхронным сбросом a_dff #(.WIDTH()) label_( .clk(), .aclr(), .ena(), .data(), .q()); */ module a_dff(clk, aclr, ena, data, q); parameter WIDTH = 8; input clk, aclr, ena; input [WID...
/* * Copyright (c) 2002 Jane Skinner * * 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) * any ...
// // Generated by Bluespec Compiler, version 2013.01.beta5 (build 30325, 2013-01-23) // // On Mon Feb 3 15:05:32 EST 2014 // // // Ports: // Name I/O size props // RDY_s_request_put O 1 // s_response_get O 153 // RDY_s_response_get O 1 // c0_...
/** * 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...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { while (b != 0) { int r = a % b; a = b; b = r; } return a; } void FindMinimum(int a[], int &n) { int g = gcd(a[0], a[1]); for (int i = 2; i < n; ++i) g = gcd(a[i], g); cout << g * n; } int main() {...
#include <bits/stdc++.h> using namespace std; bool chk(int n, int first) { return n & (1 << first); } void set(int& n, int first) { n = n | (1 << first); } void reset(int& n, int first) { n = n & ~(1 << first); } const int mx = 600010; bool f[mx]; int a[mx][3], _size; char s[mx]; int new_node() { ...
#include <bits/stdc++.h> using namespace std; const long long N = 3e4 + 10, M = 1e3 + 10; long long n, p[N], d, dp[N][M + 10]; long long solve(long long pos, long long L) { if (pos > 30000) return 0; long long wh = L - d + M / 2; if (dp[pos][wh] != -1) return dp[pos][wh]; long long ret = 0; ...
// Copyright (c) 2014 CERN // Maciej Suminski <> // // 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) // any late...
#include <bits/stdc++.h> using namespace std; long long n, k; long long mx, p1, p2, val, sum, res, res1; long long m[200007][27]; int main() { ios_base::sync_with_stdio(); cin.tie(); cout.tie(); ; cin >> n >> k; res = 1000000007.0; for (int i = 1; i <= n; i++) { cin >> val; ...
/** * 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...
`timescale 1ns / 1ps module regfile_16x32b_4rd_2wr_tb; // Inputs reg clk; reg rst; reg [3:0] rdport1_ctrl_add; reg [3:0] rdport2_ctrl_add; reg [3:0] rdport3_ctrl_add; reg [3:0] rdport4_ctrl_add; reg [3:0] wrport1_ctrl_add; reg [31:0] wrport1_data_in; reg wrport1_wren; reg [3:0] wrp...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ff_jbi_sc1_1.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/...
/* * 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...