text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; inline int read() { int ans = 0; char ch = getchar(); while (!isdigit(ch)) { ch = getchar(); } while (isdigit(ch)) { ans = (ans << 3) + (ans << 1) + (ch ^ 48), ch = getchar(); } ans = ans + 0 + 0; return ans; } int first[1...
// 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 : Mon Feb 13 12:48:47 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; long long int T = 1, inf = 10000000000; bool check(long long int n) { long long int flag = 1; while (n > 0) { if (n % 10 != 4 && n % 10 != 7) { flag = 0; break; } n /= 10; } return flag; } int main() { ios::syn...
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2018.2 // Copyright (C) 1986-2018 Xilinx, Inc. All Rights Reserved. // // =========================================================== `timescale 1 ns / 1 ps ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 201001; const int MAXK = 51; const double inf = 1e100; const double eps = 1e-10; int K, N; int tab[MAXN]; long long sum[MAXN]; double res[MAXN]; double odw[MAXN]; double dp[MAXK][MAXN]; struct Pt { double x, y; }; int ccw(con...
/* * 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 law...
#include <bits/stdc++.h> using namespace std; const int maxN = 1000009; map<string, int> mapa; int n, m, k, a, parent[maxN], used[maxN], rozmiar[maxN], centr[maxN], q; vector<int> graf[maxN]; string s, s1; void DFS(int start) { used[start] = 1; for (int i = 0; i < graf[start].size(); i++) { ...
#include <bits/stdc++.h> #define endl n #define IOS ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr) using namespace std; typedef long long LL; typedef pair<int, int> PII; const int maxn = 1e3 + 5; string input; int cnt[maxn], mx; double a, b; inline double randrand(){ ...
/** * 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; int n, m, f = 0; cin >> n >> m; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == # ) f++; else f = 0; if (f >= m) { cout << NO ; return 0; } } cout << YES ; ...
#include <bits/stdc++.h> using namespace std; void fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } long long gcd(long long a, long long b) { if (b == 0) return a; else gcd(b, a % b); } long long lcd(long long a, long long b) { return (a * b) / gcd(a, b)...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int v[3005], inv = 0, n; double sol; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> v[i]; for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) if (v[i] > v[j]) inv++; sol = double(inv) - inv / 2 + (inv / 2) * 3.0; ...
#include <bits/stdc++.h> void out(int x) { if (x) { std::cout << x << std::endl; } else { std::cout << Impossible << std::endl; } exit(0); } bool string_is_palindorome(const std::string& s) { for (int i = 0, j = s.size() - 1; i < j; i++, j--) if (s[i] != s[j]) return false;...
#include <bits/stdc++.h> int main() { int n, x, y, z, sum1 = 0, sum2 = 0, sum3 = 0; scanf( %d , &n); while (n--) { scanf( %d %d %d , &x, &y, &z); sum1 = sum1 + x; sum2 = sum2 + y; sum3 = sum3 + z; } if (sum1 == 0 && sum2 == 0 && sum3 == 0) printf( YES ); else ...
module tenv_descstd_device(); //IFACE reg[7:0] bNumConfigurations=8'h00; reg[7:0] iSerialNumber=8'h00; reg[7:0] iProduct=8'h00; reg[7:0] iManufacturer=8'h00; reg[15:0] bcdDevice=16'h0000; reg[15:0] idProduct=16'h0000; reg[15:0] i...
#include <bits/stdc++.h> using std::list; const int N = 128; struct car { int coord, length, req; }; list<car> cars; int InsertCar(int length, int req, int b, int f) { list<car>::iterator i = cars.begin(), j = ++cars.begin(); int from, to; while (j != cars.end()) { from = i->coord + i-...
#include <bits/stdc++.h> using namespace std; int n, a[1010], b[1010], cnt, x[1010], y[1010], z[1010], w[1010]; int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); for (int i = 1; i <= n; ++i) scanf( %d , &b[i]); for (int i = 1; i <= n; ++i) { if (a[i] == i && b[i]...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 9; const int Mod = 1e9 + 7; inline int dcmp(double x) { if (fabs(x) <= 1e-9) return 0; return x < 0 ? -1 : 1; } inline int scan() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == -...
#include <bits/stdc++.h> using namespace std; int const maxn = 4e6; int tr01[maxn][2], x; int len, check[maxn], n, tot; void insert(int x) { int ex, v = 0; for (int i = 29; i >= 0; i--) { ex = !!(x & (1 << i)); if (tr01[v][ex]) v = tr01[v][ex]; else { tr01[v][ex] = ++...
#include <bits/stdc++.h> using namespace std; void run(); signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(3); srand(42); run(); } template <typename T1, typename T2> bool mini(T1 &a, const T2 &b) { if (a > b) { a = b; ...
// (C) 2001-2017 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; int main() { int n, m, c, b; long ans = 0; cin >> n >> m; long a[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 0; i < m; i++) { cin >> c >> b; ans += min(a[c], a[b]); } cout << ans; }
module Sec6_SM( //input [7:0] data, input clk_i, input reset_n, output reg [2:0] sel //output [6:0] segments ); reg [1:0] state; reg [1:0] state_next; reg [3:0] num_int; //Internal number storage parameter S0 = 2'b00; //Disp Digit 1 parameter S1 = 2'b01; //Disp Digit 2 parameter S2 = 2'b10; //Disp...
/** * 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...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `ifdef OVL_ASSERT_ON wire xzcheck_enable; wire psl_valid_test_expr; reg xzdetect_bit; `ifdef OVL_XCHECK_OFF assign xzcheck_enable = 1'b0; `else `ifdef OVL_IMPLICIT_XCHECK_OFF assign xzc...
/******************************************************************************* * Module: simul_axi_master_wraddr * Date:2014-03-24 * Author: Andrey Filippov * Description: Simulation model for AXI write address channel * * Copyright (c) 2014 Elphel, Inc.. * simul_axi_master_wraddr.v is free software; you...
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000 + 7; const double esp = 1e-13; struct node { int x, y; bool operator<(const node &op) const { return op.x > x || (op.x == x && op.y > y); } } a[2000 + 10]; int h, w, n; long long res[2000 + 10], gt[200000 + 10...
#include <bits/stdc++.h> using namespace std; int main() { long long m, n, p[30], ans; cin >> m >> n; for (__typeof(0) i = 0; i <= n - 1; i++) { cout << 1 n ; fflush(stdout); cin >> ans; if (ans == 0) return 0; if (ans == -1) p[i] = 0; else p[i] = 1; ...
module testbench_BoothPPG_32R4_NORM(); reg[31:0] mulcand; reg[2:0] r4input; reg sign; wire[33:0] pp; reg[33:0] expectPP; task check(input [31:0]cand); reg[3:0] i; reg errorFlag; begin errorFlag = 0; mulcand = cand; sign = 1; for(i = 4'b0;i <= 4'b0111; i = i+1) begin ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 1; int plot[MAX], n, k; void input() { cin >> n >> k; for (int i = 1; i <= n; i++) scanf( %d , &plot[i]); } int main() { input(); int res = 0, k1 = 0, k2 = 0; for (int i = 1; i <= n; i++) { if (plot[i] != k1) k2++;...
// $Id: c_regfile.v 1922 2010-04-15 03:47:49Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of sour...
#include <bits/stdc++.h> using namespace std; long long a[400001], b[400001]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); unsigned n; cin >> n; for (unsigned i = 1; i <= n / 2; ++i) cin >> b[i]; a[1] = 0; a[n] = b[1]; for (unsigned i = 2; i <= n / 2; ++i) { if (b[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 n, r; int x[105], y[105]; vector<pair<int, int> > pos, neg; bool cmp(pair<int, int> p1, pair<int, int> p2) { return p1.first + p1.second > p2.first + p2.second; } int main() { cin >> n >> r; for (int i = 0; i < n; i++) { scanf( %d%d , &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> #pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( -Ofast ) using namespace std; void rearrange(long long arr[], long long n) { long long temp[n]; long long small = 0, large = n - 1; long long flag = true; for (long long i = 0; i < n;...
module automatic_events3(); reg [1:0] Source; initial begin Source[0] = 1'b0; forever begin #20 Source[0] = 1'b1; #20 Source[0] = 1'b0; end end initial begin Source[1] = 1'b0; #15; forever begin #10 Source[1] = 1'bx; #10 Source[1] = 1'b1; #10 Source[1] = 1'bx; #10 Source[1] = 1'b0...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; char x; int min, max; cin >> x >> min >> max; if (min > max) { swap(min, max); } for (int i = 0; i < n - 1; i += 1) ...
#include <bits/stdc++.h> using namespace std; int pri[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, -1}; long long mo[5] = {223092870ll, 2756205443ll, 907383479ll, 42600829ll, 97ll}; int N, M, d, t, len, i, j, u; int b[100]; long ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1 << 23; bool a[maxn]; bool vis[maxn]; int n, m, x; void dfs(int x) { if (vis[x]) return; vis[x] = true; for (int i = 0; i <= n; i++) if (x & (1 << i)) dfs(x ^ (1 << i)); if (a[x]) dfs((1 << n) - 1 - x); } int main() { ...
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1); long long a[200002] = {}; long long b[200002] = {}; long long c[200002] = {}; string s = , ss = ; long long n, m, k, w; long long ans, ans1; long long mod = 1e9 + 7; int main() { cin.tie(0); cin.sync_with_stdi...
Require Import List. Require Import ZArith. Require Import Bool. Require Import sort_lectures. (* Inserts an element in to a sorted list *) Function insert (x : Z) (lst : list Z) := match lst with | nil => x :: nil | hd :: tl => if (x <=? hd)%Z then x :: hd :: tl else hd :: insert x tl end. (* Ins...
// Copyright (c) 2014 Takashi Toyoshima <>. // All rights reserved. Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. `timescale 100ps/100ps module ArbitorTest; wire [1:0] w_grant_2; wire [3:0] w_grant_4; reg [3:0] r_request; reg r_error; FixedPr...
module xyz #(parameter int FOO=1, BAR=2, parameter logic [5:0] BLUP=3, ZOT=4, parameter LDWRDS=5) ( input x1, x2, input int i1, i2, input logic [5:0] i3, i4, input i5, output y); endmodule module pdq; input x; output y; parameter...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; const int INF = 0x7f7f7f7f; const double pi = 4.0 * atan(1.0); int cases; struct Segment_Tree { long long lazy[MAXN << 2]; long long data[MAXN << 2]; long long flag[MAXN << 2]; void pushup(int o) { data[o] = data[(o...
#include <bits/stdc++.h> using namespace std; const int N = 138; int n, Ans, x, y, z, GG[N][N][5][5]; int main() { memset(GG, -63, sizeof(GG)); cin >> n; int i, j, k, p; for (i = 1; i <= n; ++i) { cin >> x >> y >> z; GG[i][i][z][x] = GG[i][i][x][z] = y; } for (i = n; i >= 1; ...
#include <bits/stdc++.h> using namespace std; int perm[55]; int main() { int n; long long m; scanf( %d%lld , &n, &m); m--; int l = 1; int r = n; for (long long i = n - 2; i >= 0; i--) { if (m & (1LL << i)) { perm[r] = n - 2 - i + 1; r--; } else { per...
#include <bits/stdc++.h> using namespace std; const int maxn = 110; string s[maxn]; int cur[maxn], c[maxn]; int n, m, ans = 0; void dfs(int x) { if (x == n) { int flag = 1; for (int i = 1; i <= m; i++) if (cur[i] - c[i]) flag = 0; ans += flag; return; } for (char ...
//Com2DocHDL /* :Project FPGA-Imaging-Library :Design WindowGenerator :Function Generate window. The lowest "color_width" bits of "out_data" is the top left corner pixel of the window! In pipeline mode, it will give the first output after window_width / 2 + 1 cycles while the input enable. In req-ack mode, before ...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:102400000,102400000 ) template <class T> void chkmax(T &a, T b) { if (a < b) a = b; } template <class T> void chkmin(T &a, T b) { if (a > b) a = b; } const int inf = 0x3f3f3f3f; const long long linf = 2e18 + 100; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); int t; cin >> t; while (t--) { int n, x, y; cin >> n >> x >> y; cout << max(min(n, x + y - n + 1), 1) << << min(x + y - 1, n) << endl; ...
#include <bits/stdc++.h> using namespace std; long long a[100005], b; int n, k; pair<long long, int> pvec[100005]; int solve() { for (int i = 0; i < n - 1; i++) pvec[i] = make_pair(a[i], i + 1); sort(pvec, pvec + n); reverse(pvec, pvec + n); long long total = 0; int ans = n; for (int 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; const int inf = 0x3f3f3f3f; const int maxn = 132222; const long long mod = 1000000007; char s[maxn]; int main() { int n; cin >> n; cin >> s + 1; int len = strlen(s + 1); int l = -1, r = -1; for (int i = (1); i < (len + 1); i++) { if...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000 * 1000 * 1000 + 7; const int INF = 2000 * 1000 * 1000; const double EPS = 1e-9; const double pi = acos(-1.0); template <typename T> inline T sqr(T n) { return (n * n); } long long gcd(int a, int b) { while (a && b) { a %=...
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; string s; cin >> s; vector<string> all; for (long long i = 0; i <= 9; i++) { all.push_back(s); for (char &c : s) if (c == 9 ) c = 0 ; else c++; } stri...
#include <bits/stdc++.h> using namespace std; int N, M; long long f[155][155][155][2][2], g[155][155][2][2]; void doit() { scanf( %d %d , &N, &M); int ans = 0; for (int i = 1; i <= N; i++) { for (int j = 1; j <= M; j++) for (int k = j; k <= M; k++) { f[i][j][k][0][0] = i == 1...
//================================================================================================== // Filename : RKOA_OPCHANGE.v // Created On : 2016-10-26 23:25:59 // Last Modified : 2016-10-31 16:28:45 // Revision : // Author : Jorge Esteban Sequeira Rojas // Company : Instituto Tec...
/* 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,...
#include <bits/stdc++.h> using namespace std; const int N = 85; long long fibo[N + 5]; long long dp[N + 5][3][3]; long long arr[N + 5]; void pre() { fibo[0] = 1, fibo[1] = 2; for (int i = 2; i <= N; i++) { fibo[i] = fibo[i - 1] + fibo[i - 2]; } } long long solve(int idx, int cur1, int ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; scanf( %d %d , &N, &M); int beat[N + 5], i; memset(beat, 0, sizeof(beat)); set<int> S; for (int i = 1; i <= N; i++) S.insert(i); int L, R, W; set<int>::iterator it; while (M--) { scanf( %d %d %d , &L, &R, ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { out ...
#include <bits/stdc++.h> using namespace std; int arr[100005]; int brr[100005]; char s[1234][1234]; int vis[1234][1234]; int has[1234][1234]; int f[1234567]; int n, m, c, g; void dfs(int x, int y) { if (x < 0 || y < 0 || x == n || y == m || vis[x][y] || s[x][y] == * ) return; if (s[x][y] == ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string c; cin >> c; for (int i = 1; i <= n; i++) if (n % i == 0) reverse(c.begin(), c.begin() + i); cout << 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 la...
#include <bits/stdc++.h> int main() { int h, w, bh, bw, th, tw; long long ar, ba; bh = bw = ba = 0; scanf( %d %d , &h, &w); int tmp; for (int i = 30; i >= 0; i--) { tmp = (1 << i); if (tmp <= w) { long long x = (long long)tmp * 8; long long y = (long long)tmp * 125;...
#include <bits/stdc++.h> using namespace std; int const mod = 1e9 + 7; inline void SAFE_ADD(int& a, int b) { a += b; if (a >= mod) a -= mod; } struct Matr { vector<vector<int> > _data; Matr(int sz) : _data(sz, vector<int>(sz, 0)) {} void ones() { for (int i = 0; i < _data.size(); ++i...
#include <bits/stdc++.h> using namespace std; int main() { long long n, dem = 0; cin >> n; dem = n / 2520; cout << dem; }
#include <bits/stdc++.h> const double PI = acos(-1); using namespace std; const int mod = 1e9 + 7; const long long oo = 0x3f3f3f3f; const int nn = 1e2 + 15; vector<pair<int, int>> gr[nn], shifts; map<char, int> vis; long long get_distance(pair<int, int> a, pair<int, int> b) { return ((a.first - b.fi...
#include <bits/stdc++.h> using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } inline int readInt() { int x; scanf( %d , &...
#include <bits/stdc++.h> #define all(x) (x).begin(),(x).end() #define sz(x) int(x.size()) using namespace std; using ll = long long; using pii = pair<int, int>; template<typename... T> void rd(T&... args) {((cin>>args), ...);} template<typename... T> void wr(T... args) {((cout<<args<< ), ...); cou...
/* * 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 n, x; bool vis[300010]; int a[300010]; int ans = 1; int main() { scanf( %d , &n); x = n; printf( %d , ans); for (int i = 1; i < n; i++) { scanf( %d , &a[i]); vis[a[i]] = 1; bool p = 0; bool v = 0; while (vis[x])...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2009 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; //Simple debug: //wire [1:1] wir_a ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<long long> a(n); vector<long long> v; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { v.push_back(abs(a[i] - a[i + 1])); } long long ans = a[n - 1] - a[0]; ...
// 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> namespace io { int F() { int F = 1, n = 0; char ch; while ((ch = getchar()) != - && (ch < 0 || ch > 9 )) ; ch == - ? F = 0 : n = ch - 0 ; while ((ch = getchar()) >= 0 && ch <= 9 ) n = n * 10 + ch - 0 ; return F ? n : -n; } long long G() { lo...
#include <bits/stdc++.h> using namespace std; const int s = 1000000; int a[1000001]; bool belongs[1000001]; bool used[1000001]; vector<int> ans; int main() { int n; cin >> n; for (int i = 0; i <= s; i++) belongs[i] = used[i] = false; for (int i = 0; i < n; i++) { scanf( %i , &a[i]); ...
#include <bits/stdc++.h> using namespace std; long long bigmod(long long base, long long power, long long mod) { if (power == 0) return 1; else if (power % 2 == 1) { long long p1 = base % mod; long long p2 = (bigmod(base, power - 1, mod)) % mod; return (p1 * p2) % mod; } else if ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Iztok Jeras. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/); logic [3:0] array_simp [1:0] [3:0]; // big endian array int irep[1:2][1:6]; initi...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module Computer_Datapath_RegisterFile( output reg [WORD_WIDTH-1:0] ADDR_bus_out, output reg [WORD_WIDTH-1:0] B_data_out, input [CNTRL_WIDTH-1:0] CNTRL_bus_in, input [WORD_WIDTH-1:0] D_bus_in, input CLK, input RST ); parameter WORD_WIDTH = 16; parameter DR_WIDTH = 3; parameter SA_WIDTH = DR_WIDTH; parameter SB...
//ft_fifo_tester.v /* 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 righ...
/* * 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 M = 2e6 + 10; int a[M], b[M], c[M], d[M], e[M], f[M]; vector<int> T[M]; struct NTT { static const int G = 3, P = 998244353; int N, na, nb, w[2][M], rev[M]; long long kpow(long long a, int b) { long long c = 1; for (; b; b >>= 1, a...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 233; const int INF = numeric_limits<int>::max(); void read(int &x) { x = 0; char ch = getchar(); int f = 1; while (!isdigit(ch)) (ch == - ? f = -1 : 0), ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar...
#include <bits/stdc++.h> using namespace std; double n, h; char c[10]; double ans; double ksm(double x, long long y) { double maretu = 1.0; for (; y; y >>= 1) { if (y & 1) { maretu *= x; } x *= x; } return maretu; } int main() { scanf( %s , c); if (c[0] ==...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's IC TAGs //// //// //// //// This file is part of the OpenR...
/** * 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 t, n; cin >> t; while (t--) { cin >> n; cout << n / 2 << endl; } }
//****************************************************************************/ // ARTY CM0 Design Start // RTL IMPLEMENTATION, Synchronous Version // // Copyright (C) yyyy Ronan Barzic - // Date : Tue Nov 10 23:56:32 2015 // // This program is free software; you can redistribute it and/or // modify...
#include <bits/stdc++.h> using namespace std; int t, i; int c[32650]; void ciu(); unsigned long long int p, q; unsigned long long int minim = 0xffffffffffffffff; vector<unsigned long long int> v; int main() { cin >> t; ciu(); while (t--) { minim = 0xffffffffffffffff; cin >> p >> ...
// (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; inline int scan() { int x; scanf( %d , &x); return x; } struct data { int first; int edge_used; int prev; data() { first = 0; edge_used = 0; prev = 0; } }; vector<pair<int, int> > v[100005]; bool edge[100005] =...
/* * 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...
`timescale 1ns/1ps module BigSDRAMSim; reg clock0; reg clock180; reg clock270; reg clock2x0; reg clock2x90; reg clock2x180; reg reset; wire [7:0] leds; wire ddr_cke; wire ddr_csn; wire ddr_rasn; wire ...
`include "hglobal.v" `default_nettype none `define NS_NUM_TEST 7 `define NS_TEST_MIN_ADDR 1 `define NS_TEST_MAX_ADDR 14 `define NS_TEST_REF_ADDR 23 `define NS_NUM_DBG_CASES 12 module test_top #(parameter PSZ=`NS_PACKET_SIZE, ASZ=`NS_ADDRESS_SIZE, DSZ=`NS_DATA_SIZE, RSZ=`NS_REDUN_SIZE )( input i_clk, ...
#include <bits/stdc++.h> using namespace std; int main() { int t, i, x; cin >> t; while (t--) { int angle; cin >> angle; x = 360 % (180 - angle); if (x == 0) { cout << YES << endl; } else cout << NO << endl; } return 0; }