text
stringlengths
59
71.4k
module Create (Init, creaenhe, D, rst, RS, RW, Out_display, MsbOD, clk, scrinit); input Init; input creaenhe; input clk; input [2:0] scrinit; input [6:0] D; input rst; output reg MsbOD; output reg [6:0] Out_display; output reg RS; output reg RW; always @(negedge clk) begin if(rst) begin MsbOD=0; Ou...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, ori[300][300], mat[300][300], mr[300], mc[300], vis[100000], l[100000], r[100000]; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) scanf( %d , &ori[i][j]); for (int i = 1; i <= n; i++)...
#include <bits/stdc++.h> using namespace std; int solveA(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y, pair<pair<int, int>, int> z) { pair<int, int> a = x.first; pair<int, int> b = y.first; pair<int, int> c = z.first; int n = a.first + b.first + c.first; if (n != a.secon...
#include <bits/stdc++.h> using namespace std; int Q, N, M, K, L; int A[5001]; int MAPPING[10001]; int CHK[10001]; int RET[10001]; map<int, int> MAP; int map_idx = 0; int main() { ios::sync_with_stdio(false); cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) co...
/** * 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, m; scanf( %d %d , &n, &m); vector<string> grid; int start_x, start_y; for (int i = 0; i < n; i++) { string s; cin >> s; grid.push_back(s); for (int j = 0; j < s.size(); j++) { if (s[j] == S ) { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; long long a[maxn], n, b[maxn], f[maxn]; int main() { scanf( %lld , &n); for (int i = 1; i <= n; i++) scanf( %lld , &a[i]), b[i] = a[i]; sort(b + 1, b + n + 1); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++)...
//----------------------------------------------------------------- // AltOR32 // Alternative Lightweight OpenRisc // V2.0 // Ultra-Embedded.com // Copyright 2011 - 2013 // // Email: // // ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/05/26 16:07:35 // Design Name: // Module Name: lab3_2_1 // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revi...
#include <bits/stdc++.h> using namespace std; struct node; struct node { node* arr[26]; int val; node(); void insert(char ch[], int l, int pos); void win(); void lose(); }; node::node() { val = 0; for (int i = 0; i < 26; i++) arr[i] = 0; } void node::insert(char ch[], int l...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; map<char, int> m; vector<int> v; for (int i = 0; i < s.size(); i++) { m[s[i]]++; } map<char, int>::iterator it = m.begin(); while (it != m.end()) { v.push_back((*it).second); it++; } ...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2000 + 4; char s[maxn]; int a[maxn]; void get(bitset<maxn> &B) { scanf( %s , s); int m = strlen(s); int x = 1, y = -1; for (int i = 0; i < m; i++) a[m - 1 - i] = s[i] - 0 ; m--; x += m + y; ++x; for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; template <typename T, typename S> ostream &operator<<(ostream &os, const pair<T, S> &v) { os << ( ; os << v.first << , << v.second << ) ; return os; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << [ ; ...
#include <bits/stdc++.h> signed main(void) { int totNums, cnt = 0; long long tot = 0, num; bool zero = false; std::cin >> totNums; for (int i = 0; i < totNums; i++) { std::cin >> num; if (num == 0) { ++tot; zero = true; } else if (num > 0) tot += num - 1; ...
`define ADDER_WIDTH 011 `define DUMMY_WIDTH 128 `define 3_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
module servo(clk, rst, rs232_in, rs232_in_stb, rs232_in_ack, rs232_out, servos, rs232_out_stb, servos_stb, rs232_out_ack, servos_ack); input clk; input rst; input [15:0] rs232_in; input rs232_in_stb; output rs232_in_ack; output [15:0] rs232_out; output rs232_out_stb; input rs232_out_ack; output [...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:04:43 03/14/2016 // Design Name: Top // Module Name: C:/Users/Ranolazine/Desktop/Lab/lab5/test_top.v // Project Name: lab5 // Target Device: // Tool ...
/* * 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; const int maxn = 110; int a[maxn]; int main() { int n; while (cin >> n) { int ans = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i]) ans++; } for (int i = 1; i <= n; i++) { if (a[i] == 1) { if...
// megafunction wizard: %ALTDDIO_OUT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: ALTDDIO_OUT // ============================================================ // File Name: delay.v // Megafunction Name(s): // ALTDDIO_OUT // // Simulation Library Files(s): // altera_mf // ================================...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03:39:26 12/05/2015 // Design Name: // Module Name: LCD_Peripheral // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies:...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double PI = acos(-1.0); const int N = 3e5 + 5, K = 30; int tam[N] = {1}, g[N][K], _g[N][K]; vector<int> v; int res[N]; pair<int, int> merge(int a, int b) { if (!a) return pair<int, int>(b, 0); if (!b) return pair<int...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int nmax = 5e4 + 5; int l[nmax], r[nmax]; int main() { int n, x; scanf( %d %d , &n, &x); for (int i = 0; i < n; ++i) { scanf( %d %d , l + i, r + i); } long long res = 0; for (int i = 0; i < n;) { i...
#include <bits/stdc++.h> using namespace std; int n, m, w[100010], in1, in2, in3; double ans; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &w[i]); for (int i = 1; i <= m; i++) { scanf( %d%d%d , &in1, &in2, &in3); ans = max(ans, (w[in1] + w[in2]) * 1.0 / in...
// 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 : Thu May 25 15:28:56 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10, N = 1e3 + 10; int tp[maxn], x[maxn], y[maxn]; vector<int> edge; char ch[2]; int rt[N], V, E, i, k; int root(int u) { if (rt[u] < 0) return u; else return rt[u] = root(rt[u]); } void init(int _V) { for (i =...
#include <bits/stdc++.h> using namespace std; const int N = 1005; const int Q = 1e9 + 7; struct Point { int x, y; Point(int _x = 0, int _y = 0) : x(_x), y(_y) {} const int sign() const { return y < 0 || y == 0 && x < 0; } Point operator-(const Point &R) { return Point(x - R.x, y - R.y); } lo...
`include "pycoram.v" `define THREAD_NAME "ctrl_thread" module userlogic # ( parameter W_A = 13, parameter W_D = 32, parameter W_COMM_A = 4 ) ( input CLK, input RST ); wire [W_A-1:0] mem_addr; wire [W_D-1:0] mem_d; wire mem_we; wire [W_D-1:0] mem_q; wire [W_D-1:0] com...
/** * 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 mat[105][105]; int n, m, res; void solve(int p) { if (p % 2) return; for (int i = 0, j = p - 1; i < p / 2; i++, j--) for (int k = 0; k < m; k++) if (mat[i][k] != mat[j][k]) return; res = res / 2; solve(p / 2); } int main() { ...
/* * Copyright (C) 2017 Systems Group, ETHZ * 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 t...
`define ADDER_WIDTH 010 `define DUMMY_WIDTH 128 `define 3_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
#include <bits/stdc++.h> using namespace std; int main() { int n, c1 = 0, c2 = 0; cin >> n; char x[n]; for (int i = 0; i < n; i++) { cin >> x[i]; if (x[i] == A ) c1++; else if (x[i] == D ) c2++; } if (c1 > c2) cout << Anton ; else if (c1 < c2) ...
#include <bits/stdc++.h> using namespace std; long long l[5001], dp[5001][5001]; void solve() { int n, k, ans = 0; cin >> n >> k; vector<int> v(n, 0); for (int i = 0; i < (int)(n); ++i) cin >> v[i]; sort(v.begin(), v.end()); for (int i = 0, j = 0; i < n; ++i) { while (v[i] - v[j] > 5...
/* * 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 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < 7; i++) { cin >> arr[i]; } int day = 1; int i = 0; while (n > 0) { n = n - arr[i]; i++; if (n > 0) { day++; } if (day > 7) { ...
#include <bits/stdc++.h> using namespace std; struct point { int x, y; int num; int mark; }; point p[100010]; int ans[100010]; point pt; int sum1, sum2; bool cmp(point a, point b) { return (a.x - pt.x) * (b.y - pt.y) - (a.y - pt.y) * (b.x - pt.x) < 0; } bool cmp2(point a, point b) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, s; int max = 0; int counter = 0; cin >> n >> s; for (int i = 0; i < n; i++) { int a; cin >> a; counter += a; if (a > max) { max = a; } } if (counter - max > s) { cout << NO ; ...
#include <bits/stdc++.h> using namespace std; int n, sum, dp[1 << 16], arc[16][16], d[16]; void Floyd() { int k, i, j; for (k = 0; k < n; k++) for (i = 0; i < n; i++) for (j = 0; j < n; j++) arc[i][j] = min(arc[i][j], arc[i][k] + arc[k][j]); } int getans() { int i, j, x, t, totol; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:00:11 03/29/2015 // Design Name: // Module Name: decoderparam // Project Name: // Target Devices: // Tool versions: // Description: // // De...
#include <bits/stdc++.h> using namespace std; unsigned gcd(unsigned a, unsigned b) { unsigned r; do { r = a % b; a = b; b = r; } while (r > 0); return a; } unsigned arr[705]; bool dp[705][705][2]; bool en[705][705][2]; unsigned g[705][705]; bool f(int l, int r, int rm) ...
// // 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; long long int mod1 = 1000000007; long long int mod2 = 67280421310721; long long int mod3 = 998244353; long long int INF = 1e18; long long int pow1(long long int a, long long int b) { long long int res = 1; while (b > 0) { if (b & 1) res = res * a; ...
// (c) Copyright 1995-2014 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; template <class T> T inline sqr(T x) { return x * x; } const long double pi = 3.1415926535897932384626433832795; const long double eps = 1e-8; const int MAXN = 1000500; string s; int n; int fin[3]; struct node { int l, r, par, link; map<cha...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; long long l, a; cin >> n >> l >> a; long long arr[n][2]; long long ans = 0; for (int i = 0; i < n; i++) { cin >> arr[i][0] >> arr[i][1]; if (i == 0) { ...
//***************************************************************************** // (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
module vgpr_comparator (/*AUTOARG*/ // Outputs result, // Inputs retired_operand_mask, retired_operand_addr, src1_gpr_info, src4_gpr_info, dst1_gpr_info, src2_gpr_info, src3_gpr_info, dst2_gpr_info ); wire src1_cmp_en, src2_cmp_en, src3_cmp_en, src4_cmp_en, dst1_cmp_en, dst2_cmp_en; ...
#include <bits/stdc++.h> using namespace std; string str; const long long MOD = 1e9 + 7; template <class T> inline void amin(T &x, const T &y) { if (y < x) x = y; } template <class T> inline void amax(T &x, const T &y) { if (x < y) x = y; } int read() { long long s = 0, f = 1; char c...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> g(n); int mm = 99999; for (int i = 0; i < n; i++) { cin >> g[i]; mm = min(mm, abs(g[i])); } sort(g.begin(), g.end()); int rest = k; for (int i = 0; i < k; i++) { if (...
#include <bits/stdc++.h> using namespace std; void solve() { char a[8][8]; int i, j, c = 0, k, d = 0, e = 1, f = 0; vector<int> v; for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { cin >> a[i][j]; } } for (i = 0; i < 8; i++) { d = 0; for (j = 0; j < 8; j++) ...
// Copyright (C) 2013 Simon Que // // This file is part of DuinoCube. // // DuinoCube is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later ...
#include <bits/stdc++.h> bool a[100000 << 1]; int b[100000 << 1], c[100000 << 1], h[100000], n, m, i, x, y; int go(int k) { int i, t, x = -1; for (i = h[k]; ~i; i = b[i]) if (!a[i]) { a[i] = 1, a[i >= m ? i - m : i + m] = 1; t = go(c[i]); if (~t) printf( %d %d %d n ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t, x, y, a, b; cin >> t; while (t--) { cin >> x >> y >> a >> b; if (2 * a < b) cout << a * (x + y) << n ; else cout << b * min(x, y) +...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using db = double; using str = string; using pi = pair<int, int>; using pl = pair<ll, ll>; using pd = pair<db, db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vecto...
// megafunction wizard: %LPM_MULT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_mult // ============================================================ // File Name: mult12_8.v // Megafunction Name(s): // lpm_mult // // Simulation Library Files(s): // lpm // ================================...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long LINF = 2e16; const long long INF = 2e9; const long long magic = 348; const double eps = 1e-10; const double pi = acos(-1); inline long long getint() { char ch; long long res; bool f; while (!isdi...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[m], b[m]; int ndup = n; for (int i = 0; i < m; i++) { cin >> a[i]; b[i] = a[i]; } sort(a, a + m); sort(b, b + m, greater<int>()); int mn = 0, mx = 0; for (int i = 0; i < m; i...
#include <bits/stdc++.h> using namespace std; typedef struct { double d; int num; } node; node no[1005]; int cmp(node a, node b) { return a.d < b.d; } double dis(int x, int y) { return sqrt(x * x + y * y); } int main() { int n, s; scanf( %d%d , &n, &s); for (int i = 0; i < n; ++i) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; int x, y, tx, ty, vis[N]; int chk(int x, int y) { for (int i = 0; i < 7; i++) vis[i] = 0; for (int i = 1; i <= tx; i++) ++vis[x % 7], x /= 7; for (int i = 1; i <= ty; i++) ++vis[y % 7], y /= 7; for (int i = 0; i < 7; i++) ...
#include <bits/stdc++.h> using namespace std; char buf[11]; const int MAXC = 20; double C[MAXC][MAXC + 1]; void count(int &sum, int &q) { char buf[11]; cin >> buf; sum = 0; q = 0; for (char *p = buf; *p; ++p) { switch (*p) { case + : ++sum; break; ...
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define all(v) v.begin(), v.end() #define eb emplace_back #define ll long long const int N = 2e5 + 5; const int inf = 1e9 + 7; ll t[4 * N]; ll z[4 * N]; ll a[N]; bool modify[4 * N]; void push(int tl, int tr, int v) {...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Wojtek Gumua // // Create Date: 14:10:58 05/19/2015 // Design Name: // Module Name: closing3x3 // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2005-2007 by Wilson Snyder. module t (/*AUTOARG*/); reg [3:0] value; reg [3:0] valuex; // verilator lint_off CASEOVERLAP // verilator lint_off CASEWITHX // verilator ...
#include <bits/stdc++.h> using namespace std; const int N = 5005; const int K = 100005; int n, m, k; int t, p; int l[N], c[N], x[K]; int main() { scanf( %d%d%d , &n, &m, &k); x[0] = 0; for (int i = 1; i <= k; ++i) { scanf( %d%d%d , &t, &p, &x[i]); if (t == 1) l[--p] = i; ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:400000000 ) int n, a[200010], b[200010], f[200010]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { int x; cin >> x; f[x - 1] = i; } for (int i = 0; i...
// // File: ntsc2zbt.v // Date: 27-Nov-05 // Author: I. Chuang <> // // Example for MIT 6.111 labkit showing how to prepare NTSC data // (from Javier's decoder) to be loaded into the ZBT RAM for video // display. // // The ZBT memory is 36 bits wide; we only use 32 bits of this, to // store 4 bytes of bla...
// file: system_clk_wiz_0_0.v // // (c) Copyright 2008 - 2013 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...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; long long m, n, t, a1, b1, cnta, cntb, b[maxn]; struct point { long long x, y; point(long long x = 0, long long y = 0) : x(x), y(y) {} bool operator<(const point& p) const { return x < p.x || (x == p.x && y < p.y); } ...
/* * 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...
module Queue_2048 ( input clock, input reset, input [2047:0] io_enq_bits, input io_enq_valid, output io_enq_ready, output [2047:0] io_deq_bits, output io_deq_valid, input io_deq_ready ); wire q1_rdy; wire q2_rdy; wire q1_vld; wire q2_vld; wire [1023:0] bitsIn_0_1023; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; int arr[n], brr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n, gr...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; vector<pair<int, int>> v; for (int i = 0; i < n; i++) { long long a, b; cin >> a >> b; v.push_back(make_pair(a, b)); } int c = 0; for (int i = 0; i < n; i++) { int up = 0, lo = 0...
#include <bits/stdc++.h> using namespace std; long long int n, t; int main() { cin >> n >> t; long long int a = (n - t) / 2; for (int i = 1; i <= n; i++) { cout << !((i) % (a + 1)); } }
#include <bits/stdc++.h> using namespace std; string ANSWER[2] = { NO n , YES n }; int v[2009], s1[2009], s2[2009]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &v[i]); s1[i] = s1[i - 1] + (v[i] == 1); s2[i] = s2[i - 1] + (v[i] == 2); } i...
`include "SVGA_DEFINES.v" module COLOR_BARS ( pixel_clock, reset, pixel_count0, line_count0, vga_red_data, vga_green_data, vga_blue_data ); input pixel_clock; input reset; input [10:0] pixel_count0; input [9:0] line_count0; output vga_red_data; output vga_green_data; output vga_blue_data; reg [10:0] ...
#include<bits/stdc++.h> using namespace std; #define ll int long long #define mp make_pair //#define for(i,n) for(int i=0;i<n;i++) #define F first #define S second #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define N 1000000007 #define pq priority queue #define pb ...
#include <bits/stdc++.h> using namespace std; int convexP = 0; const int SQ = 1075; const long long mini = -8e18; bool isErased[300001]; long long type[300001], a[300001], b[300001]; long long out[300001]; long long la[300001], lb[300001]; int convexSz, p; double cross(int x, int y) { return (double...
#include <bits/stdc++.h> template <typename T> void read(T& x) { x = 0; int flag = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) flag = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; x *= flag; } using namespace std; const int maxn = 200010;...
`include "defines.v" `timescale 1ns/1ps module tb( input `control_w port0_ci, input `data_w port0_di, output `control_w port0_co, output `data_w port0_do, input `control_w port1_ci, input `data_w port1_di, output `control_w port1_co, output `data_w port1_do, input `control_w port2...
#include <bits/stdc++.h> inline int getint() { register char ch; register bool neg = false; while (!isdigit(ch = getchar())) if (ch == - ) neg = true; register int x = ch ^ 0 ; while (isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ 0 ); return neg ? -x : x; } const int ...
/* * .--------------. .----------------. .------------. * | .------------. | .--------------. | .----------. | * | | ____ ____ | | | ____ ____ | | | ______ | | * | ||_ || _|| | ||_ \ / _||...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; if (n == k) cout << 0 << endl; else if (k > n) cout << k - n << endl; else { if ((n - k) % 2 == 0) cout << 0 << endl; ...
/** * 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 k, l; cin >> k; vector<int> a[k]; for (int i = 0; i < k; i++) for (int j = 0; j < k; j++) cin >> l, a[i].push_back(l); l = 0; for (int i = 0; i < k; i++) l += a[k / 2][i]; for (int i = 0; i < k; i++) l += a[i][k / 2]; ...
/** * 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; cin >> n; int r = 0; int rr = 0; int prev = 10000; while (n--) { int a, b; cin >> a >> b; if (a != b) r = 1; else { if (a > prev) rr = 1; } prev = a; } if (r == 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...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Wrap_2pi.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------- // -...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps 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 maxn = 100005; int n, o; string st; long long a[maxn], all; int cc[100], where[100], zhu[100], g[maxn], wc[maxn]; int f[66][maxn]; int main() { cin >> n; all = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; all ^= a[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...