akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

struct node{
    struct node *right;
    struct node *left;
    struct node *parent;
    int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
/*
Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
    Node y; // node to be deleted
    Node x; // child of y



}
*/

Node find(Node u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key){
            u = u->left;
        }else{
            u = u->right;
        }
    }
    return u;
}

void insert(int k){
    Node y = NIL;
    Node x = root;
    Node z;

    z = malloc(sizeof(struct node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL){
        root = z;
    }else{
        if(z->key < y->key){
            y->left = z;
        }else{
            y->right = z;
        }
    }
}

void inorder(Node u){
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node u){
    if(u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}


int main(){
    int n, i, x;
    char com[20];
    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
        scanf("%s", com);
        if ( com[0] == 'f' ){
            scanf("%d", &x);
            Node t = find(root, x);
            if ( t != NIL ) printf("yes\n");
            else printf("no\n");
        } else if ( com[0] == 'i' ){
            scanf("%d", &x);
            insert(x);
        } else if ( com[0] == 'p' ){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        } else if ( com[0] == 'd' ){
            scanf("%d", &x);
            //treeDelete(treeSearch(root, x));
        }
    }

    return 0;
}






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

static
const char tbl[ ] = "abcdefghijklmnopqrstuvwxyz.?! ";

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char  s[ 256 ];

  while ( scanf ( "%s", s ) == 1 )
  {
    char  * p;
    char  * q;

    for ( p = q = s; *p != '\0'; p += 2 )
    {
      if ( p[ 0 ] < '1' || p[ 0 ] > '6'
        || p[ 1 ] < '1' || p[ 1 ] > '5' ) goto NA;

      *( q++ ) = tbl[ ( p[ 0 ] - '1' ) * 5 + p[ 1 ] - '1' ];
    }

    for ( p = s; p != q; ++p )
    {
      putchar ( *p );
    }
    puts ( "" );
    continue ;
NA:
    puts ( "NA" );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    
    int cnt = 0;
    rep(i, N) {
        if (p[i] != i + 1) ++cnt;
    }
    if (cnt < 3) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * Aizu Chicken
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			if (line.equals("0")) break;
			words = line.split(" ");

			int q1, b, c1, c2, q2;
			q1 = parseInt(words[0]);
			b = parseInt(words[1]);
			c1 = parseInt(words[2]);
			c2 = parseInt(words[3]);
			q2 = parseInt(words[4]);

			int a1 = 0, a2 = 0;

			if (b / c1 >= q2) {
				a1 = q2;
				a2 = (b - c1 * q2) / c2;
			} else {
				a1 = b / c1;
				a2 = (b - c1 * a1) / c2;
			}

			if (a1 + a2 < q1) {
				if (c1 > c2) {
					while (a1 + a2 < q1) {
						a1--;
						a2 = (b - c1 * a1) / c2;
					}
				} else if (c1 < c2) {
					while (a1 + a2 < q1) {
						a2--;
						a1 = (b - c2 * a2) / c1;
					}
				}
			}

			if (a1 > 0 && a2 >= 0 && a1 + a2 >= q1 && a1 <= q2) {
				System.out.println(a1 + " " + a2);
			} else {
				System.out.println("NA");
			}
		}
	}
}

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

using namespace std;

const int MOD = 1000000007;

int modPow(int a, int p){
    if(p == 0) return 1;
    long long half = modPow(a, p/2);
    long long res = (half * half) % MOD;
    if(p % 2) res = (res * a) % MOD;
    return res;
}

int main(){
    int N;
    while(cin >> N){
        vector<int> A(N);
        for(auto& t : A) cin >> t;
        vector<int> B(N+1, 0);
        for(int i=0;i<N;i++) B[i+1] = B[i]^A[i];
        vector<int> checked0(1<<20, 0);
        vector<vector<int>> seq(1<<20, vector<int>());
        int cnt0 = 0;
        long long res = 0;
        if(B.back() == 0){
            for(auto& t : B){
                if(t == 0) ++cnt0;
                else {
                    if(checked0[t] != cnt0){
                        seq[t].push_back(cnt0 - checked0[t]);
                        seq[t].push_back(1);
                        checked0[t] = cnt0;
                    } else {
                        ++seq[t].back();
                    }
                }
            }
            for(int i=0;i<(1<<20);i++){
                seq[i].push_back(cnt0 - checked0[i]);
            }
            res = modPow(2, seq[0][0] - 2);
            for(int i=1;i<(1<<20);i++){
                if(seq[i].size() == 1) continue;
                long long num0 = 1, num1 = 0;
                for(int j=1;j<seq[i].size();j+=2){
                    num1 += num0 * seq[i][j];
                    num1 %= MOD;
                    num0 += num1 * seq[i][j+1];
                    num0 %= MOD;
                }
                res = (res + num1) % MOD;
            }
        } else {
            long long num0 = 1, num1 = 0;
            for(auto& t : B){
                if(t==0){
                    num0 = (num0 + num1) % MOD; 
                } else if(t==B.back()){
                    num1 = (num0 + num1) % MOD;
                }
            }
            res = num0;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 69632
/* 
 * Project: AtCoder Beginners Contest 172 A - Calc
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/27
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int a;

void solve() {

    long result = a + a*a + a*a*a;

    printf("%ld\n", result);

}

int main() {

    scanf("%d", &a);

    solve();

}

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

int main() {
	int N, i;
	cin >> N;
	vector<int> H(N), a(N), b(N);
	for (int& j : H) cin >> j;
	a.front() = H.front();
	b.back() = H.back();
	for (i = 1; i < N; ++i) a[i] = max(H[i], a[i - 1]);
	for (i = N - 2; i >= 0; --i) b[i] = min(H[i], b[1 + i]);
	for (i = 0; i < N; ++i) {
		if (1 < a[i] - b[i]) break;
	}
	if (N == i) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
 <url:>
 ?????????============================================================
 ????????????????????????????????£?¶???????3????????????JOI?????????IOI??¨????????????????????£??????????????????
 ??????????????????????????????????????°????????????????????°????????????????????????
 ??????????????¢???????????????????????§???????????????????????????
 ????????°????????????JOIOIOI?????¨?????????????????????JOI???1?????????IOI???2??????????????????????????????
 =================================================================
 ?§£??¬=============================================================
 ??????
 ================================================================
 */
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    string S;
    string joi = "JOI",ioi = "IOI";
    int cnt_joi,cnt_ioi;
    while(cin >> S){
        cnt_joi = cnt_ioi = 0;
        for(int i = 0; i < S.length() - 2;i++){
            string subS = S.substr(i,3);
            if(subS == joi) cnt_joi++;
            if(subS == ioi) cnt_ioi++;
        }
        cout << cnt_joi << endl;
        cout << cnt_ioi << endl;
    }
    return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	long long n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	long long min_move = min( { a,b,c,d,e } );
	long ans = ((n + min_move - 1) / min_move) + 4;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int h,w; cin>>h>>w;
    vector<vector<int>> m(h+2,vector<int>(w+2,-1));
    rep(i,h){
        rep(j,w){
            char ch; cin>>ch;
            if(ch=='#') m[i+1][j+1]=-10;
            else m[i+1][j+1]=0;
        }
    }
    rep(i,h){
        rep(j,w){
            if(m[i+1][j+1]==-10) continue;
            for(int dx=-1;dx<=1;dx++){
                for(int dy=-1;dy<=1;dy++){
                    if(m[i+1+dx][j+1+dy]==-10) m[i+1][j+1]++;
                }
            }
        }
    }
    rep(i,h){
        rep(j,w){
            if(m[i+1][j+1]==-10) cout<<'#';
            else cout<<m[i+1][j+1];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
//       Author: Mostafa Mounir Shehab
 
#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
#define SZ(v) (int)(v.size())
typedef long long ll;
typedef long double ld;
//template <class Type>
 
 
void Fast(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
}
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}
 

 

ll MOD=1e9 + 7; 
const int N=2e5 + 4;
ll arr[N];
unordered_map<int,ll> dp[N];
ll OO=1e16;
 
 
ll n,m,k,cnt,SU,idx,len,MN,MX,T,prime;
ll l,r,mid;
ll a,b,c,d;
vector<int> vec,v;
string str,s;

ll Solve(int idx,int len){
	
	if((n-idx+1)/2 + len < n/2)
		return -OO;
	
	if(idx >= n)
		return len == n/2 ? 0 : -OO;
	
	if(dp[idx].count(len))
		return dp[idx][len];


	ll ret = -OO;
	
	ret = max(ret,arr[idx] + Solve(idx+2,len+1));
	ret = max(ret,Solve(idx+1,len));
	
	return dp[idx][len] = ret;
	
}





int main(){

	scanf("%d",&n);
	for(int i=0;i<n;++i)
		scanf("%lld",arr+i);
	
	printf("%lld\n",Solve(0,0));

	return 0;
}
 
 
 
 
 
 
 
 

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

int main(){
  char c1, c2;
  cin >> c1 >> c2;
  if(c1 < c2){
   cout << "<" << endl;
  }else if(c1 > c2){
   cout << ">" <<endl;
  }else{
   cout << "=" << endl;
  }
 return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    cin >> n >> k;
    double ans = 0.0;
    rep1(i, n) {
        int sum = n;
        for (int j=i; j<k; j*=2) sum *= 2;
        ans += 1.0 / sum;
    }
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp112 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = st[0];
            int K = st[1];

            var h = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var dp = new int[N + 3];

            dp[0] = 0;
            dp[1] = Math.Abs(h[1] - h[0]);

            for (int i = 2; i < N; i++) {
                //まずは適当な値を入れる
                dp[i] = dp[i - 1] + Math.Abs(h[i] - h[i - 1]);
                for (int j = 1; (i - j >= 0 && j <= K); j++) {
                    dp[i] = Math.Min(dp[i], dp[i - j] + Math.Abs(h[i] - h[i - j]));
                }
            }


            Console.WriteLine(dp[N - 1]);


        }
    }
}


Measured memory_bytes: 20448
use std::str::FromStr;
use std::fmt::Debug;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn eucrid(a: u32, b: u32) -> u32{
    if b == 0{
        return a;
    }
    
    return eucrid(b, a%b);
        
}

fn main(){
    let n: u32 = read_as_vec()[0];
    let monsters: Vec<u32> = read_as_vec();
    //println!("monsters = {:?}", monsters);
    let mut answer = monsters[0];
    let monsters: Vec<u32> = monsters.into_iter().skip(1).collect();
    //println!("monsters = {:?}", monsters);

    for monster in &monsters{
        answer = eucrid(answer, *monster);
    }
    println!("{}", answer);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
 
class DandA {
    static void Main(string[] args) {
        int[] nk = ReadLineIntArray();
        int[] rsp = ReadLineIntArray();
        string t = ReadLineStr();
        string len = "";
        int rtn = 0;
        for (int i = 0; i < nk[1]; i++){
            int j = 0;
            bool flg = true;
            while ((j * nk[1]) + i < nk[0]) {
                len = t.Substring((j * nk[1]) + i, 1);
                if (nk[1] <= (j * nk[1]) + i && len == t.Substring(((j - 1) * nk[1]) + i, 1)&& flg) {
                    flg = false;
                } else {
                    flg = true;
                }
                if (flg) {
                    if (len == "s") {
                        rtn += rsp[0];
                    } else if (len == "p"){
                        rtn += rsp[1];
                    } else {
                        rtn += rsp[2];
                    }
                }
                j++;
            }
        }
        Console.WriteLine(rtn);
    }
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}

    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 17628
import sys
sys.setrecursionlimit(10**9)

MOD = 10**9 + 7

N, K = map(int, input().split())
adjL = [[] for _ in range(N)]
for _ in range(N-1):
    A, B = map(int, input().split())
    adjL[A-1].append(B-1)
    adjL[B-1].append(A-1)

numCs = [-1]*N
def dfs1(vNow):
    numCs[vNow] = 0
    for v2 in adjL[vNow]:
        if numCs[v2] == -1:
            numCs[vNow] += 1
            dfs1(v2)

dfs1(0)

ps = [0]*N
p = 1
m = K
for _ in range(numCs[0]+1):
    p *= m
    p %= MOD
    m -= 1
ps[0] = p
for v in range(1, N):
    p = 1
    m = K-2
    for _ in range(numCs[v]):
        p *= m
        p %= MOD
        m -= 1
    ps[v] = p

ans = 1
for p in ps:
    ans *= p
    ans %= MOD

print(ans)


Measured memory_bytes: 88124
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200001;
int n, x[maxn], y[maxn], a[maxn], b[maxn];
int main() {
	cin >> n;
	for(int i = 1; i <= n; ++ i) {
		cin >> x[i] >> y[i];
		a[i] = x[i] + y[i], b[i] = y[i] - x[i];
	}
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	cout << max(a[n] - a[1], b[n] - b[1]);
	return 0;
}


Measured memory_bytes: 6756
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
ll H, W;
ll N;
vector<ll> a;
vector<ll> b;
set<pair<int, int>> S;
ll A[10];
int d_a[9] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
int d_b[9] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
// http://mmxsrup.hatenablog.com/entry/2016/09/12/215414
int main() {
    cin >> H >> W;
    cin >> N;
    a.resize(N);
    b.resize(N);
    // vvl grid(H + 2, vl(W + 2, 0));
    //各整数 j ( 0≤j≤9 ) について、盤の中に完全に含まれるすべての
    // 3行 3列の連続するマス目のうち、黒いマスがちょうど j個あるもの。
    // cout << "hoge" << endl;
    REP(i, N) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        S.insert({a[i], b[i]});
    }
    vector<ll> ans(10, 0);
    set<pair<int, int>> used;
    REP(i, N) {
        REP(j, 9) {
            //黒の周りから探す
            int ca = a[i] + d_a[j];
            int cb = b[i] + d_b[j];
            auto coord = make_pair(ca, cb);
            if(!(1 <= ca and ca < H - 1 and 1 <= cb and cb < W - 1)) {
                continue;
            }
            if(used.count(coord)) {
                continue;
            }
            int cnt = 0;
            REP(k, 9) {
                //探すところの周り
                int na = ca + d_a[k];
                int nb = cb + d_b[k];
                if(!(0 <= na && na < H && 0 <= nb && nb < W)) {
                    continue;
                }
                if(S.count(make_pair(na, nb))) {
                    cnt++;
                }
            }
            used.insert(coord);
            ans[cnt]++;
            // cout << ca << " : " << cb << "hoge" << endl;
        }
    }
    ll sum = accumulate(ans.begin(), ans.end(), 0LL);
    ans[0] = ((ll)H - 2LL) * ((ll)W - 2LL) - sum;
    REP(i, 10) { cout << ans[i] << endl; }
    return 0;
}

Measured memory_bytes: 48640
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

long long int gcd(long long int m, long long int n)
{
	if (n == 0)
		return m;
	return gcd(n, m % n);
}

int main()
{
	long long int a, b;
	cin >> a >> b;
	cout << a * b / gcd(a, b) << endl;
}

Measured memory_bytes: 256
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

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

int main(void){
	long x;
	scanf("%ld", &x);
	long ans = x/11*2;
	char i = x%11;
	if(i>=7) ans+=2;
	else if(i>=1) ans++;
	printf("%ld\n", ans);
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            List<int> lstInp = new List<int>();
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < 3; i++) { lstInp.Add(int.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstInp.Sort();
            int iOut = lstInp[0] + lstInp[1];

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

ll fn(ll a){
    if ((a+1) % 2 == 0)
    {
        return ((a+1) / 2) % 2;
    }
    else
    {
        return (( (a+1) / 2) % 2) ^ a;
    }
}

int main()
{
    ciosup;
    ll a,b;
    cin >> a >> b;
    ll sa = b - a + 1;
    cout << (fn(b) ^ fn(a - 1)) << endl;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

const string YES = "YES";
const string NO = "NO";

string cand[4] = {"maerd", "remaerd", "esare", "resare"};

void solve(std::string S){
  reverse(S.begin(), S.end());
  bool flag = true;
  REP(i, S.length()){
    if(!flag) break;
    if(i>S.length()-5) flag = false;
    if(S.substr(i, 5) == cand[0]) { i+=4; continue; }
    if(S.substr(i, 5) == cand[2]) { i+=4; continue; }
    if(i>S.length()-6) flag = false;
    if(S.substr(i, 6) == cand[3]) { i+=5; continue; }
    if(i>S.length()-7) flag = false;
    if(S.substr(i, 7) == cand[1]) { i+=6; continue; }
    flag = false;
  }
  cout << (flag ? YES : NO) << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 764
a,b,k=map(int,input().split())
turn=0
for i in range(k):
    if(turn==0):
        if(a%2==0):
            b+=a//2
            a-=a//2
        else:
            a-=1
            b+=a//2
            a-=a//2
        turn=1
    else:
        if(b%2==0):
            a+=b//2
            b-=b//2
        else:
            b-=1
            a+=b//2
            b-=b//2
        turn=0
print(a,b)

Measured memory_bytes: 3064
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

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

fn main(){
    let x = read_as_string();

    let mut s_stack = 0;
    let mut num_st = 0;
    for c in x.chars(){
        if c == 'S'{
            s_stack += 1;
        }else{
            if s_stack > 0{
                s_stack -= 1;
                num_st += 1;
            }
        }
    }

    println!("{}", x.len() - num_st*2);
}


Measured memory_bytes: 4352
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>

#include <random>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
//typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//#ifdef __int128
using hll = __int128;

using ll = long long;
//#endif
using pii = pair<ll, ll>;
using ld = double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}


#ifdef _getchar_nolock
#else
#define _getchar_nolock getchar_unlocked
#endif

//#define solvsh
//#define multi

#ifdef solvsh
#else

ll mod = 1000000007;

ll add(ll a, ll b){
    return (a + b) % mod;
}
ll ml(ll a, ll b) {
    return (a * b) % mod;
}

ll sub(ll a, ll b) {
    return add(a, mod - b);
}

const int MAXN = 112;

void solve() {

    int k;
    cin >> k;
    while (k--)cout << "ACL";

}


#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case " << i << ": ";
        solve();
//        cout << "\n";
        i++;
    }
}

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifndef ONLINE_JUDGE
#else
#endif
#ifdef multi
    //        gen();
    multisolve();
#else
    solve();
//    gen();
#endif
//    time_calc();
}


Measured memory_bytes: 3484
s = int(input())
a = s
a_list = [a]
m = 1

while(True):
  m += 1
  if a % 2== 0:
    a = a // 2
  else:
    a = 3 * a + 1
  if a in a_list:
    break
  a_list.append(a)
print(m)

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

int main(void){
	char str[110];

	while(fgets(str, 110, stdin) != NULL){
		str[strlen(str) - 1] = '\0';

		int i = 0;
		while(str[i] != '\0'){
			if(str[i] == '@'){
				i++;
				for(int j=0; j< str[i] - '0'; j++){
					printf("%c", str[i+1]);
				}
				i++;
			}else{
				printf("%c", str[i]);
			}
			i++;
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a<b){cout<<"a < b"<<endl;}
    else if(a>b){cout<<"a > b"<<endl;}
    else if(a==b){cout<<"a == b"<<endl;}
    return 0;
}



Measured memory_bytes: 3088
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var S string
	fmt.Scan(&S)

	N := [4]int{}
	for i, s := range S {
		N[i], _ = strconv.Atoi(string(s))
	}

	for i := 0; i < (1 << 3); i++ {
		ans := N[0]
		sign := [3]string{}
		for j := 0; j < 3; j++ {
			if i&(1<<j) > 0 {
				ans += N[j+1]
				sign[j] = "+"
			} else {
				ans -= N[j+1]
				sign[j] = "-"
			}
		}

		if ans == 7 {
			fmt.Printf("%d%s%d%s%d%s%d=7\n", N[0], sign[0], N[1], sign[1], N[2], sign[2], N[3])
			return
		}
	}
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template <typename T1, typename T2> 
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n + 1), b(n);
  rep(i, n + 1) cin >> a[i];
  rep(i, n) cin >> b[i];
  ll ans = 0;
  rep(i, n) {
    ll dmg = min(a[i], b[i]);
    ll dmg2 = min(b[i] - dmg, a[i + 1]);
    a[i + 1] -= dmg2;
    ans += dmg + dmg2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4756
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint dp[110][100010];
int main() {
  int n,k;
  int a[101];
  cin >> n >> k;
  rep(i,n){
    cin >> a[i];
  }

  dp[0][0] = 1;
  mint sum[100010];
  rep(i,n){
    sum[0] = 0;
    rep(j,k+1){
      sum[j+1] = sum[j] + dp[i][j];
    }
    rep(j,k+1){
      dp[i+1][j] = sum[j+1] - sum[max(0,j-a[i])];
    }
  }
  cout << dp[n][k].x << endl;
}


Measured memory_bytes: 87040
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(int a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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;
}

ll INF = 10000000;
ll mod = 1000000007;//10^9+7



//番号ズレ注意！！
int main() {
    int P,Q,R;
    cin>>P>>Q>>R;
    int ans =350;
    if(P+Q<ans){ans=P+Q;}
    if(R+Q<ans){ans=R+Q;}
    if(P+R<ans){ans=P+R;}
    printAns(ans);
}


Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))


def check(lst):
    for i in range(N):
        if lst[i] >= N:
            return False
    return True

ans = 0
while not check(L):
    cnts = []
    for l in L:
        cnts.append(l // N)
    sum_cnts = sum(cnts)
    ans += sum_cnts
    for i in range(N):
        L[i] = L[i] - cnts[i] * N + sum_cnts - cnts[i]
print(ans)


Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    
    void calc()
    {
        cin = new Scanner();
        int H, W;
        H = cin.nextInt();
        W = cin.nextInt();
        int N = cin.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++)
        {
            a[i] = cin.nextInt();
        }
        int[,] ans = new int[H, W];
        int cnt = 0;
        for (int i = 0; i < H; i++)
        {
            for (int jj = 0; jj < W; jj++)
            {
                int j = jj;
                if (i % 2 == 1) j = (W - jj - 1);
                while (a[cnt] == 0) cnt++;
                ans[i, j] = cnt + 1;
                a[cnt]--;
            }
        }

        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                Console.Write(ans[i,j] + " ");
            }
            Console.WriteLine();
        }
    }


        
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}
 

Measured memory_bytes: 13280
import java.util.Scanner;

class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int count = 0;
    
    while (N != 0) {
      int num = in.nextInt();
      if (isPrime(num)) count++;
      N--;
    }
    
    System.out.println(count);
  }
  
  public static boolean isPrime(int x) {
    if      (x == 2)     return true;
    else if (x % 2 == 0) return false;
    else {
      // if if x has a factor, then it has one less than or equal to sqrt(x),
      // so for efficiency we only need to check i <= sqrt(N) or equivalently i*i <= x
      for (int i = 3; i * i <= x; i += 2) {
        if (x % i == 0) return false;
      }
      return true;
    }
  }
}

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

#define MAX 100
#define INFTY (1LL<<32)
typedef long long ll;
int n;
ll d[MAX][MAX];

void floyd(){
	for (int k =0;k<n;k++){
		for (int i =0;i<n;i++){
			if (d[i][k] == INFTY) continue;
			for (int j =0;j<n;j++){
				if (d[k][j] == INFTY) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

int main(){
	int e, u, v, c;
	cin >> n >> e;
	//init
	for ( int i = 0; i < n; i ++) {
		for ( int j = 0; j < n; j ++) {
			d[i][j] = ( (i == j) ? 0 : INFTY);
		}
	}

	for (int i = 0; i < e; i++) {
		cin >> u >> v >> c;
		d[u][v] = c;
	}

	floyd();
	bool negative = false;
	for (int i =0; i < n; i++) if ( d[i][i] < 0) negative = true;

	if (negative) {
		cout << "NEGATIVE CYCLE" << endl;
	} else {
		for ( int i = 0; i < n; i ++) {
			for ( int j = 0; j < n; j ++) {
				if (j) cout << " ";
				if( d[i][j] == INFTY) cout << "INF";
				else cout << d[i][j];
			}
			cout << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3184
#include <stdio.h>

int main(){

	int N,T,choosenC=1001;
	scanf("%d %d",&N,&T);

	int i,a,b;
	for(i=1;i<=N;i++){
		scanf("%d %d",&a,&b);
		if(b<=T && a<=choosenC){
			choosenC = a;
		}
	}

	if(choosenC<1001){
		printf("%d\n",choosenC);
	}else{
		printf("TLE\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -O2 #-}

import qualified Data.Vector.Unboxed as VU
import Data.Bits
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.List


-- 1 <= damageOther < damageTarget <= 10^9
{-# INLINE isPossibleWith #-}
isPossibleWith :: VU.Vector Int -> Int -> Int -> Int -> Bool
isPossibleWith !hps !damageTarget !damageOther !numMagics
  = (<= numMagics) $ VU.sum
    $ VU.map ((`div` damageDiff) . (+ (damageDiff - 1)))
    $ VU.filter (> 0)
    $ VU.map (subtract damageMin)
    $ hps
  where
    !damageMin = damageOther * numMagics
    !damageDiff = damageTarget - damageOther

query :: VU.Vector Int -> Int -> Int -> Int
query !hps !damageTarget !damageOther = binSearch 0 (10 ^ 9)
  where
    binSearch !ng !ok
      | ok - ng <= 1 = ok
      | isPossibleWith hps damageTarget damageOther mid = binSearch ng mid
      | otherwise = binSearch mid ok
      where
        !mid = (ng + ok) `shiftR` 1

main :: IO ()
main = do
  [n, damageTarget, damageOther]
    <- unfoldr (BS.readInt . BS.dropWhile (==' ')) <$> BS.getLine
  hps <- VU.unfoldrN n (BSL.readInt . BSL.dropWhile (< '-'))
         <$> BSL.getContents
  print $ query hps damageTarget damageOther


Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
void init_fact(){
	kaijo[0]=1;
	for(int i=1;i<=2000000;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(!kaijo[0])init_fact();
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
	x=modpow(x,MOD-2);
	return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
	return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,a[100010],ans=1,cnt[3]={0,0,0};
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n){
		int memo=0;
		bool flag=true;
		rep(j,3){
			if(cnt[j]==a[i]){
				memo++;
				if(flag){
					cnt[j]++;
					flag=false;
				}
			}
		}
		ans*=memo;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
N, M = map(int, input().split())
H = list(map(int, input().split()))

L = [1] * N

for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] > H[B]:
        L[B] = 0
    elif H[A] == H[B]:
        L[A] = 0
        L[B] = 0
    else:
        L[A] = 0

print(sum(L))



Measured memory_bytes: 20028
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
int main()
{
   char s[101];
   scanf("%s",s);
   int len = strlen(s);
   int i;
   for(i = 0;i < len ;i++)
   {
       if(i==len-1)
       printf("x\n");
       else
        printf("x");
   }
}


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
int dx[]={1, -1, 0, 0, 1, 1, -1, -1};


int main() {
    cout<<fixed<<setprecision(10);

    ll n,k; cin>>n>>k;
    vint a(n); rep(i,n) cin>>a[i];

    ll l,r;
    l = 0; r = 1e9;


    auto isOK = [&](ll key){
        ll cnt = 0;
        for(auto e:a){
            cnt += e/key - (ll)(e%key==0);
        }

        return cnt <= k;
    };

    while(r-l > 1){
        ll mid = (l+r)/2;
        if(isOK(mid)) r = mid;
        else l = mid;
    }
    cout<<r<<endl;

    return 0;

}

Measured memory_bytes: 4840
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

ans = -1
ans_tp = 1000
for i in range(N):
    h = H[i]
    tp = T - 0.006*h
    if abs(ans_tp-A) > abs(tp-A):
        ans_tp = tp
        ans = i

print(ans+1)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int a, b, prod;
	// char judge[10] = "Odd";
	scanf("%d %d",&a,&b);
	prod=a*b;
	if (prod % 2 == 0) printf("Even");
	else printf("Odd");
	// ;
	return 0;
}

Measured memory_bytes: 128
package main

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

//
var (
	N int
	M int
	R int
	r []int
	d [][]int
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func fillInts(a []int, x int) {
	for i := 0; i < len(a); i++ {
		a[i] = x
	}
}

func warshallFloyd(n int, d [][]int) {
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				d[i][j] = min(d[i][j], d[i][k]+d[k][j])
			}
		}
	}
}

func permtationsImpl(a []int, i int, f func(a []int)) {
	if i == len(a)-1 {
		f(a)
		return
	}
	permtationsImpl(a, i+1, f)
	for j := i + 1; j < len(a); j++ {
		a[i], a[j] = a[j], a[i]
		permtationsImpl(a, i+1, f)
		a[i], a[j] = a[j], a[i]
	}
}

func permtations(a []int, f func(a []int)) {
	permtationsImpl(a, 0, f)
}

func main() {
	defer flush()

	N = readInt()
	M = readInt()
	R = readInt()
	r = make([]int, R)
	for i := 0; i < R; i++ {
		r[i] = readInt()
	}

	d = make([][]int, N+1)
	for i := 0; i < N+1; i++ {
		d[i] = make([]int, N+1)
		fillInts(d[i], math.MaxInt32)
		d[i][i] = 0
	}

	for i := 0; i < M; i++ {
		A := readInt()
		B := readInt()
		C := readInt()
		d[A][B] = C
		d[B][A] = C
	}
	warshallFloyd(N+1, d)

	result := math.MaxInt64
	permtations(r, func(a []int) {
		t := 0
		for i := 0; i < R-1; i++ {
			t += d[a[i]][a[i+1]]
		}
		result = min(result, t)
	})
	println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdoutWriter, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


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

using namespace std;

int main()
{
    string s;
    cin >> s;
    int n=s.size();
    int l=0,r=n-1;
    int res=0;
    while(l<=r)
    {
        res+=(s[l]!=s[r]);
        l++;
        r--;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> X(N+1,0);
	for (int i = 0; i < K; i++)//每一種零食
	{
		int kind;
		cin >> kind;//該零食有幾份
		int house;//哪幾家拿到
		for (int j = 0; j < kind; j++)
		{
			cin >> house;
			X[house]++;
		}
	}
	int count = 0;
	for (int i = 1; i <= N; i++)
	{
		if (X[i] == 0)	count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 3628
x,y=map(int,input().split())
ans=0
if x==3:
    ans+=100000
elif x==2:
    ans+=200000
elif x==1:
    ans+=300000
if y==3:
    ans+=100000
elif y==2:
    ans+=200000
elif y==1:
    ans+=300000
if x==1 and y==1:
    ans+=400000
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n;cin >> n;
    vl a(n);
    rep(i,n) cin >> a[i];
    vl Sum(n,0);
    rep(i,n){
        Sum[i] = (i==0?0:Sum[i-1]) + a[i];
    }
    
    vector<vl> dp(n+10, vl(n+10,LINF));
    rep(i,n) dp[i][i] = 0;
    for(int interval=1;interval<=n;++interval){
        rep(l,n){
            int r = l + interval;
            if(r>=n) continue;
            for(int mid=l;mid<r;++mid){
                chmin(dp[l][r],dp[l][mid] + dp[mid+1][r] + Sum[r] - (l==0? 0 : Sum[l-1]));
                //cerr << l << " " << mid << " " << mid+1 << " " << r << endl;
                //cerr << dp[l][r] << " " << dp[l][mid] << " " << dp[mid+1][r] << endl;
            }
        }
    }
    cout << dp[0][n-1] << endl;
}

Measured memory_bytes: 1536
#include <stdio.h>

int F[44]={};

int fibonacci(int);


int main(){

  int n;

  scanf("%44d",&n);

  printf("%d\n",fibonacci(n));


  return 0;
}

int fibonacci(int n){
  if( (n==0)||(n==1) ){
    return F[n] = 1;
  }
  if( F[n] != 0){
    return F[n];
  }
  return F[n] = fibonacci(n-2) + fibonacci(n-1);
}



Measured memory_bytes: 2104
#include<iostream>
#include <vector>
#include <algorithm>

int main() {

	using namespace std;

	vector<int> a(3);

	for (int i = 0; i < 3; i++) {

		cin >> a.at(i);

	}

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

	cout << a.at(0) << " " << a.at(1)  << " " << a.at(2) << endl;

	return 0;

}


Measured memory_bytes: 3172