text
stringlengths
59
71.4k
/** * 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 long long INF = INT_MAX; void solve() { long long n; cin >> n; vector<long long> a(n); vector<long long> first(n, INF); vector<long long> last(n, -INF); for (long long i = 0; i < n; ++i) { cin >> a[i]; --a[i]; first[a[i]...
#include <bits/stdc++.h> using namespace std; vector<int> cities[100000], T[100000]; bool visited[100000]; int tin[100000], low[100000], tv[100000]; int up[100000][20]; map<pair<int, int>, int> b; int c = 0, n, l, m, k; void dfs1(int v, int p = -1) { visited[v] = true; tin[v] = low[v] = c++; ...
#include <bits/stdc++.h> using namespace std; int len = 0, coun = 0; bool visited[1000006]; vector<int> check; vector<int> grid[1000006]; void dfs(int v) { visited[v] = true; for (int i = 0; i < grid[v].size(); i++) { if (!visited[grid[v][i]]) { dfs(grid[v][i]); } } check...
/** * 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...
/** * 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 count = 0; bool YES = false; vector<string> record; int compare(vector<string> cards, int pile1, int pile2) { if (cards.at(pile1)[0] == cards.at(pile2)[0] || cards.at(pile1)[1] == cards.at(pile2)[1]) return 1; return 0; } void move(ve...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
//================================================================================================== // Filename : mux_switch.v // Created On : 2015-04-09 16:38:08 // Last Modified : 2015-05-24 21:01:14 // Revision : 1.0 // Author : Angel Terrones // Company : Universidad Simón Bolívar /...
#include <bits/stdc++.h> using namespace std; struct node { int x, y, time; }; char str[120][120]; int vis[102][102][102], n, m, ck = 0; void train(int p, int q, int cnt) { int time = 0, d = 0; for (int j = q; (j + cnt - 1) >= 0; j -= 2) { d = 0; int lim = cnt; if (j < 0) lim =...
/** * 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 const N = 13; int n, m, q; long long dp[N][1 << N]; struct lca { int u, v, c; }; struct edge { int u, v; }; vector<edge> edges; vector<lca> lcas; inline bool valid(int mask, int sub, int u, int v) { if (!(mask & (1 << u)) || !(mask & (1...
// // Copyright 2011 Ettus Research LLC // // 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 dis...
#include <bits/stdc++.h> using namespace std; int n; long long sum; struct myS { int index; long long v; myS(){}; myS(int index, long long v) : index(index), v(v){}; bool operator<(const myS& right) const { return v < right.v; } } a[200001]; bool dd[1000001]; vector<int> res; int mai...
#include <bits/stdc++.h> using namespace std; int n; char s[1000]; bool check_type() { int i; for (i = 1; s[i]; i++) { if (!isdigit(s[i]) && isdigit(s[i - 1])) return true; } return false; } void first() { int i, n = 0, m = 0; for (i = 0; !isdigit(s[i]); i++) n = 26 * n + s[i] ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 4, INF = 1e9; int sub[N], par[N], nn, level[N]; set<int> adj[N]; vector<int> ar[N]; void dfs(int n, int p) { for (auto i : ar[n]) if (i != p) level[i] = level[n] + 1, dfs(i, n); } void dfs1(int n, int p) { nn++; sub[n] =...
#include <bits/stdc++.h> using namespace std; struct node { int l, r; int num; } Treex[4000009], Treey[4000009]; map<int, int> vis; int i; int tot = 1; int Tot = 1; int x, y; char str[5]; void update_y(int ll, int rr, int c, int l, int r, int t) { if (ll <= l && r <= rr) Treey[t].n...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; sort(s.begin(), s.end()); cout << s; }
// File name : DebouncerWithoutLatch.v // Written by : Jianjian Song // debouncing an input switch // if (Switch==1) delay a bit and test again. // if (switch==1) output is 1 else output is 0 // Debouncing time is controlled by DelayLoop module `timescale 1ns / 1ps module DebouncerWithoutLatch(InputPulse, DebouncedOu...
#include <bits/stdc++.h> using namespace std; bool isprime(long long int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (long long int i = 5; i * i <= n; i += 6) { if (n % i == 0 || n % (i + 2) == 0) return false; } return true; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Hasan Hassan // // Create Date: 08/24/2015 04:50:25 PM // Design Name: // Module Name: SHDScheduler // Project Name: // Target Devices: // Tool Versions: // Description: // // Depende...
#include <bits/stdc++.h> using namespace std; bool check(string s) { for (int i = 0; i < s.size() - 1; i++) { if (s[i] == s[i + 1]) return false; } return true; } void solve() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == ? && i != 0 && i != s.size(...
#include <bits/stdc++.h> long long int power(int x, int y) { int i = 0; long long int result = 1; for (i = 0; i < y; i++) result = result * x; return result; } int main() { int r, d, r1; int n; int x, y; int i = 0; double dist = 0; int count = 0; double temp1, temp2; ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:50000000 ) using namespace std; int n, z = 0, x, y; int a[105]; bool f; int main() { scanf( %d , &n); if (n % 2 == 0 || n < 2) { printf( -1 n ); return 0; } for (int i = 1; i <= n; i++) scanf( %d , &a[i]); 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...
//Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2015.1 (lin64) Build Mon Apr 27 19:07:21 MDT 2015 //Date : Sat Aug 8 13:34:20 2015 //Host : edinburgh running 64-bit Ubuntu 15.04 //Command ...
#include <bits/stdc++.h> using namespace std; vector<int> num, con, a; vector<vector<int> > g(1000001); bool used[1000001]; void dfs(int v) { num.push_back(v); con.push_back(a[v - 1]); used[v] = true; if (g[v].empty()) return; for (int i = 0; i < g[v].size(); i++) if (!used[g[v][i]])...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_74x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ===============================...
/**************************************************************************** AddSub unit - Should perform ADD, ADDU, SUBU, SUB, SLT, SLTU is_slt signext addsub op[2] op[1] op[0] | Operation 0 0 0 0 SUBU 2 0 1 0 SUB 1 0 0 1 ADDU 3 ...
#include <bits/stdc++.h> using namespace std; double EPS = 1e-9; int INF = 2000000000; long long INFF = 8000000000000000000LL; double PI = acos(-1); int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1}; int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1}; inline string IntToString(int a) { char x[100]; sprintf(x, %...
#include <bits/stdc++.h> using namespace std; void think() { long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; i++) { cin >> a[i]; } long long ans = 0; unordered_map<long long, long long> mp; mp[a[0]]++; for (long long i = 1; i < n; i++) { lo...
/* * 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...
// // Copyright (c) 2002 Stephen Williams (steve at icarus.com) // // 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 (...
#include <bits/stdc++.h> using namespace std; int mx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}, my[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; int main() { ios::sync_with_stdio(false); int n, m; cin >> n >> m; char a[n + 2][m + 2]; memset(a, 0, sizeof a); for (int i = 1; i <= n; i++) for (int j = 1; j ...
#include <bits/stdc++.h> using namespace std; int g[25][25], n, p, i, T, j, k; bool FLAG; int main() { scanf( %d , &T); while (T--) { for (i = 1; i <= 24; i++) for (j = 1; j <= 24; j++) g[i][j] = 0; scanf( %d%d , &n, &p); for (i = 1; i <= 5; i++) for (j = i + 1; j <= 5;...
// (c) Copyright 1995-2016 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; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; const int N = 2 * 5e5 + 5; int n, m, q; int par[N], sub[N]; int p[N]; struct edge { int l, r, tag = 0; } elist[N]; vi g[N]; int dp[19][500005]; const int lg = 19; int po...
#include <bits/stdc++.h> using namespace std; double EPS = 1e-10; double EQ(double a, double b) { return abs(a - b) < EPS; } void fast_stream() { std::ios_base::sync_with_stdio(0); } int xs[4]; int ys[4]; int rs[4]; int Rs[4]; void solve() { for (int i = 0; i < 2; i++) { cin >> xs[i * 2] >> ...
/* 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; const long long P = 1e9 + 7; const int N = 2e5 + 5; const int inf = 0x3f3f3f3f; const double pi = acos(-1); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, x, y, a[2]; vector<int> g[N]; void dfs(int x, int fa, int grp) { a[g...
/******************************************************************************* * 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; const int N = 100100, L = 18; int n, m, Q; int dep[N], p[N][L]; set<int> adj[N]; map<int, int> mp[N]; int get(int par, int i) { if (mp[par][i] == i) return i; return mp[par][i] = get(par, mp[par][i]); } void mrg(int par, int u, int v) { u = get...
// file: clk_wiz_v3_6_0.v // // (c) Copyright 2008 - 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 // laws. // // DISCLAIMER // This discl...
/* * 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 = 1 << 30; const int Mod = 1000000007; char s[1010]; bool dp[1010][2 * 1010][3]; int v[1010]; int pre[1010][2 * 1010][3]; char ch[4]; int main() { int n, m; ch[0] = W , ch[1] = L , ch[2] = D ; scanf( %d %d %s , &n, &m, s + 1); ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; vector<int> a(n + 1), b(n + 1), p(n + 1); for (int i = 1; i <= n; ++i) { cin >> a[i]; p[a[i]] = 0; } for (int i = 1; i <= n; ++i) { cin...
#include <bits/stdc++.h> using namespace std; long long lkd(long long a, long long b) { while (b > 0) { long long c = b; b = a % b; a = c; } return a; } int main() { long long a, s, b = 1; cin >> a >> s; for (long long i = 0; i < s; i++) b = b * 10; cout << (a * b) ...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: FFF0.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =======================...
/** * 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 © 1998-2006 * Henk Barendregt * Luís Cruz-Filipe * Herman Geuvers * Mariusz Giero * Rik van Ginneken * Dimitri Hendriks * Sébastien Hinderer * Bart Kirkels * Pierre Letouzey * Iris Loeb * Lionel Mamane * Milad Niqui * Russell O’Connor * Randy Pollack * Nickolay V. Shmyrev * Bas Spitters * ...
// -------------------------------------------------------------------------------- //| Avalon Streaming Timing Adapter // -------------------------------------------------------------------------------- // altera message_level level1 `timescale 1ns / 100ps module soc_system_master_secure_timing_adt ( // In...
#include <bits/stdc++.h> int n, m; int main() { int i, j, T; long long k, total, w; while (scanf( %I64d%I64d%I64d , &k, &total, &w) != EOF) { long long ans = (1 + w) * w / 2; ans *= k; if (ans - total >= 0) printf( %I64d n , ans - total); else printf( 0 n ); }...
#include <bits/stdc++.h> using namespace std; int cnt0, cnt1, timer; void dfs(int v, vector<int> &colour, vector<int> &comp, vector<vector<pair<int, int>>> &g) { if (colour[v] == 0) cnt0++; else cnt1++; comp[v] = timer; for (auto &now : g[v]) if (colour[now.first] == -...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a <= b) cout << Second ; else if (a > b) cout << First ; return 0; }
// ====================================================================== // AES encryption/decryption // algorithm according to FIPS 197 specification // Copyright (C) 2012 Torsten Meissner //----------------------------------------------------------------------- // This program is free software; you can redistribute ...
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; long long add(long long a, long long b) { return (a + b) % MOD; } long long sub(long long a, long long b) { return ((a - b) % MOD + MOD) % MOD; } long long mul(long long a, long long b) { return (a * b) % MOD; } long long a[800000], tim[...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2008 Matt Ettus // // 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 2 of the License...
#include <bits/stdc++.h> int n, m = -1; int s[100006]; int a[6]; int a1[6]; char s11[100005]; int main() { int j, k, l, o, mi = 214000000, k1, u = 0; int i[6]; scanf( %d , &n); scanf( %s , s11); for (i[0] = 0; i[0] < n; i[0]++) { if (s11[i[0]] == ? ) s[i[0]] = 0; if (s11[i[0...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:60777216 ) const int N = 1111111; char s[N]; int n, k; const int mod = 1000000007; int f[N], g[N], h[N], ps[N], pW[N], pX[N], pB[N], p2[N], pr[N]; inline void solve(int *f, int *g, char W, char B, char X) { pW[0] = pX[0] =...
#include <bits/stdc++.h> using namespace std; signed main() { long long n, k; scanf( %lld%lld , &n, &k); long long coin = 0, sum = 0; for (long long i = 1; i <= k; i++) { long long a, b; scanf( %lld%lld , &a, &b); sum = (sum + a * b) % n; coin += b; } if (coin > n) { ...
#include <bits/stdc++.h> using namespace std; int Dx[] = {1, -1, 0, 0}; int Dy[] = {0, 0, 1, -1}; double x, y, n, mn = 10000000.0, a, b, i; bool ok(int m) { if (x * i > m * y) return 1; return 0; } int main() { cin >> x >> y >> n; for (i = 1; i <= n; i++) { int s = 0, e = 1e9; ...
/* * Copyright (c) 1999 Stephen Williams () * * 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 a[500005], n, d; long long int ans = 0; void func(long long int st, long long int ed) { if (st + 1 == ed) return; if (a[st] == a[ed]) { ans = max(ans, (ed - st) / 2); for (int i = st; i <= ed; ++i) { a[i] = a[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 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Wed Mar 01 09:53:13 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int n, m, k, a[33][33], vis[33]; int dfs(int u, int sum, int lim) { if (sum > lim) return 0; if (u > n) return 1; int ans = dfs(u + 1, sum, lim); for (int v = 1; v <= n && ans < k; v++) if (!vis[v] && a[u][v]) vis[v] = 1, ans += dfs(u + 1...
#include <bits/stdc++.h> using namespace std; int main() { string stringg; string test = new string for test ; cin >> stringg; int a = 5, b = 20; int length = stringg.size(); int lower = 5 * 20; for (int i = 1; i <= 5; i++) for (int j = 1; j <= 20; j++) { if (length <= 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...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2009 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Version : 10....
`timescale 1ns/10ps module svinterface_at_top_tb; logic clk; logic rst; logic [21:0] outOther; logic [1:0] sig; logic [1:0] sig_out; logic flip; logic [15:0] passThrough; integer outfile; logic interfaceInstanceAtTop_setting; logic [2:0] interfaceInstanceAtTop_other_setting; logic [1:0] interf...
#include <bits/stdc++.h> using namespace std; bool cur1; int A[100005]; void check_min(int &x, int y) { if (x > y) x = y; } void check_max(int &x, int y) { if (x < y) x = y; } struct node { int sum; int mx, L, R; int mxL, ToL, mxR, ToR; void Init(int d, int x) { sum = d; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a[1007]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int ans, min = 10000007, sum = 0; for (int i = 1; i <= 100; i++) { sum = 0; for (int j = 0; j < n; j++) { if (a[j] > i + 1) sum += a[j] - i ...
#include <bits/stdc++.h> using namespace std; int trees(vector<vector<int> >& v, int a, int b, int y, int x) { int trees = 0; for (int i = y; i < (y + a); ++i) { for (int j = x; j < (x + b); ++j) { trees += v[i][j]; } } return trees; } int main() { int n, m; cin >> n ...
#include <bits/stdc++.h> using namespace std; long long n, t[1000 * 1000], a[1000 * 1000], b[1000 * 1000], v, ans; map<long long, long long> w; long long get(int v, int tl, int tr, int l, int r) { if (r < tl || tr < l) return 0; if (l <= tl && tr <= r) return t[v]; int m = (tl + tr) >> 1; return...
// (c) Copyright 2012-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 is not a license and does not g...
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a > b) return a; else return b; } void solve() { vector<pair<int, int> > points; vector<int> xval, yval; for (int i = 0; i < 3; i++) { int x, y; cin >> x >> y; ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_eab_e // // Generated // by: wig // on: Mon Mar 22 13:27:29 2004 // cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls // // !!! Do not edit this file! Autogenerated by MIX !...
#include <bits/stdc++.h> using namespace std; signed main() { long long N, B; cin >> N >> B; vector<long long> res(N, -1); queue<pair<long long, long long> > Q; long long endTime = -1; for (long long i = 0; i < N; i++) { long long t, d; cin >> t >> d; while (endTime <= t) {...
#include <bits/stdc++.h> using namespace std; long long me[10000][1001]; long long n, m; long long d[10000]; long long g, r; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> n >> m; for (long long i = 0; i < m; i++) cin >> d[i]; sort(d, d + m); cin >> g >> r; queue<p...
#include <bits/stdc++.h> using namespace std; int main() { int N; scanf( %d , &N); static int X[100]; for (int i = 0; i < N; i++) scanf( %d , &X[i]); vector<int> Ans; for (int i = 0, Count = 0, First = 0; i < N; i++) { if (X[i] < 0) Count++; if (i == N - 1 || (Count == 2 && X[i +...
`define ADDER_WIDTH 019 `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,...
/* * 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; string rep(char c, int x) { string ret = ; for (int i = 0; i < x; i++) { ret += c; } return ret; } int main() { int n, k; cin >> n >> k; if (n == k) { string ans = ; for (int i = 0; i < n; i++) { ans += 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...
#include <bits/stdc++.h> using namespace std; const int INF = (1 << 30) - 1; const long long oo = (1ll << 62) - 1; const long double PI = 3.1415926535898; const int N = 1000000 + 5; int n, m; vector<int> a[N], e[N]; int num[N], low[N], vt[N], dd[N]; int Time = 0, tpltm = 0; stack<int> s; vector<in...
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)1e5 + 10; int n, m, k; int fa[MAXN]; int visit[MAXN]; vector<int> res; struct node { int x, y, id; double w; node() {} node(int x_, int y_, double w_, int id_) { x = x_; y = y_; w = w_; id = id_; ...
(****************************************************************************) (* Copyright 2021 The Project Oak Authors *) (* *) (* Licensed under the Apache License, Version 2.0 (the "License") *) (* y...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<vector<int>> p(n + 1, vector<int>(m + 1, 0)); vector<int> ma(m + 1); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { cin >...
/** * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: cpx_dp_maca_l.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and...
#include <bits/stdc++.h> using namespace std; struct compare { bool operator()(const std::string& first, const std::string& second) { return first.size() > second.size(); } }; int main() { ios_base::sync_with_stdio(false); int n, k, i; cin >> n >> k; string arr[110]; for (i = 0...
#include <bits/stdc++.h> using namespace std; int n; int a[110]; long long g[110], f[110][110][110]; char s[110]; int main() { int L, R; scanf( %d , &n); gets(s); if (s[0] != 0 ) gets(s); for (int i = 1; i <= n; i++) { scanf( %d , &g[i]); for (int j = 1; j < i; j++) g[i] = m...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { long long r; while (b != 0) { r = a % b; a = b; b = r; } return a; } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } int n, m; vector<int> v[4000000]; char g[4000...
`timescale 1 ns / 1 ps module gclk_generator_v1_0 # ( // Users to add parameters here parameter integer C_COUNTER_WIDTH = 16, // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Slave Bus Interface S_AXI parameter integer C_S_AXI_DATA_WIDTH = 32, parameter ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int a[maxn], cnt[maxn]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; } int l = 1, r = 1; int ans = 0; cnt[a[1]]++; while (l <= n) { if (((r - l + 1) - ...
#include <bits/stdc++.h> int main() { int i; char a[1000]; gets(a); for (i = 0; i < strlen(a); i++) { printf( %c , a[i]); } for (i = strlen(a) - 1; i >= 0; i--) { printf( %c , a[i]); } return 0; }