text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int n, m, st, ed, i, j, ep = 1, h[1005]; long long d[1005][1005], dis[1005]; queue<int> q; struct node { int y, ne, v; } e[1000005]; void add(int a, int b, int v) { e[ep].y = b; e[ep].v = v; e[ep].ne = h[a]; h[a] = ep; ep++; } int m...
#include <bits/stdc++.h> using namespace std; int a[111111], b[111111]; vector<int> id[111111]; int main() { int N, M; cin >> N >> M; for (int i = 1; i <= N; i++) id[i].clear(); for (int i = 0; i < M; i++) scanf( %d , a + i); long long tot = 0; for (int i = 1; i < M; i++) { if (a[i...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-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 ...
//***************************************************************************** // (c) Copyright 2008-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 // ...
#include <bits/stdc++.h> using namespace std; int n; bool isPrime(int x) { for (int i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } int main() { cin >> n; for (int i = (1); i <= (1000); i++) if (!isPrime(n * i + 1)) { cout << i; 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 law...
#include <bits/stdc++.h> using namespace std; int n, CountDog[400]; char x[100005]; int main() { scanf( %d , &n); if (n == 1) { printf( Yes ); return 0; } for (int i = 1; i <= n; i++) { cin >> x[i]; CountDog[x[i]]++; } for (int i = 1; i <= n; i++) if (CountD...
#include <bits/stdc++.h> using namespace std; vector<char> sequ; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; long long num; cin >> n; vector<long long> a(n); vector<long long> b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (in...
//----------------------------------------------------------------------------- //-- Generador de tonos de 1Khz, 2Khz, 3Khz y 4Khz //-- (C) BQ. August 2015. Written by Juan Gonzalez //----------------------------------------------------------------------------- //-- GPL license //---------------------------------------...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:18:56 06/07/2015 // Design Name: UART_IP // Module Name: /home/sadique/Work/Verilog/Spartan6/USB-uart/uart_test.v // Project Name: USB-uart // Target Device: //...
/** * 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; set<int> d; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t, n, a, k = 0; cin >> t >> n; int x[200] = {}; for (int i = 1; i <= t; ++i) { cin >> a; if (x[a] >= 1) continue; else {...
// (C) 2001-2015 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 doc...
/* * Milkymist 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 distribut...
#include <bits/stdc++.h> using namespace std; using INT = long long; const int NN = 111; string tar; string s[NN]; int n; void dfs(int len) { if (!len) { for (int i = 1; i <= n; i++) { for (int j = 0; j < s[i].length(); j++) { int f = 1; for (int k = j; k < s[i].lengt...
/** * 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; char str[25]; char times[6] = {4, 5, 6, 3, 2, 1}; int main() { scanf( %s , str); int len = strlen(str); char seat = str[len - 1]; long long rows = 0; for (int i = 0; i < len - 1; i++) { rows = rows * 10; rows += str[i] - 0 ; } ...
// -- (c) Copyright 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 prope...
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int M = 20; pair<int, int> dp[M][(1 << 10)]; int a[M], K, ten[M]; int Count(int st) { int rnt = 0; while (st) st &= st - 1, rnt++; return rnt; } pair<int, int> f(int pos, int st, int lead, int limit) { if (pos...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> inline int read() { int x = 0, f = 0; register char ch = getchar(); for (; ch < 48 || ch > 57; ch = getchar()) f |= ch == - ; for (; ch > 47 && ch < 58; ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return f ? ~x + 1 : x; } using namespace std; int t[70...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int t, a, b, c, d, k; cin >> t; while (t--) { cin >> a >> b >> c >> d >> k; int x = a / c; int y = b / d; if (a % c) x++; if (b % d) y++; if (x + y <= k) { cout << x << << k...
#include <bits/stdc++.h> using namespace std; int w, b; int main() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { char s; cin >> s; if (s == Q ) { w += 9; } if (s == R ) { w += 5; } if (s == B ) { w +...
/* * 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 "config.inc" module gammaconv( input clock, input [4:0] gamma_config, input in_wren, input [`RAM_WIDTH-1:0] in_wraddr, input [7:0] in_red, input [7:0] in_green, input [7:0] in_blue, input in_starttrigger, output reg wren, output reg [`RAM_WIDTH-1:0] wraddr, o...
#include <bits/stdc++.h> using namespace std; inline char nc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline void read(int &x) { char c = nc(), b = 1; for (; !(c...
#include <bits/stdc++.h> using namespace std; const int mn = 2e5 + 10; int bit[mn]; void update(int a, int b) { for (; a < mn; a += a & -a) bit[a] += b; } int query(int a) { int b = 0; for (; a; a -= a & -a) b += bit[a]; return b; } int a[mn], v[mn], n; void go() { int i; for (...
#include <bits/stdc++.h> using namespace std; int main() { double n, t, x = 1.000000011; scanf( %lf%lf , &n, &t); double res = n * pow(x, t); printf( %.12lf , res); return 0; }
// -------------------------------------------------------------------- // Copyright (c) 2005 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time bas...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-7; const int MOD = 1e9 + 7; const long long INFLL = 0x3f3f3f3f3f3f3f3f; const int INF = 0x3f3f3f3f; const int MAXN = 4e5 + 5; char s[MAXN]; int vis[200], t[200]; int check(int n, int l) { int need = (l / 2) * n, cnt = 0; for (...
#include <bits/stdc++.h> using namespace std; const int maxn = (int)2e5 + 10; vector<int> res[maxn]; int main() { string s; cin >> s; stack<int> st, st2; int ma = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 1 ) { if (st.empty()) { cout << -1 << endl; ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int a[2020]; void solve() { int n, x, y; cin >> n >> x >> y; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); reverse(a, a + n); int c = 0; cout << a[x - 1] - a[x]; } int main() { ios::sync_with_st...
/** * 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) 2015 Jan Adelsbach <>. // All Rights Reserved. // // 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 optio...
#include <bits/stdc++.h> using namespace std; int v[1100][1100]; int main() { int n, k; cin >> n >> k; if (n > k + k) { cout << n * k << endl; for (int i = 1; i <= n; i++) { int t = k; for (int j = 1; j <= n; j++) if (i != j && !v[i][j] && !v[j][i] && t) { ...
#include <bits/stdc++.h> using namespace std; const long long N = 2000 * 100 + 1000; vector<long long> adj[N]; long long a[N], h[N], t[N]; bool mark[N]; long long f(long long p) { mark[p] = true; long long ans = h[p] * a[p]; t[p] = a[p]; for (auto q : adj[p]) if (mark[q] == false) { ...
#include <bits/stdc++.h> using namespace std; int fp(int abc, int parent[]) { if (parent[abc] == abc) return abc; int def = fp(parent[abc], parent); parent[abc] = def; return def; } void cycledmerge(vector<int> hub[], int n, int parent[]) { stack<int> urutan; for (int i = 0; i < n; i++) ...
interface automodport_if ( input logic clk, input logic rst_n ); //---------------------------------------------------------------------------------------- // Group: Signals logic req_val; logic [63:0] req_dat; logic req_credit; logic [1:0] rsp_cmd; logic [63:0] rsp...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int a1, a2, a3, b1, b2, b3, n, total = 0; cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3 >> n; if ((a1 + a2 + a3) % 5 == 0) { total = total + (a1 + a2 + a3) / 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 la...
/* * File: tb_top.v * Project: pippo * Designer: kiss@pwrsemi * Mainteiner: kiss@pwrsemi * Checker: * Description: * testbench for pippo-based system */ // synopsys translate_off `include "timescale.v" // synopsys translate_on `include "def_pippo.v" module tb_cbu_tasks(); reg ...
#include <bits/stdc++.h> using namespace std; const int N = 1000010; bitset<N> b; int p[N]; int cnt[N]; bool was[N]; int main() { int n, k; scanf( %d %d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , p + i); p[i]--; was[i] = false; } for (int i = 1; i <= n; i++)...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq * Copyright (C) 2007 Das Labor * * 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 Li...
/** * 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 = 1005; int n; vector<int> point[2]; vector<pair<long long, int> > area[2], vec[4]; long long query(int type, int i, int j, int k) { printf( %d %d %d %d n , type, i, j, k); fflush(stdout); long long res; scanf( %lld , &res); re...
#include <bits/stdc++.h> int main(void) { int stack[100000 + 1], sp = 0, c; stack[0] = 0 ; while (c = getchar(), c != n ) { if (c == stack[sp]) --sp; else stack[++sp] = c; } printf( %s n , sp == 0 ? Yes : No ); exit(EXIT_SUCCESS); }
#include <bits/stdc++.h> using namespace std; const double eps = 3e-5; double x, h, l; int main() { scanf( %lf , &x); for (double h = 1; h <= 10 + eps; h++) { if (h + eps < x) continue; l = h / (sqrt((h * h) / (x * x) - 1)) * 2.0; for (double q = 1; q <= 10 + eps; q++) if (l - ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; vector<int> fa; int n, m, q, g[300][300], x, y, c; int id(int x, int y) { return x * m + y; } int in(int x, int y) { return x >= 0 && y >= 0 && x < n && y < m; } int find(int x) { return fa[x] == x ? x : (fa[x] = find(fa[x])); } i...
#include <bits/stdc++.h> using namespace std; set<int> S; priority_queue<pair<int, pair<int, int> >, vector<pair<int, pair<int, int> > >, greater<pair<int, pair<int, int> > > > H; int i, j, k, n, a[222222], nl, nr, sz, aa, bb, u[222222], o; pair<int, pair<int, int> > pp; set<pair<int,...
#include <bits/stdc++.h> using namespace std; long long int n, m; long long int arr[300000]; vector<long long int> ans; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long int TESTS, q, a, b, l, r, c, k, p, h, w, x, y, z, xs, ys, t, f; long double d; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long q; cin >> q; while (q--) { long long n, m; cin >> n; cin >> m; if (m > n || m % 10 == 0) { cout << 0 << n ; continue...
#include <bits/stdc++.h> using namespace std; bool f1(pair<long long, long long> x, pair<long long, long long> y) { return x.first > y.first; } bool f2(pair<long long, long long> x, pair<long long, long long> y) { return x.second > y.second; } bool f3(long long x, long long y) { return x > y; } bo...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > ans; void merge(int l, int r, int lev) { if (lev == 0) { ans.push_back({l, r}); return; } int mid = (l + r) >> 1; merge(l, mid, lev - 1); merge(mid + 1, r, lev - 1); int j = mid + 1; for (int i = l; i <= ...
#include<iostream> #include<string.h> #include <fstream> #include <string> #include <vector> #include <iomanip> #include <cmath> #include <cstdlib> #include<map> #include <ctime> using namespace std; int main(){ long long int t; cin>>t; for(long long int mat=0;mat<t;mat=mat+1){ lon...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { unsigned long long a, b; cin >> a >> b; if (max(a, b) % min(a, b)) { cout << -1 << endl; continue; } int dem = 0; long long p = max(a, b) / min(a, b); while...
/** * 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...
/** * bsg_fpu_preprocess.v * * @author Tommy Jung */ `include "bsg_defines.v" module bsg_fpu_preprocess #(parameter `BSG_INV_PARAM(e_p ) , parameter `BSG_INV_PARAM(m_p ) ) ( input [e_p+m_p:0] a_i , output logic zero_o , output logic nan_o , output logic sig_nan_o , output logic infty...
#include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, vector<T> V) { os << [ ; for (auto v : V) os << v << ; os << ] ; return os; } template <class T> ostream &operator<<(ostream &os, set<T> S) { os << { ; for (auto s : S) os << s <...
#include <iostream> #include <cmath> #include <map> #include <string> #include <vector> #include <algorithm> #define int long long using namespace std; string s; int a, b, c; int n, m, k; vector<int>vec, vec2; int arr[4000000], mark[4000000]; signed main() { ios_base::sync_with_stdio(false)...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); map<long long int, long long int> mpp; long long int n; cin >> n; for (long long int i = 0; i < n; i++) { long long int x; cin >> x; mpp[__builtin_popcount(x)]++; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; long long arr[n + 5]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); long long mn = arr[0]; long long mx = arr[n - 1]; ...
#include <bits/stdc++.h> using namespace std; long long t, d, ct, q, ans, l, m, r, n, mx, mn, i, j, k, x, y, z, s; char ch; string ss = , str = ; map<pair<long long, long long>, long long> mp; set<long long> st; long long a[300003], b[300003]; vector<pair<long long, long long>> v; bool ask(long lo...
#include <bits/stdc++.h> using namespace std; int main() { int n, p1 = 0, p2 = 0; cin >> n; int mid[1000], index = 0; for (int i = 0; i < n; i++) { int a; cin >> a; if (a % 2 == 0) { for (int j = 1; j <= (a / 2); j++) { int t; cin >> t; p1 += t...
#include <bits/stdc++.h> using namespace std; int main() { int n, t = 1, i; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (i = 0; i < n - 1; i++) { if (a[i + 1] == a[i]) { t++; } else if (t > (n + 1) / 2) { cout << NO ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; map<long long, long long> mp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long n, m; cin >> n; vector<long long> v(n); for (int i = 0; i < n; ++i) { cin >> v[i]; if (mp.find(v[i]) ==...
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int n; long long sol(long long* data) { long long ans = 0, fang = 0, sum = 0; for (int i = 1; i <= n; i++) { ans += data[i] * data[i] * (i - 1); ans -= sum * data[i] * 2; ans += fang; fang += data[i] * data[i]...
/* Copyright (c) 2014-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, distri...
#include <bits/stdc++.h> using namespace std; int n, t; int ask(int r) { cout << ? << 1 << << r << endl; int ans; cin >> ans; return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); srand(time(0)); cin >> n >> t; vector<int> a(1, t); int inv = 0, rep...
#include <bits/stdc++.h> using namespace std; const int MAX = 500000; int a[MAX], last[MAX], prv[MAX], inSet[MAX], current[MAX]; int n, k; int main() { ios_base::sync_with_stdio(false); cin >> n >> k; memset(last, -1, sizeof(last)); memset(prv, -1, sizeof(prv)); for (int i = 0; i < n; i++)...
#include <bits/stdc++.h> using namespace std; const int M = 1001; int n, m, h, A[M], w, a; int main() { scanf( %d%d%d , &n, &m, &h); for (int i = 1; i <= m; i++) scanf( %d , &A[i]), w += A[i]; w--, n--; a = w - (A[h] - 1); if (n > w) { puts( -1 ); return 0; } if (n > a) {...
#include <bits/stdc++.h> long long int min(long long int x, long long int y) { return (x < y) ? x : y; } long long int max(long long int x, long long int y) { return (x > y) ? x : y; } long long int fastexpo(long long int base, long long int power) { long long int res = 1; while (power) { if (power ...
/* Copyright (c) 2014-2017 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, distri...
// synthesis VERILOG_INPUT_VERSION SYSTEMVERILOG_2005 // // This file is part of multiexp-a5gx. // // multiexp-a5gx 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 ...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; const long long llinf = 1e18 + 7; const double eps = 1e-15; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); int n, a[100001], k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; int i = n; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a == b) { cout << 0 << n ; continue; } if (a - b > 5) { int answ = 0; int cant = (a - b) / 5; answ = answ + cant;...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, n; cin >> n; long long int arr[n]; vector<long long int> vec[100010]; for (i = 0; i < n; i++) { cin >> arr[i]; vec[arr[i]].push_back(i); } long long int y = 0, d; for (i = 0; i < 100010; i++) {...
// Library - static, Cell - th22, View - schematic // LAST TIME SAVED: May 23 15:00:43 2014 // NETLIST TIME: May 23 15:01:15 2014 `timescale 1ns / 1ns module th22 ( y, a, b ); output y; input a, b; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "th22"; specparam CDS_VIEWNAME = ...
////////////////////////////////////////////////////////////////////// //// //// //// eth_rxstatem.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; int get(long long a) { if (a < 4) return 0; if (a < 16) return 1; if (a < 82) return 2; if (a < 6724) return 0; if (a < 50626) return 3; if (a < 2562991876) return 1; return 2; } int main() { int cur = 0; int n; cin >> n; ...
#include <bits/stdc++.h> using namespace std; int a[200100]; int sub[200100]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(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 la...
#include <bits/stdc++.h> using namespace std; int n, i, j, x, y, a[179000]; int main() { for (cin >> n >> x >> y, i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= n; i++) { for (j = max(1, i - x); j <= min(n, i + y); j++) if (i != j && a[j] <= a[i]) break; if (j > min(n, i + y)) break...
`ifdef cyclonev `define LCELL cyclonev_lcell_comb `define MAC cyclonev_mac `define MLAB cyclonev_mlab_cell `endif `ifdef cyclone10gx `define LCELL cyclone10gx_lcell_comb `define MAC cyclone10gx_mac `define MLAB cyclone10gx_mlab_cell `endif module __MISTRAL_VCC(output Q); MISTRAL_ALUT2 #(.LUT(4'b1111)) _TECHMAP_REPLAC...
`timescale 1ns / 1ps module control( input [5:0] opcode, input [5:0] special, input branch_eq, // result of comparison for conditional branch output reg [1:0] if_pc_source, output id_rt_is_source, // rt is source ...
/* * 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> const int MAXN = 1005; int a[MAXN]; int cnt[MAXN]; int main() { int n, k; while (scanf( %d%d , &n, &k) + 1) { memset(cnt, 0, sizeof(cnt)); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { ...
`include "lo_simulate.v" /* pck0 - input main 24Mhz clock (PLL / 4) [7:0] adc_d - input data from A/D converter pwr_lo - output to coil drivers (ssp_clk / 8) adc_clk - output A/D clock signal ssp_frame - output SSS frame indicator (goes high while the 8 bits are shifted) ssp_din - output SSP data to ...
#include <bits/stdc++.h> #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; void JIZZ(string output = ) { cout << output; exit(0); } const long double PI = 3.14159265358979323846264338327950288; const long double eps = 1e-13; const long long mod = ...
//***************************************************************************** // (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 /...
#include <bits/stdc++.h> using namespace std; int n, fwt[262144]; vector<int> a1, b1, c1, d1, e1, ans; void add(int x, int k) { for (; x < 262144; x += x & -x) { fwt[x] += k; } } int sum(int x) { int res = 0; for (; x; x -= x & -x) { res += fwt[x]; } return res; } int...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; int n, k; long long f[100009], g[100009]; vector<int> p; string s1, s2; int main() { cin >> s1 >> s2 >> k; int i; n = s1.size(); p.clear(); for (i = 1; i <= n; ++i) { if (s1 == s2) p.push_back(i - 1);...
#include <bits/stdc++.h> const double eps = 1e-4, pi = acos(-1.0); const int maxS = 1e3 + 13; const int maxT = 20; const long long MOD = 1e9 + 7; using namespace std; struct point { int x, y; }; struct rs { int x, y, z; }; int n, m, i, j, k, x, y, z, S, T, ii, s, t, l, r, pos, len; int tot...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k; cin >> n >> k; long long a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } std::map<long long, long long> m; for (int i = 0; i < ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009 Xilinx, Inc. // This design is confidential and proprietary of Xilinx, All Rights Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ /...
#include <bits/stdc++.h> using namespace std; bool win(long long a, long long b) { if (a > b) swap(a, b); if (a == 0) return false; if (!win(b % a, a)) return true; long long df = b - b % a; if (a % 2) return df % 2 == 0; else return df / a % (a + 1) % 2 == 0; } void solve() ...
/* * 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...