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; int main() { int n, a; cin >> n >> a; vector<int> m(n); for (int i = 0; i < n; i++) cin >> m[i]; n--; a--; int calc = 0; if (m[a]) calc++; for (int j = 1; j <= max(n - a, a); j++) { if (a - j < 0) { if (m[a + j]) calc++;...
// -- (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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int cnt = 0; while (n--) { int p, q; cin >> p >> q; if ((q - p) >= 2) cnt++; } cout << cnt << n ; }
/** * 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> const int MAXN = 100; int R[2 * MAXN + 2]; int main() { int n, k, i; scanf( %d%d , &n, &k); for (i = 1; i <= 2 * n + 1; ++i) scanf( %d , R + i); for (i = 2; i <= 2 * n && k; ++i) if (R[i - 1] < R[i] - 1 && R[i] - 1 > R[i + 1]) { --R[i]; --k; } ...
`include "twi_define.v" module twi_core ( input clk , input rst , input wr , //we input [7:0] data_in,//dat1 input [7:0] wr_addr,//adr1 output [7:0] i2cr , output [7:0] i2rd , output twi_scl_o , input twi_sda_i , output twi_sda_oen ); parameter TWI_F = 3 ; parameter ...
// 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 : Tue Jun 06 02:45:50 2017 // Host : GILAMONSTER running 64-bit major release (...
/** * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:49:36 03/19/2013 // Design Name: // Module Name: clockdiv // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // /...
#include <bits/stdc++.h> using namespace std; long long input() { long long x; scanf( %lld , &x); return x; } const int inf = 1e9; int clamp(int a, int l, int r) { if (a < l) a = l; if (a > r) a = r; return a; } int main() { int n, m; cin >> n >> m; vector<int> pos(1010...
#include <bits/stdc++.h> using namespace std; int main() { int kl[5] = {0}, n, ans = 0, x; cin >> n; for (int i = 1; i <= n; i++) { cin >> x; kl[x]++; } x = min(kl[1], kl[2]); ans += x; kl[1] -= x; kl[2] -= x; kl[3] += x; if (kl[1] != 0) { ans += kl[1] / 3 *...
// ---------------------------------------------------------------------- // Copyright (c) 2016, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; long long a[9][5], b[8]; long long dis(int i, int j) { long long x = a[i][0] - a[j][0], y = a[i][1] - a[j][1], z = a[i][2] - a[j][2]; return x * x + y * y + z * z; } bool check() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { ...
#include <bits/stdc++.h> using namespace std; const int SIZE = 401; const int MOD = 1000000007; struct matr { long long a[8][8]; }; matr d, f, e; int n; void make() { for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) f.a[i][j] = d.a[i][j] = e.a[i][j] = 0; d.a[0][1] = 1; d.a[0...
#include <bits/stdc++.h> using namespace std; char str[30]; char a[3][30]; int main(void) { int i, j, k, p1, p2; scanf( %s , str + 1); for (p1 = 1; p1 <= 27; p1++) { for (p2 = p1 + 1; p2 <= 27; p2++) if (str[p1] == str[p2]) break; if (p2 <= 27) break; } if (p1 + 1 == p2) ...
#include <bits/stdc++.h> using namespace std; struct Point { int x; int y; Point(int x_, int y_) : x(x_), y(y_) {} }; template <class T> T sqr(const T& t) { return t * t; } template <class T> T abs(const T& t) { return ((t > 0) ? (t) : (-t)); } void initialize() { freopen( _....
#include <bits/stdc++.h> using namespace std; char op[] = { R , G , B , Y , W , 1 , 2 , 3 , 4 , 5 }; string s[555]; int main() { int n, i, j, k; ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for (i = 1; i <= n; i++) { cin >> s[i]; } map<char, bool> mp; int mn = 1...
#include <bits/stdc++.h> using namespace std; ; const long long N = 5e3 + 10; vector<bitset<N> > v; vector<pair<long long, pair<long long, long long> > > hor, ver; long long n, cnt, y11, y2, x1, x2; long long ans; bool check(long long x, pair<long long, long long> a) { return a.first <= x && x <= a....
/** * 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 ba...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); if ((n / 2) % 2 == 0) { for (int i = 1; i <= n; ++i) { if (i <= n / 2 && i % 2 == 1) { printf( %d , i + 1); } else if (i <= n / 2 && i % 2 == 0) { printf( %d , n - i + 2); ...
#include <bits/stdc++.h> using ::std::cin; using ::std::cout; using ::std::endl; using ::std::multiset; using ::std::pair; using ::std::vector; int main() { ::std::ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; string ans; for (int i = 0; i < n; i++) { ans += s[2 * i]; } cout << ans << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> years; int curr = 1; for (int i = 1; i <= n; ++i) { int x; cin >> x; if (x == curr) { ++curr; years.push_back(2000 + i); } } cout << years.size() << endl; f...
#include <bits/stdc++.h> using namespace std; map<vector<int>, int> mp; int ig[11][6] = { {6, 0, 0, 0, 0, 0}, {1, 5, 0, 0, 0, 0}, {2, 4, 0, 0, 0, 0}, {1, 1, 4, 0, 0, 0}, {3, 3, 0, 0, 0, 0}, {1, 2, 3, 0, 0, 0}, {1, 1, 1, 3, 0, 0}, {2, 2, 2, 0, 0, 0}, {1, 1, 2, 2, 0, 0}, {1, 1, 1, 1, 2, 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 maxn = 2e5; const long long mol = 1e9 + 7; int fa[maxn + 11], siz[maxn + 11], x[maxn + 11], y[maxn + 11]; bool cir[maxn + 11]; vector<int> row, cul; int get(int x) { return x == fa[x] ? x : fa[x] = get(fa[x]); } void merge(int x, int y) { int f...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; long long p = 998244353; int gcd(int a, int b, int& x, int& y) { if (a == 1) { x = 1; y = 0; return 1; } if (b == 1) { x = 0; y = 1; return 1; } if (b == 0) { x = 1; y = 0; return a; } i...
#include <bits/stdc++.h> using namespace ::std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long add(long long a, long long b, long long m = 1000000007) { return (a % m + b % m + 2 * m) % m; } long long mul(long long a, long long b, long long m = 1000000007) { r...
// Copyright (c) 2015-2016 CERN // Maciej Suminski <> // // 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) // any...
// Copyright 2012 Sriram Radhakrishnan, Varun Sampath, Shilpa Sarode // // This file is part of PVS. // // PVS 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> const int INF = 0x3f3f3f3f; using namespace std; int a[3030], b[3030]; int dp[3030]; int main() { int t; cin >> t; while (t--) { int n; memset(dp, 0, sizeof(dp)); cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; b[i] = a[i]; ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e9 + 55; const int inf = 1e9 + 77; const int MOD = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-7; vector<int> primes; bitset<int(1e7) + 2> isprime; void seive() { isprime[0] = isprime[1] = 1; for (int i = 2; i < in...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int INF = 1e9; const long long mod = 1e9 + 7; int n, a, b, v; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { cin >> n >> a >> b >...
#include <bits/stdc++.h> using namespace std; vector<int> V[100005]; int main() { int N, M, K, ans = 1; scanf( %d%d%d , &N, &M, &K); for (int i = 1; i <= N; ++i) { int c; scanf( %d , &c); V[c].push_back(i); } for (int c = 1; c <= M; ++c) { int L = V[c].size(), rem = 0, ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m; string s, t; cin >> n >> m >> s >> t; bool can = false; if (s == t) can = true; else { if (n <= m + 1) { for (int i = 0; i < int(n); i++) { ...
//***************************************************************************** // (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // ...
module fmrv32im_timer ( input RST_N, input CLK, input BUS_WE, input [3:0] BUS_ADDR, input [31:0] BUS_WDATA, output reg [31:0] BUS_RDATA, output wire EXPIRED ); // Interrupt Mask reg [31:0] counter, mask; always @(posedge ...
/** * 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 gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } void solve() { int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) cin >> a[i]; if (n == 1) { cout << 1 n ; return; } vector<long long> ...
#include <bits/stdc++.h> using namespace std; template <class T> inline int SIZE(T& n) { return n.size(); } template <class T> void OUT(const T& n) { for (unsigned int i = 0; i < n.size(); ++i) { cout << n[i] << ; } cout << endl; } int toInt(string s) { int r = 0; string...
#include <bits/stdc++.h> using namespace std; void chekarre(int* arr, int n) { cout << [ ; for (int i = 0; i < n; i++) cout << arr[i] << ; cout << ] << endl; } bool comp(int i, int j) { return (i > j); } int a[2000007]; int main() { int n; long long sum = 0; cin >> n; for (...
#include <bits/stdc++.h> using namespace std; const int MN = 200010; int a[MN], b[MN], p[MN], q[MN]; char ans[MN]; int main() { int t, m, k; for (scanf( %d , &t); t--;) { scanf( %d%d , &m, &k); int pos = 0, pos1; for (int i = 1; i <= k; i++) { scanf( %d , &a[i]); } ...
// // Copyright 2012 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; const int maxn = 1000005; int n, m, _m, cnt, d[maxn], fa[maxn]; bool vis[maxn]; struct Edge { int x, y; } Es[maxn]; long long ans; int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); } void merge(int x, int y) { x = getfa(x); y = g...
// *************************************************************************** // *************************************************************************** // Copyright 2014(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
/** * 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 = 300110; const int mod = 1e9 + 9; int n, m; int sumv[maxn * 4]; int f1[maxn * 4]; int f2[maxn * 4]; int num[maxn]; int sum[maxn]; int f[maxn]; int addv(int a, int b, int n) { return ((((long long)f[n + 1] * (long long)b) % mod + ...
#include <bits/stdc++.h> using namespace std; void solve() { long long n, m, ans; cin >> n >> m; vector<long long> ar(n); for (long long i = 0; i < n; i++) cin >> ar[i]; sort(ar.begin(), ar.end()); ans = 1; if (n > m) { cout << 0; return; } for (long long i = 0; i < n...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 04:14:03 03/17/2011 // Design Name: jace // Module Name: C:/proyectos_xilinx/cpld_jace/test_cpld_ace.v // Project Name: cpld_jace // Target Device: // Tool version...
/** * 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; void solve() { int n; cin >> n; int count[2] = {0, 0}; bool all_even = 1; for (int i = 0; i < n; i++) { static string s; cin >> s; if (static_cast<int>(s.size()) & 1) all_even = 0; for (const char &c : s) count[c - 0 ]++; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define f(i,q,n) for(int i=(int)q;i<n;i++) #define pb push_back #define debug(x) cout<<#x<< <<x<<endl; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t=1; cin>>t; while(t--){ int n,m; ...
#include <bits/stdc++.h> using namespace std; int main() { long long ara[20], ara1[20]; for (long long i = 1; i <= 14; i++) { scanf( %I64d , &ara[i]); } long long maxi = 0; long long sum, c; for (long long i = 1; i <= 14; i++) { if (ara[i] == 0) { continue; } ...
#include <bits/stdc++.h> const int mod = 1000000007; int A[13][13], B[13][13], C[13][13]; int ID[4][4]; int L, R, r1, r2; void mul(int A[][13], int B[][13]) { for (int i = 0; i < 13; i++) for (int j = 0; j < 13; j++) C[i][j] = 0; for (int k = 0; k < 13; k++) for (int i = 0; i < 13; 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 N = 5e3 + 3; int sz, mn, o, rt, s[N], s2[N], fa[N], ch[N][2], lf[N], cnt; bool vis[N]; void findrt(int u) { if (vis[u]) { s[u] = 0; return; } int mx; if (ch[u][0]) { int x = ch[u][0], y = ch[u][1]; findrt(x), findr...
#include <bits/stdc++.h> using namespace std; bool vouel(char c) { return (c == a || c == e || c == i || c == o || c == u ); } int main() { string s; cin >> s; string new_s = ; bool same = false; int streak = 0; char c = 0 ; for (int i = 0; i < s.length(); ++i) { ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int fac[4]; fac[0] = 1; fac[1] = 1; fac[2] = 1; for (int i = 3; i < 10; i++) { int y1213 = 100; int n1113; vector<int> ans112; int tempor = 100; } while (t--) { int n; ...
/* * 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 string sf[6] = { lios , liala , etr , etra , initis , inites }; char a[1100000], s[1100000]; int n, sd, p, num[3]; int gender; int suffix(int x) { int len = strlen(s); if (len < (int)sf[x].length()) return 0; for (int i = len - sf[x].lengt...
#include <bits/stdc++.h> using namespace std; const int sh = 1e6; const int ppr = 257; const long long INF = 1e18; const int inf = 1e9; const int mod = 1e9 + 7; const int N = 6e5 + 123; const long double pi = 3.141592653589793238462643; const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1};...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, l[N], r[N], cnt[4 * N], one[4 * N]; vector<int> g; map<int, int> mp; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; ++i) { cin >> l[i] >> r[i]; g.push_back(l[i] - 1);...
#include <bits/stdc++.h> using namespace std; long long n, a[3000], b[3000], w[500], pos[500][5000], ans; string second; int ispal(int x, int y) { int t = y; while (x != y) { if (second[x] != second[y]) return 0; if (y - x == 1 || y - x == 2) { b[t]++; return 1; } ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( unroll-loops ) using namespace std; template <typename A> ostream &operator<<(ostream &cout, vector<A> const &v); template <typename A, typename B> ...
#include <bits/stdc++.h> using namespace std; const int maxn = 300005; pair<long long, long long> dif[maxn]; long long x[maxn], y[maxn], pref[maxn], suff[maxn], ans[maxn]; vector<int> adj[maxn]; int main() { int n, m; scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %lld %lld ...
#include <bits/stdc++.h> using namespace std; int read() { int x = 0; int sign = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) { sign |= c == - ; } for (; isdigit(c); c = getchar()) { x = x * 10 + c - 0 ; } return sign ? -x : x; } const int ms = 1 << 22;...
//-------------------------------------------------------------------------------- // Project : SWITCH // File : ethernet_controller_top.v // Version : 0.2 // Author : Shreejith S, Vipin K // // Description: Ethernet Controller Module Top File // //-------------------------------------------------------...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int i, j, K; int num[101]; memset(num, 0, sizeof(num)); cin >> n >> k; for (i = 0; i < n; i++) { scanf( %d , &K); num[K]++; } int cut = 0; int Max = 0; for (i = 1; i <= 100; i++) { if (num[...
#include <bits/stdc++.h> using namespace std; int temp1[26]; int temp2[1001][26]; set<int> myset[1001]; set<int> empty; vector<int> myvec; int main() { int n; cin >> n; string str; cin >> str; int m; cin >> m; string arr[m]; for (int i = 0; i < m; i++) { cin >> arr[i]...
#include <bits/stdc++.h> using namespace std; const int N = 3000 + 5; struct node { int val, id; } a[N]; int n; int dp[N * N], tree[N], ranks[N]; inline int lowbit(int x) { return x & -x; } inline int query(int x) { int sum = 0; while (x != 0) { sum += tree[x]; x -= lowbit(x); ...
#include<iostream> typedef long long ll; using namespace std; const int maxn =1e5+5; int n,q; ll sum[maxn]; string s; int main() { cin>>n>>q; cin>>s; s = # +s; for(int i=1;i<=n;i++) sum[i] = sum[i-1]+s[i]- a +1; while (q--) { int l,r; cin>>l>>r; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int mod = 1e9 + 7; struct SAM { int n, tot, last; int ch[N][26], dep[N], fa[N]; int root[N], ls[N * 20], rs[N * 20], cnt; vector<int> G[N]; void init() { tot = last = 1; memset(ch[1], 0, sizeof(ch[1])); ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int inf = 0x3f3f3f3f; const double eps = 1e-15; const long long INF = (1LL << 60); int cnt[1010]; int a[1010]; int M[1010]; int m; int dp[1010][1010][2]; int main() { int n, m, x; scanf( %d%d , &n, &m); m...
#include <bits/stdc++.h> using namespace std; struct s { long long col, colf, flag; } node[100010 << 2]; void build(int l, int r, int tr) { node[tr].col = node[tr].colf = node[tr].flag = 0; if (l == r) { node[tr].col = l; return; } int mid = (l + r) >> 1; build(l, mid, tr << ...
/* ############################################################################### # pyrpl - DSP servo controller for quantum optics with the RedPitaya # Copyright (C) 2014-2016 Leonhard Neuhaus () # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gen...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { f = ch == - ? -1 : 1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return x * f; } const int N ...
#include <bits/stdc++.h> using namespace std; const int N = 510; struct node { int x, y; } d[2]; int n, m, T, g[N][N]; int f, len, root, fa[N], size[N], son[N][2], t[4]; int a[N][N][2], b[N][N][2], dt[N], tmp, tmp2, ans; int Abs(int x) { return x > 0 ? x : -x; } void init() { int i, j; for...
#include <iostream> #include <cmath> using namespace std; typedef long long int ll; int main(){ int cases; ll num; double temp; cin >> cases; bool cube = false; for(int a = 0; a < cases; a++){ cin >> num; cube = false; for(ll b = max(int(cbrt(double(num/2))), 1); b < cbrt(...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.141592653589793238462643383; long long int gcd(long long int a, long long int b) { if (a == 0) return b; return gcd(b % a, a); } long long int Ceil(long long int a, long long int b) { if (a % b == 0) return a / b; els...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const long long inf = 1e18; const int maxn = 1e5 + 10; const double eps = 1e-7; const double pi = 3.14159265359; int n, m, t[maxn]; int par[maxn]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops ) #pragma GCC optimize( no-stack-protector,fast-math ) using namespace std; const long long N = 1e6 + 100, OO = 724249387, T = (1 << 20) + 10, M = 998244353, P = 6151, SQ = 280, lg = 64; long long n, m, k, n...
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T a) { return (a >= 0 ? a : -a); } int main() { int k, no[12]; cin >> k; for (int i = 0; i < 12; i++) cin >> no[i]; sort(no, no + 12); int res = 0, i = 11; while (k > 0 && i >= 0) { res++; k -= no[i]...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int ar[n], i, b; b = n; for (i = 0; i < n; i++) cin >> ar[i]; sort(ar, ar + n); for (i = 0; i < n; i++) { if (ar[i] < b) b--; els...
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; for (int i = 0; i < n.length(); i++) cout << n[i]; for (int i = n.length() - 1; i >= 0; i--) cout << n[i]; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2004 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; reg [67:0] q; reg signed [67:0] qs; initial begin q = 68'he_12345678_9abcdef0 **...
`timescale 1ns / 1ps /* -- Module Name: Route Planner -- Description: Wrapper de algoritmo de planificacion de ruta "Wrapper" alrededor del algoritmo a utilizar para el calculo de la ruta a seguir para el paquete en transito. Forma parte del modulo "Link Controller". -- Dependencies: -- system.vh ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_c // // Generated // by: wig // on: Thu Jun 29 16:41:09 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -conf macro._MP_VHDL_USE_ENTY_MP_=Overwritten vhdl_enty from cmdline -conf macro._MP_VH...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Wilson Snyder. module t (/*AUTOARG*/); typedef struct packed { logic [3:2] a; logic [5:4][3:2] b; } ab_t; typedef ab_t [7:6] c_t; // array of structs ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T; cin >> T; while (T--) { long long a, b, n; cin >> a >> b >> n; if (a < b) swap(a, b); int ans = 0; while (a <= n) { b += a; if...
#include <bits/stdc++.h> /* ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while(t--) solve(); */ using namespace std; typedef long long ll; typedef long double ld; int magic(vector<int> &a, int del){ auto it = lower_bound(a.begin(), a.end(), del); i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:57:12 03/23/2015 // Design Name: // Module Name: message_rom // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
// // Copyright (C) 2015-2017 Markus Hiienkari <> // // This file is part of Open Source Scan Converter project. // // 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 Li...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:20000000 ) string problem_name = a ; void init() { freopen((problem_name + .in ).c_str(), rt , stdin); } struct tpoint { int x, y; }; long long vp(tpoint a, tpoint b, tpoint c) { tpoint f, s; f.x = b.x - a.x; ...
//***************************************************************************** // (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> #define ff first #define ss second #define endl n using namespace std; const long long INF = (long long) 1e18; const int mod = (int) 1e9+7; const int MAXN = (int) 3.5e4+5; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<l...
//----------------------------------------------------------------------------- // // (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 ...