text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; vector<long long> tim(N), pos(N), cur(N); int main() { long long T, n, act, start, des, dir, ans, startTime; cin>>T; for(long long t = 1; t <= T; ++t) { tim[0] = pos[0] = start = des = act = ans = startTime...
#include <bits/stdc++.h> using namespace std; struct edge { int v, nxt; } e[2050]; int ecnt; int n, m; int totdep; int pw[2050]; map<int, int> head; map<int, bool> has_fa; map<int, int> sz; map<int, bool> vis; void adde(int u, int v) { e[++ecnt].v = v; e[ecnt].nxt = head[u]; head...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty. // bug998 interface intf #(parameter PARAM = 0) (); logic val; function integer func (); return 5; endfunction endinterface module t1(intf mod_intf); initial begin ...
#include <bits/stdc++.h> using namespace std; long long dem[100001]; long long f[100002]; int main() { int n; long long x; cin >> n; for (int i = 0; i < n; i++) { cin >> x; dem[x]++; } f[1] = dem[1]; for (int i = 2; i < 100002; i++) f[i] = max(f[i - 2] + dem[i] * i, f[i -...
#include <bits/stdc++.h> using namespace std; const long long p = 1000000007LL; long long power(long long x, long long n) { long long ret = 1LL; while (n > 0LL) { if (n & 1LL) ret = ret * x % p; x = x * x % p; n >>= 1LL; } return ret; } long long n, m; long long dp; int m...
#include <bits/stdc++.h> using namespace std; long long res; const long long mod = 1073741824; long long d(int a, int b, int c) { vector<int> q(102, 0); for (int i = 2; i <= a; i++) if (a % i == 0) { while (a % i == 0) { a /= i; q[i]++; } } for (int i ...
#include <bits/stdc++.h> using namespace std; int n, k; struct Poi { int x, y, ff; bool operator<(const Poi &A) const { return x < A.x || (x == A.x && y < A.y); } } pp[(200100)]; int row[(200100)], cntr; int cnt[(200100)], pre[(200100)]; long long ans[(200100)]; inline void solve() { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, q, l; int A[N], sum[N]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , A + i); sum[i] = sum[i - 1] + A[i]; } scanf( %d , &q); while (q--) { scanf( %d , &l); printf(...
/******************************************************************************* * 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; long long holes[14]; int main() { long long zeroes = 0; for (long long i = 0; i < 14; i++) { cin >> holes[i]; if (holes[i] == 0) zeroes++; } zeroes++; long long mx = 0; for (long long i = 0; i < 14; i++) { long long cnt = 0; ...
/*------------------------------------------------------------------------------ * 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> using namespace std; int t; int x, n, m; int main() { cin >> t; while (t--) { cin >> x >> n >> m; while (x > 20 && n) { x = x / 2 + 10; n--; } while (m) x -= 10, m--; if (x > 0) printf( NO n ); else printf( YES ...
#include <bits/stdc++.h> using namespace std; int n; char s[1000005]; int main() { int i, j, l, r, p = 0; scanf( %s , s); n = strlen(s); for (j = 0; j < n && s[j] != . ; j++) ; if (j == n) { s[n] = . ; n++; } for (i = 0; i < n && s[i] == 0 ; i++) ; if (...
#include <bits/stdc++.h> using namespace std; long long a[300005] = {0}; long long two[300005] = {0}; const long long mod = 1e9 + 7; int main() { two[0] = 1; for (int i = 1; i <= 300000; i++) { two[i] = (two[i - 1] * 2LL) % mod; } long long res = 0; int n; while (cin >> 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> using namespace std; const int maxn = 1e5 + 5; int n, a[maxn], b[maxn], t[maxn]; bool check(int num, int pos) { t[pos] = num; if (pos == n) return true; for (int i = 0; i <= 3; i++) { if ((num | i) == a[pos] && (num & i) == b[pos]) return check(i, pos + 1); } r...
#include <bits/stdc++.h> #pragma GCC optimize( -O3 ) using namespace std; const long long N = 1e6 + 5; const long long MAX = 1e7 + 9; long long binarySearch(long long arr[], long long l, long long r, long long x) { if (r >= l) { long long mid = l + (r - l) / 2; if (arr[mid] == x) return mid; ...
#include <bits/stdc++.h> using namespace std; long long t, n, m, u, v, q, k; const int N = 3e5 + 500; const int LN = 20; const int SN = 331; const long long mod = 1e9 + 7; const long long INF = 1LL << 57; long long arr[N], brr[N]; string str, ss; vector<int> adj[N]; vector<int> idx[N]; int d[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> using namespace std; const int maxN = 200011; long long n, i, j, cntx, cnty, x, y, z; long long vx[maxN]; map<long long, long long> Mx, My; map<pair<long long, long long>, long long> M; pair<long long, pair<long long, long long> > low; vector<vector<long long> > data; vector<l...
`include "defines.v" `timescale 1ns/1ps module tb( input `control_w port0_ci, input `data_w port0_di, output `control_w port0_co, output `data_w port0_do, input `control_w port1_ci, input `data_w port1_di, output `control_w port1_co, output `data_w port1_do, input `control_w port2...
module GPU_core( input clk, // ~ wishbone. Somethink like wishbone input wire [31:0] W_ADDR, input wire [31:0] W_DAT_I, input wire W_CLK, input wire W_RST, output reg [31:0] W_DAT_O, output reg W_ACK, // monitor connection input [9:0] x, input [8:0] y, output R, output G, output B, output reg...
/******************************************************************************* * 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 ...
#include <bits/stdc++.h> using namespace std; inline long long gcd(long long a, long long b) { a = ((a) < 0 ? -(a) : (a)); b = ((b) < 0 ? -(b) : (b)); while (b) { a = a % b; swap(a, b); } return a; } const long long inf = 2147383647; const long long mod = 1000000007; const do...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long int n, t, x, y, a = 0, b = 0, suma = 0, sumb = 0; cin >> n; while (n--) { cin >> t >> x >> y; if (t == 1) { a++; suma += ...
/////////////////////////////////////////////////////////// module counter_behavioural #( parameter bits = 16 ) ( input clock, reset, enable, load, input [bits-1:0] init, output reg [bits-1:0] q ); always @(posedge clock, posedge reset) if (reset) q <= 0; el...
/*------------------------------------------------------------------------------ * 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...
/** * 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 = 1e9 + 7, N = 3e5 + 7, M = 998244353; vector<int> G[N], add[N], del[N]; long long f[N], fi[N], inv[N]; int cans[41], dp[1 << 20][21]; int C(int n, int k) { return f[n] * fi[k] % M * fi[n - k] % M; } void ADD(int& a, int b) { a += b; if (...
#include <bits/stdc++.h> using namespace std; template <class T> void read(T& num) { char CH; bool F = false; for (CH = getchar(); CH < 0 || CH > 9 ; F = CH == - , CH = getchar()) ; for (num = 0; CH >= 0 && CH <= 9 ; num = num * 10 + CH - 0 , CH = getchar()) ; F &&...
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; int a[maxn], b[maxn]; int main() { int n; scanf( %d , &n); long long ans = 0; int cnt1 = 0, cnt2 = 0, cnt0 = 0; for (int i = 1; i <= n; i++) { scanf( %d , a + i); if (a[i] <= -1) { ans += -1 - a[i...
#include <bits/stdc++.h> using namespace std; int tree[10000][2]; int lights; void mark(int node, int l) { int p = node / 2; if (p == 0) return; tree[p][node % 2] = min(tree[p][node % 2], lights - l); mark(p, l); } int cont[10000]; int main() { cin.tie(0); ios_base::sync_with_stdio...
#include <bits/stdc++.h> int n, h; char name[10]; long double p[70], cont[70]; int main() { scanf( %s%d%d , name, &n, &h); if (name[0] == B ) { printf( %d n , n); return 0; } long double ans = n; p[0] = cont[0] = 1.0; for (int i = 1; i <= h; i++) { p[i] = p[i - 1] / 2....
#include <bits/stdc++.h> using namespace std; int a, b, mn = 1000000009, mx; char c[59][59]; int ist, ien; bool w; int main() { cin >> a >> b; for (int i = 1; i <= a; i++) for (int j = 1; j <= b; j++) { cin >> c[i][j]; if (c[i][j] == * ) mn = min(j, mn), mx = max(j, ...
/** * 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) 1999 Steven Wilson () // // 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; void seive(bool a[], long long int n) { for (int i = 2; i * i <= n; i++) { if (a[i] == true) { for (int j = i * i; j <= n; j += i) a[j] = false; } } } int np(bool a[], long long int ppr, long long int n) { ppr++; while (ppr <= n) ...
#include <bits/stdc++.h> using namespace std; int freq[3]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { freq[s[i] - 0 ]++; } for (int i = n - 1; i >= 0; i--) { if (freq[0] <= n / ...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\PWM.v // Created: 2014-09-08 14:12:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------- // ----------------------------------...
/** * 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() { long long i, j, k, n, t; cin >> n; vector<long long> adj[n + 1]; vector<long long> par(n + 1, 0); for (i = 2; i <= n; i++) { cin >> k; par[i] = k; adj[k].push_back(i); } vector<long long> level(n + 1, 0); le...
//----------------------------------------------------------------------------- // // Jonathan Westhues, April 2006 //----------------------------------------------------------------------------- module hi_read_rx_xcorr( pck0, ck_1356meg, ck_1356megb, pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4, adc...
#include <bits/stdc++.h> using namespace std; const long long NR = 5e5 + 100; const long long oo = 2e9 + 100; const long long MOD = 998244353; long long n; string s; long long a[NR]; long long dp[5]; signed main() { ios::sync_with_stdio(0); cin.tie(0); long long i; cin >> n; cin >>...
/* * This module demonstrates the ability to use a defparam to control * the instantation of an instance array, and to also control * parameter values within the instance array. */ module main; localparam wid = 5; reg [wid-1:0] clk; dut xx (.clk(clk)); // This defparam sets the desired with of the U...
/** * Author: lukasdeimos */ #include<bits/stdc++.h> #define endl n #define ff first #define ss second using ll = long long; using namespace std; void solve() { int n,k; cin >> n >> k; cout << (n-k+k/2) << endl; for(int i = k+1; i <= n; i++) cout << i << ; for(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; pair<int, long long> da; inline long long p(long long x) { return x * x * x; } long long m; void dfs(long long now, int sum, long long maxnum) { if (!now) da = max(da, make_pair(sum, maxnum)); else { long long i = 1; for (; p(i + 1) <= no...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; template <class T> inline void amin(T &x, const T &y) { if (y < x) x = y; } template <class T> inline void amax(T &x, const T &y) { if (x < y) x = y; } template <class Iter> void rprintf(const char *fmt, Iter begin, Ite...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n, k; cin >> n >> k; string s[n + 1]; set<string> ar; for (int x = 0; x < n; x++) { cin >> s[x]; ar.insert(s[x]); } char a[3] ...
/* * plle2_adv.v: Simulates the PLLE2_ADV pll of the xilinx 7 series. This is * just a wrapper around the actual logic found in pll.v * author: Till Mahlburg * year: 2020 * organization: Universität Leipzig * license: ISC * */ `timescale 1 ns / 1 ps /* A reference for the interface can be found in Xilinx UG95...
/** * 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 = 2e3 + 9; bool p[N][N]; priority_queue<pair<pair<int, int>, pair<int, int> > > q; int cu; int n, m, si, sj, ml, mr, a, b, ti, tj; char c; bool valid(int i, int j) { return i > 0 && i <= n && j > 0 && j <= m && p[i][j]; } void add(int x, ...
#include <bits/stdc++.h> using namespace std; int main() { int n, d, m, i, a, b; cin >> n >> d >> m; for (i = 0; i < m; i++) { cin >> a >> b; if ((a - b + d) * (a - b - d) <= 0 && (a + b - d) * (a + b + d - 2 * n) <= 0) cout << YES << endl; else cout << NO ...
/** * 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 x,y; cin>>x>>y; int count =0; while(x>0&&y>0) { x--; y--; count+=2; } if(x!=...
#include <bits/stdc++.h> using namespace std; int main() { long l; cin >> l; int div = 0; for (int i = 5; i < 1 + pow(l, 0.5); i++) { if (l % i == 0) { div = i; break; } } if (div == 0 || (l / div) < 5) { cout << -1 << endl; } else { char a[div][in...
#include <bits/stdc++.h> using namespace std; long long x, y, n; long long arr[6]; int main() { ios_base::sync_with_stdio(0); cin >> x >> y >> n; int pos = (n - 1) % 6; arr[0] = (x + 1000000007) % 1000000007; arr[1] = (y + 1000000007) % 1000000007; arr[2] = (y - x + 1000000007 + 10000000...
#include <bits/stdc++.h> using namespace std; long long n, k, T; long long doit(long long n, long long k) { if (n == 1) return k * (k + 1) / 2; long long tp = (n - 1) / k + 1, v1 = doit(tp, k), tp2 = (n - 1) % k + 1; long long f1 = (tp - 1) * (k * k + 1), f2 = v1 - f1; if (tp2 * k < f2) retu...
//--------------------------------------------------------------------------- //--clockGenerator.v--------------------------------------------------------- //--By Kyle Williams, 11/20/2012--------------------------------------------- //--PROJECT DESCRIPTION------------------------------------------------------ //----Th...
/** * 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 lsu_transit_table( in_wftag_resp, in_wfid, in_lddst_stsrc_addr, in_exec_value, in_gm_or_lds, in_rd_en, in_wr_en, in_instr_pc, out_exec_value, out_gm_or_lds, out_lddst_stsrc_addr, out_reg_wr_en, out_instr_pc, clk, rst ); input [6:0] in_wftag_resp; input [5:0] in_wfid; input [11:0] ...
#include <bits/stdc++.h> using namespace std; struct Node { int v; int id; } node[110]; int t[110]; bool cmp(Node x, Node y) { return x.v > y.v; } int main() { int n, w; cin.sync_with_stdio(false); while (cin >> n >> w) { for (int i = 0; i < n; i++) { cin >> node[i].v; ...
#include <bits/stdc++.h> using namespace std; using lint = long long; using ulint = unsigned long long; const int T = 10; lint dp[T], nxt[T]; void relax(lint &x, lint y) { x = max(x, y); } int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); fill(begin(dp), end(dp), -1); fi...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; int m, n, nword, R[MAXN], len[MAXN]; map<string, int> M; string s[MAXN]; vector<int> adj[MAXN], adj2[MAXN]; int super[MAXN], nsuper, number[MAXN], low[MAXN], cnt; int best[MAXN], rep[MAXN]; bool inStack[MAXN]; int st[MAXN], nst; ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, s; while (cin >> n >> k >> s) { long long temp = (s / k); long long rem = s % k; temp++; if (((n - 1) * k < s || (k > s))) { cout << NO << endl; return 0; } cout << YES << endl;...
#include <bits/stdc++.h> using namespace std; int AbsDifference(int a, int b) { if (a >= b) return a - b; return b - a; } long long AbsDifference(long long a, long long b) { if (a >= b) return a - b; return b - a; } const int mod = 1000000007; const int mod2 = 1000000009; const int inf =...
/** * 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> struct vit { int price; char vit[4]; }; int main() { int i, n, min; scanf( %d , &n); struct vit t[n]; for (i = 0; i < n; i++) { scanf( %d %s , &t[i].price, t[i].vit); } int A = 300001, B = 300001, C = 300001, AB = 300001, AC = 300001, BC = 300001, ...
`define WIDTH_P 3 `define ELS_P 4 `define SEED_P 100 /**************************** TEST RATIONALE ******************************* 1. STATE SPACE All the elements are in memory are written once and the first $clog2(`ELS_P) elements are re-written with w_v_i kept LOW to check if those elements are overwritten...
/* * 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; long long n, m, k; long long cp1[102]; long long cp2[102]; long long dp[102][10002]; long long comb[102][102]; bool mark[102][10002]; long long Calculate_Pow(long long x, long long y) { long long val = 1; for (long long i = 1, t = x; i <= y; i <<= 1,...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:09:18 10/03/2016 // Design Name: // Module Name: sr_timer // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // /...
`include "assert.vh" module cpu_tb(); reg clk = 0; // // ROM // localparam MEM_ADDR = 4; localparam MEM_EXTRA = 4; reg [ MEM_ADDR :0] mem_addr; reg [ MEM_EXTRA-1:0] mem_extra; reg [ MEM_ADDR :0] rom_lower_bound = 0; reg [ MEM_ADDR :0] rom_upper_bound = ~0; wire [2...
#include <bits/stdc++.h> using namespace std; int main() { int n, x[100005], h[100005]; cin >> n; for (int i = 0; i < n; ++i) cin >> x[i] >> h[i]; int count = 1; int newarr[100005]; newarr[1] = x[0] - h[0]; for (int i = 1; i < n - 1; ++i) { if ((x[i] - h[i] > x[i - 1]) && (x[i] - h...
/* * 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 la...
#include <bits/stdc++.h> using namespace std; struct city { int x, y, p; double dis; } t[1010]; int cmp(city a, city b) { return a.dis < b.dis; } int main() { int s, n, i; while (scanf( %d%d , &n, &s) > 0) { for (i = 0; i < n; i++) { scanf( %d%d%d , &t[i].x, &t[i].y, &t[i].p); ...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const int inf = 0x3f3f3f3f; const long long INF = 1e18; const int maxn = 200000 + 10; const int maxm = 1000000000 + 7; const int mod = 1000000000 + 7; int gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } inline long...
#include <bits/stdc++.h> using namespace std; struct scroll { int pow; int dmg; int loc; bool operator<(const scroll& a) const { if (dmg > a.dmg) return true; else if (dmg == a.dmg && pow < a.pow) return true; else return false; } }; struct used_scro...
#include <bits/stdc++.h> using namespace std; int n, m, mr; vector<string> v; string s, s2, tmp, res; vector<pair<int, int> > e; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> s; v.push_back(s); } sort(v.begin(), v.end()); for (int i = 0; i < m; i++) { ...
/* This file is part of jt51. jt51 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. jt51 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; long long ll, tt, i, j, a[234567], b[211212], c[211456], d[213456]; long long x, m, n, r, s, t, k, l, y, z; vector<long long> p[12], q; pair<long long, long long> pp[345678]; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> x; if (x =...
#include <bits/stdc++.h> using namespace std; vector<int> temp(100005); vector<int> v(100005); int fn(int l, int h, int x) { while (h - l > 1) { int mid = (h + l) / 2; if (temp[mid] >= x) { h = mid; } else { l = mid; } } if (temp[h] > x) return h; el...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: dram_ctl_pad.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/...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, p, x, y; cin >> n >> k >> p >> x >> y; long long int sum = 0; long long int cov = 0; for (int i = 0; i < k; i++) { long long int kk; cin >> kk; if (kk < y) cov++; sum += kk; } int used ...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2021 Yutetsu TAKATSUKASA. // SPDX-License-Identifier: CC0-1.0 import "DPI-C" context function int import_func0(); import "DPI-C" context function int import_func1();...
/** * 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; vector<int> H; vector<int> L; int a[200001]; bool vis[200001]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } bool T = 0; for (int i = 1; i <= n;) { bool faH = 0, faL = 0; int t...
#include <bits/stdc++.h> int** arr; std::vector<int> opers; void del3(int x, int y) { if (arr[x][y] && arr[x + 1][y] && arr[x][y + 1]) { opers.push_back(x + 1); opers.push_back(y + 1); opers.push_back(x + 2); opers.push_back(y + 1); opers.push_back(x + 1); opers.push_back(y...
#include <bits/stdc++.h> using namespace std; int main() { string p; cin >> p; int n; cin >> n; bool a = false, b = false; while (n--) { string s; cin >> s; if (s == p) { a = true; b = true; } if (s[0] == p[1]) a = true; if (s[1] == p[0]) b...
#include <bits/stdc++.h> using namespace std; int C[200005], A[200005], n, k, i, j, mx; int main() { scanf( %d%d%d , &n, &i, &k); for (i = 1; i <= n; i++) scanf( %d , &A[i]); for (i = j = 1; i <= n; i++) { while (j - i + 1 - C[A[i]] - (A[j] == A[i]) <= k && j <= n) { C[A[j]]++; j...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; const int s = 1000000; int n; int b[maxn]; int p[maxn]; int c[maxn]; vector<int> ans; int main() { scanf( %d , &n); int t; for (int i = 0; i < n; ++i) { scanf( %d , &t); b[t] = 1; p[i] = t; } ...
/* * PicoSoC - A simple example SoC using PicoRV32 * * Copyright (C) 2017 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies...
#include <bits/stdc++.h> using namespace std; int n, m; int a[1010][1010]; bool got[1010][1010]; bool ok(int x) { memset(got, 0, sizeof(got)); for (int j = 0; j < m; j++) { vector<int> vt; for (int i = 0; i < n; i++) if (a[i][j] >= x) vt.push_back(i); for (int o = 0; o < vt.s...
#include <bits/stdc++.h> using namespace std; const int max_n = 2e5 + 5; long long ans[max_n]; struct no { long long p, val; }; vector<no> v; bool operator<(const no &x, const no &y) { return x.p < y.p; } int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { long long...
////////////////////////////////////////////////////////////////////// //// //// //// uart_tfifo.v //// //// //// //// ...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const long long int maxN = 5005; long long int n; vector<long long int> a, coords, keys; long long int cnt...
#include <bits/stdc++.h> using namespace std; int mobius[500005], prime_cnt[500005], prime[500005], present[500005], nums[500005], cnt[500005]; vector<int> divisors[500005]; void calc_divisors(int val) { int i; if (divisors[val].size() > 0) return; int foo = sqrt(val); for (i = 1; i <= foo...