akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define ll long long
#define ull unsigned long long
#define ld long double

#define tiii tuple < int, int, int >
#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >
#define pis pair < int, string >

#define vi vector < int >
#define vd vector < double >
#define vld vector < ld >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define vpi vector < pii >
#define vpll vector < pll >
#define vpis vector < pis >

#define pb push_back
#define mt make_tuple
#define gt0 get < 0 >
#define gt1 get < 1 >
#define gt2 get < 2 >

#define pi acos(-1)

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 9;

ll a[maxn], f[maxn];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    fast;

    int n, k;

    cin >> n >> k;

    for(int i = 1; i <= n; i++) cin >> a[i];

    f[n] = 0;

    for(int i = n - 1; i > 0; i--){
        f[i] = 1e18;

        for(int j = 1; j <= k; j++){
            if(i + j > n) continue;

            f[i] = min(f[i], f[i + j] + abs(a[i] - a[i + j]));
        }
    }

    cout << f[1] << endl;

    return 0;
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define prep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  fspcnt = 0;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  string s;
  cin >> s;
  string t = s.substr(4,6);
  cout << "2018" << t << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

int main() {
    std::string a, b;
    std::cin >> a >> b;
    const int n = std::stoi(a + b);

    for (int i = 1; i <= 1000; ++i) {
        if ((i * i) == n) {
            std::cout << "Yes\n";
            return 0;
        }
    }
    
    std::cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;

const int N = (int)3e3+5;

ll dp[N][N];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,s;
    cin>>n>>s;
    vector<int> a(n+1);
    //dp[0][0] = 1;
    ll ans = 0;
    for(int i=1;i<=n;i++) {
        cin>>a[i];
        for(int j=0;j<=s;j++) {
            dp[i][j] = dp[i-1][j];
            if(j>=a[i]) dp[i][j] = (dp[i][j] + dp[i-1][j-a[i]])%mod;
        }
        dp[i][a[i]] = (dp[i][a[i]] + i)%mod;
        ans = (ans + dp[i][s])%mod;
    }
    cout<<ans;
}


Measured memory_bytes: 70656
#include <algorithm>
#include <iostream>

auto main() -> int {
  int a, b;
  std::cin >> a >> b;

  const auto c1 = std::minmax(a, b);
  const auto c2 = std::max(c1.second - 1, c1.first);

  std::cout << c1.second + c2 << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
const int MOD = 1000000007;

int main(){
  int n, k;
  cin >> n >> k;
  vector<ll> b(n+2), e(n+2);
  b[0] = 0;
  e[0] = 0;
  REP(i, 1, n+1){
    b[i] = b[i-1] + (i-1);
    e[i] = e[i-1] + (n+1-i);
  }

  ll cnt = 0;
  REP(i, k, n+1){
    cnt += e[i] - b[i] + 1; 
    cnt %= MOD;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 6364
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }

// $ g++ -std=c++11 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
string yes="YES",no="NO";
bool solve(int N, int M, VI &A, VI &B) {
  map<int,int> im;
  REP(i,M) im[A[i]]++,im[B[i]]--;
  int p=0;
  FORR(kvp,im) {
    p=(p+kvp.second)%2;
    if(p==1) return false;
  }
  return true;
}

int main() {
  int N,M; scanf("%d %d",&N,&M);
  vector<int> A(M),B(M);
  REP(i,M) scanf("%d %d",&A[i],&B[i]);
  string res=solve(N,M,A,B)?yes:no;
  printf("%s\n",res.c_str());
}


Measured memory_bytes: 5120
//ProblemC

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//for
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define forbe(i, begin, end) for(decltype(begin) i = (begin); i > (end); ++i)
#define forbes(i, begin, end, step) for(decltype(begin) i = (begin); i > (end); i += (step))

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
#define fi first
#define se second

//vector
template <typename Value>
static inline void fillv(Value& x, const Value& val) { x = val; }
template <typename Vector, typename Value>
static inline void fillv(Vector& v, const Value& val) { for (auto& x : v) fillv(x, val); }

static inline void Solve();

int main(int argc, char* argv[]) {
#ifdef REDIRECT_STDIO
	REDIRECT_STDIO;
#endif // REDIRECT_STDIO

	Solve();
	return 0;
}

constexpr int MAXN = 200000;
int a[MAXN];
int n;

//ProblemC
void Solve() {
	cin >> n;
	forn(i, n) cin >> a[i];

	while (n >= 0 && a[n - 1] == 0) n--;
	ll cnt = 0;

	int last = 0;
	for(int i = n - 1;i >= 0; i--) {
		if (a[i] > i || a[i] < last) {
			cnt = -1;
			break;
		}
		if (a[i] != last) {
			cnt += a[i];
		}
		last = max(0, a[i] - 1);
	}
	cout << cnt << endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main()
{
    int q, t=1, f,k;
    string  s; char x;
    deque <char> v;
    cin >> s;
    for (int i = 0; i< s.size(); i++)
        v.push_back(s[i]);
    cin >> q;
    int j = 1, ct = 0;
    while (q--)
    {
        cin >> k;
        if (k == 1)
        {
            ct++;
            t = 3-t;
        }
        else
        {
            cin >> f >> x;
            if (t == 1)
            {
                if (f == 1)
                    v.push_front(x);
                else
                    v.push_back(x);
            }
            else
            {
                if (f==1)
                    v.push_back(x);
                else
                    v.push_front(x);
            }
        }
    }
    if (ct % 2 == 0)
    {
        while(!v.empty())
        {
            cout<< v.front();
            v.pop_front();
        }
    }
    else
    {
        while(!v.empty())
        {
            cout<< v.back();
            v.pop_back();
        }
    }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;

  vector<int> p(m);
  vector<string> s(m);

  for (int i = 0; i < m; ++i)
    cin >> p[i] >> s[i];

  vector<int> ac(n), wa(n);

  for (int i = 0; i < m; ++i) {
    if (s[i] == "AC" && ac[p[i] - 1] == 0)
      ac[p[i] - 1]++;
    if (s[i] == "WA" && ac[p[i] - 1] == 0)
      wa[p[i] - 1]++;
  }

  for (int i = 0; i < m; ++i) {
    if (ac[p[i] - 1] == 0)
      wa[p[i] - 1] = 0;
  }

  int a = 0, w = 0;
  for (int i = 0; i < n; ++i) {
    a += ac[i];
    w += wa[i];
  }

  cout << a << " " << w << endl;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define R cin>>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long unsigned int ll;
int main(){
    string s;
    R s;
    if (s[0] != s[1] && s[1] != s[2] && s[2] != s[3]) {
        cout << "Good";
    } else {
        cout << "Bad";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int S=0,h=0,m=0,s=0;
  scanf("%d", &S);
  h=S/3600;
  m=(S-h*3600)/60;
  s=S-h*3600-m*60;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(v)  (v).begin() (v).end()

void solve()
{
    ll n,d,x,y;
    cin >> n>>d;
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        ans+=(x*x+y*y<=d*d);
    }
    cout<<ans;
}



int main()
{
  

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    for(int i = 0; i < t; i++)
    {
        solve();
    }

}

Measured memory_bytes: 3648
/*Graph*/
#include <stdio.h>
#define N 101

int main(){
  int n, u, v[N], k, i, j, l;
  int m[N][N];

  scanf("%d", &n);


  for (i=1; i<=n; i++){
    for (j=1; j<=n; j++)
	m[i][j] = 0;
  }
  
  for (i=1; i<=n; i++){
    scanf("%d%d", &u, &k);
    for (j=0; j<k; j++){
      scanf("%d", &v[j]);
      m[u][v[j]] = 1;
    }
  }
  
  for (i=1; i<=n; i++){
    for (j=1; j<=n; j++){
      if (j==n) printf("%d", m[i][j]);
      else printf("%d ", m[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2112
import numpy as np
N, D = map(int, input().split())
x = []
for _ in range(N):
    x.append(list(map(int, input().split())))
x = np.array(x)
c = 0
for i in range(N-1):
    y = x[i+1:]
    y = np.sqrt(np.sum((y - x[i])*(y-x[i]), axis=1))
    c += len(np.where(y==y.astype('i'))[0])
print(c)

Measured memory_bytes: 12420
#include <stdio.h>

int main()
{
    char a[100]={0};
    int i;
    
    scanf("%s",a);
    for(i=1; a[i] != '\0' ;i++)
    {
    }
    printf("%c%d%c\n",a[0],i-2,a[i-1]);
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> pp;

int N;
const int MAX_N = 55;
int a[MAX_N];
vector<pp> s;

int main(){
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i=1;i<=N;i++){
		cin >> a[i];
	}

	int m = min_element(a+1,a+N+1)-a;
	int M = max_element(a+1,a+N+1)-a;

	if(a[M]+a[m] >= 0){
		for(int i=1;i<=N;i++){
			if(a[i]<0){
				s.push_back({M,i});
			}
		}
		for(int i=1;i<=N-1;i++){
			s.push_back({i,i+1});
		}
	}else{
		for(int i=1;i<=N;i++){
			if(a[i]>0){
				s.push_back({m,i});
			}
		}
		for(int i=N;i>1;i--){
			s.push_back({i,i-1});
		}
	}

	cout << s.size() << endl;
	for(auto& i:s){
		cout << i.first << " " << i.second << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
w=list(input())
l=len(w)
w.append(0) #そのままだとforループの最後でw[i+2]がout of rangeになる
for i in range(l-1):
    if w[i]==w[i+2]:
        print("{} {}".format(i+1,i+3))
        break
    elif w[i]==w[i+1]:
        print("{} {}".format(i+1,i+2))
        break
else:
    print("{} {}".format(-1,-1))

Measured memory_bytes: 3956
use std::io::prelude::*;
use std::str::FromStr;
pub struct Scanner<R: Read>(R);
impl<R: Read> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self(reader)
    }
    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| (b as char).is_whitespace())
            .take_while(|&b| !(b as char).is_whitespace())
            .collect::<Vec<u8>>();
        unsafe { std::str::from_utf8_unchecked(token.as_slice()) }
            .parse()
            .ok()
            .expect("Can't parse it.")
    }
    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
fn main() {
    let (stdin, stdout) = (std::io::stdin(), std::io::stdout());
    let mut sc = Scanner::new(stdin.lock());
    let mut out = std::io::BufWriter::new(stdout.lock());
    solve(&mut sc, &mut out);
    out.flush().ok().unwrap();
}
fn solve(sc: &mut Scanner<std::io::StdinLock>, out: &mut std::io::BufWriter<std::io::StdoutLock>) {
    let N: usize = sc.read();
    let A: Vec<i32> = sc.vec(N);

    use itertools::Itertools;
    println!("{}", A.iter().unique().count());
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;





int main(int argc, const char * argv[]) {
    
   

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,a; cin >> n >> a;
    
    cout << n*n - a << endl;
}



Measured memory_bytes: 256
#![allow(unused_imports, non_snake_case)]
use proconio::{
    input, fastout,
    marker::{Chars, Bytes, Usize1}
};

#[fastout]
fn main() {
    input!{
        s: String
    }
    let t = s.chars().collect::<Vec<_>>()[s.len()-1];
    println!("{}{}", s, if t == 's' { "es" } else { "s" });
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int main(){
    while(true){
        int h,w;
        cin >> h >> w;
        if(h == 0 && w == 0)break;

        rep(i,h){
            rep(j,w){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;



    }
}


Measured memory_bytes: 3076
#include<stdio.h>
int main(void)
{
	char so[10001];
	int i,j,flg,n;
	int sum,cnt;
	
	for(i=2;i<=10000;i++)	{
		so[i]=1;
	}
	for(i=2;i<=100;i++)	{
		for(j=i*2;j<=10000;j=j+i)	{
			so[j]=0;
		}
	}
	while(1)	{
		scanf("%d",&n);
		if(n==0)	break;
		cnt=0;
		for(i=2;i<=n;i++)	{
			if(so[i]==1)	{
				sum=0;
				for(j=i;j<=n;j++)	{
					if(so[j]==1)	{
						sum+=j;
						if(sum==n)	{
							cnt++;
							break;
						}
						else if(sum>n)	{
							break;
						}
					}
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}


Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,sum=0;
    cin>>n;
    for(long long i=1; i<=n; i++)
        if((i%3!=0 && i%5!=0) && (i%3!=0 || i%5!=0))
            sum+=i;

    cout<<sum<<endl;
    return 0;

}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
#define ll long long
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> siz; //素集合のサイズ
    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if(siz[rx]<siz[ry])swap(rx,ry);
        siz[rx] += siz[ry];
        par[ry] = rx; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool issame(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main(){
    int N,M;
    cin >>N>>M;
    //最も大きな友人集合の大きさが答え
    UnionFind tree(N);
    
    rep(i,M){
        int x,y;
        cin>>x>>y;
        if(x<y){
            swap(y,x);
        }
        tree.unite(x,y);
    }
    int ans =0;
    for(int p: tree.siz){
        ans=max(p,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4772
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;

  vector<vector<int32_t>> dp(s.size() + 1, vector<int32_t>(t.size() + 1, 0));

  for (int32_t i = 1; i <= s.size(); ++i) {
    for (int32_t j = 1; j <= t.size(); ++j) {
      if (s[i-1] == t[j-1]) {
        dp[i][j] = dp[i-1][j-1] + 1;
      } else {
        dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
      }
    }
  }

  int32_t i = s.size();
  int32_t j = t.size();
  vector<char> rev;
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i-1][j]) {
      --i;
    } else if (dp[i][j] == dp[i][j-1]) {
      --j;
    } else {
      --i;
      --j;
      rev.push_back(s[i]);
    }
  }
  for (auto itr = rev.rbegin(); itr != rev.rend(); ++itr) {
    cout << *itr;
  }
  cout << endl;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


int main(){
    ll n, t, a;    cin >> n >> t >> a;
    vector<ll> h(n);
    a *= 1000; t *= 1000;
    ll ans=1e+5, mini=1e+14;
    for(int i=0; i<n; i++){
        ll x;   cin >> x;
        ll tmp = abs(t-6*x-a);
        if(tmp<mini){
            ans = i+1; mini = tmp;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int64_t power(int64_t n, int64_t k, int64_t p) {
  if (k == 0) return 1;
  int64_t ans = power(n * n % p, k / 2, p);
  if (k % 2) ans = ans * n % p;
  return ans;
}

int main() {
  int n, p;
  cin >> n >> p;
  string s;
  cin >> s;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    d.at(i) = s.at(i) - '0';
  }
  int64_t ans = 0;
  if (p == 2 || p == 5) {
    for (int i = 0; i < n; i++) {
      if (d.at(i) % p == 0) {
        ans += i + 1;
      }
    }
    cout << ans << endl;
    return 0;
  }
  vector<int> r(n + 1);
  for (int i = 0; i < n; i++) {
    r.at(i + 1) = (power(10, i, p) * d.at(n - 1 - i) + r.at(i)) % p;
  }
  sort(r.begin(), r.end());
  int k = 0;
  for (int i = 0; i < n; i++) {
    ans += k;
    if (r.at(i + 1) != r.at(i)) {
      k = 0;
    } else {
      k++;
    }
  }
  ans += k;
  cout << ans << endl;
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int INF = 1e9 + 7;

ll cnt[100001], a, b, num, n, q, x, i;
ll sum = 0;

int main(void)
{
	FAST
	
	cin >> n;
	for(i = 0; i < n; i++)
	{
		cin >> x;
		sum += x;
		cnt[x]++;
	}

	cin >> q;

	for(i = 0; i < q; i++)
	{
		cin >> a >> b;

		num = cnt[a];
		cnt[a] = 0;
		sum -= a*num;
		cnt[b]+=num;
		sum += b*num;
		cout << sum << '\n';
	}

			
	return 0;
}


Measured memory_bytes: 4440
#include<bits/stdc++.h>
#include<boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

int main() {
	u64 H, W;
	cin >> H >> W;

    u64 Ch, Cw;
    cin >> Ch >> Cw;

    u64 Dh, Dw;
    cin >> Dh >> Dw;

    vector<vector<bool>> HW(H, vector<bool>(W));

    for(u64 i=0; i<H; i++) {
        for(u64 j=0; j<W; j++) {
            char c;
            cin >> c;
            HW[i][j] = (c == '.');
        }
    }
    
    vector<vector<u64>> M(H, vector<u64>(W, UINT64_MAX));
    M[Ch-1][Cw-1] = 0;

    deque<pair<u64, u64>> F;
    F.push_back(make_pair(Ch-1, Cw-1));

    while(!F.empty()) {
        s64 Fh = F.front().first;
        s64 Fw = F.front().second;
        F.pop_front();

        for(s64 h=max(0l, Fh-2); h<min((s64)H, Fh+3); h++) {
            for(s64 w=max(0l, Fw-2); w<min((s64)W, Fw+3); w++) {
                if(!HW[h][w]) continue;

                if(abs(h - Fh) + abs(w - Fw) > 1) { // warp
                    if(M[h][w] > M[Fh][Fw] + 1) {
                        M[h][w] = M[Fh][Fw] + 1;
                        F.push_back(make_pair(h, w));
                    }
                } else { // walk
                    if(M[h][w] > M[Fh][Fw]) {
                       M[h][w] = M[Fh][Fw];
                        F.push_front(make_pair(h, w));
                    }
                }
            }
        }
    }

    if(M[Dh-1][Dw-1] == UINT64_MAX) {
        cout << -1 << endl;
    } else {
        cout << M[Dh-1][Dw-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 11820
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main
{
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        String t=sc.nextLine();
        int value[][]=new int[s.length()+1][t.length()+1];
        for(int i=1;i<=s.length();i++)
        {
            for(int j=1;j<=t.length();j++)
            {
                if(s.charAt(i-1)==t.charAt(j-1))
                  {
                      value[i][j]=value[i-1][j-1]+1;
                  }
                else 
                {
                    if(value[i][j-1]>value[i-1][j])
                       {
                        value[i][j]=value[i][j-1];
                       }
                    else
                    {
                        value[i][j]=value[i-1][j];
                    }
                }
              //  System.out.print(value[i][j].value+" "+value[i][j].dir+", ");
            }
            //System.out.println("");
        }
        int i=s.length(),j=t.length();
        StringBuilder common=new StringBuilder("");
        while(i>=0&&j>=0&&value[i][j]!=0)
        {
            if(s.charAt(i-1)==t.charAt(j-1))
            {
                common=common.append(s.charAt(i-1));
                 i--;j--;
            }
            else if(value[i][j-1]>value[i-1][j])
            {
                j--;
            }
            else
             {
                 
                 i--;
             }
        }
        System.out.println(common.reverse().toString());
        sc.close();
    }
}

Measured memory_bytes: 86656
#include <bits/stdc++.h>
using namespace std;

int main(){
    long long n, m, tem, sum = 0;
    cin >> n >> m;
    long long a[n];
    for(int i=0; i<n; i++) cin >> a[i];

    sort(a, a+n);

    while(m>0){
        tem = a[n-1]/2;
        for(int i=n-1; i>=0; i--){
            if(tem > a[i] || m == 0) break;

            a[i] /= 2;
            m--;
        }
        sort(a, a+n);
    }

    for(int i=0; i<n; i++) sum += a[i];
    cout << sum;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {

    int N, A;
    double sum=0;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A;
        sum += 1.0/double(A);
    }

    cout << 1.0/sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5+5;
const ll mod = 998244353;

int n,l[N],r[N];

set<pair<int,int> >L,R;
set<pair<int,int> >::iterator it;

ll move(int &p,int x){
	int ret=0;
	if(l[x]<=p&&p<=r[x])ret=0;
	else if(abs(l[x]-p)>abs(r[x]-p))ret=abs(r[x]-p),p=r[x];
	else ret=abs(l[x]-p),p=l[x];
	return ret;	
}

ll Solve(bool f){
	int p=0;
	ll ret=0;
	for(int i=1,x;i<=n;++i){
		if((i^f)&1){
			it=L.end();it--;
			x=it->second;
			ret+=move(p,x);
		}
		else{
			it=R.begin();
			x=it->second;
			ret+=move(p,x);
		}
		L.erase(make_pair(l[x],x));
		R.erase(make_pair(r[x],x));
	}
	ret+=abs(p); 
	return ret;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d%d",&l[i],&r[i]);
	ll ans[2];
	for(int f=0;f<2;++f){
		for(int i=1;i<=n;++i)L.insert(make_pair(l[i],i)),R.insert(make_pair(r[i],i));
		ans[f]=Solve(f);
	}
	printf("%lld\n",max(ans[0],ans[1])); 
}

Measured memory_bytes: 12416
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		long n = Long.parseLong(str);

		Data[] ab = new Data[(int)n];

		for(int i = 0; i < n;i++) {
			str = scan.nextLine();
			ab[i] = new Data(Long.parseLong(str.split(" ")[0]), Long.parseLong(str.split(" ")[1]));
		}

		Arrays.sort(ab, new MyComparator());
		long sum = 0;
		long dead = 0;
		String yes = "Yes";
		for(int i = 0; i < n; i++) {
			sum += ab[i].a;
			dead = ab[i].b;
			//System.out.println("sum:" + sum + " dead:" + dead);
			if(sum > dead ) {
				yes = "No";
				break;
			}
		}

		System.out.println(yes);


	}

	public static class Data  {
        long a, b;
        public Data(long a, long b) {
            this.a = a;
            this.b = b;
        }
    }
    // Comparator インターフェースを実装する
    public static class MyComparator implements Comparator<Data> {
        public int compare(Data d1, Data d2) {
            if (d1.b == d2.b) {
                return (int)(d1.a - d2.a);
            } else {
                return (int)(d1.b - d2.b);
            }

        }
    }

}


Measured memory_bytes: 231316
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  
  int sum = 0;
  
  for (int i = 0;i < N;i++) {
    int x;
    cin >> x;
    if (x < K - x) {
      sum += x;
    }
    else {
      sum += K - x;
    }
  }
  cout << sum * 2 << endl;
}
      

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    int H[N];
    for(int i=0; i<N; i++){
        cin >> H[i];
    }
    int max = H[0];
    for(int i=1; i<N; i++){
        if(max-H[i]>1){
            cout << "No" << endl;
            return 0;
        }
        if(max < H[i]) max = H[i];
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;
#define SAY_YES cout<<"YES"<<endl;
#define SAY_Yes cout<<"Yes"<<endl;
#define SAY_NO cout<<"NO"<<endl;
#define SAY_No cout<<"No"<<endl;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


long long int N,used[105]={},res=0;
pair<long long int,long long int>ab[105],cd[105];
int main() {
	cout << fixed << setprecision(18);
	cin>>N;
    for(int i=0;i<N;i++){
        cin>>ab[i].first>>ab[i].second;
    }
    for(int i=0;i<N;i++){
        cin>>cd[i].first>>cd[i].second;
    }
    sort(cd,cd+N);
    for(int i=0;i<N;i++){
        long long int id=-1,maxb=-1;
        for(int j=0;j<N;j++){
            if(used[j]==1){continue;}
            if(ab[j].first<cd[i].first&&ab[j].second<cd[i].second&&maxb<ab[j].second){
                id=j;
                maxb=ab[id].second;
            }
        }
        if(id!=-1){
            res++;
            used[id]=1;
        }
    }
    cout<<res;
} 


Measured memory_bytes: 256
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define xrep(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define all(A) A.begin(), A.end()
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modPow(ll x,ll n,ll mod){if(n==0)return 1; if(n%2==0)return modPow(x*x,n/2,mod)%mod; return x%mod*modPow(x,n-1,mod)%mod;}


/*------------------------------------------------*/

//main関数
int main() {
    ll d, g; cin >> d >> g;
    g /= 100;
    vl p(d), c(d);
    rep(i,d) {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }

    ll ans = INF;
    rep(tmp, 1<<d){
        bitset<16> comp(tmp); //コンプリートするかどうか
        ll count = 0, score = 0, noncomp = 0;
        rep(i,d){
            if(comp.test(i)){
                count += p[i];
                score += p[i] * (i + 1) + c[i];
            }
            else{
                noncomp = i;
            }
        }
        ll dis = (g - score + (noncomp + 1) - 1) / (noncomp + 1);
        if(dis < p[noncomp] && score < g){
            count += dis;
            score += dis * (noncomp + 1);
        }
        if(score >= g && ans > count){
            ans = count;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3608
// V solo
#include <bits/stdc++.h>

#define forn(i, a, b) for (int i = a; i <= b; ++i)
#define forr(i, a, b) for (int i = a; i >= b; --i)

using namespace std;

const int N = (int)3e5 + 1;
const int INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int n, ans[N];
pii a[N];
int main (){
  scanf ("%d", &n);
  forn (i, 1, n){
    scanf ("%d", &a[i].first);
    a[i].second = i;
  }
  sort (a + 1, a + n + 1);
  int l = n / 2;
  forn (i, 1, n){
    if (i <= l){
      ans[a[i].second] = a[l + 1].first;
    } else {
      ans[a[i].second] = a[l].first;
    }
  }
  forn (i, 1, n){
    printf ("%d\n", ans[i]);
  }
  return 0;
}


Measured memory_bytes: 4608
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


signed main(){
	int a,b;
	cin>>a>>b;
	a--;
	b--;
	cout<<(b+a-1)/a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for(int i=a; i<b; i++)

char s[64][64];

int main(){
  int h, w; scanf("%d%d", &h, &w);
  REP(i, h) scanf("%s", s[i+1]+1);
  FOR(i, 1, h+1){
    FOR(j, 1, w+1){
      if(s[i][j] == '.'){
        s[i][j] = '0';
        REP(k, 3) REP(l, 3) if(s[i+k-1][j+l-1]=='#') s[i][j]++;
      }
    }
    printf("%s\n", s[i]+1);
  }
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		double n = sc.nextInt();
		double d = sc.nextInt();
		
		// 計算
		int result = (int)ceil(n/(2*d + 1));
		
		// 出力
		System.out.println(result);
	}

}


Measured memory_bytes: 21844
import Data.Foldable (and, or, product, sum)
import Data.Function

import qualified Data.List as L

main :: IO ()
main = do
    n  <- read <$> getLine
    as <- getSeq
    print $ solve n as

getSeq  = map read . words <$> getLine   :: Read a => IO [a]

solve :: Int -> [Int] -> Int
solve n as =
  let
    replaceTo :: Int -> Int
    replaceTo y = sum $ L.map (`cost` y) as
  in
    L.minimum $ L.map replaceTo [L.minimum as .. L.maximum as]

cost :: Int -> Int -> Int
cost x y = (x - y) ^ 2


Measured memory_bytes: 1020
A = [[0 for _ in range(3)] for _ in range(3)]
for i in range(3):
    a1, a2, a3 = map(int, input().split())
    A[i] = [a1, a2, a3]
N = int(input())
board = [[False for _ in range(3)] for _ in range(3)]
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                board[i][j] = True
# yoko
for i in range(3):
    if board[i][0] and board[i][1] and board[i][2]:
        print('Yes')
        exit(0)
# tate
for j in range(3):
    if board[0][j] and board[1][j] and board[2][j]:
        print('Yes')
        exit(0)

# naname
if board[0][0] and board[1][1] and board[2][2]:
    print('Yes')
    exit(0)
if board[0][2] and board[1][1] and board[2][0]:
    print('Yes')
    exit(0)
print('No')

Measured memory_bytes: 38384
import sys
sys.setrecursionlimit(10 ** 6)

def solve():
    N, Q = map(int, input().split())
    graph = [[] for _ in range(N)]
    for i in range(N - 1):
        a, b = map(lambda x: int(x) - 1, input().split())
        graph[a].append(b)
        graph[b].append(a)
    ans = [0] * N
    for i in range(Q):
        p, x = map(int, input().split())
        p -= 1
        ans[p] += x
    def dfs(cur, pre):
        for to in graph[cur]:
            if to == pre:
                continue
            ans[to] += ans[cur]
            dfs(to, cur)
    dfs(0, -1)
    print(*ans)
    return

solve()


Measured memory_bytes: 282888
#include <bits/stdc++.h>

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

int gcd(int x, int y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a <= c && c <= b) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	hawawa();
}


Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    n, k = map(int, input().split())
    cnt = {}
    for i in range(n):
        a, b = map(int, input().split())
        if a not in cnt:
            cnt[a] = 0
        cnt[a] += b
    print(kth_smallest(cnt, k))

def kth_smallest(cnt, k):
    keys = sorted(cnt.keys())
    for key in keys:
        k -= cnt[key]
        if k <= 0:
            return key
    raise Exception

main()


Measured memory_bytes: 10592
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;


//0 : bad
//1 : good
int main(){
  int i,j,k,y,n;
  vector<vector<int>> xy(15,vector<int>(15));
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    xy[i].assign(15,-1);
    for(int k=0;k<a[i];k++){
      cin>>j>>y;
      xy[i][j-1]=y;
    }
  }
  int ans=0;
  for (int bit = 0; bit < (1<<n); ++bit){
    bool flag=true;
    for (int i = 0; i < n; ++i) {
      if(bit&(1<<i)){ //iが正直者のとき言ってることは正しいはず
	for(int j = 0; j < n; ++j) {
	  //if(a[i][j]==-1)//無視するケースですわ
	  if(xy[i][j]==1){//jが正直者
	    if(!(bit&(1<<j))){//trueなら問題ない
	      flag=false;
	    }
	  }
	  else if(xy[i][j]==0){//jが正直者でない
	    if(bit&(1<<j)){//true=jが正直者
	      flag=false;
	    }
	  }
	  //	  cout<<bitset<8>(bit)<<" "<<i<<" "<<j<<" "<<xy[i][j]<<" "<<flag<<"\n";
	}
      }
    }
    if(flag){
      //      cout<<bitset<15>(bit)<<"\n";
      ans=max(ans,__builtin_popcount(bit));
    }
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define sigma_size 30
#define max_size (int)(1e5+10)
#define MAX (int)(1e5+7)
int qread()
{
	char c; int s=0,t=1; while ((c=getchar())<'0' || c>'9') (c=='-' && (t=-1));
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s*t;
}
int main ()
{
	LL s;
	scanf ( "%lld",&s );
	int a , b , c , d;
	a = d = (int)sqrt(s);
	b = c = 0;
	while ( s > 1ll * a * d ){
		if ( a < d ) a++;
		else d++;
	}
	LL k = 1ll * a * d - s;
	for ( int i = 1 ; i <= sqrt(k) ; i++ )
	{
		if ( k % i == 0 )
		{
			if ( i <= 1e9 && k / i <= 1e9 ){
				b = i;
				c = k / i;
				break;
			}
		}
	}
	printf ( "0 0 %d %d %d %d\n",a,b,c,d );
	return 0;
}

Measured memory_bytes: 3776
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, k: usize, a: [u128; n]};

    let mut v: Vec<u128> = Vec::new();
    // let mut count: usize = 0;
    // let mut result: u128 = 1;

    for i in k..n {
        if a[i] > a[i - k] {
            println!("Yes")
        } else {
            println!("No")
        }
    }

    // for i in 0..k {
    //     result *= a[i];
    // }
    // v.push(result);

    // for i in k..n {
    //     v.push(v[count] / a[i - k] * a[i]);
    //     count += 1;
    // }

    // println!("{:?}", v);

    // for i in 0..v.len() - 1 {
    //     if v[i] < v[i + 1] {
    //         println!("Yes")
    //     } else {
    //         println!("No")
    //     }
    // }
}


Measured memory_bytes: 7104
#pragma GCC optimize ("Ofast","unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define F first
#define S second
#define setpre(a) cout.precision(a),cout<<fixed;
#define ALL(a) a.begin(),a.end()
#define MEM(a,b) memset(a,b,sizeof a)
#define Tie ios::sync_with_stdio(0),cin.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

ll ans,n,a[200];

int main(){Tie
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<1000;i++){
		ll tans=0;
		for(int j=0;j<n;j++){
			tans+=(a[j]-i)*(a[j]-i);
		}
		if(i==0)ans=tans;
		ans=min(ans,tans);
	}
	cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define C getchar()-48
int read(int s=0,int k=C)
{
  for (;k<0||9<k;k=C);
  for (;0<=k&&k<=9;k=C) s=(s<<1)+(s<<3)+k;
  return s;
}

  int n;
int main()
{
  for (int i=read();~--i;)
    n^=read()&1;
  if (n) puts("NO");
  else puts("YES");
  exit(0);
} 

Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;

int n,l,s;
int main()
{
	scanf("%d%d",&n,&l);
	s=n*l+n*(n-1)/2; int as=inf,ans=0;
	for(int i=1;i<=n;i++)
		if(abs(l+i-1)<as)	as=abs(l+i-1),ans=l+i-1;
	printf("%d\n",s-ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);
	      	  
	      	  string s;
	      	  cin >> s;
	      	  int n=s.size();
	      	  s[3]='8';
	      	  cout << s << endl;

	          return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
#define tl 1'000'000'007
//grid 深さ優先
vector<vector<int>> grid_bfs(const vector<string> &g, char start, char wall) {
    const int INF = 1000000000;
    using pii = std::pair<int, int>;

    int h = g.size(), w = g[0].size();
    static const auto is_valid = [&](int i, int j) {
        if (i < 0 || i >= h || j < 0 || j >= w) return false;
        if (g[i][j] == wall) return false;
        return true;
    };

    static const pii dir[] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    queue<pii> q;
    vector<vector<int>> d(h, vector<int>(w, INF));

    REP(i, h) REP(j, w) {
        if (g[i][j] == start) {
            d[i][j] = 0;
            q.emplace(i, j);
        }
    }

    while (q.size()) {
        int ci, cj;
        std::tie(ci, cj) = q.front();
        q.pop();
        for (auto &v : dir) {
            int ni = ci + v.first;
            int nj = cj + v.second;
            if (is_valid(ni, nj)) {
                int nd = d[ci][cj] + 1;
                if (d[ni][nj] > nd) {
                    d[ni][nj] = nd;
                    q.emplace(ni, nj);
                }
            }
        }
    }

    return d;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;
    cin >> h >> w;
    vector<string>A(h);
    vector<vector<int>> ans;
    int b=0;
    REP(i,h){
        cin >> A[i];
        REP(j,w){
            if(A[i][j]=='#') b++;
        }
    }
    A[0].replace(0, 1, "s");
    ans= grid_bfs(A,'s','#');
    int aa= h*w-b-(ans[h-1][w-1]+1);
    cout << ((aa>=0)?aa:-1) << endl;
    // REP(i,h){
    //     REP(j,w){
    //         cout << ans[i][j] << " ";
    //     }cout << endl;
    // }
    // 深さ優先
    // vector<Point> V;
    // Point start= {0,0,0};
    // while(1){
    
    // }
}
    // 584 husky
    // 試食いかがですかべにはるか

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
using namespace std;

/** defines and macros */
#define ll long long
#define ull unsigned long long
#define loop(n) for(int i = 0; i < n; i++)
#define loop1(n) for(int i = 1; i <= n; i++)
#define all(v) (v.begin(), v.end())
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vvi vector<vi>
#define vvpii vector<vii>
#define PB push_back

#define fw(fileName) freopen(fileName, "w", stdout)
#define fr(fileName) freopen(fileName, "r", stdin)
#define fc(stream) fclose(stream);

#define faster_IO_stream ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

/*To compile and run

	g++ -o main main.cpp && ./main

*/

/*
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣀⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣀⡀⠄⠄⠄⠄⠄⣰⣷⡀⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⣀⣀⣀⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⢠⣿⣿⣷⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠤⠒⠛⠛⠛⠛⠻⠷⣦⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢀⣤⣤⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣡⡤⠐⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⢀⣶⣿⣿⠿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⢠⣿⠟⠉⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠘⠁⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⣾⣿⡿⣽⡿⢹⣿⣿⣟⣿⢻⠇⢀⢹⣿⢿⣿⣿⣿⣿⣿⣦⣙⢿⣿⢷⣈⠻⢿⣟⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢿⡿⠁⡿⠁⢸⣿⣿⢹⡇⢸⠄⠈⠄⠻⣏⠻⣿⡿⣿⣿⣿⣌⠛⢿⡌⠙⢧⣀⠙⢳⡹⢻⣿⣿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠘⡇⠄⡇⢠⣼⣿⣿⠈⡇⠘⠤⠤⠤⠤⢜⣢⣘⡻⢮⡛⢿⣿⣷⣬⡤⠤⠤⠤⠥⠤⠥⢬⣿⣧⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠘⢿⡏⠛⠄⠄⠄⠄⠄⠄⠄⠄⠄⠙⣿⣿⣿⡿⠋⠉⠛⠉⠄⠄⠄⠄⠄⠄⠄⢹⡿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡟⠁⠈⢳⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠱⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⡜⠁⠄⠄⠈⢇⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠑⠦⢄⣀⣀⣀⣀⣀⠴⠊⠄⠄⠄⠄⠄⠄⠑⠤⢀⣀⣀⣀⡀⠠⠔⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣶⣦⣄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣤⣶⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣶⣄⣀⣀⣀⣀⣤⣾⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠙⢿⣿⣿⣿⡟⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⠟⠋⠁⠄⠄⠄⠄⠄⠄⠄⠄⠉⠛⠿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
 */

int modulo = 1e9 + 7;

int main() {
	faster_IO_stream

	int d, t, s;
	cin >> d >> t >> s;

	if(d / (s * 1.0) <= t) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}



Measured memory_bytes: 3648
#include <stdio.h>
#include <math.h>
int main(void){
    long int n;
    scanf("%ld", &n);

    long int ans = 1;
    long int tmp = pow(10, 9);
    for (long int i = 1; i <= n; i++){
        ans = ans * i % (tmp + 7);
    }
    printf("%ld\n", ans);

    return 0;
}


Measured memory_bytes: 128