akhauriyash/Code-Regression huggingface dataset:
// May this submission get accepted
#pragma GCC optimize ("O3")
#pragma GCC target("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll n = inp1;
    vector<string> s = inp(n);

    map<string, ll> m;
    ll amax = 0;
    for (string &si : s) chmax(amax, ++m[si]);
    
    vector<string> ans;
    for (auto &p : m) {
        if (p.second == amax) {
            ans.push_back(p.first);
        }
    }
    sort(ALL_OF(ans));
    for (string &si : ans) cout << si << endl;
    
}

Measured memory_bytes: 27120
import java.util.*;

public class Main {
  
  public int[] value;
  public int[] cost;
  
  public Main() {
  }
  
  private void getValue () {
    int total = 0;
    
    for (int i = 0; i < value.length; i++) {
      if (value[i] - cost[i] > 0 )
        total += value[i] - cost[i];
    }
    
    System.out.println(total);
  }
    
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
    
    Main obj = new Main();
    int size = scan.nextInt();
    obj.value = new int[size];
    obj.cost = new int[size];
    
    for (int i = 0; i < size; i ++) {
      obj.value[i] = scan.nextInt();
    }
    
    for (int i = 0; i < size; i ++) {
      obj.cost[i] = scan.nextInt();
    }
    obj.getValue();
    
  }
}


Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    int a;
    cin >> a ;
    a /= 3;
    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -Wall #-}

import Control.Monad
import Data.List

readInt :: String -> Int
readInt = read

riffle :: [Int] -> [Int]
riffle xs = (concat . transpose) [ys1,ys2]
    where
        (ys1,ys2) = splitAt (length xs `div` 2) xs

cut :: [Int] -> Int -> [Int]
cut xs k = ys2 ++ ys1
    where
        (ys1,ys2) = splitAt k xs

operate :: [Int] -> Int -> [Int]
operate xs 0 = riffle xs
operate xs k = cut xs k

main :: IO ()
main = do
    n   <- fmap readInt getLine
    m   <- fmap readInt getLine
    ops <- fmap (map readInt) $ replicateM m getLine

    let xs  = [1..2*n]
    let ans = foldl operate xs ops

    forM_ ans print



Measured memory_bytes: 5568
#include<stdio.h>
int main()
{
    char a,b;
    int A,C;
    scanf("%c %c",&a,&b);
    if(a=='H')
       A=1;
    if(a=='D')
       A=0;
    if(A==1&&b=='H')
        printf("H\n");
    if(A==1&&b=='D')
        printf("D\n");
    if(A==0&&b=='H')
        printf("D\n");
    if(A==0&&b=='D')
        printf("H\n");
    return 0;

}

Measured memory_bytes: 128
// poland.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <istream>
#include <stack>

double read_and_evaluate(std::istream& ins) {
    std::stack<char> operations;
    char tmp;
    while (true) {
        char c = ins.get();
        if (c >= '0' && c <= '9') {
            operations.push(c);
        }
        if (c == '+' || c == '-' || c == '*' || c == '/') {
            tmp = c;
        }
        if (c == ')') {
            operations.push(tmp);
        }

    }
    return 0;
}

int main()
{
    char c;
    std::cin >> c;
    if (c >= 'a' && c <= 'z') {
        std::cout << 'a';
    }
    else  std::cout << 'A';

}


// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

#define ll long long int
ll dp[404][404];
ll arr[404];
ll solve(ll l,ll r){
	if(l>r)return 0;
	if(l==r)return arr[l];
	if(dp[l][r]!=-1)return dp[l][r];
	
//	cout<<l<<' '<<r<<'\n';
	
	ll x=arr[l]+min(solve(l+2,r),solve(l+1,r-1));
	ll y=arr[r]+min(solve(l,r-2),solve(l+1,r-1));
	dp[l][r]=max(x,y);
	return dp[l][r];
}

int main(){
	ll n,k;
	cin>>n;
//	memset(dp,-1,sizeof(dp));
	ll sum=0;
	for(ll i=0;i<n;i++){
		cin>>arr[i];
		sum+=arr[i];
		
		//cout<<"sun "<<i<<' '<<arr[i]<<' '<<sum<<'\n';
	}
	auto SUM=[&](ll l,ll r){
		
		ll sum=0;
		for(ll z=l;z<=r;z++){sum+=arr[z];}
		return sum;
	};
//	cout<<solve(0,n-1)<<' '<<sum<<'\n';
	for(ll l=0;l<=n-1;l++){
		for(ll i=0;i<n-l;i++){
			ll j=i+l;
			if(i==j){
				dp[i][j]=0;
			}
			else{
				//ll sum=0;
				dp[i][j]=10000000000000;
				for(ll k=i+1;k<=j;k++){
					dp[i][j]=min(dp[i][j],dp[i][k-1]+dp[k][j]+SUM(i,j)
						
					);
					//sum+=arr[k];
				//	cout<<i<<' '<<j<<' '<<k<<' '<<dp[i][j]<<'\n';
				}
				
				//dp[i][j]+=sum;
			}
			
		}
	}
	
	
	cout<<dp[0][n-1]<<'\n';
	
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
using namespace std;
vector<int> used;
vector< vector<int> > connect;

int N, M;
int res = 0;
int dsf(int cur, int depth) {
  if(used[cur] == 1)
    return 0;
  if(depth == N)
    return 1;
  used[cur] = 1;
  for(int i=0; i < N; i++) {
    if(connect[cur][i] == 1) {
      res += dsf(i, depth + 1);
    }
  }
  used[cur] = 0;
  return 0;
}
int main(void) {
  cin >> N >> M;
  int a, b;
  used = vector<int>(N, 0);
  connect = vector< vector<int> >(N, vector<int>(N, 0));
  for(int i=0; i < M; i++) {
    cin >> a >> b;
    a--;
    b--;
    connect[a][b] = connect[b][a] = 1;
  }

  dsf(0, 1);
  printf("%d\n", res);
  return 0;
}


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

struct Suffix_Array {
    string str;
    int strlen, nowlen;
    vector<int> rank, tmp, sa, lcp;
    Suffix_Array(string news = "", bool reqlcp = 0) {
        str = news;
        strlen = str.size();
        nowlen = 0;
        rank.resize(strlen + 1);
        tmp.resize(strlen + 1);
        sa.resize(strlen + 1);
        constuct_sa();
        if(reqlcp) constuct_lcp();
    }

    void constuct_sa() {
        auto cmp = [&](int l, int r) {
            if(rank[l] != rank[r]) return rank[l] < rank[r];
            int rx = l + nowlen <= strlen ? rank[l + nowlen] : -1;
            int ly = r + nowlen <= strlen ? rank[r + nowlen] : -1;
            return rx < ly;
        };

        for(int i = 0; i <= strlen; ++i) {
            sa[i] = i;
            rank[i] = i < strlen ? str[i] : -1;
        }
        for(nowlen = 1; nowlen <= strlen; nowlen *= 2) {
            sort(sa.begin(), sa.end(), cmp);
            tmp[sa[0]] = 0;
            for(int i = 1; i <= strlen; ++i)
                tmp[sa[i]] = tmp[sa[i - 1]] +
                             (cmp(sa[i - 1], sa[i]) ? 1 : 0);
            for(int i = 0; i <= strlen; ++i) rank[i] = tmp[i];
        }
    }
    // Longest Common Prefix Array
    void constuct_lcp() {
        lcp.resize(strlen + 1);
        for(int i = 0; i <= strlen; ++i) rank[sa[i]] = i;
        int h = 0;
        lcp[0] = 0;
        for(int i = 0; i < strlen; ++i) {
            int j = sa[rank[i] - 1];
            if(h > 0) --h;
            for(; j + h < strlen && i + h < strlen; ++h)
                if(str[j + h] != str[i + h]) break;
            lcp[rank[i] - 1] = h;
        }
    }

    bool contain(string &nowt) {
        int lef = 0, righ = strlen, tsize = nowt.size();
        while(righ - lef > 1) {
            int mid = (lef + righ) / 2;
            if(str.compare(sa[mid], tsize, nowt) < 0)
                lef = mid;
            else
                righ = mid;
        }
        return str.compare(sa[righ], tsize, nowt) == 0;
    }
};

string s,t;

int solve();

int main(){
    while(cin >> s){
        cin >> t;
        cout << solve() << endl;
    }
    return 0;
}

int solve(){
    int ans = 0;
    string st = s + "#" + t;
    Suffix_Array suf(st,1);
    for(int i = 0;i < st.size();++i)
        if((suf.sa[i] < s.size()) != (suf.sa[i+1] < s.size()))
            ans = max(ans,suf.lcp[i]);
    return ans;
}


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

#define ll long long int
void dfs(int node, vector<int> adj[], int dp[], bool vis[])
{
	vis[node] = true;

	for (int i = 0; i < adj[node].size(); i++) {

		if (!vis[adj[node][i]])
			dfs(adj[node][i], adj, dp, vis);

		dp[node] = max(dp[node], 1 + dp[adj[node][i]]);
	}
}

void addEdge(vector<int> adj[], int u, int v)
{
	adj[u].push_back(v);
}

int findLongestPath(vector<int> adj[], int n)
{
	int dp[n + 1];
	memset(dp, 0, sizeof dp);


	bool vis[n + 1];
	memset(vis, false, sizeof vis);

	for (int i = 1; i <= n; i++) {
		if (!vis[i])
			dfs(i, adj, dp, vis);
	}

	int ans = 0;


	for (int i = 1; i <= n; i++) {
		ans = max(ans, dp[i]);
	}
	return ans;
}

int main()
{    ios_base::sync_with_stdio(0);
cin.tie(0);
	int n,w;
	cin>>n>>w;
	vector<int> adj[n + 1];
	while(w--)
    {   int a,b;
    cin>>a>>b;
        addEdge(adj,a,b);
    }
	cout << findLongestPath(adj, n);
	return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
ll dp[(1<<21)+2];
int main()
{	
	int n;
	cin>>n;
	int mat[n][n];
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)cin>>mat[i][j];
	dp[0]=1;
	for(int mask=0;mask<(1<<n);mask++)
	{
		int cur=__builtin_popcount(mask);
		for(int i=0;i<n;i++)
		{
			if(mat[cur][i] and !(mask&(1<<i))) //won't go in for count = n
			dp[mask|(1<<i)]=(dp[mask]+dp[mask|(1<<i)])%mod;
		}
	}
	cout<<dp[(1<<n)-1];
	
	

}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    if(s.size()==2)cout<<s<<endl;
    else cout<<s[2]<<s[1]<<s[0]<<endl;
}

Measured memory_bytes: 3648
#[allow(dead_code)]
fn getline() -> String {
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

#[allow(unused_macros)]
macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! readlvec {
    ($t: ty) => {{
        let s = getline();
        let iter = s.trim().split(' ');
        iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
    }};
}

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

#[allow(dead_code)]
fn show<T>(iter: T) -> String
where
    T: Iterator,
    T::Item: std::fmt::Display,
{
    let mut res = iter.fold(String::new(), |sum, e| sum + &format!("{} ", e));
    res.pop();
    res
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::collections::btree_map::Entry::{Occupied, Vacant};

fn eratosthenes(n: usize) -> Vec<bool> {
    let n = n + 1;
    let mut res = vec![true; n];
    res[0] = false;
    res[1] = false;
    for i in (2..).take_while(|i| i * i <= n) {
        if !res[i] {
            continue;
        }
        let mut j = i * 2;
        while j < n {
            res[j] = false;
            j += i;
        }
    }
    res
}

fn main() {
    use std::io::Write;
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    macro_rules! printf { ($($arg:tt)*) => (write!(out, $($arg)*).unwrap()); }
    macro_rules! printfln { () => (writeln!(out).unwrap()); ($($arg:tt)*) => (writeln!(out, $($arg)*).unwrap()); }

    let n = readl!(usize);
    // debug!(eratosthenes(10));
    let era = eratosthenes(55555);
    let ans = era.into_iter()
        .enumerate()
        .filter(|&(i, f)| f && i % 5 == 1)
        .map(|x| x.0)
        .take(n);
    printfln!("{}", show(ans));
}


Measured memory_bytes: 4352
/*
 *     ____              _    
 *    / __ \____ _____  (_)___ *   / /_/ / __ `/ __ \/ /_  /
 *  / _, _/ /_/ / /_/ / / / /_
 * /_/ |_|\__,_/ .___/_/ /___/
 *            /_/             
 *           code@rapiz.me
 *          Fri, 13 Sep 2019 19:55:31 +0800
 */
#include <bits/stdc++.h>
#define xxx(x) cerr<<(#x)<<": "<<x<<endl;
#define fastios ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
using namespace std;
const int N = 1010;
int n, m, dd[4][2] = {
  {1, 0},
  {0, 1},
  {-1, 0},
  {0, -1}
}, fac;
char mm[N][N];
struct Node {
  int x, y, s, hp;
};
queue<Node> q;
bool vis[N][N][10];
int main() {
  cin >> n >> m >> fac;
  Node start;
  for (int i = 1; i <= n; i++) {
    cin >> (mm[i] + 1);
    for (int j = 1; j <= m; j++) {
      if (mm[i][j] == 'S') {
        start.x = i;
        start.y = j;
      }
    }
  }
  start.s = 0;
  start.hp = 1;
  q.push(start);
  while (!q.empty()) {
    Node u = q.front(); q.pop();
    vis[u.x][u.y][u.hp] = 1;
    //xxx(u.x);xxx(u.y);xxx(u.hp);xxx(u.s);
    if (u.hp == fac +1) {
      cout << u.s << endl;
      break;
    }
    for (int i = 0; i < 4; i++) {
      int nx = u.x + dd[i][0], ny = u.y + dd[i][1], nhp = u.hp;
      if (1 <= nx && nx <= n && 1 <= ny && ny <= m){
        if (mm[nx][ny] != 'X') {
          if (mm[nx][ny] >= '1' && mm[nx][ny] <= '9') {
            int idx = mm[nx][ny] - '1' + 1;
            if (u.hp == idx) nhp++;
          }
          if (!vis[nx][ny][nhp]) {
            vis[nx][ny][nhp] = 1;
            q.push((Node){nx, ny, u.s + 1, nhp});
          }
        }
      }
    }
  }
}


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

void solve(long long int arr[][3], int n){
  for(int i = n-2; i >= 0; i--){
      for(int j = 0; j < 3; j++){
          if(j == 0)arr[i][j] = arr[i][j]+max(arr[i+1][j+1],arr[i+1][j+2]);
          else if(j == 1)arr[i][j] = arr[i][j]+max(arr[i+1][j+1],arr[i+1][j-1]);
          else if(j == 2)arr[i][j] = arr[i][j]+max(arr[i+1][j-1],arr[i+1][j-2]);
      }
  }
  long long int ans = INT_MIN;
  for(int i = 0; i < 3; i++)
    ans = max(ans, arr[0][i]);
  cout<<ans;
}

int main(){
    int n;
    cin>>n;
    long long int arr[n][3];
    for(int i = 0; i < n; i++)
        for(int j = 0; j < 3; j++)
            cin>>arr[i][j];
    
    solve(arr,n);
    
}

Measured memory_bytes: 2560
total = int(input())
element = [int(s) for s in input().split()]

count = 0
for i in range(1, total-1):
  if ((element[i-1] < element[i]) and (element[i] < element[i+1])) or ((element[i-1] > element[i]) and (element[i] > element[i+1])):
    count += 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> f(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> f[i];

    sort(a.begin(), a.end());
    sort(f.begin(), f.end());
    reverse(f.begin(), f.end());

    ll l = -1;
    ll r = a[n-1]*f[0]+2;
    while (r-l>1) {
        ll x = (l+r)/2;
        //cout << l << " " << x << " " << r << endl;
        ll ik = 0;
        rep(i, n) {
            ll v = x/f[i];
            if (v<a[i]) ik += (a[i]-v);
        }
        if (ik>k) l = x;
        else r = x;
    }

    
    
    
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3328
n,k = map(int, input().split())


win=0
lose=0
COUNT=0
ans=0
for i in range(1,n+1):
    if i>=k:
        win=0
        lose=0
        win+=1
        lose+=n-1
        ans+=float(win/(win+lose))

    elif i<k:
        win=0
        lose=0
        count=n
        win+=1
        while i<k:
            count*=2
            i*=2
        lose=lose+count-1
        ans+=float(win/(win+lose))

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
// for文短縮類
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
// iteratorのbeginとendをまとめて渡す
#define ALL(x) (x).begin(), (x).end()
//略
#define PB push_back  // vectorヘの挿入
#define MP make_pair  // pairのコンストラクタ
#define F first       // pairの一つ目の要素
#define S second      // pairの二つ目の要素
//出力
#define COUT(x) cout << (x) << endl
#define SCOUT(x) cout << (x) << " "
#define ENDL cout << endl
/************ Combination wtih MOD ************
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// preprocess for some tables
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; 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;
  }
}
// combination
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
*******************************************************/
/********** UnionFind ***************
struct UnionFInd {
vector<ll> par;
UnionFInd(ll N) : par(N) {
for (ll i = 0; i < N; i++) {
par[i] = i;
}
}
ll root(ll x) {
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(ll x, ll y) {
ll rx = root(x);
ll ry = root(y);
if (rx == ry) return;
par[rx] = par[ry];
}
bool same(ll x, ll y) {
ll rx = root(x);
ll ry = root(y);
return rx == ry;
}
};
*************************************/
/***********************************
ll gcd(ll a, ll b) {
  if (a < b) {
    swap(a, b);
  }

  ll r = a % b;
  while (r > 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
***********************************/
int main(int argc, char *argv[]) {
  // input高速化。cinとcoutの結合解除。scanfとprintfは使えない。
  cin.tie(0);
  ios_base::sync_with_stdio(0);

  ll n, d;
  cin >> n >> d;
  vector<ll> x;
  vector<ll> y;
  REP(i, n){
      ll xi, yi;
      cin >> xi >> yi;
      x.push_back(xi);
      y.push_back(yi);
  }
  ll ans = 0;
  REP(i, n)
  {
      if(pow(x[i], 2) + pow(y[i], 2) <= d*d){
          ans += 1;
      }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 6668
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

int main()
{
    double a, b;
    cin >> a >> b;
    cout << a / b;
}

Measured memory_bytes: 3708
#include <stdio.h>

int main(void)
{
	int k, a, b;
	int i;
	int flag = 0;
	scanf("%d%d%d", &k, &a, &b);

	for (i = a; i <= b; i++) {
		if (i % k == 0) {
			flag = 1;
			break;
		}
	}

	if (flag == 1) {
		printf("OK\n");
	} else {
		printf("NG\n");
	}

	return 0;
}
		

Measured memory_bytes: 1660
#include<stdio.h>
#include<string.h>

int main()
{
	int X;
	scanf("%d", &X);
	int big = X / 500;
	int small = (X - 500*big) / 5;
	
	printf("%d", 1000*big+5*small);
		
	return 0;
	
}




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

int main(){
	long long int n, a, b; cin >> n >> a >> b;
	if(a > b || (n == 1 && a != b)){
		cout << 0 << endl;
	}else if(n == 1 || n == 2){
		cout << 1 << endl;
	}else{
		cout << (b - a) * (n - 2) + 1<< endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void){
	int n;
	cin>>n;
	string b[9]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	for(int j=0;j<n;j++){
		string s;
		cin>>s;
		int a=-1,time=0;
		string m;
		for(int i=0;i<s.size();i++){
			if(a==s[i]-'1'){
				time++;
			}else if(s[i]=='0'){
				if(a!=-1){
					time%=b[a].size();
					m=b[a][time];
					cout<<m;
					a=-1;
					time=0;
				}
			}else{
				time=0;
				a=s[i]-'1';
			}

		}
		cout<<endl;

	}
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  string h, t;
  int hanako = 0, taro = 0;
  for (int i = 0; i < n; i++) {
    cin >> h >> t;
    if (h < t)
      taro += 3;
    else if (h == t) {
      hanako++;
      taro++;
    } else
      hanako += 3;
  }
  cout << hanako << " " << taro << endl;
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
#define endl "\n" 
using namespace std;
#define debug(x) cout<<"The value of "<<#x<<" is "<<x<<endl;
typedef long long ll;
typedef unsigned long long ull;
bool visited[100003];
vector<int>adj[100003];
int parent[100003];
void bfs(){
    visited[1]=true;
    queue<int>qa;
    qa.push(1);
    while(qa.size()){
        int a=qa.front();
        qa.pop();
        for(auto i:adj[a]){
            if(!visited[i]){
                parent[i]=a;
                visited[i]=1;
                qa.push(i);
            }
        }
    }
}
int main()
{
    cin.sync_with_stdio(0); cin.tie(0); 
    int n,m;
    cin>>n>>m;
    while(m--){
        int a,b;
        cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for(int i=1;i<=n;i++)
    parent[i]=0,visited[i]=0;
    bfs();
    for(int i=1;i<=n;i++)
    if(!visited[i]){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;i++)
    cout<<parent[i]<<endl;
}


Measured memory_bytes: 10644
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
    int n; cin >> n;
    string s; cin >> s;
    if(n%2){
        cout << "No" << endl;
        return 0;
    }else{
        rep(i,n/2){
            if(s[i] != s[i+n/2]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
using namespace std;
string a,b;
int cnt;
char ch[200005];
int main(){
	scanf("%s",ch);
	a=string(ch);
	scanf("%s",ch);
	b=string(ch);
	for(int i=0;i<a.size();++i){
		if(a[i]!=b[i])++cnt;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 3488
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  set<pair<int,int>> st;
  for(int i = 1; i < n; i++) {
    if(i != n - i && i < n - i) st.emplace(i, n - i);
  }
  cout << st.size() << endl;
  return 0;
}


Measured memory_bytes: 23680
#include <iostream>
#include <cstdlib>
#include <vector>
#include <queue>
#include <algorithm>

int main() {
    int32_t n, m;
    std::cin >> n >> m;

    std::vector<std::vector<int32_t>> links(n);
    for (int32_t i = 0; i < m; ++i) {
        int32_t a, b;
        std::cin >> a >> b;
        links[a - 1].push_back(b - 1);
        links[b - 1].push_back(a - 1);
    }
    for (int32_t i = 0; i < n; ++i) {
        if (links[i].empty()) {
            std::cout << "No" << std::endl;
            return 0;
        }
        std::sort(links[i].begin(), links[i].end());
        links[i].erase(std::unique(links[i].begin(), links[i].end()), links[i].end());
    }
    
    using R = std::pair<int32_t, int32_t>;
    std::vector<R> rec(n);
    std::fill(rec.begin(), rec.end(), R(std::numeric_limits<int32_t>::max(), -1));
    rec[0] = R(0, 0);
    
    using P = std::pair<int32_t, int32_t>;
    std::priority_queue<P, std::vector<P>, std::greater<>> queue;
    
    queue.push(P(0, 0));
    while(!queue.empty()) {
        const auto& top = queue.top();
        int32_t cost = top.first;
        int32_t index = top.second;
        queue.pop();
        if (rec[index].first < cost) {
            continue;
        }

        for (auto i : links[index]) {
            auto dist = cost + 1;
            
            if (dist < rec[i].first) {
                rec[i].first = dist;
                rec[i].second = index;
                queue.push(P(dist, i));
            }
        }
    }

    std::cout << "Yes" << std::endl;    
    for (auto i = 1; i < n; ++i) {
        std::cout << rec[i].second + 1 << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 11080
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    String t = sc.next();
    
    for(int i = 0; i < n; i++) {
      System.out.print(s.charAt(i));
      System.out.print(t.charAt(i));
    }
  }
}

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

int main()
{
  int N;cin>>N;
  vector<int> H(N+1);
  for (int i=1;i<=N+1;i++)
     cin>>H[i];
  
  int max=0;
  int count=0;
  for (int i=1;i<=N;i++)
  {
    if (H[i]>=max)
    {
      count++;
      max = H[i];
    }
  }
    
  cout<<count<<endl;
}

Measured memory_bytes: 256
import copy

def swap(a, b):
    return b, a

def partition(A, p, r):
    x = int(A[r][1])
    i = p - 1
    for j in range(p, r):
        if int(A[j][1]) <= x:
            i = i+1
            A[i], A[j] = swap(A[i], A[j])
    A[i+1], A[r] = swap(A[i+1], A[r])
    return i+1

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q-1)
        quick_sort(A, q+1, r)
    return A

def merge(A, left, mid, right):
    L = A[left:mid]
    R = A[mid:right]
    L.append(['X', float('inf')])
    R.append(['X', float('inf')])
    i = 0
    j = 0
    for k in range(left, right):
        if float(L[i][1]) <= float(R[j][1]):
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return A

def merge_sort(A, left, right):
    if left+1 < right:
        mid = (left + right) >> 1
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        return merge(A, left, mid, right)

def read_n_lows_input(n):
    Alist=[[j for j in input().split()] for i in range(n)]
    return Alist

n = int(input())
A = read_n_lows_input(n)
B = copy.deepcopy(A)
quick_sort(A, 0, n-1)
merge_sort(B, 0, n)
if A == B:
    print("Stable")
else:
    print("Not stable")
for i in A:
    print(*i, sep=" ")


Measured memory_bytes: 43420
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 200000;
typedef long long ll;
int main()
{
  ll n,i,l,r,c,k,t,s=0;
  ll a[N_MAX];
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> a[i];
    s+=a[i];
  }
  sort(a,a+n,greater<ll>());
  l=max(s/(n+k),(ll)1);
  r=a[0];
  while(l<r){
    c=(l+r)/2;
    t=0;
    for(i=0;i<n;i++){
      t+=(a[i]+c-1)/c-1;
      if(t>k)
        break;
    }
    if(t>k){
      l=c+1;
    }else{
      r=c;
    }
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 5096
#include <stdio.h>

int main(void) {
  int i, j, k, l, n, m;
  scanf("%d%d", &n, &m);
  char a[n][n + 10], b[m][m + 10];
  for(i = 0; i < n; ++i) scanf("%s", a[i]);
  for(i = 0; i < m; ++i) scanf("%s", b[i]);
  for(i = 0; i <= n - m; ++i) for(j = 0; j <= n - m; ++j) {
    bool s = true;
    for(k = 0; k < m; ++k) for(l = 0; l < m; ++l) if(a[i + k][j + l] != b[k][l]) s = false;
    if(s) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>

int main(){
   int N;
   std::cin >> N;
   struct T{
      int t;
      int x;
      int y;
   };
   std::vector<T> v(N);
   for (int i=0; i<N; i++){
      int t, x, y;
      std::cin >> t >> x >> y;
      v.at(i).t = t;
      v.at(i).x = x;
      v.at(i).y = y;
   }
   //for (auto x : v){
   //   std::cout << x.t << " " << x.x << " " << x.y << std::endl;
   //}
   int t = 0, x = 0, y = 0;
   bool flag = true;
   for (int i=0; i<N; i++){
      int abst = v.at(i).t - t; 
      int absr = abs(v.at(i).x - x) + abs(v.at(i).y - y);
      if (abst < absr){
         flag = false;
         break;
      } else if ((abst % 2 == 0) && (absr % 2 == 1)){
         flag = false;
         break;
      } else if ((abst % 2 == 1) && (absr % 2 == 0)){
         flag = false;
         break;
      } else{
         t = v.at(i).t;
         x = v.at(i).x;
         y = v.at(i).y;
      }
   }
   if (flag){
      std::cout << "Yes" << std::endl;
   } else{
      std::cout << "No" << std::endl;
   }

}



Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	static int h,m,s;
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		tim(t);


	}
	static void tim(int S){
		if(S>=0 && S<=86400){
			h = S/3600;
			m = (S%3600)/60;
			s = (S%3600)%60;
		}
		System.out.println(h+":"+m+":"+s);

	}

}

Measured memory_bytes: 26272
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
ans = []
for j in range(0, w):
    for i in range(0, h-1):
        if a[i][j]%2 == 1:
            a[i][j] -= 1
            a[i+1][j] += 1
            ans.append([i+1, j+1, i+2, j+1])

for j in range(0, w-1):
    if a[h-1][j]%2 == 1:
        a[h-1][j] -= 1
        a[h-1][j+1] += 1
        ans.append([h, j+1, h, j+2])

print(len(ans))
for i in range(0, len(ans)):
    print(ans[i][0],ans[i][1],ans[i][2],ans[i][3],end="")
    print()

Measured memory_bytes: 30308
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    string s;cin>>s;

    REP(i,SIZE(s)){
        if(i == 5 || i == 13){
            cout << " ";
        }
        else{
            cout << s[i];
        }

    }
    cout << endl;

	return;
}

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int N,M;
vector<vector<int>> A;

bool f(int x) {
    vector<int> cnt(M),now(N);
    vector<bool> check(M);
    rep(i,N) cnt[A[i][0]]++;
    rep(z,M) {
        rep(i,N) {
            bool met = false;
            while (now[i] < M && check[A[i][now[i]]]) {
                met = true;
                now[i]++;
            }
            if (now[i] < M && met) cnt[A[i][now[i]]]++;
        }
        rep(i,M) if (cnt[i]>x) check[i] = true;
    }
    bool ok = false;
    rep(i,M) if (!check[i]) ok = true;
    return ok; 
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> N >> M;
    A.resize(N, vector<int>(M));
    rep(i,N) rep(j,M) {
        cin >> A[i][j];
        A[i][j]--;
    }
    int left = 0;
    int right = N;
    while (right - left > 1) {
        int mid = (left+right)/2;
        if (f(mid)) right = mid;
        else left = mid;
    }

    cout << right << endl;

}

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


#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

ll p[110000];
string s[110000];
map<ll,vector<string>> f;
main(){
  ll n,m,acsum=0,wasum=0;
  cin>>n>>m;
  rep(i,0,m){
    cin>>p[i]>>s[i];
    f[p[i]].pb(s[i]);
  }
  ll cnt=0;
  for(map<ll,vector<string>>::iterator it=f.begin();it!=f.end();it++){
    vector<string> ff=it->second;
    bool ac=false;
    ll cnt=0;
    for(ll i=0;i<ff.size();i++){
      //cout<<it->first<<ff[i]<<endl;
      if(ac)break;
      if(!ac&&ff[i]=="WA")cnt++;
      else if(!ac&&ff[i]=="AC"){ac=true;acsum++;wasum+=cnt;}
    }
    cout<<endl;
  }
  cout<<acsum<<" "<<wasum;
}

Measured memory_bytes: 17664
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  string S, T;
  cin >> S >> T;
  COUT(T + S);
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
	static int mod = 1000000007;
   public static void main(String[] main) throws Exception{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer st = new StringTokenizer(br.readLine());
      PrintWriter out = new PrintWriter(System.out);
      int k = Integer.parseInt(st.nextToken());
      st = new StringTokenizer(br.readLine());
      String s = st.nextToken();
      long ans = 0;
      long[] fact = new long[2000001];
      fact[0] = 1;
      for(int i = 1; i < 2000001; i++)
    	  fact[i] = (fact[i-1]*i)%mod;
      long inv = pow(fact[s.length()-1],mod-2);
      for(int i = 0; i <= k; i++) {
    	  ans = (ans + multiply(pow(25,i),multiply(multiply(pow(26,k-i),fact[s.length()+i-1]),multiply(inv,pow(fact[i],mod-2)))))%mod;
      }
      out.println(ans);
      out.close();
   }
   static long multiply(long a, long b) {
	   return (a*b)%mod;
   }
   static long pow(long l, int p) {
	   if(p == 0)
		   return 1;
	   if(p == 1 || l == 1)
		   return l;
	   long temp = pow(l, p/2);
	   long temp1 = (temp*temp)%mod;
	   if(p%2 == 1)
		   temp1 = (temp1*l)%mod;
	   return temp1;
   }
}

Measured memory_bytes: 52432
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

int main() {
	int S, M;
	cin >> S ;
	M = S * S * S;
	if (S == 1) {
		cout << 1 << endl;
	}

	else {
		cout << M << endl;
	}
	}

	    

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
#define PI 3.141592653589793
 
int main()
{
    double a, b, c, s, C;
    double S, L, h; 
     
    scanf("%lf%lf%lf", &a, &b, &C);
    c = sqrt(a*a + b*b - 2*a*b*cos(C*PI/180));
    L = a+b+c;
    s = L/2;
    S = sqrt(s*(s-a)*(s-b)*(s-c));
    h = 2*S/a;
    printf("%.8lf\n%.8lf\n%.8lf\n", S, L, h);
    return 0;
}


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

#define int long long int
# define pb push_back
# define mod 1000000007
typedef vector<int> vi; 
typedef pair<int, int> pi; 
#define F first;
#define S second;
#define mp make_pair;
#define fo(i, a, b) for(int i=a; i<b; i++)
#define forev(i, a, b) for(int i=a; i>=b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


// Modular Multiplicative Inverse a x = 1 (mod m) 
// https://math.stackexchange.com/questions/1372705/formula-for-reciprocal-of-a-factorial
// invFact(n) = fact(n)^(mod-2)


int32_t main()
{
	fast
    int n;
    	cin>>n;
//    int arr[n+1]={0};
    int tot=0;
    for(int i=2; i*i<=n; i++)
    {
    	int num=0;
    	while(n%i==0)
    	{
    		num++;
    		n/=i;
		}
		for(int j=1; ; j++)
		{
			if(num < j)break;
			num -= j;
			tot++;
//			cout<<i<<" "<<j<<"\n";
		}
	}
	if(n!=1)tot++;
	cout<<tot;
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[100];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a, a + n);
    reverse(a, a + n);
    int p = 0, q = 0;
    for (int i = 0; i < n; ++i)
        (i % 2 ? q : p) += a[i];
    cout << abs(p - q);
}


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

using namespace std;
using ll = long long;


int main()
{
	ll n; cin >> n;
	vector<ll> a(4, -1000000000000LL);
	vector<pair<ll,ll>> p(n);
	for(ll i = 0; i < n; i++) {
		ll x, y; cin >> x >> y;
		a[0] = max(a[0], x + y);
		a[1] = max(a[1], -x + y);
		a[2] = max(a[2], -y + x);
		a[3] = max(a[3], -x - y);
		p[i] = {x, y};
	}

	ll dist = 0;

	for(ll i = 0; i < n; i++) {
		ll cur = 0;
		ll x = p[i].first, y = p[i].second;
		cur = max(cur, a[0] - (x + y));
		cur = max(cur, a[1] + (x - y));
		cur = max(cur, a[2] - (x - y));
		cur = max(cur, a[3] + (x + y));
		dist = max(cur, dist);
	}

	cout << dist << endl;

}

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

using namespace std;

int main()
{
    long long q, h, s, d; cin >> q >> h >> s >> d;
    long long n; cin >> n;
    long long res = 0;

    if (n > 1)
    {   
        if (d < 2 * s && d < 4 * h && d < 8 * q) res = (n / 2) * d;
        else if (2 * s < 4 * h && 2 * s < 8 * q) res = (n / 2) * 2 * s;
        else if (4 * h < 8 * q) res = (n / 2) * 4 * h;
        else res = (n / 2) * 8 * q;
        n %= 2;
    }   
    if (n > 0)
    {   
        if (s < 2 * h && s < 4 * q) res += s;
        else if (2 * h < 4 * q) res += 2 * h;
        else res += 4 * q;
    }   
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
 
const int MAX_N = 100001;
const int MAX_K = 13;
 
// 連続で x 回半額弁当をゲットしたときに半額弁当を得る確率
double P(int x){
    return 1.0 / (1 << x);
}
 
// dp[i][k] := i 日目で k 回連続ゲットしたときの期待値
double dp[MAX_N+1][MAX_K+1] = {0};
// ans[i] := i 日目の半額弁当を得る個数の期待値
double ans[MAX_N+1] = {0};
 
int main(){
    int n;
    double sum = 0;
     
    dp[0][0] = 1.0;
    for(int i=0 ; i < MAX_N ; i++ ){
        for(int k=0 ; k < MAX_K ; k++ ){
            if( dp[i][k] > 0 ){
                sum += dp[i][k] * P(k);
                 
                // 半額弁当を得るとき
                dp[i+1][k+1] += dp[i][k] * P(k);
                // 半額弁当を得られないとき
                dp[i+1][0] += dp[i][k] * (1.0 - P(k));
                 
            }
        }
        ans[i] = sum;
    }
     
    while( scanf("%d", &n ) , n ){
        printf("%.8f\n", ans[n-1] );
    }
}

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

int main()
{
    int r, c, sum=0;
    cin>>r>>c;
    int table[r+1][c+1];
    for(int i=0;i<r;i++)
    {
        int line=0;
        for(int j=0;j<c;j++)
        {
            cin>>table[i][j];
            line += table[i][j];
        }   
        table[i][c]=line;
        sum += line;
    }
    for(int j=0;j<c;j++)
    {
        int line = 0;
        for(int i=0;i<r;i++)
        {
            line += table[i][j];
        }
        table[r][j]=line;
    }
    table[r][c]=sum;
    for(int i=0;i<=r;i++)
    {
        for(int j=0;j<=c;j++)
        {
            cout<<table[i][j];
            if(j!=c)cout<<' ';           
        }   
        cout<<endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)


int main() {
  string s;
  cin >> s;
  ll ans = 0;
  rep(i, 1<<(s.length()-1)) {
    ll ic = i;
    string sc = s;
    for(ll j=s.length()-1; ic!=0; --j, ic>>=1) {
      if(ic & 1) sc.insert(j, "+");
    }
    auto iter=sc.begin();
    while(true) {
      auto p = find(iter, sc.end(), '+');
      ans += stoll(string(iter, p));
      if(p == sc.end()) break;
      iter = p + 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()

r = 0
g = 0
b = 0

for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    else:
        b += 1

ans = r * g * b

for i in range(n-1):
    for j in range(i+1, n):
        if s[i] == s[j]: continue
        k = 2*j - i
        if k >=n: continue
        if s[i] == s[k] or s[j] == s[k]: continue
        ans -= 1

print(ans)

Measured memory_bytes: 9212
#include <cstdlib>
#include <iostream>


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

  int a, b;
  char op;
  std::cin >> a >> op >> b;
  std::cout << (op == '+' ? (a + b) : (a - b)) << std::endl;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256