text
stringlengths
59
71.4k
// ============================================================== // 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 mod...
/* * 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 N = 1e5 + 7; bool vis[N]; int n, a[N], go[N]; pair<int, int> v[N]; bool isLucky(int x) { while (x > 0) { if (x % 10 != 4 && x % 10 != 7) return false; x /= 10; } return true; } void solve() { bool hasLN = false; for ...
#include <bits/stdc++.h> using namespace std; int n, k, ans, t; int a[100005]; int main() { scanf( %d%d , &n, &k); ans = 1; t = 1; for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); if (a[i] == a[i - 1]) { ans = max(ans, i - t); t = i; } } ans = max(ans,...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-2010 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...
// megafunction wizard: %LPM_CONSTANT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_constant // ============================================================ // File Name: lpm_constant2.v // Megafunction Name(s): // lpm_constant // // Simulation Library Files(s): // lpm // ===========================...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, carry = 0, flag = 1; cin >> n; int ar[n]; for (i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0 && carry == 1) { flag = 0; } if (ar[i] % 2 == 0 && carry == 0) { continue; } if (i...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int MAXH = 200000 + 10, MAXN = 2000 + 10; const long long MOD = 1000000007; struct Point { int x, y; bool operator<(const Point &p1) const { return x + y < p1.x + p1.y; } } p[MAXN]; long long fac[MAXH], inv[MAXH]; long long f[MAXN]; inline long...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013 Xilinx Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // // ____ ___ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Versi...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, a, b; string s = , s1; cin >> n >> a >> b; for (int i = 0; i < b; i++) s += ( a + i); for (int i = b; i < a; i++) s += a ; s1 = s; int x = n / a, y = n % a; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, sum = 1, sum2 = 2, t = 0, k = 0; cin >> n; int a[n], b[n]; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n; i++) { if (a[i] == 1) t++; if (a[i + 1] == 1 || i == n - 1) { b[k] = a[i]; ...
#include <bits/stdc++.h> struct XD { double x, y, z; void input() { scanf( %lf%lf%lf , &x, &y, &z); } XD operator+(const XD& b) const { XD a; a.x = x + b.x; a.y = y + b.y; a.z = z + b.z; return a; } }; XD a, v; double r; inline double MIN(double a, double b) { ret...
/** * 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; struct point { int x, y, h; } a[100010]; bool cmp(point a, point b) { if (a.y != b.y) return a.y < b.y; return a.x < b.x; } int dp[100010]; int main() { int n; while (~scanf( %d , &n)) { for (int i = 0; i < n; i++) scanf( %d%d%d , &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 law...
/* Copyright (c) 2014 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,...
/* * 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> #pragma GCC optimize trapv long long int power(long long int x, long long int b) { long long int p = 1; while (b > 0) { if (b & 1) { p = p * x; p %= 1000000007; } b >>= 1; x *= x; x %= 1000000007; } return p % 1000000007; } ...
#include <bits/stdc++.h> using namespace std; vector<int> s; vector<pair<int, int> > v; vector<vector<int> > g; vector<bool> used; map<int, int> mp; int c[1005]; int cl[1005]; int cr[1005]; int main() { ios_base::sync_with_stdio(0); int n, m, k; cin >> n >> m >> k; g.resize(n); f...
#include <bits/stdc++.h> using namespace std; int n; int cnt[10000001] = {}; int par[10000001], ra[10000001]; void dsuInit() { for (int i = 0; i < (int)(10000001); ++i) par[i] = i, ra[i] = cnt[i]; } int dsuParent(int v) { if (v == par[v]) return v; return par[v] = dsuParent(par[v]); } void...
#include <bits/stdc++.h> using namespace std; void maximize(int &a, int b) { a = max(a, b); } const long long int modulo = 1e9 + 7; void add(int &a, long long int b) { a = (a + b) % modulo; } int n; int memcompute[20][2][1000005]; int expo3[2]; int compute(int x, int y, long long int available) { in...
#include <bits/stdc++.h> const int N = 4096; int a, n, v[N], h; long long w, c[N * 10]; char s[N]; int main() { std::cin >> a >> s; for (; s[n]; ++n) v[n + 1] = v[n] + s[n] - 0 ; h = v[n]; for (int i = 1; i <= n; ++i) for (int j = 0; j < i; ++j) ++c[v[i] - v[j]]; if (a) { for ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1005; vector<int> v[MAX]; int dp[105][MAX]; int main() { ios::sync_with_stdio(false); int n, t; cin >> n >> t; for (int i = 0; i < n; i++) { int t, p; cin >> t >> p; v[t].push_back(p); } for (int i = 0; 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 law...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int TESTS = 1; while (TESTS--) { long long int n, x = 1, ans = 0, w = 0, q; string s; cin >> n; long long int p = pow(2, 32) - 1; stack<long long in...
/** * 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() { string s; cin >> s; long long cnt = 0; for (long long i = 0; i < s.length(); i++) { if ((s[i] - 0 ) % 2 == 0) cnt++; } if (cnt == 0) cout << -1 << endl; else { vector<char> v; for (long long i = 0; i < s....
#include <bits/stdc++.h> using namespace std; int main() { int r, c, i, j, flag = 0; cin >> r >> c; char a1[r][c]; for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { cin >> a1[i][j]; } } for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { if (a1[i][j] == ....
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin...
/****************************************************************************** * File Name : data.v * Version : 0.1 * Date : 2008 02 27 * Description: data source module * Dependencies: * * * Company: Beijing Soul * * BUG: * *************************************************...
#include <bits/stdc++.h> using namespace std; int n, m; int a[1111]; int b[1111]; int c[1111]; int vis[1111]; int pos[5]; int cntp; int main() { scanf( %d , &n); bool flag = 0; for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); vis[a[i]]++; } for (int i = 1; i <= n; ++i...
#include <bits/stdc++.h> using namespace std; int calc(long long n, long long k, long long a1, long long a2, long long a3) { long long sum; if (a2 < a3) { swap(a2, a3); } if (a1 < a2) { swap(a1, a2); } if (a2 < a3) { swap(a2, a3); } if (a1 < 0 || a2 < 0 || a3 < 0) {...
//----------------------------------------------------------------------------- // Title : ALU Behavioral Model // Project : ECE 313 - Computer Organization //----------------------------------------------------------------------------- // File : alu.v // Author : John Nestor <> // ...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const double PI = acos(-1.0); const int MOD = 1000 * 1000 * 1000 + 7; const int INF = 2000 * 1000 * 1000; const int MAXN = 55; template <typename T> inline T sqr(T n) { return n * n; } int n; long long m; long long weight...
/***************************************************************************** * File : processing_system7_bfm_v2_0_gen_clock.v * * Date : 2012-11 * * Description : Module that generates FCLK clocks and internal clock for Zynq BFM. * *****************************************************************************/...
/** * 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) 2013 Adapteva, Inc. Contributed by Andreas Olofsson <> 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 vers...
#include <bits/stdc++.h> using namespace std; int n, m; char x[5][105]; int main() { cin >> n >> m; for (int i = 0; i < 4; i++) { for (int j = 0; j < n; j++) { x[i][j] = . ; } } if (m % 2 == 0) { printf( YES n ); for (int i = 1; i <= m / 2; i++) { x[1][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; int n; bool next_n(vector<int> &a) { int i = n - 1; for (; i >= 0 && a[i] == 5; --i) { a[i] = 0; } if (i == -1) { return false; } ++a[i]; return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; int defence[4]; int atack[4]; int main() { for (int i = 0; i < 4; i++) cin >> defence[i] >> atack[i]; int maximum = max(defence[0], defence[1]); maximum = max(maximum, atack[0]); maximum = max(maximum, atack[1]); if (defence[0] > atack[2] && defe...
// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // 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) an...
#include <bits/stdc++.h> using namespace std; int main() { int months[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int n, m; cin >> n >> m; vector<int> ans; string s; int idx = 0; while (getline(cin, s)) { int month = (s[5] - 0 ) * 10 + (s[6] - 0 ); int day = (s[...
/* * * Copyright (c) 2011 * * * * 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 distributed in the ...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> ostream& operator<<(ostream& o, pair<A, B> a) { return o << a.first << << a.second; } template <typename A, typename B> istream& operator>>(istream& o, pair<A, B>& a) { return o >> a.first >> a.second; } const in...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 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 // //...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_a_e // // Generated // by: wig // on: Mon Jun 26 08:25:04 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Auth...
#include <bits/stdc++.h> using namespace std; const int maxn = 5000; const double INF = 1e18; const double ep = 1e-8; struct Edge { int from, to; long long cap, flow; int id; Edge() {} Edge(int u, int v, long long c, long long f, int id_) : from(u), to(v), cap(c), flow(f), id(id_) ...
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...
/** * 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 a[100]; struct node { long long l; long long r; long long x; } p[100]; bool cmp(node aa, node bb) { return aa.x > bb.x; } int main() { long long n, h, m, i, ans = 0; cin >> n >> h >> m; for (i = 1; i <= n; i++) { a[i] = -1...
////////////////////////////////////////////////////////////////////// //// //// //// eth_register.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; long a, b, r; int main() { ios_base::sync_with_stdio(0); cin >> a >> b >> r; if (min(a, b) >= 2 * r) cout << First << endl; else cout << Second << endl; cin.get(); cin.get(); return 0; }
#include <bits/stdc++.h> using namespace std; template <class t> inline t read(t &x) { char c = getchar(); bool f = 0; x = 0; while (!isdigit(c)) f |= c == - , c = getchar(); while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); if (f) x = -x; return x; } template ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t; //Several simulators don't support this. //typedef struct pack2; // Forward declaration typedef struct packed { // [3:0] bit ...
/** * 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> #include <sys/types.h> #include <stdio.h> #include <unistd.h> #define _USE_MATH_DEFINES #define ll long long int #ifndef ONLINE_JUDGE #define debug(x...) cerr << [ << #x << ] = [ ; _print(x) #else #define debug(x...) #endif using namespace std; //mp.reserve(1024); /...
//============================================================================= // Verilog module generated by IPExpress 08/21/2007 16:22:41 // Filename: USERNAME_bb.v // Copyright(c) 2005 Lattice Semiconductor Corporation. All rights reserved. //======...
/* * 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; template <typename T> inline int read(T &a) { a = 0; char c = getchar(), f = 1; while (c > 9 || c < 0 ) { if (c == - ) f = (~f) + 1; if (c == -1) return -1; c = getchar(); } while (c <= 9 && c >= 0 ) a = (a << 1) + (a...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { long long int n; cin >> n; if (n == 1 || n == 2) { cout << n << endl; return 0; } if (n % 2 == 1) { cout << (n * (n - 1) * (n - 2)) << endl; return 0; } if (n == 4 || n == 6) { ...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const int toN = 58; int pn, p[10000]; int n, a[10000], omask[10000]; int dp[110][1 << 18]; int ans[110][1 << 18]; bool isPrime(int n) { if (n == 2) return true; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return f...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; struct Node { long long x, y; } p[N]; int n; double ans, a, b, c, xx, x1, yy1, x2, x3, y2, y3, x, y; int tf; map<pair<long long, long long>, int> f; inline double dis(Node a, Node b) { return sqrt((a.x - b.x) * (a.x - b.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 double pi = acos(-1.0); const int inf = (int)1e9; const long long int infll = (long long int)1e18; const double inf1 = 1e-9; const int ss = (int)1e6 + 3; const int base = inf; bool pred(const pair<int, int>& i, const pair<int, int>& j) { if (i.firs...
////////////////////////////////////////////////////////////////////////////////// // NPCG_Toggle_BNC_P_program for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Ilyong Jung <> // Yong Ho Song <> // // This file is part of Cosmos OpenSS...
#include <bits/stdc++.h> using namespace std; int n, c[8005][8005], fal[8005], dp[8005], len[8005]; char s[8005]; void Init(char *s, int n, int *c) { fal[1] = 0, fal[2] = 1; for (int i = 2; i <= n; i++) { int j = fal[i]; while (j && s[i] != s[j]) j = fal[j]; fal[i + 1] = j + 1; } ...
#include <bits/stdc++.h> using namespace std; int k, n, x[10000], y[10000], z[10000], ans, xx[10000], yy[10000], r, la[10][10000], d[10000]; bool flag[10000], ff[10000]; struct lsg { int x, y; } a[10000], b[10000]; int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); } bool dfs(int l) { ...
`define PROGRAM_BINARY "instr.hex" module clk_and_rst_n; parameter CLK_INIT_VALUE=1; parameter HALF_CLOCK_PERIOD=5; parameter CYCLES_LIMIT=100000; reg clk, rst_n; wire halt; wire [15:0] PC_plus_1; integer total_cycles; cpu WISC_S14 (.clk(clk), .rst_n(rst_n), .hlt(halt), .pc(PC_plus_1)); in...
#include <bits/stdc++.h> using namespace std; void solve() { int n, k; cin >> n >> k; int *arr = new int[n]; for (int i = 0; i < n; i++) cin >> arr[i]; int res = 0; for (int i = 0; i < n - 1; i++) { int k1 = arr[i] + arr[i + 1]; if (k1 < k) { arr[i + 1] += k - k1; ...
/** * 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 nmax = 1010; const int inf = 1000000007; int n; pair<int, int> a[nmax]; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i].first >> a[i].second; long double ans = 1e15; a[n + 1] = a[1];...
/* * Wishbone Flash RAM core for Altera DE0 board * 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;...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; int floor[n][2 * m]; for (int i = 0; i < n; i++) { for (int j = 0; j < 2 * m; j++) { cin >> floor[i][j]; } } int count = 0; for...
#include <bits/stdc++.h> using namespace std; class Node { set<int> adj; public: bool isLeave() const { return adj.size() == 1; } void add(int v) { adj.insert(v); } void remove(int v) { adj.erase(v); } int front() const { return *adj.begin(); } }; const int N = 100001; Node neighbors...
#include <bits/stdc++.h> using namespace std; struct node { int h, s, preh, pres, vis, water, sec; } n[400010][4]; int m, k, p, hh; char c; queue<node> q; int main() { scanf( %d%d , &m, &k); getchar(); for (int i = 1; i <= m; i++) { scanf( %c , &c); n[i][1].vis = n[i][2].vis = ...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; template <class e, class t, int N> std::basic_istream<e, t>& operator>>(std::basic_istream<e, t>& in, const e (&literal)[N]) { std::array<e, N - 1> buffer; in >> buffer[0]; if (N > 2) in...
#include <bits/stdc++.h> using namespace std; const int N = 1000000, M = 1000000007, D3 = (M + 1) / 3; int T, n, m; int pd[N + 5], pr[N], pn, phi[N + 5]; int f[N + 5], s0[N + 5], s1[N + 5], s2[N + 5]; void init() { phi[1] = 1; for (int i = 2; i <= N; i++) { if (!pd[i]) phi[i] = i - 1, pr[++pn]...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; int cnt = 0; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n - 1; i++) { if (a[i] == 0) { if (a[i + 1] == 1 && a[i - 1] == 1) { if (i + 2 < n) { if (a[i + ...
#include <bits/stdc++.h> using namespace std; long long fact(int x) { long long ans = 0; while (x > 0) { ans += x; x--; } return ans; } int main() { int n; cin >> n; vector<vector<char> > a(n, vector<char>(n)); for (int i = 0; i < n; i++) for (int j = 0; j < n; ...
#include <bits/stdc++.h> using namespace std; const long long INF = 2000000000LL; const long double EPS = 1e-9; vector<pair<int, int> > clear(vector<pair<int, int> > v) { vector<pair<int, int> > ret; int tox = v[1].first; int x = v[0].first, y = v[0].second; while (x <= tox) { ret.push_bac...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2005 by Wilson Snyder. module t (clk); input clk; reg [0:0] d1; reg [2:0] d3; reg [7:0] d8; wire [0:0] q1; wire [2:0] q3; wire [7:0] q8; // verilator lint_o...
//----------------------------------------------------------------------------- // File : instruction_decoder.v // Creation date : 16.05.2017 // Creation time : 09:02:07 // Description : // Created by : TermosPullo // Tool : Kactus2 3.4.106 32-bit // Plugin : Verilog generator 2.0e // This file was gener...
// 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 : Fri Dec 2 16:43:55 2016 // Host : chinook.andrew.cmu.edu running 64-bit Red H...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const int kMod = 998244353; int inv(int b) { int e = kMod - 2; int r = 1; while (e) { if (e ...
#include <bits/stdc++.h> using namespace std; struct ed { int a, b, w; } p[600010]; int n, m, fa[600010], d[600010], ans; bool cmp(ed a, ed b) { return (a.w > b.w); } int gf(int x) { return (fa[x] != x) ? fa[x] = gf(fa[x]) : x; } int main() { cin >> n >> m; for (int i = 1; i <= m; i++) cin >> ...
#include <bits/stdc++.h> using namespace std; int a[100010], b[100010], ja[100010]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; ja[a[i]] = i; } for (int i = 2; i <= n; i++) { if (ja[i] > ja[i - 1]) b[i] = 1; else b[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 la...
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
/* * 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 N = 2e5 + 5; const int MOD = 1000000007; long long power(long long a, long long n, long long m) { if (n == 0) return 1; long long p = power(a, n / 2, m); p = (p * p) % m; if (n % 2) p = (p * a) % m; return p; } int fact[N]; int if...
/** * The ps2 protocol is here http://www.computer-engineering.org/ps2protocol/ */ module ps2controller ( input clk, input reset, input i_clock, input i_data, output scan_ready, output [7:0] scan_code ); reg [9:0] buffer; reg [3:0] counter; reg sample_timer_active; reg rea...
/** * 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; vector<int> a(n); map<long long, vector<pair<int, int>>> d; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { long long sum = 0; for (int j = i; j < n; j++) { sum += a[j]; ...
// Copyright 2007 Altera Corporation. All rights reserved. // Altera products are protected under numerous U.S. and foreign patents, // maskwork rights, copyrights and other intellectual property laws. // // This reference design file, and your use thereof, is subject to and governed // by the terms and conditions...
#include <bits/stdc++.h> using namespace std; int T, n, x; int main() { scanf( %d , &T); while (T--) { scanf( %d%d , &n, &x); printf( %d n , 2 * x); } return 0; }
#include <bits/stdc++.h> using namespace std; long long date(int y, int m, int d) { if (m < 3) y--, m += 12; return (long long)365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306; } int main() { int y1, y2, m1, m2, d1, d2; scanf( %d:%d:%d , &y1, &m1, &d1); scanf( %...
#include <bits/stdc++.h> using namespace std; vector<long long> adj[100001]; long long vis[100001]; long long level[100001]; long long nodes[100001]; void bfs(long long s) { queue<long long> q; q.push(s); vis[s] = 1; while (!q.empty()) { long long f = q.front(); q.pop(); fo...
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; vector<ll> prime_factors(ll num) { vector<ll> ans; while (num % 2) { ans.push_back(2); num /= 2; } for (int i = 3; i * i <= num; i += 2) { while (num % i == 0) { ans.push_back(i)...