akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

static const int MAX_N = 100;

void insertionSort(int A[], int n){
  for(int i = 1; i < n; i++){
    int v = A[i];
    int j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for(int j = 0; j < n; j++){
      cout << A[j];
      if(j < n - 1) cout << " ";
    }
    cout << endl;
  }
}

int main(void){ 
  int A[MAX_N], n;

  cin >> n;
  for(int i = 0; i < n; i++) cin >> A[i];

  for(int i = 0; i < n; i++){
    cout << A[i];
    if(i < n - 1) cout << " ";
  }
  cout << endl;
  insertionSort(A, n);

  return 0;
}

Measured memory_bytes: 1160
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, k: i64,
        a: [i64; n],
        f: [i64; n],
    }
    let mut a = a;
    let mut f = f;
    a.sort();
    f.sort();
    f.reverse();
    let mut pass: i64 = 1 << 40;
    let mut fail = -1;
    while pass - fail > 1 {
        let mid = (pass + fail) / 2;
        let t: Vec<i64> = f.iter().map(|&x| mid / x).collect();
        let mut sum = 0;
        for i in 0..n {
            sum += max(0, a[i] - t[i]);
        }
        if sum <= k {
            pass = mid;
        } else {
            fail = mid;
        }
    }
    puts!("{}\n", pass);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 16636
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int D=sc.nextInt();
		int G=sc.nextInt();
		int[][] prbs=new int[D][2];
		int[] toki=new int[D];
		for(int i=0; i<D; i++) {
			prbs[i][0]=sc.nextInt();
			prbs[i][1]=sc.nextInt();
		}

		int brute=1;
		for(int i=0; i<D; i++) {
			brute*=2;
			toki[i]=0;
		}
		int tmp=0;
		int mondaisu=0;
		int min=Integer.MAX_VALUE;
		for(int i=0; i<brute; i++) {
			tmp=0;
			mondaisu=0;
			int a=i;
			for(int j=0; j<D; j++) {
				tmp+=(a%2)*((j+1)*100*prbs[j][0]+prbs[j][1]);
				mondaisu+=prbs[j][0]*(a%2);
				toki[j]=a%2;
				a/=2;
			}
			if(tmp>=G) {
				min=Math.min(min,mondaisu );
			}
			else if(tmp<G){
				int sabun=G-tmp;
				for(int j=0; j<D; j++) {
					if(toki[j]==0) {
						int tuika=Math.min((sabun+(j+1)*100-1)/((j+1)*100), prbs[j][0]);
						if(sabun<=tuika*(j+1)*100) {
							min=Math.min(min, mondaisu+tuika);
						}
					}
				}
			}
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)


constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	ll n; cin >> n;

	ll ans = 1;
	rep(i, 0, n) ans = ans * -~i % MOD;
	cout << ans;
	return 0;
}

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

/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

using namespace std;

typedef long long ll;

int n;
ll d;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> d;
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        ll x, y;
        cin >> x >> y;
        if(x * x + y * y <= d * d)
            ans++;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3652
use proconio::input;
use num::integer::gcd;
 
fn main() {
  input! {
    n: u64
  }
  
  let mut result: u64 = 0;

  for i in 1..=n {
    for j in 1..=n {
      let mut ij = gcd(i, j);
      for k in 1..=n {
        result += gcd(ij, k);
      }
    }
  }
  
  println!("{}", result);

}

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

using namespace std;

int n;
char x[20];

int main() {
	scanf("%s", x);
	printf(x[0] == 'Y' && x[1] == 'A' && x[2] == 'K' && x[3] == 'I' ? "Yes\n" : "No\n");
	return 0;
}

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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)

int main() {
  int N, H, W;
  cin >> N;
  cin >> H;
  cin >> W;
  int ans = (N - H + 1) * (N - W + 1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
main(){
	long long int N;
	cin >> N;
	for(int n=1;n<3501;n++){
		for(int h=n;h<3501;h++){
			if(4*h*n-N*n-N*h<= 0){
			continue;
			}
			long long int check =  (N*h*n)%(4*h*n-N*n-N*h);
			long long int val =  (N*h*n) / (4*h*n-N*n-N*h);
			if(check==0 && val>0){
				cout << n << " " << h <<" "<< val << endl;
				return 0;
			}
		}
	}
}


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

int main() {
  int N;
  cin >> N;
  int a = 0;
  for ( int i = 0 ; i < N ; i++) {
    string S;
    cin >> S;
    if ( S == "Y" ) {
      
      cout << "Four" << endl;
      a++;
      break;
      }
    }
  if ( a == 0 ) {
    cout << "Three" << endl;
  }
  // ここにプログラムを追記
}


Measured memory_bytes: 256
#include<iostream> 
#include<cstdio>
using namespace std;
long long k,i,x,y;
int main(){
	cin>>k;
	if(!k)cout<<"2\n"<<k/2<<' '<<k/2+1+(k&1)<<endl;
		else{
			puts("50");
			x=(k-1)/50;
			y=k-50*x;
			for(i=50+x;i>50+x-y;)cout<<i--<<' ';
			for(--i;i>=x;)cout<<i--<<' ';
		}
	return 0;
}

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

typedef pair<int, int> pii;

static const int INF = 1 << 28;

int main(){
    int H, W;
    char s[51][51];
    int dist[51][51];
    
    cin >> H >> W;
    
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> s[i][j];
            dist[i][j] = INF;
        }
    }
    
    /*for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cout << s[i][j];
        }
        cout << endl;
    }*/
    
    queue<pii> q;
    q.push(pii(0,0));
    dist[0][0] = 1;

    const int dy[] = {-1, 0, 0, 1}; // y軸方向の移動先
    const int dx[] = {0, -1, 1, 0}; // x軸方向の移動先

    while(q.size()){
        pii p = q.front(); q.pop(); // 現在の座標 
        int cy = p.first;           // 現在のy座標
        int cx = p.second;          // 現在のx座標
        int ccost = dist[cy][cx];   // 総移動距離
        for(int k=0; k<4; k++){     // 上下左右全方向を探索する
            int ny = cy + dy[k];
            int nx = cx + dx[k];
            if(ny>=0 && nx>=0 && ny<H && nx<W && dist[ny][nx]==INF && s[ny][nx]=='.'){
                // 迷路の範囲内 かつ 幅優先探索が終わっていない かつ 移動先が白色のマスならば
                dist[ny][nx] = ccost + 1;   // 移動先のdistに(これまでの移動距離+1)の値を代入
                q.push(pii(ny, nx));        // キューの最後尾に追加
            }
            // 移動不可（移動先が黒マス、または迷路の枠外の場合）ならば何もしない
        }
    }

    if(dist[H-1][W-1]==INF){
            cout << -1 << endl;
    }
    else{
        int last_white_cnt = dist[H-1][W-1];    // 幅優先探索により得られた最短距離
                                                // ゴールに必要な最小の白いマスの数
        int fst_white_cnt = 0;                  // すべての白いマスの数
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(s[i][j]=='.'){
                    fst_white_cnt++;
                }
            }
        }
        cout << fst_white_cnt - last_white_cnt << endl; // 解説の通り
    }

    return 0;
}

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

int main() {
	int A[3];
	cin >> A[0] >> A[1] >> A[2];
	sort(A, A + 3, greater<int>());
	int count = A[0] + A[1] + A[2];
	if (A[0] % 2 == count % 2) cout << (A[0] * 3 - count) / 2;
	else cout << (A[0] * 3 - count + 3) / 2;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int n,x,sum,a,b;

int main()
{
	cin>>n>>a>>b;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		sum+=(x<a||x>=b);
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <sstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
using namespace std;

#define int long long
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define REP(i, a) for (int i = 0, _a = (a); i < _a; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)

#define DEBUG(X) { cerr << #X << " = " << (X) << endl; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << endl; }
#define PR0(A, n) { cerr << #A << " = "; REP(_, n) cerr << A[_] << ' '; cerr << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define double long double
typedef pair<int, int> II;
#define PI (2 * acos((double)0))
#define __builtin_popcount __builtin_popcountll
#define SZ(x) ((int)(x).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(a,x) memset(a, x, sizeof(a))
#define epsilon 0.0000001
using namespace std;

bool check(string s, int len) {
  if (len == 1) return true;
  for (int i=1; i<len; i++) {
    if (s[i] != s[0]) {
      return false;
    }
  }
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int min = 1000;
  REP(i, 26) {
    vector<int> a;
    a.push_back(-1);
    REP(j, s.length()) {
      if(s[j]== 'a'+i) {
        a.push_back(j);
      }
    }
    if (a.size() == 1) continue;
    a.push_back(s.length());
    int max = 0;
    for (int j=0; j<a.size()-1; j++) {
      if (a[j+1] - a[j] - 1 > max) {
        max = a[j+1] - a[j] - 1;
      }
    }
    if (max < min) min = max;
  }
  cout << min << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
s1 = S
while True:
  if s1 == T:
    print('Yes')
    exit()
  s1 = s1[-1]+s1[:-1]
  if s1 == S:
    print('No')
    exit()
  if s1 == T:
    print('Yes')
    exit()

Measured memory_bytes: 3060
n = int(input())
a = 6
b = [1]
b.append(a)
while a <= 100000:
	a *= 6
	b.append(a)
c = 9
b.append(c)
while c <= 100000:
	c *= 9
	b.append(c)
b.sort()
INF = 10**7
dp = [INF]*100001
dp[0] = 0
for i in range(100001):
	for j in b:
		if i + j > 100000:
			continue
		dp[i+j] = min(dp[i]+1, dp[i+j])
print (dp[n])

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<pair<ll, ll>> BA(N);
    rep(i, N) {
        cin >> BA[i].second >> BA[i].first;
    }
    sort(BA.begin(), BA.end());
    ll t = 0;
    rep(i, N) {
        t += BA[i].second;
        if (t > BA[i].first) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
int a,b;
int main(){
    cin>>a>>b;
    if(a+b==15){
        cout<<'+'<<endl;
    }
    else if(a*b==15){
        cout<<"*"<<endl;
    }
    else{
        cout<<"x"<<endl;
    }
}

Measured memory_bytes: 256
// A - Shiritori

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	string A, B, C;
	cin >> A >> B >> C;

	string ans;

	if (A[A.size()-1] == B[0] && B[B.size() -1] == C[0]) ans = "YES";
	else ans = "NO";

	cout << ans << endl;

	return 0;
}

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

typedef long long int ll;
int main() {
  ll n, sum=0LL;cin>>n;
  vector<ll> a(n);
  for(int i=0;i<int(n);i++){
    cin>>a[i];
    sum+=a[i];
  }
  ll ans=ll(1e18), ps=0LL;
  for(int i=0;i<n;i++){
    ps += a[i];
    ans = min(ans, abs(ps*2LL-sum));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
    int count,add,i,num,dnum,knum;
    scanf("%d",&count);
    scanf("%d",&add);
    num=1;
    for(i=0;i<count;i++){
        dnum=num*2;
        knum=num+add;
        if(dnum<knum){
            num=dnum;
        }else{
            num=knum;
        }
    }
    printf("%d\n",num);
    return 0;
}




Measured memory_bytes: 128
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next();
  return Math.ceil(n/111)*111;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n; i >= 0; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m, x;
  cin >> n >> m >> x;
  vi c(n);
  vii a(n,vi(m));
  rep(i,n) {
    cin >> c[i];
    rep(j,m) cin >> a[i][j];
  }
  int ans = inf;
  for(int bit = 0; bit < (1<<n); bit++) {
    bitset<12> b(bit);
    int cost = 0;
    vi u(m);
    rep(i,n) {
      if(b[i]) {
        cost += c[i];
        rep(j,m) u[j] += a[i][j];
      }
    }
    bool ok = true;
    rep(i,m) {
      if(u[i] < x) ok = false;
    }
    if(ok) ans = min(ans, cost);
  }
  if(ans == inf) cout << -1 << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 3664
s,d,e;main(a,b,c){for(scanf("%d%d%d",&a,&b,&c);a%2+b%2+c%2<1&s<30;a=b+c>>1,b=d+c>>1,c=d+e>>1)d=a,e=b,s++;printf("%d",s<30?s:-1);}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<vector<P>> v(n);
  rep(i, 0, n) {
    int c;
    cin >> c;
    rep(j, 0, c) {
      int x, y;
      cin >> x >> y;
      x--;
      v[i].push_back(make_pair(x, y));
    }
  }

  vector<vector<int>> pattern(1 << n);

  rep(i, 0, 1 << n) {
    rep(j, 0, n) {
      if (i >> j & 1)
        pattern[i].push_back(1);
      else
        pattern[i].push_back(0);
    }
  }

  int ans = 0;
  rep(i, 0, 1 << n) {
    bool flg = true;
    rep(j, 0, n) {
      if (pattern[i][j]) {
        for (auto vv : v[j]) {
          if (pattern[i][vv.first] != vv.second) {
            flg = false;
            break;
          }
        }
      }
      if (!flg)
        break;
    }
    if (flg) {
      chmax(ans, __builtin_popcount(i));
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 6628
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec));
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
	int n,m;
	cin>>n>>m;
	int c[364364],d[364364];
	rep(i,364364) {
		c[i]=0; d[i]=0;
	}
	rep(i,m) {
		int a,b;
		cin>>a>>b;
		if(a==1) c[b]++;
		else if(b==n) d[a]++;
	}
	rep(i,364364) {
		if(c[i]==d[i]&&c[i]!=0) {
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 6016
n=int(input())
a=[]
t=n
while(abs(t)>0):
    a.append(abs(t%(-2)))
    if t%(-2)==0:
        t//=-2
    else:
        t//=-2
        t+=1
a=list(map(str, a))
if n==0:
    print(0)
else:
    print("".join(a[::-1]))

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll X;
    cin >> X;

    vll t(100, 0);
    rep(i, 1000) t[i] = i*i*i*i*i;
    rep(i, 1000) rep(j, 1000){
        if(X==t[i]-t[j]){
            cout << i << " " << j << endl;
            return 0;
        }
        if(X==t[i]+t[j]){
            cout << i << " " << -j << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
	int i,num,a[5],flag=0;
	scanf("%d",&num);
	a[0]=-1;
	for(i=1;i<=4;i++)
	{
		a[i]=num%10;
		if(a[i]==a[i-1])
		{
			printf("Bad\n");
			flag=1;
			break;
		}
		num=num/10;
	}
	if(flag==0)
		printf("Good\n");

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	double a, b, c, d, e, f;
	double x, y;
		
	while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		
		x = (c * e - b * f) / (a * e - b * d);
		y = (f * a - c * d) / (a * e - d * b);
		
		if (x == -0){
			x = 0;
		}
		if (y == -0){
			y = 0;
		}
		
		printf("%.3lf %.3lf\n", x, y);
		
	}
	
	return (0);
}

Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
signed main()
{
    int n, k, cnt1 = 0, cnt2 = 0, ans = 0;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        if (i % k == 0)
        {
            cnt1++;
        }
        else if (i % (k / 2) == 0)
            cnt2++;
    }
    ans += (cnt1 * cnt1 * cnt1);
    if (k % 2 == 0)
    {
        ans += (cnt2 * cnt2 * cnt2);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (n, k) = get!(usize, usize);
    let xy = get!(i64, i64; n);

    let mut ans = i64::max_value();

    for i1 in 0..n {
        for i2 in i1 + 1..n {
            for j1 in 0..n {
                for j2 in j1 + 1..n {
                    let (x1, _) = xy[i1];
                    let (x2, _) = xy[i2];
                    let (_, y1) = xy[j1];
                    let (_, y2) = xy[j2];

                    let l = min(x1, x2);
                    let r = max(x1, x2);
                    let d = min(y1, y2);
                    let u = max(y1, y2);

                    if xy.iter()
                        .filter(|&&(x, y)| l <= x && x <= r && d <= y && y <= u)
                        .count() >= k
                    {
                        ans = min(ans, (r - l) * (u - d));
                    }

                }
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> P;


int main(){
    int N; cin >> N;
    vector<vector<int>> a(N, vector<int>(N-1));
    rep(i,N) {
        rep(j,N-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
        reverse(a[i].begin(), a[i].end());
    }

    vector<P> q;
    auto check = [&](int player) {
        if (a[player].size() == 0) return;
        int next_enemy = a[player].back();
        if (a[next_enemy].size() == 0) return;
        if (a[next_enemy].back() == player) {
            P p(player, next_enemy);
            if (p.second < p.first) swap(p.first, p.second);
            q.push_back(p);
        }
    };
    rep(i,N) {
        check(i);
    }
    int day = 0;
    while (q.size() > 0) {
        day++;
      	sort(q.begin(), q.end());
        q.erase(unique(q.begin(),q.end()), q.end());
        vector<P> prevQ;
        swap(prevQ, q);
        for (P p: prevQ) {
            int i = p.first, j = p.second;
            a[i].pop_back();
            a[j].pop_back();
        }
        for (P p: prevQ) {
            int i = p.first, j = p.second;
            check(i);
            check(j);
        }
    }
    rep(i,N) {
        if (a[i].size() != 0) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << day << endl;
    return 0;
}

Measured memory_bytes: 4224
def p_c():
    n, m = map(int, input().split())
    *X, = map(int, input().split())
    X.sort()
    L = [abs(X[i] - X[i + 1]) for i in range(m - 1)]
    L.sort()
    print(sum(L[:len(L) - n + 1]) if m > n else 0)
    
p_c()

Measured memory_bytes: 59304
import sys
import math
import bisect


def main():
    n = int(input())
    A = list(map(int, input().split()))
    cnt = 0
    for a in A:
        if a % 2:
            cnt += 1
    if cnt % 2 == 0:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()


Measured memory_bytes: 14480
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a;
  cin>>a;
  ll b;
  cin>>b;
  vector<ll>vec(b);
  vector<ll>veco(b);
  for(ll i=0;i<b;i++){
    cin>>vec.at(i)>>veco.at(i);
  }
  sort(vec.begin(),vec.end());
  sort(veco.begin(),veco.end());
  ll d=0;
  cout<<max(veco.at(0)-vec.at(b-1)+1,d)<<endl;
  return 0;
}


Measured memory_bytes: 4824
#include <bits/stdc++.h>
#define mem(s,t) memset(s,t,sizeof(s))
#define pb(s) push_back(s)
#define inf 0x3f3f3f3f
#define mn 100010
typedef long long ll;
using namespace std;
int n=1407,k=38;
int ans[2000][100];
int main()
{
    int i,j,l;
    for (i=1;i<=k;i++)
    for (j=0;j<=k-2;j++)
        ans[i][j]=(i-1)*(k-1)+j+2;
    for (i=2;i<=k;i++)
    for (j=0;j<=k-2;j++)
    {
        for (l=0;l<=k-2;l++)
            ans[(i-1)*(k-1)+2+j][l]=ans[l+2][((i-2)*l+j)%(k-1)];
    }
    cout<<n<<' '<<k<<endl;
    for (i=1;i<=k;i++)
    {
        printf("%d",1);
        for (j=0;j<=k-2;j++)
            printf(" %d",ans[i][j]);
        printf("\n");
    }
    for (i=2;i<=k;i++)
    for (j=0;j<=k-2;j++)
    {
        printf("%d",i);
        for (l=0;l<=k-2;l++)
            printf(" %d",ans[(i-1)*(k-1)+2+j][l]);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1024
s=list(input())
t=list(input())
l=len(s)

henkan1 = {chr(ord("a")+i) : set() for i in range(26) }
henkan2 = {chr(ord("a")+i) : set() for i in range(26) }

for i in range(l):
#    if s[i]!=t[i]:
    henkan1[s[i]].add(t[i])
    henkan2[t[i]].add(s[i])
        
if all(len(h) <=1 for h in henkan1.values()) and all(len(h) <=1 for h in henkan2.values()):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 70476
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int h,w,i,j;
	cin >> h >> w;
	char a[h+2][w+2];
	for(i=0;i<h+2;i++){
		for(j=0;j<w+2;j++){
			a[i][j]='#';
		}
	}
	
	for(i=1;i<h+1;i++){
		for(j=1;j<w+1;j++){
			cin >> a[i][j];
		}
	}
	for(i=0;i<h+2;i++){
		for(j=0;j<w+2;j++){
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct mint {
	ll x;
	mint(ll x=0):x((x%MOD+MOD)%MOD){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {if ((x+=a.x)>=MOD) x-=MOD; return *this;}
	mint& operator-=(const mint a) {if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
	mint& operator*=(const mint a) {(x*=a.x)%=MOD; return *this;}
	mint operator+(const mint a) const {mint res(*this); return res+=a;}
	mint operator-(const mint a) const {mint res(*this); return res-=a;}
	mint operator*(const mint a) const {mint res(*this); return res*=a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
 		return a;
	}

	// For prime mod.
	// Do not use if MOD is not prime number !!
	mint inv() const { return pow(MOD-2);}
	mint& operator/=(const mint a) { return (*this) *= a.inv();}
	mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

void solve() {
    ll n;
    cin >> n;
    vll t(n), a(n);
    rep(i, n) cin >> t[i];
    rep(i, n) cin >> a[i];
    bool valid = true;
    for(ll i = 0; i < n - 1; i++) {
        if(t[i] < a[i] && a[i] > a[i + 1]) valid = false;
        else if(t[i] == a[i]) break;
    }
    for(ll i = n - 1; i > 0; i--) {
        if(a[i] < t[i] && t[i - 1] < t[i]) valid = false;
        else if(t[i] == a[i]) break;
    }
    if(t[n - 1] != a[0]) valid = false;
    if(!valid) {
        cout << 0 << endl;
        return;
    }
    vb change(n, true);
    for(ll i = 1; i <= n - 2; i++) {
        if(t[i] > a[i]) break;
        if(t[i] != t[i - 1]) change[i] = false;
    }
    for(ll i = n - 2; i >= 1; i--) {
        if(a[i] > t[i]) break;
        if(a[i] != a[i + 1]) change[i] = false;
    }
    mint ans = 1;
    for(ll i = 1; i <=  n - 2; i++) {
        if(change[i]) ans *= min(a[i], t[i]);
    }
    cout << ans.x << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
long long dp[100010];
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;}
#define rep(i,n) for(int i=0;i<n;i++)
//bitset<64>(x).count()
//fixed << setprecision(15) << 
int a[10][2] = {} ;
double dist(int x, int y){
  double ans;
  ans = pow(pow(a[x][0]-a[y][0],2)+pow(a[x][1]-a[y][1],2),0.5);
  return ans ;
}

int main (){
  int n;
  cin >> n;
  rep(i,n){
    cin >> a[i][0] >> a[i][1];
  }
  int O[n];
  rep(i,n)
    O[i] = i;
  double ans = 0;
  do{
    rep(i,n-1)
      ans += dist(O[i],O[i+1]);
  }while(next_permutation(O,O+n));
  int tmp = 1;
  for(int i=2;i<=n;i++)
    tmp *= i;
  cout << fixed << setprecision(15) << ans/tmp << endl;
}

Measured memory_bytes: 4248
#include <iostream>
main(){int i,n,o,b,p;char s[9];for(std::cin>>n;n--;std::cout<<p<<std::endl)for(o=b=p=0;o<3;b&=7){std::cin>>s;if(*s==79)o++;if(s[1]==79)b=b<<4|8;if(s[1]==73)b+=b+1;for(i=8;i<128;i*=2)if(b&i)p++;}}

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

int main() {
  char a,b;
  int A,B;
  cin>>a>>b;
  if(a=='H'){
    A=1;
  }else{
    A=-1;
  }
  if(b=='H'){
    B=1;
  }else{
    B=-1;
  }
  if(A*B==1){
    cout<<"H"<<endl;
  }else{
    cout<<"D"<<endl;
  }
}


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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    fast;
    string s;
    cin >> s;
    int ans = -1, cnt = 0;
    f(i,0,sz(s))
    {
        cnt = 0;
        if(s[i] == 'R')
        {
            while(s[i] == 'R')
            {
                i++;
                cnt++;
            }
            i--;
        }
        ans = max(ans,cnt);
    }
    cout << ans;
}


Measured memory_bytes: 3632
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion

//ABC  -B Half and Half

int main(void) {
	int     a, b,c, x, y;

	scanf("%d %d %d %d %d", &a,&b,&c,&x,&y);

    long ab  = a * x + b * y;
	long abc = 2 * c * (long)((x < y) ? y : x);
	long ac  = 2 * c * x +  b * ((y - x < 0) ? 0 : y - x);
	long bc  = 2  *c * y +  a* ((x - y < 0) ? 0 : x - y);

	long    ans;

	ans = _min(ab, _min(ac, _min(abc,bc)));

	printf("\n%ld\n", ans);
	return 0;
}


Measured memory_bytes: 2156
int main()
{
  int a, b, c, k;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  
  if (k <= a)
  {
    printf("%d", k);
  }
  else if (k <= a + b)
  {
    printf("%d", a);
  }
  else
  {
    printf("%d", 2 * a - k + b);
  }
}

Measured memory_bytes: 1728
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL N,K; cin >> N >> K;
    VL A(N);
    REP(i,N) cin >> A[i];
    map<LL,int> mp;
    VL acc(N+1);
    mp[0] = 1;
    LL ans = 0;
    FOR(i,1,N+1){
        acc[i] = acc[i-1] + A[i-1];
        if(i >= K){
            mp[(acc[i-K]-(i-K)+K)%K]--;
        }
        dump(acc[i]-i)
        ans += mp[(acc[i]-i+K)%K];
        mp[(acc[i]-i+K)%K]++;

    }
    cout << ans << endl;


}

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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int a, b;
    cin >> a >> b;
    if(a <= b) cout << a << endl;
    else cout << a-1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  string str;
  cin>>n;
  cin>>str;

  int black_diff[200005]={0};
  int white_diff[200005]={0};
  vector<int>turning;

  for(int i=0;i<n;i++){
    if(i!=0){
      white_diff[i]=white_diff[i-1];
    }
    if(str[i]!='.'){
      white_diff[i]++;
    }
  }
  for(int i=n-1;i>=0;i--){
    if(i!=n-1){
      black_diff[i]=black_diff[i+1];
    }
    if(str[i]!='#'){
      black_diff[i]++;
    }
  }

  for(int i=0;i<n-1;i++){
    if(str[i]=='.'&&str[i+1]=='#'){
      turning.push_back(i);
    }
  }

  int cnt=200009;
  for(int i=0;i<(int)turning.size();i++){
    int p=turning[i];
    cnt=min(cnt,white_diff[p]+black_diff[p+1]);
  }
  
  cnt=min(cnt,white_diff[n-1]);
  cnt=min(cnt,black_diff[0]);

  if(cnt==200009){
    cnt=0;
  }

  cout<<cnt<<endl;
  return(0);
}

Measured memory_bytes: 2688
n = int(input())
[*A] = map(int, input().split(' '))
q = int(input())
[*Q] = map(int, input().split(' '))


def search(key):
    i = 0
    A[len(A) - 1] = key
    while A[i] != key:
        i += 1
    if i == len(A) - 1:
        return -1
    return i


A.append(0)
sum = 0
for i in range(q):
    A[len(A) - 1] = Q[i]
    if search(Q[i]) != -1:
        sum += 1
print(sum)



Measured memory_bytes: 6548
H, W, K = map(int, input().split())
MOD = 10 ** 9 + 7

dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
fib = [1, 2, 3, 5, 8, 13, 21, 34]


def calc(w):
    if w < 0:
        return 1
    return fib[w]


for h in range(H):
    for w in range(W):
        dp[h + 1][w] = (dp[h + 1][w] + dp[h][w] * calc(w - 1) * calc(W - w - 2)) % MOD
        if w + 1 < W:
            dp[h + 1][w + 1] = (dp[h + 1][w + 1] + dp[h][w] * calc(w - 1) * calc(W - w - 3) % MOD)
        if w - 1 >= 0:
            dp[h + 1][w - 1] = (dp[h + 1][w - 1] + dp[h][w] * calc(w - 2) * calc(W - w - 2) % MOD)

print(dp[H][K - 1] % MOD)


Measured memory_bytes: 3064
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  ll y=100;
  ll x;
  cin>>x;
  ll cnt=0;
  while(y<x)
  {
    y+=y/100;
    cnt++;
  }
  cout<<cnt<<endl;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 3804
import numpy as np
from numba import njit
import itertools

@njit
def imos(N,K,A):

    
    B=np.zeros((N+1),dtype=np.int64)
    #B=np.zeros((N+1))
    for i in range(N):
        a=A[i]
        start=max(0,i-a)
        end=min(N,i+a+1)
        B[start]+=1
        B[end]-=1
        #B=np.array(B)
    return np.cumsum(B)[:N]
    

if __name__=="__main__":
    N,K=map(int, input().split())
    A=list(map(int, input().split()))
    for _ in range(K):
        A=imos(N,K,A)
        if A.min()==N:
            break   
    
    print(*A)

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

int main() {
  string s;
  while(true) {
    getline(cin, s);
    if (s == "END OF INPUT") break;
  
    int cnt = 0;
    for (auto c : s) {
      if (c == ' ') {
	cout << cnt;
	cnt = 0;
      }
      else {
	cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define ll long long
#define maxn 100005
int n,a[maxn];
ll suf[maxn],ans;
int main(){
	scanf("%d",&n);
	for(int i=0;i<=n;++i)scanf("%d",&a[i]);
	for(int i=n;i>=0;i--)suf[i]=suf[i+1]+a[i];
	ll pre = 1;
	for(int i=0;i<=n;++i){
		pre-=a[i];
		if(pre<0) {puts("-1");return 0;}
		ans+=std::min(pre,suf[i+1])+a[i];
		pre = std::min(pre*2,suf[i+1]);
	}printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 5000
n,m = map(int,input().split())
lis = {}
cs = set()
for i in range(m):
    ps,s = input().split()
    p = int(ps)
    if lis.get(p) == None:
        lis[p] = [0,0]
    if s == "WA":
        if lis[p][0] == 0:
            lis[p][1] += 1
    if s == "AC":
        if lis[p][0] == 0:
            lis[p][0] += 1
            cs.add(p)
pcnt = 0
for i in cs:
    pcnt += lis[i][1]
print(len(cs),pcnt)


Measured memory_bytes: 26340
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x , int m){
    return power(x,m-2,m);
}

int const N = 5e5+5;
int const inf = 2e16;

int fact[N],ifact[N];

void precompute_factorials(){
    fact[0] = 1;
    for(int i=1;i<N;i++) {
        fact[i] = i*fact[i-1]; fact[i] %= mod;
    }
    ifact[N-1] = inverse(fact[N-1] , mod);
    for(int i=N-2;i>=0;i--){
        ifact[i] = (i+1)*ifact[i+1];
        ifact[i] %= mod;
    }
}

int ncr(int n,int r){
    if(n < r || r < 0) return 0;
    if(n == r) return 1;

    int res = fact[n];
    res *= ifact[r];
    res %= mod;
    res *= ifact[n-r];
    res %= mod;
    return res; 
}


void solve(){  
    int i,j,l;
    int n,m;
    cin>>n>>m;
    int ans = 0;
    for(i=0;i<=n;i++){
        int sm = ncr(n,i);
        sm = sm * ((ncr(m,i)*fact[i]) % mod); sm %= mod;
        sm = sm * ((ncr(m-i,n-i)*fact[n-i])%mod); sm %= mod;
        sm = sm * ((ncr(m-i,n-i)*fact[n-i])%mod); sm %= mod;
        // cout<<ans<<endl;

        if(i%2 == 0){
            ans = ans + sm;
            ans %= mod;
        }
        else{
            ans = ans - sm;
            ans = (ans%mod + mod)%mod;
        }
    }

    cout<<ans<<endl;
}           


int32_t main(){
    IOS;
    int t;
    t = 1;
    precompute_factorials();
    // precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*

1 3 4 7 8 8 


*/

Measured memory_bytes: 11404
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; i++){
        if(i % d == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648