akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(a>b){a=b;return 1;}return 0;}

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

  ll N;
  cin >> N;

  bool ok = false;
  FOR(n,1,3501) {
    FOR(w,1,3501){
      ll vm = 4*n*w-N*w-N*n, vc = N*n*w;
      if(vm <= 0) continue;
      //cerr << "vm" << vm << " vc" << vc << endl;      
      if(vc%vm == 0){
	cout << vc/vm << " " << n << " " << w << endl;
	ok = true;
	break;
      }
    }
    if(ok) break;
  }

  
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main(){
for(;;){
	int n,h[3]={0},i,a;
	std::cin>>n;
	if(!n)break;
	h[n-1]=1;
	for(i=1;i<5;i++)
		std::cin>>n,
		h[n-1]|=1<<i;
	for(i=0;i<5;i++){
		for(n=0;!(h[n]&1<<i);n++);
		a=!!h[(n+1)%3]+(h[(3+n-1)%3]?2:0);
		std::cout<<(a?a:3)<<'\n';
	}
}
return 0;
}

Measured memory_bytes: 1160
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    HS = list(map(int, input().split()))
    ans = 1
    last = HS[0]
    for h in HS[1:]:
        if h >= last:
            last = h
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3952
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

void combination(Graph& graph, vector<int> selected, vector<int> rest, int r) {
  if (selected.size() == r) {
    graph.push_back(selected);
    return;
  }
  if (selected.size() + rest.size() < r) return;
  int e = rest.at(rest.size() - 1);
  rest.pop_back();
  combination(graph, selected, rest, r);
  selected.push_back(e);
  combination(graph, selected, rest, r);
}

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<vector<int>> ABCD(Q);
  rep(i, Q) {
    vector<int> abcd(4);
    cin >> abcd.at(0) >> abcd.at(1) >> abcd.at(2) >> abcd.at(3);
    ABCD.at(i) = abcd;
  }

  int size = M + N - 1;
  vector<int> rest(size);
  rep(i, size) rest.at(i) = i + 1;

  Graph graph(0);
  combination(graph, {}, rest, N);

  int ans = 0;
  for (auto vec : graph) {
    vector<int> row(M + N, true);
    for (auto i : vec) {
      row.at(i) = false;
    }
    vector<int> A;
    int a = 0;
    for (auto b : row) {
      if (b)
        a++;
      else
        A.push_back(a);
    }

    int d = 0;
    for (auto abcd : ABCD) {
      int a = abcd.at(0);
      int b = abcd.at(1);
      int c = abcd.at(2);

      if (A.at(b - 1) - A.at(a - 1) == c) {
        d += abcd.at(3);
      }
    }
    ans = max(ans, d);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }

ll dp[105][4][4][4];

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

    dp[0][3][3][3] = 1;
    int N; cin >> N;
    rep(i,N) {
        rep(j,4) rep(k,4) rep(l,4) {
            if(dp[i][j][k][l] == 0) continue;
            rep(m,4) {
                if(j == 0 and (k == 1 or l == 1) and m == 2) continue;
                if(k == 0 and l == 1 and m == 2) continue;
                if(k == 1 and l == 0 and m == 2) continue;
                if(k == 0 and l == 2 and m == 1) continue;
                dp[i+1][k][l][m] += dp[i][j][k][l];
                dp[i+1][k][l][m] %= mod;
            }
        }
    }
    ll ans = 0;
    rep(j,4) rep(k,4) rep(l,4) {
        ans += dp[N][j][k][l];
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    A = read_ints()
    max_A = max(A)
    is_divisible = [False]*(max_A+1)
    A.sort()
    answer = 0
    last_a = None
    for a in A:
        if a == last_a:
            is_divisible[a] = True
        for step in range(2*a, max_A+1, a):
            is_divisible[step] = True
        last_a = a
    return sum([not is_divisible[a] for a in A])


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 113844
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  int r,d,x;cin>>r>>d>>x;
  rep(i,10){
    x=r*x-d;
    cout<<x<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx")
using namespace std;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }

constexpr int b = 80 * 80;
constexpr int M = b * 2 + 1;

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

    int H, W;
    cin >> H >> W;
    vector<int> A(H * W), B(H * W);
    cin >> A >> B;

    vector<bitset<M>> dp(W + 1);
    dp[1][b] = 1;
    int k = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            int d = abs(A[k] - B[k]);
            dp[j + 1] |= dp[j];
            dp[j + 1] = (dp[j + 1] << d) | (dp[j + 1] >> d);
            k++;
        }
    }
    printf("%d", dp.back()._Find_next(b - 1) - b);
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
from collections import defaultdict

N=raw_input()
K=input()

dp=defaultdict(lambda: 0)  #未満T or F , i桁目, 0でない数値がちょうどk個

l=len(N)

for i in range(l):
    x=int(N[i])
    i+=1
    if i==1:
        if x==1:
            dp[("T",i,0)]=1
            dp[("F",i,1)]=1
        else:
            dp[("T",i,0)]=1
            dp[("T",i,1)]=x-1
            dp[("F",i,1)]=1
    else:
        for k in range(K+1):
            #未満:Trueの場合
            dp[("T",i,k)]+=dp[("T",i-1,k)]      #k桁目の数字pが0の場合
            dp[("T",i,k+1)]+=dp[("T",i-1,k)]*9  #k桁目の数字pが0以外の場合。1-9までの9個の数を使用して良い
            #未満:Falseの場合
            if 0<x:
                dp[("T",i,k+1)]+=dp[("F",i-1,k)]*(x-1) #k桁目の数字pが0<p<xなのは、x-1通り。この場合は未満の方に移動
                dp[("T",i,k)]+=dp[("F",i-1,k)]  #k桁目の数字pが0の場合は1通り。この場合は未満の方に移動
                dp[("F",i,k+1)]+=dp[("F",i-1,k)]*1 #k桁目の数字p=xの場合はゼロでない数字の個数が1個増える
            else: #k桁の目の数字xが0の場合
                dp[("F",i,k)]+=dp[("F",i-1,k)]*1
        
print dp[("T",l,K)]+dp[("F",l,K)]


Measured memory_bytes: 32236
#include <iostream>
#include <string>

using namespace std;
int n, k, q, a;
int ans[100005];
int main()
{
    scanf("%d%d%d", &n, &k, &q);
    for(int i = 1; i <= q; i++)
    {
        scanf("%d", &a);
        ans[a]++;
    }
    for(int i = 1; i <= n; i++)
        if(q - ans[i] < k)
            printf("Yes\n");
        else
            printf("No\n");
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>

using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int N, M, L;
ll D1[310][310];
ll D2[310][310];

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    cin >> N >> M >> L;
    rep(i,310) rep(j,310) if(i!=j) D1[i][j] = INF;
    rep(i,M){
        int a, b, c;
        cin >> a >> b >> c;
        D1[a][b] = D1[b][a] = c;
    }
    REP(k,1,N+1) REP(i,1,N+1) REP(j,1,N+1)
        D1[i][j] = min(D1[i][j], D1[i][k] + D1[k][j]);

    rep(i,310) rep(j,310) if(i!=j) D2[i][j] = INF;
    REP(i,1,N+1) REP(j,1,N+1) if(D1[i][j] <= L) D2[i][j] = 1;
    REP(k,1,N+1) REP(i,1,N+1) REP(j,1,N+1)
        D2[i][j] = min(D2[i][j], D2[i][k] + D2[k][j]);

    int Q;
    cin >> Q;
    rep(i,Q){
        int s, t;
        cin >> s >> t;
        if(D2[s][t] == INF) cout << -1 << endl;
        else cout << D2[s][t]-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
s = input()
k = int(input())

if len(s) == 1:
    print(s)
else:
    if s[0] != '1':
        print(s[0])
    else:
        cnt = 0
        for i in range(len(s)):
            if s[i] == '1':
                cnt += 1
            else:
                not1 = s[i]
                break
                
        if k <= cnt:
            print(1)
        else:
            print(not1)

Measured memory_bytes: 3060
N = list(input())
b_n = N.count("B")
point = 0
for i in range(len(N)):
    if N[i] == "B":
        point += i
future_point = (b_n * (len(N) - 1 - b_n + 1 + len(N) - 1)) // 2
print(future_point - point)


Measured memory_bytes: 4840
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<long> h(n);
    for(int i = 0;i < n;i++){
        cin >> h[i];
    }
    h.push_back(10e9 + 1);
    long cnt = 0;
    long ans = 0;
    for(int i = 1;i <= n;i++){
        if(h[i - 1] >= h[i]){
            cnt++;
        }else{
            ans = max(cnt,ans);
            cnt = 0;
        }
    }
    cout << ans << endl;
}


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

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

  vector<int> ans(n, 0);
  int tmp;
  rep(i, 2 * m) {
    cin >> tmp;
    ans[tmp - 1]++;
  }

  rep(i, n) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 256
import fractions


def lcm_list(numbers):
    ans = numbers[0]
    for number in numbers[1:]:
        ans = (((number * ans)) //(fractions.gcd(number, ans)))
    return ans


MOD = 10 ** 9 + 7
N = input()
i = 0
arrs = list(map(int, input().split()))
lcms = lcm_list(arrs)
result = 0
for arr in arrs:
    result += (lcms // arr)
result = result % MOD
ans = str(result).replace('.0', '')
print(ans)

Measured memory_bytes: 6200
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
string s,t,u;
int a,b;
int main(void){
	cin>>s>>t>>a>>b>>u;
	if(s==u)a--;
	else b--;
	cout<<a<<' '<<b;
	return 0;
}

Measured memory_bytes: 256
/*
g++ -std=c++11 -o2 -Wall AISing2019B.cpp -o .\out\AISing2019B.out
.\out\AISing2019B.out
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int n;
int a, b;
int p[105];

int t;
int aa, bb, cc;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cin >> a >> b;

  for (int i = 0; i < n; ++i) {
    cin >> t;
    if(t <= a) {
      ++aa;
    } else if (t <= b) {
      ++bb;
    } else {
      ++cc;
    }
  }
  cout << min({aa, bb, cc}) << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
 
int main(){
    int N,K,count = 0;
    cin >> N >> K;
    rep(i,N){
        int a;
        cin >> a;
        if(a >= K)count +=1;
    }
    cout << count;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define N 100

int main()
{
	int m[N][N] = {0};
	
	int n;	cin >> n;

	int v, in, out;
	for (int i = 0; i < n; ++i)
	{
		cin >> in >> v;
		for (int j = 0; j < v; ++j)
		{
			cin >> out;
			m[in - 1][out - 1] = 1;
		}
	}

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cout << m[i][j];
			if (j != n - 1) cout << " ";
			else cout << endl;
		}
	}

	return 0;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


signed main() {
    int p, q, r;
    cin >> p >> q >> r;
    cout << p + q + r - max(p, max(q, r)) << endl;
    return 0;
}


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

int N, K;

void solve() {
    cin >> N >> K;
    cout << (N % K == 0 ? 0 : 1) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}


Measured memory_bytes: 256
str = input()
h = list(str)#文字列をリストに

if(h[-1]=='2' or h[-1]=='4' or h[-1]=='5' or h[-1]=='7' or h[-1]=='9'):
    print('hon')
elif(h[-1]=='0' or h[-1]=='1' or h[-1]=='6' or h[-1]=='8'):
    print('pon')
else:
    print('bon')


Measured memory_bytes: 9056
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
using namespace std;


int main(int argc, const char * argv[]) {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  for(int i = 0; i < m; i++){
    cin >> b.at(i);
  }
  int a;
  int result = 0;
  for(int i = 0; i < n; i++){
    int sum = 0;
    for(int j = 0; j < m; j++){
      cin >> a;
      sum += a*b.at(j);
    }
    if(sum + c > 0){
      result++;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B, m := nextInt(), nextInt(), nextInt()
	a, b := nextInts(A), nextInts(B)

	ans := min(a...) + min(b...)
	for i := 0; i < m; i++ {
		x, y, c := nextInt()-1, nextInt()-1, nextInt()
		ans = min(ans, a[x]+b[y]-c)
	}

	puts(ans)
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


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

#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef vector<ll> dlist;
typedef vector<dlist> matrix;

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

    int t, n, m;
    string s;
    
    cin >> s;
//    Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy

    if(s == "Sunny")
        cout << "Cloudy\n";
    if(s == "Cloudy")
        cout << "Rainy\n";
    if(s == "Rainy")
        cout << "Sunny\n";
    return 0;
}//RUL0


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

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;

int largestSquare(int n) {
  int i = 0;
  while ((i+1)*(i+1) <= n) {
    ++i;
  }
  return i*i;
}

int n, afs;
int main() {
	cin >> n;
	cout << largestSquare(n) << endl;
	return 0;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const int MOD = 1e9 + 7;

int c[200000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

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

    sort(c, c + n);
    long long ret = 0;
    for (int i=0; i<n; i++) {
        ret += (long long) c[i] * (n - i + 1) % MOD;
        if (ret >= MOD)
            ret -= MOD;
    }
    for (int i=0; i<n-1; i++)
        ret = ret * 4LL % MOD;

    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 4440
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
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() {
    ll N;
    cin >> N;

    vector<ll> vec(N);
    for (ll i = 0; i < N; ++i) {
        cin >> vec[i];
    }

    ll add      = 0;
    ll ansCount = 0;
    for (ll i = 1; i < N; ++i) {
        ll tmp = vec[i] - vec[i - 1];
        if (add == 0) {
            add = tmp;
        } else if (tmp == 0) {
        } else {
            bool isSignAdd = add > 0;
            bool isSignTmp = tmp >= 0;
            if (isSignAdd != isSignTmp) {
                ansCount++;
                add = 0;
            }
        }
    }
    ansCount++;
    cout << ansCount << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
const long long INF = 1LL << 60;


int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n);
    vector<int> b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    ll t = 0;
    rep(i, m) t += b[i];

    int j = m;
    int ans = 0;
    rep(i, n+1){
        while(j > 0 && t > k){
            j--;
            t -= b[j];
        }
        if(t > k) break;
        ans = max(ans, i+j);
        if(i == n) break;
        t += a[i];
    }  
    cout << ans << endl;
    return 0;
}


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


int main(){
 int N;
 cin >> N;

 vector<string> W(N);
 map<string,int> V;
 for(int i = 0; i < N; i++){
   cin >> W[i];
   V[W[i]] += 1;
   if(V[W[i]] > 1){ cout << "No" << endl; return 0; }
 }

 for(int i = 0; i < N - 1; i++){
   if(W[i].back() != W[i + 1].front()){ cout << "No" << endl; return 0; }
 }

 cout << "Yes" << endl; 

 return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int chars[26];
    int c;
    int i;

    for(i = 0; i < 26; i++) {
        chars[i] = 0;
    }
    while((c = getchar()) != EOF) {
        if(c >= 'a' && c <= 'z') {
            chars[c-'a'] += 1;
        }
        if(c >= 'A' && c <= 'Z') {
            chars[c-'A'] += 1;
        }
    }
    for(i = 0; i < 26; i++) {
        printf("%c : %d\n", 'a'+i, chars[i]);
    }
    return 0;
}


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  for(int i = 0; i <= 1e6; i++){
    if(a % 2 || b % 2 || c % 2) {
      cout << i << endl;
      return 0;
    }
    int d = a/2 + b/2;
    int e = b/2 + c/2;
    int f = c/2 + a/2;
    a = e; b = f; c = d;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
		 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	    public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        String S = sc.next();
	        String T = sc.next();
	        T = T.substring(0,S.length());
	        if(S.equals(T)) {
	        	System.out.println("Yes");
	        } else {
	        	System.out.println("No");
	        }
	        
	    }
	}

Measured memory_bytes: 35716
def ok(s):
    n = len(s)
    return (s[0] == "A") and \
        len(filter(lambda _: _=="C", s[2:n-1])) == 1 and \
        len(filter(lambda _: _.islower(), s)) == n-2

def solve(s):
    return "AC" if ok(s) else "WA"

assert solve("AtCoder") == "AC"
assert solve("ACoder") == "WA"
assert solve("AcycliC") == "WA"
assert solve("AtCoCo") == "WA"
assert solve("Atcoder") == "WA"
s = raw_input()
print solve(s)

Measured memory_bytes: 2568
import java.util.*;

class Main{
    static int nmax = 100000;
    static int[] res = new int[nmax+1];
    static int[] steps = new int[nmax+1];
    static Map<Integer, List<Integer>> path = new HashMap<>();
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer n = sc.nextInt();
        Integer m = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            path.put(i, new ArrayList<>());
            steps[i] = 99999999;
        }
        for(int i=0;i<m;i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            List<Integer> atmp = path.get(a);
            atmp.add(b);
            path.put(a, atmp);
            List<Integer> btmp = path.get(b);
            btmp.add(a);
            path.put(b, btmp);
        }

        List<Integer> firstnow = new ArrayList<>();
        firstnow.add(1);
        List<Integer> firstbef = new ArrayList<>();
        firstbef.add(0);
        
        search(firstnow, 0, firstbef);

        for (int i = 2; i <= n; i++) {
            if (res[i] == 0) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        for (int i = 2; i <= n; i++) {   
            System.out.println(res[i]);
        }
    }

    private static void search(List<Integer> nows, int step, List<Integer> befores) {
        List<Integer> next_rooms = new ArrayList<>();

        for (int i=0;i<nows.size();i++) {
            int now = nows.get(i);
            int before = befores.get(i);
            int min_step = steps[now];
            if(step >= min_step)continue;
            steps[now] = step;
            res[now] = before;
            next_rooms.add(now);
        }

        if(next_rooms.isEmpty())return;

        List<Integer> next_nows = new ArrayList<>();
        List<Integer> next_befores = new ArrayList<>();

        for (Integer b : next_rooms) {
            List<Integer> root = path.get(b);
            for (Integer r : root) {
                next_nows.add(r);
                next_befores.add(b);
            }
        }
        search(next_nows, step+1, next_befores);
        return;
    }

}


Measured memory_bytes: 97144
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,l,a,b,c;
     map<ll,ll>mp;
    cin>>n;
    c=0;
    for(i=0;i<n;i++)
    {
        cin>>k;
        if(mp[k]>0)
        {
            mp[k]--;
            c--;
        }
        else if(mp[k]==0)
        {
            mp[k]++;
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 6528
#include<stdio.h>
#include<math.h>
int so(int);
int main(){
  int n,i,num,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&num);
    if(num==2){
      sum++;
      continue;
    }else if(num%2==0){
      continue;
    }
    if(so(num)==1){
      sum++;
    }
  }
  printf("%d\n",sum);
}

int so(int num){
  int i,a;
  a=sqrt(num);
  for(i=3;i<=a;i=i+2){
    if(num%i==0){
      return 0;
    }
  }
  return 1;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,f=0,c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s=="A")c++;
    else c--;
    f|=(c<0);
  }

  if(f||c)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
  return 0;
}

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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<pair<string,ll> > svp;

#define spc        ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back
#define pb         push_back
#define mp         make_pair
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0)
#define lb         lower_bound
#define bs         binary_search
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define sp(x)      cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;   vector<long long> v,v1;
    
    cin>>n>>x>>m;
    if(n%x==0) n=n/x;
    else n=n/x+1;
    cout<<n*m<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    /*freopen ("input.txt","r",stdin);
    freopen ("output.txt","w",stdout);*/

    ll tt;
    /*cin>>tt;
    while(tt--)*/
        solve();

    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int T,top; long long n,a,b,c,d;
std::map<long long,long long>mac;
long long g[1000001];
unsigned long long f(long long n){
	if(n==1)return d;
	if(n==2)return std::min(d<<1,d+a);
	if(n==3)return std::min(std::min(d*3,d+b),d+a+d);
	if(mac.count(n)) return mac[n];
	unsigned long long ans=-1;
	for(long long i=max(n-4,0ll);i<=n+4;i++){
		if(i%2==0&&(i/2)<n)ans=std::min(ans,f(i/2)+1ull*a+1ull*d*abs(n-i));
		if(i%3==0&&(i/3)<n)ans=std::min(ans,f(i/3)+1ull*b+1ull*d*abs(n-i));
		if(i%5==0&&(i/5)<n)ans=std::min(ans,f(i/5)+1ull*c+1ull*d*abs(n-i));
	}
	if((ans/d)>n)ans=n*d; return mac[n]=ans;
}
int main(){
	scanf("%d",&T);
	while(T--) scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d),mac.clear(),cout<<f(n)<<endl;
}

Measured memory_bytes: 6636
(N, M) = gets.split.map(&:to_i)

data = []

N.times do
  (xd, yd, zd) = gets.split.map(&:to_i)

  d = {}
  d[:x] = xd
  d[:y] = yd
  d[:z] = zd
  data << d
end

rp = []

[1, -1].each do |x|
  [1, -1].each do |y|
    [1, -1].each do |z|
      bucket = []

      data.each do |d|
        dc = d.clone
        dc[:sum] = d[:x] * x + d[:y] * y + d[:z] * z
        bucket << dc
      end

      bucket = bucket.sort do |a, b|
        b[:sum] <=> a[:sum]
      end

      xsum = 0
      ysum = 0
      zsum = 0
      M.times do |i|
        xsum += bucket[i][:x]
        ysum += bucket[i][:y]
        zsum += bucket[i][:z]
      end
      rp << xsum.abs + ysum.abs + zsum.abs
    end
  end
end

puts rp.max

Measured memory_bytes: 3576
#include<iostream>
#include<cstdio>
using namespace std;
static const int MAX  = 101;
int main ()
{
  int n,u,k,v;
  cin>>n;
  int M[MAX][MAX];
  for(int i  = 1;i<=n;i++)
    {
      for(int j = 1;j<=n;j++)
        {
          M[i][j] = 0;
        }
    }
  for(int i = 1;i<=n;i++)
   {
     cin>>u>>k;
     for(int j = 1;j<=k;j++)
       {
         cin>>v;
         M[u][v] = 1;
       }
   }
   for(int i = 1;i<=n;i++)
     {
       for(int j = 1;j<=n;j++)
        { if(j-1) cout<<" ";
          cout<<M[i][j];
     }
     cout<<endl;
   }
  return 0 ;
}



Measured memory_bytes: 3100
def cc087():
    n = int(input())
    a1n = list(map(int, input().split()))
    a2n = list(map(int, input().split()))

#    if n == 1:
#        print(a1n[0] + a2n[0])
#        sys.exit()

    ma = 0
    for i in range(0, n):
        m = sum(a1n[0:i+1]) + sum(a2n[i:n])
        if m > ma:
            ma = m

    print(ma)

cc087()

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long p = sc.nextLong();
		long q = sc.nextLong();
		long INF = 1000_000_000_000_000L;
		if (a == 1 && b == 1) {
			// (p+q)N
			long ans = INF;
			long div = m / (p + q);
			div = Math.min(div, n);
			ans = Math.min(ans, Math.abs(div * (p + q) - m));
			div = Math.min(div + 1, n);
			ans = Math.min(ans, Math.abs(div * (p + q) - m));
			System.out.println(ans);
			return;
		}
		// pa^k+qb^k
		long lim = 0;
		while (p * Math.pow(a, lim) + q * Math.pow(b, lim) <= m) {
			++lim;
		}
		lim += 1;
		lim = Math.min(lim, n);
		lim = Math.min(lim, 40);
		ArrayList<Long> pending1 = new ArrayList<>();
		ArrayList<Long> pending2 = new ArrayList<>();
		long[] powA = new long[42];
		long[] powB = new long[42];
		powA[0] = 1;
		powB[0] = 1;
		for (int i = 1; i < powA.length; ++i) {
			powA[i] = powA[i - 1] * a;
			powB[i] = powB[i - 1] * b;
		}
		for (int t = 0; t < 2; ++t) {
			long max = (t == 0 ? lim / 2 : (lim + 1) / 2);
			outer: for (long i = 0; i < (1L << max); ++i) {
				long s = 0;
				for (int j = 0; j < max; ++j) {
					if ((i & (1L << j)) > 0) {
						s += p * powA[(int) (j + (t == 1 ? lim / 2 : 0))]
								+ q * powB[(int) (j + (t == 1 ? lim / 2 : 0))];
						if (s > INF)
							continue outer;
					}
				}
				if (t == 0)
					pending1.add(s);
				else
					pending2.add(s);
			}
		}

		Collections.sort(pending1);
		Collections.sort(pending2);

		long ans = m;
		for (int j = 0; j < 2; ++j) {
			int t = pending2.size() - 1;
			for (int i = 0; i < pending1.size(); ++i) {
				if (j == 0)
					while (t > 0 && pending1.get(i) + pending2.get(t) > m)
						--t;
				else if (j == 1)
					while (t > 0 && pending1.get(i) + pending2.get(t) >= m
							&& pending1.get(i) + pending2.get(t - 1) >= m)
						--t;
				ans = Math.min(ans, Math.abs(-m + pending1.get(i) + pending2.get(t)));
			}
		}

		System.out.println(ans);

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

	static long pow(long a, long n) {
		long ret = 1;
		for (; n > 0; n >>= 1, a *= a) {
			if (n % 2 == 1) {
				ret *= a;
			}
		}
		return ret;
	}
}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<end
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  ll N,x;
  cin>>N>>x;

  vector<ll> v(N);
  cinv(v,0,N);
  sortAl(v);
  FOR(i,1,N){
    v[i]+=v[i-1];
  }
  ll res=0;
  FOR(i,0,N){
    if(x<v[i]){
      res=i;
      break;
    }
  }
  if(res==0){
    if(x==v[N-1]){
      res=N;
    }
    else if(x>v[N-1]){
      res=N-1;
    }
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<random>
#include<queue>
#include<unordered_map>

int main(){
  int d;
  std::cin >> d;
  std::vector<int> c(26);
  for (int i = 0; i < 26; i++) std::cin >> c[i];
  std::vector<std::vector<int> > s(d, std::vector<int>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      std::cin >> s[i][j];
    }
  }
  for (int i = 0; i < d; i++) {
    int maxi = 0, ans;
    for (int j = 0; j < 26; j++) {
      if(maxi < s[i][j])ans = j, maxi = s[i][j];
    }
    std::cout << ans + 1 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3676
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define BUFSIZE 51

int cmp(const void *p, const void *q) {
    return *(int *)p - *(int *)q;
}

int main(int argc, char const *argv[]) {
    int N, v[BUFSIZE], i;
    double ans= 0.0;
    scanf("%d", &N);
    for(i= 0; i < N; i++) {
        scanf("%d", &v[i]);
    }
    qsort(v, N, sizeof(int), cmp);
    ans= (double)(v[0] + v[1]) / 2.0;
    for(i= 2; i < N; i++) {
        ans= (double)(ans + v[i]) / 2.0;
    }
    printf("%lf\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <climits>
#include <iomanip>
#include <cmath>
using namespace std;
using uint = unsigned int;

int main() {
	
	uint N;
	cin >> N;
	
	vector<double> X(N);
	vector<double> Y(N);
	
	double lx = 1000;
	double hx = 0;
	double ly = 1000;
	double hy = 0;
	
	for(uint i=0; i<N; i++) {
		cin >> X[i] >> Y[i];
		lx = min(lx, X[i]);
		hx = max(hx, X[i]);
		ly = min(ly, Y[i]);
		hy = max(hy, Y[i]);
	}
	
	double curX = (hx + lx) / 2;
	double curY = (hy + ly) / 2;
	double nxtX = 0;
	double nxtY = 0;
	
	double alfa = 0.1;
	uint idx = 0;
	
	while(alfa > pow(10, -9)) {	
		curX = nxtX;
		curY = nxtY;
		double maxD = 0;
		
		for(uint i=0; i<N; i++) {
			double d = pow(X[i] - curX, 2) + pow(Y[i] - curY, 2);
			
			if(maxD < d) {
				maxD = d;
				idx = i;
			}
		}
		
		nxtX = (1 - alfa) * curX + alfa * X[idx];
		nxtY = (1 - alfa) * curY + alfa * Y[idx];
		alfa = alfa * 0.999999;
	
	}
	
	double ans = sqrt(pow(X[idx] - curX, 2) + pow(Y[idx] - curY, 2));
	cout << setprecision(10) << ans;
	
	return 0;
}


Measured memory_bytes: 256
import sys,math,collections
from collections import defaultdict

#from itertools import permutations,combinations
    
def file():
    sys.stdin = open('input.py', 'r')
    sys.stdout = open('output.py', 'w') 
def get_array():
    l=list(map(int, input().split()))
    return l
def get_ints():   
    return map(int, input().split())
    #return a,b
def get_3_ints():   
    a,b,c=map(int, input().split())
    return a,b,c    
def sod(n):
    n,c=str(n),0
    for i in n: 
        c+=int(i)
    return c    
def isPrime(n):
    if (n <= 1):
        return False
    if (n <= 3):
        return True
    if (n % 2 == 0 or n % 3 == 0):
        return False
    i = 5
    while(i * i <= n):
        if (n % i == 0 or n % (i + 2) == 0):
            return False
        i = i + 6
  
    return True
def getFloor(A, x):

    (left, right) = (0, len(A) - 1)

    floor = -1
    while left <= right:
        mid = (left + right) // 2
        if A[mid] == x:
            return A[mid]
        elif x < A[mid]:
            right = mid - 1
        else:
            floor = A[mid]
            left = mid + 1
            
    return floor
def chk(aa,bb):
	f=0
	for i in aa:
		for j in bb:
			if(j[0]>=i[0] and j[1]<=i[1]):
				f+=1
			elif(j[0]<=i[0] and j[1]>=i[1]):	
				f+=1
			elif(i[0]==j[1] or i[1]==j[0]):
				f+=1
			else:
				continue
	return f			

#file()
def main():
	s=""
	for tt in range(int(input())):
		a,b=get_ints()
		if(a==b):
			s+='1'
		else:
			s+='0'
	if('111' in s):
		print('Yes')	
	else:
		print("No")

		




				





		


	





        
            
        























    

    
    

        











        
        

        























































                

            







            
            
































        








if __name__ == '__main__':
    main()

Measured memory_bytes: 9436
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 2147483647;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 2000088;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[SIZE], finv[SIZE], inv[SIZE];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

double len(int a, int b, int c, int d) {
	return (double)sqrt((a - c) * (a - c) + (b - d) * (b - d));
}


void COMinit() {
	fac[0] = 1, fac[1] = 1, finv[0] = 1, finv[1] = 1, inv[1] = 1;
	for (int i = 2; i < SIZE; ++i) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

//calc
long long COM(ll n, ll k) {
	if (n < k) { return 0; }
	if (n < 0 || k < 0) { return 0; }
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll a, b, c, d, ans;
int main() {
	cin >> a >> b >> c >> d;
	COMinit();
	for(ll i = b; i <= d; ++i){
                ans += COM(i+c+1,c);
		ans %= MOD;
		ans += MOD - COM(i+a,a-1);
		ans %= MOD;
        }
        cout << ans % MOD << endl;
}

Measured memory_bytes: 47104
S = int(input())

S_pre = S // 100
S_nex = S - S_pre * 100

if 0 < S_pre and S_pre < 13:
    if 0 < S_nex and S_nex < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0 < S_nex and S_nex < 13:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

signed main(){
	int n, K;
	scanf("%d %d", &n, &K);
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}

	vector<vector<ll> > dp(n + 1, vector<ll> (K + 1, 0));
	for(int i = 0; i <= n; i++){
		dp[i][0] = 1;
	}
	for(int i = 0; i < n; i++){
		for(int j = 1; j <= K; j++){
			if(j - a[i] - 1 < 0){
				(dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j]) %= MOD;
			}
			else{
				(dp[i + 1][j] = dp[i][j] + dp[i + 1][j - 1] - dp[i][j - a[i] - 1] + MOD) %= MOD;
			}
		}
	}
	cout << dp[n][K] << endl;
}

Measured memory_bytes: 83240
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  long double a,b;
  cin>>a>>b;
  long double c=a*b;
  cout<<(ll)c<<endl;
  return 0;
}


Measured memory_bytes: 3732
D=int(input())
c=list(map(int,input().split()))
c_memo=[0]*26
s=[]
for i in range(D):
    ss=list(map(int,input().split()))
    s.append(ss)
ans_b=[]
for i in range(D):
    t=int(input())
    c_down=0
    for j in range(26):
        if j==t-1:
            c_memo[t-1]=i+1
            continue
        else:
            c_down+=(i+1-c_memo[j])*c[j]
    ans=s[i][t-1]-c_down
    ans_b.append(ans)
ans=0
for x in ans_b:
    ans+=x
    print(ans)


Measured memory_bytes: 9464
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int s;cin>>s;
  vector<int> a(1000001,0);
  vector<int> first(1000001,inf);
  a[0]=s;int f=inf;first[a[0]]=0;
  rep1(i,1000000){
    a[i]=a[i-1]/2;
    if(a[i-1]%2==1){
      a[i]=3*a[i-1]+1;
      f=min(f,i);
    }
    if(first[a[i]]==inf){
      first[a[i]]=i;
    }
  }
  int res=inf;
  for(int i=0;i<=1000000;i++){
    if(first[a[i]]!=inf&&first[a[i]]!=i){
      res=i;
      break;
    }
  }
  res++;
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 8064
// 2020-09-16 00:25:29
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
#include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
using namespace atcoder;

// clang-format on
void answer() {
  int n, q;
  cin >> n >> q;
  fenwick_tree<ll> fw(n);
  rep(i, n) {
    ll a;
    cin >> a;
    fw.add(i, a);
  }
  rep(i, q) {
    int c;
    cin >> c;
    if (c == 0) {
      ll p, x;
      cin >> p >> x;
      fw.add(p, x);
    } else {
      int l, r;
      cin >> l >> r;
      cout << fw.sum(l, r) << '\n';
    }
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 8256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN
    ll n;cin>>n;
    n = n / 200;
    cout<<10-n<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  ll tmp = 0;
  rep(i, N) {
    if(i % 2 == 0)
      tmp += A[i];
    else
      tmp -= A[i];
  }
  tmp /= 2;
  rep(i, N) {
    cout << 2 * tmp << ' ';
    tmp = A[i] - tmp;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
def main():
    n, k, s = list(map(int, input().split()))
    ans = [0] * n
    for i in range(k):
        ans[i] = s
    if s == 10 ** 9:
        for i in range(k, n):
            ans[i] = 1
        print(" ".join(str(x) for x in ans))
    elif s > 1:
        stack = 0
        for i in range(k, n):
            if stack + 1 == s:
                stack = 0
                ans[i] = int(10 ** 9)
            else:
                stack += 1
                ans[i] = 1
        print(" ".join(str(x) for x in ans))
    else:
        for i in range(k, n):
            ans[i] = 2
        print(" ".join(str(x) for x in ans))
    return
if __name__ == "__main__":
    main()

Measured memory_bytes: 65516