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

using namespace std;


int main(void) {

	long long x[4];

	cin >> x[0] >> x[1] >> x[2] >> x[3];

	int i, j, max_i = 0, max_j = 2;
	long long max = -9223372036854775807;
	//long long max = -922337203685;
	for (i = 0; i < 2; i++) {
		for (j = 2; j < 4; j++) {
			if (x[max_i] * x[max_j] <= x[i] * x[j]) {
				max_i = i;
				max_j = j;
			}
			//cout << x[i] * x[j] << endl;
		}
	}

	cout << x[max_i] * x[max_j] << endl;




	return 0;
}






Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();

            Console.WriteLine(n >= 3200 ? s : "red");
        }

    }
}

Measured memory_bytes: 27240
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        int n = 0;
        for(int i = 0 ; i < 4 ; i++ ){
            n += (Math.pow(10 , i) * (s.charAt(3 - i) - 48));
        }
        n *= 10000;
        n += (s.charAt(5) - 48) * 1000;
        n += (s.charAt(6) - 48) * 100;
        n += (s.charAt(8) - 48) * 10;
        n += s.charAt(9) - 48;
        if(n < 20190431){
            System.out.println("Heisei");
        }else{
            System.out.println("TBD");
        }
    }
}

Measured memory_bytes: 35512
from itertools import combinations_with_replacement
n,m,q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

nums = combinations_with_replacement(range(1,m+1), n)
ans = 0
for a in nums:
  t = 0
  for i in abcd:
    if a[i[1]-1] - a[i[0]-1] == i[2]: t += i[3]
  if ans < t: ans = t
print(ans)

Measured memory_bytes: 9060
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
from collections import deque

MAX_V = 100000
G = [[] for _ in range(MAX_V)]
level = [0 for _ in range(MAX_V)]
iter = [0 for _ in range(MAX_V)]


def add_edge(fr, to, cp):
    G[fr].append((to, cp, len(G[to])))
    G[to].append((fr, 0, len(G[fr])-1))


# sからの最短距離をBFSで計算
def bfs(s):
    for i in range(MAX_V):
        level[i] = -1
    que = deque()
    level[s] = 0
    que.append(s)
    while len(que) != 0:
        v = que.popleft()
        for e in G[v]:
            if e[1] > 0 and level[e[0]] < 0:
                level[e[0]] = level[v] + 1
                que.append(e[0])


def dfs(v, t, f):
    if v == t:
        return f
    for i in range(iter[v], len(G[v])):
        if G[v][i][1] > 0 and level[v] < level[G[v][i][0]]:
            d = dfs(G[v][i][0], t, min(G[v][i][1], f))
            if d > 0:
                G[v][i] = (G[v][i][0], G[v][i][1]-d, G[v][i][2])
                G[G[v][i][0]][G[v][i][2]] = (G[G[v][i][0]][G[v][i][2]][0], G[G[v][i][0]][G[v][i][2]][1]+d, G[G[v][i][0]][G[v][i][2]][2])
                return d
    return 0


def max_flow(s, t, FLW_LIM=10**18):
    flow = 0
    while True:
        bfs(s)
        if level[t] < 0:
            return flow
        for i in range(MAX_V):
            iter[i] = 0
        f = 0
        while True:
            f = dfs(s, t, FLW_LIM)
            if f == 0:
                break
            flow += f


def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            add_edge(i, j, 10**18+5)
    for i, _a in enumerate(a):
        if _a < 0:
            add_edge(0, i+1, -_a)
        else:
            add_edge(i+1, n+1, _a)
    ans = 0
    for _a in a:
        if _a > 0:
            ans += _a
    print(ans - max_flow(0, n+1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 12260
#include<cmath>
#include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;
int main() {
	int h, w;
	while (1) {
		cin >> h >> w;
		if (h == 0 && w == 0)break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cout << "#";
			}
			cout << endl;
		}
                cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
N = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(N):
  if p[i] - 1 == i:
    ans += 1
    if i != N - 1:
      a = p[i]
      b = p[i + 1]
      p[i] = b
      p[i + 1] = a
print(ans)

Measured memory_bytes: 14008
#include<bits/stdc++.h>
using namespace std;
main(){
    int a;
    switch(getchar()){
        case 'S':a=getchar()=='U'?7:1;break;
        case 'M':a=6;break;
        case 'T':a=getchar()=='U'?5:3;break;
        case 'W':a=4;break;
        case 'F':a=2;break;
    }
    cout<<a;
}

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

using namespace std;

int main() {
    long n;
    long ans = 0;
    cin >> n;
    vector<long> a(n);

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

    long r,sum;
    r = sum = 0;
    for (long l=0; l<n; l++) {
        while(r<n && (sum^a[r])==(sum+a[r])) {
            sum += a[r];
            r++;
        }

        ans += r - l;
        sum -= a[l];
    }

    cout << ans << endl;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		if (line.equals("abc") || line.equals("acb") || line.equals("bac") || line.equals("bca") || line.equals("cab")
				|| line.equals("cba")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 22996
import sys
input = sys.stdin.readline
N = int(input())
slis = []
for i in range(N) :
    s = list(input())
    s.sort()
    slis.append(s)

slis.sort()
temp = 1
ans = 0

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

for i in range(1, N) :
    if slis[i] == slis[i-1] :
        temp += 1
    else :
        if temp == 2 :
            ans += 1
        elif temp >= 3 :
            ans += combinations_count(temp, 2)
        temp = 1

if temp == 2 :
    ans += 1
elif temp >= 3 :
    ans += combinations_count(temp, 2)

print(ans)


Measured memory_bytes: 26400
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int h = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
    int half = 0;
    double s = 0;
    if((w==2*x)&&(h==2*y)){
      half=1;
    }
    s=0.5*w*h;
    System.out.println(s+" "+half);
  }
}

Measured memory_bytes: 21844
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let (n, k) = read_touple::<usize>();
    let mut h: Vec<usize> = read_vec();

    h.sort();

    let ans = h.into_iter().fold(0, |acc, x| if x >= k { acc +  1 } else { acc +  0 });
    println!("{}", ans);

}


Measured memory_bytes: 6396
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define N_MAX 300001

void solv()
{
	int N; scanf("%d", &N);
	int cnt[N_MAX];
	fill(cnt, cnt + N, 0);
	for (int i = 0; i < N; i++){
		int a; scanf("%d", &a); a--;
		cnt[a]++;
	}

	sort(cnt, cnt + N);

	int sum = 0, head = 0, len[N_MAX];
	for (int op = 1; op <= N; op++){
		for (; head < N; head++){
			if (cnt[head] < op){
				sum += cnt[head];
			}
			else{
				break;
			}
		}
		len[op] = N - head + sum / op;
	}

	reverse(len + 1, len + N + 1);

	for (int K = 1; K <= N; K++){
		printf("%d\n", (len + N + 1) - lower_bound(len + 1, len + N + 1, K));
	}

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 3072
import math
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
res = 0
for i in range(n):
  for j in range(i+1, n):
    cal = 0
    for k in range(d):
      dis = (x[i][k] - x[j][k]) ** 2
      cal += dis
    if math.sqrt(cal)%1==0:
      res += 1
print(res)


Measured memory_bytes: 9256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
using namespace std;

const int mod = 1e9 + 7;
typedef long long li;

inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
inline int Mul(int x, int y) { return (int)((li)x * y % mod); }
inline int Mul(int x, int y, int z) { return Mul(x, Mul(y, z)); }

int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}

// ----------------------------------------

const int maxn = 1e6;
int n;
int fact[maxn + 1], ifact[maxn + 1];
int dp[maxn + 1][3], way[maxn + 1];

int Binom(int a, int b) {
  return Mul(fact[a], ifact[b], ifact[a - b]);
}

void GetWay(void) {
  dp[0][0] = 1;
  dp[0][1] = dp[0][2] = 0;
  way[0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int x = 0; x < 3; ++x) {
      for (int y = 0; y < 3; ++y) {
        if (x != y) {
          Add(dp[i][x], dp[i - 1][y]);
        }
      }
    }
    way[i] = dp[i][1];
    
  }

  fact[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fact[i] = Mul(fact[i - 1], i);
  }
  ifact[n] = Pow(fact[n], mod - 2);
  for (int i = n; i >= 1; --i) {
    ifact[i - 1] = Mul(ifact[i], i);
  }

  int inv = Pow(Pow(3, n - 1), mod - 2);
  for (int i = 1; i <= n; ++i) {
    way[i] = Mul(way[i], Binom(n, i), inv);
  }
}

int main(void) {
  scanf("%d", &n);
  GetWay();
  int sum = 0;
  for (int k = 1; k <= n; ++k) {
    Add(sum, Mul(Pow(Mul(n, k), mod - 2), way[k]));
  }
  printf("%d\n", Mul(sum, Pow(3, mod - 2)));
  return 0;
}


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

using namespace std;
using LL = long long;

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

    int n;
    cin >> n;

    vector< double> in(n);
    double up = 1, down = 0;
    for (auto &e : in) {
        cin >> e;
        up *= e;
    }

    for (auto &e : in) {
        down += up / e;
    }

    cout << setprecision(10) << up / down << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        System.out.println(N == M ? "Yes" : "No");
    }

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;


/*
参考（ほぼそのまま）: http://drken1215.hatenablog.com/entry/2018/06/08/210000
*/
class ModCom {
    public:
        ModCom(int _n, long long _mod){
            assert(_n>=2);
            n = _n+1;
            mod = _mod;
            fac.assign(n,0);
            finv.assign(n,0);
            inv.assign(n,0);
            init();
        }

        long long com(int _n, int k){
            if(_n < k){return 0;}
            if(_n < 0 || k < 0){return 0;}
            return fac.at(_n) * (finv.at(k) * finv.at(_n - k) % mod) % mod;
        }

    private:
        int n;
        long long mod;
        vector<long long> fac;
        vector<long long> finv;
        vector<long long> inv;

        void init(void){
            fac.at(0) = fac.at(1) = 1;
            finv.at(0) = finv.at(1) = 1;
            inv.at(1) = 1;
            for(int i = 2;i < n; i++){
                fac.at(i) = fac.at(i - 1) * i % mod;
                inv.at(i) = mod - inv.at(mod % i) * (mod / i) % mod;
                finv.at(i) = finv.at(i - 1) * inv.at(i) % mod;
            }
            return;
        }
};

int main(void) {
    // test : https://atcoder.jp/contests/abc132/tasks/abc132_d
    cin.tie(0);
    ios::sync_with_stdio(false);
    ModCom com(100000,MOD);
    int n,k;
    cin >> n >> k;
    ll res;
    rep(i,k+1){
        if(i==0)continue;
        res = com.com(n-k+1,i);
        if(k!=i)res *= com.com(k-1,k-i);
        res %= MOD;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
  cin>>arr[i];
}
sort(arr,arr+n);
int r=0,s;
for(int i=0;i<n-2;++i){
int k=i+2;
for(int j=i+1;j<n;++j){
  while(k<n&&(arr[k]<arr[i]+arr[j])){
    k++;
  }

  r+=k-j-1;
}
}
cout<<r<<endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int A, B;

int main(void){
    
    scanf("%d %d", &A, &B);
    printf("%s", (A <= 8 && B <= 8) ? "Yay!" : ":(");
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm> 
#define LL long long
using namespace std;
const int MAX=2e5+3;
LL a[MAX];
LL rin()
{
	LL s=0;
	char c=getchar();
	bool bj=false;
	for(;(c>'9'||c<'0')&&c!='-';c=getchar());
	if(c=='-')bj=true,c=getchar();
	for(;c>='0'&&c<='9';c=getchar())s=(s<<1)+(s<<3)+(c^'0');
	if(bj)return -s;
	return s;
}
int main()
{
	int i,j;
	LL n,k;
	LL l,r;
	LL s_0;
	n=rin();k=rin();
	for(i=1;i<=n;i++)a[i]=rin();
	sort(a+1,a+n+1);
//	for(i=1;i<=n;i++)printf("%lld ",a[i]);printf("\n");
	l=1,r=n;
	LL n_1=0,n_2=n+1;
	for(;l<=r;){LL mid=(l+r)>>1;if(a[mid]<0)n_1=mid,l=mid+1;else r=mid-1;}
	l=1;r=n;
	for(;l<=r;){LL mid=(l+r)>>1;if(a[mid]>0)n_2=mid,r=mid-1;else l=mid+1;}
	
	LL nam_0=n_2-n_1-1;
	s_0=nam_0*(n-nam_0)+(nam_0*(nam_0-1)/2);
	if(nam_0>0)for(i=n_1+1,j=n_2;j<=n;j++,i++)a[i]=a[j];
	n-=nam_0;
//	printf("n_1:%lld,n_2:%lld\ns_0:%lld\n",n_1,n_2,s_0);
	r=(1LL<<60);
	l=-r;
	LL ans=0;
	for(;l<=r;)
	{
		LL mid=(l+r)>>1;
		LL sum=0;
		int last;
		for(i=1;i<=n_1;i++)
		{
			last=n+1;
			int l_1=1,r_1=n;
			for(;l_1<=r_1;)
			{
				int m_1=(l_1+r_1)>>1;
				if(a[m_1]*a[i]<mid)last=m_1,r_1=m_1-1;
				else l_1=m_1+1;
			}
//			printf("mid:%lld a[%d](%lld)*a[%d](%lld)  sum:%lld-->",mid,i,a[i],last,a[last],sum);
			sum+=n-last+1;
			if(last<=i)sum--;
//			printf("%lld\n",sum);
		}
		
		for(i=n_1+1;i<=n;i++)
		{
			last=0;
			int l_1=1,r_1=n;
			for(;l_1<=r_1;)
			{
				int m_1=(l_1+r_1)>>1;
				if(a[m_1]*a[i]<mid)last=m_1,l_1=m_1+1;
				else r_1=m_1-1;
			}
//			printf("mid:%lld a[%d](%lld)*a[%d](%lld)  sum:%lld-->",mid,i,a[i],last,a[last],sum);
			sum+=last;
			if(last>=i)sum--;
//			printf("%lld\n",sum);
		}
	//	printf("l:%lld,r:%lld,mid:%lld ,sum:%lld\n",l,r,mid,sum);
		sum>>=1;if(mid>0)sum+=s_0;
//		printf("sum:%lld\n",sum);
		if(sum>=k)r=mid-1;
		else ans=mid,l=mid+1;
	}
	printf("%lld",ans);
	return 0;
}

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


int main() {

    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else if (n == 2) {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	int n, k, s;
	cin >> n >> k >> s;
	vi res(n);
	rep(i, 0, k) {
		res[i] = s;
	}
	rep(i, k, n) {
		if (s >= 1e6) {
			res[i] = 1;
		} else {
			res[i] = 1e9;
		}
	}
	rep(i, 0, n) cout << res[i] << ' ';
	cout << endl;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] reds = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (j == 0 || (j != w - 1 && i % 2 == 0)) {
					reds[i][j] = '#';
				} else {
					reds[i][j] = '.';
				}
			}
		}
		StringBuilder red = new StringBuilder();
		StringBuilder blue = new StringBuilder();
		char[][] blues = new char[h][w];
		for (int i = 0; i < h; i++) {
			char[] line = sc.next().toCharArray();
			for (int j = 0; j < w; j++) {
				if (reds[i][j] == '#') {
					blues[i][j] = '.';
				} else {
					blues[i][j] = '#';
				}
				if (line[j] == '#') {
					reds[i][j] = '#';
					blues[i][j] = '#';
				}
			}
			red.append(new String(reds[i])).append("\n");
			blue.append(new String(blues[i])).append("\n");
		}
		System.out.println(red);
		System.out.print(blue);
	}
}


Measured memory_bytes: 33756
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf=1e18L+5;
int sum(int l,int r,int a[])
{
  int s=0;
  for(int i=l; i<=r; i++)
    s+=a[i];
  return s;
}
//int32_t
int32_t main()
{
	int n;
	 cin>>n;
	  int a[n];
	  
	  for(int i=0; i<n; i++)
      
        cin>>a[i];
        
	 
  
	  int dp[n][n];
	  for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
        {
          dp[i][j]=inf;
        
        }
	  for(int i=0; i<n;i++)
	  dp[i][i]=0;
	  
  //int s=0;
  
	  for(int l=2; l<=n; l++)
	  {
	  	for(int i=0; i<=n-l; i++)
        {
          for(int j=i; j<i+l-1; j++)
        {
         
          dp[i][i+l-1]=min(dp[i][i+l-1],dp[i][j]+dp[j+1][i+l-1]+sum(i,i+l-1,a));
          
        }
         
          
        }
	  }
	
 
	 
  cout<<dp[0][n-1];
	  
	  
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000

int main() {
    string o, e;
    cin >> o >> e;
    rep(i,o.size()+e.size()) {
        if (i%2 == 0) cout << o.at(i/2) << flush;
        else cout << e.at(i/2) << flush;
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n, k;
int w[100010];

bool check(int W) {
    int num = 0, sum = 0;
    for (int i = 0; i < n; ++i) {
        if (w[i] > W) return false;
        else if (sum + w[i] > W) {
            num++;
            sum = 0;
        }
        sum += w[i];
    }
    if (sum > 0) num++;
    return num <= k;
}

int main() {
    int mx = 0, sum = 0;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> w[i];
        mx = max(mx, w[i]);
        sum += w[i];
    }
    int l = max((sum + k - 1) / k, mx) - 1, r = sum;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        if (!check(mid)) l = mid; else r = mid;
    }
    cout << r << endl;
    return 0;
}



Measured memory_bytes: 3504
#include <iostream>
#include <cstdio>

using namespace std;

int n, t[105], m, p, x, s;
int main()
{
    int i;
    cin >> n;
    for(i=1; i<=n; i++) {
        cin >> t[i];
        s += t[i];
    }
    cin >> m;
    while(m--) {
        cin >> p >> x;
        cout << s-t[p]+x << endl;
    }
    return 0;
}


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

/*
int times;
if(N % X == 0) times = N / X;
else times = N / X + 1;
ans = times * t;
でも良い
*/

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << ((n + x - 1) / x) * t << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int fir[1010],ex[200010],ey[200010];
std::vector<int>G[1010];
int vis[1010][1010],que[1010],hd,tl,from[1010];
bool vv[1010];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi(),m=gi(),x,y;
	for(int i=1;i<=m;++i)ex[i]=x=gi(),ey[i]=y=gi(),G[x].push_back(y);
	for(int s=1;s<=n;++s){
		int*v=vis[s];
		v[s]=1;hd=tl=0,que[tl++]=s;from[s]=0;
		while(hd^tl){
			int x=que[hd++];
			for(int i:G[x])
				if(!v[i])v[i]=1,from[i]=(x==s?i:from[x]),que[tl++]=i;
				else if(from[x]!=from[i])from[i]=-1;
		}
		hd=tl=0,que[tl++]=s;
		memset(vv,0,sizeof vv);vv[s]=1;
		while(hd^tl){
			int x=que[hd++];
			for(int i:G[x]){
				if(!vv[i])vv[i]=1,que[tl++]=i;
				if(x!=s&&i!=from[x])++v[i];
				if(x!=s&&from[x]!=from[i])from[i]=-1;
			}
		}
	}
	for(int i=1;i<=m;++i){
		x=ex[i],y=ey[i];
		if(vis[y][x])puts(vis[x][y]==1?"diff":"same");
		else puts(vis[x][y]==1?"same":"diff");
	}
	return 0;
}


Measured memory_bytes: 8320
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}
ll dp[105][200000];
ll sdp[200000];
ll num[200000];

int main() {
   int N, K;
   cin >> N >> K;
   int cnt = 0;
   for (int i = 1; i <= N;) {
      int j = N / i;
      if (i <= j) {
         num[cnt] = 1;
         i++;
      }
      else {
         num[cnt] = N / j - i + 1;
         i = N / j + 1;
      }
      cnt++;
   }
   
   memset(dp, 0, sizeof(dp));
   dp[0][0] = 1;
   for (int k = 0; k < K; k++) {
      memset(sdp, 0, sizeof(sdp));
      
      for (int j = 0; j <= cnt; j++) {
         sdp[j + 1] = sdp[j] + dp[k][j];
         sdp[j + 1] %= MOD;
      }
      for (int j = 0; j < cnt; j++) {
         dp[k + 1][j] = sdp[cnt - j] * num[j];
         dp[k + 1][j] %= MOD;
      }
   }
   ll ans = 0;
   for (int j = 0; j <= cnt; j++) add(ans, dp[K][j]);
   cout << ans << endl;
   
   return 0;
}


Measured memory_bytes: 166400
N = int(input())
if N < 5002:
    if N % 2  == 0:
        sans = [6 * i  + 3 for i in range(N-2)]
        ans = sans + [2,4]
    if N % 2 == 1:
        sans = [6 * i  + 3 for i in range(N-3)]
        ans = sans + [2,4,6]
    if N == 3:
        ans = [2,3,25]
else:
    sans = [6 * i  + 3 for i in range(5000)]
    nis = [2 * i + 2 for i in range(N - 5000 )]
    if (len(nis) * (nis[0] + nis[-1]) //2) % 3 == 1:
        nis[-1] += 2
    elif    (len(nis) * (nis[0] + nis[-1]) //2) % 3 == 2:
        nis[-1] += 2
        nis[-2] += 2
    ans = sans + nis
ans = map(str,ans)
print(" ".join(ans)) 


Measured memory_bytes: 5360
use std::io;
use std::cmp;


fn main() {
    let (n, a, b) = {
        let i = read::<usize>();
        (i[0], i[1], i[2])
    };
    println!("{}", cmp::min(n * a, b));
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

int main() {
    cin>>S;
    N = S.size();
    vec num(26, 0);
    rep(i,N) ++num[S[i] - 'a'];
    bool yes = true;
    rep(i,26) if(num[i]%2) yes = false;
    cout<<(yes ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 200010
int n, a[N];

int main() {
    //freopen("sample.in", "r", stdin);
    cin >> n;
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int l = 1, r = 1, now = 0;
    long long ans = 0;
    while (r <= n)
        if ((now ^ a[r]) == now + a[r] || r == l) ans += r - l + 1, now = now ^ a[r], r++;
        else now = now ^ a[l], l++;
    cout << ans << endl;
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n;
    cin >> n;
    
    int m = n%10;
    if(m == 2 || m == 4 ||m == 5 ||m == 7 ||m == 9) { puts("hon"); }
    if(m == 0 || m == 1 ||m == 6 ||m == 8) { puts("pon"); }
    if(m == 3) { puts("bon"); }
    return 0;
}   
/** atcoder **/


Measured memory_bytes: 3636
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define MXN 103

int n,ans,
	a[2*MXN];


int main(){

	scanf("%d",&n);
	for(int i=1,lim=2*n;i<=lim;i++)
		scanf("%d",&a[i]);
	std::sort(a+1,a+2*n+1);
	for(int i=1;i<=n;i++)
		ans+=a[2*i-1];
	printf("%d\n",ans);
	//system("pause");
	return 0;
}

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

using namespace std;

int fr[200001];

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

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        fr[x]++;
    }

    std::sort(fr + 1, fr + n + 1);

    int ans = 0;
    for (int i = n - k; i > 0; i--)
        ans += fr[i];

    cout << ans;

    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  ll a,b,c;
  cin >> a >> b >> c;
  bool flag = true;
  if(c-b-a <= 0)flag = false;
  if(4*a*b >= (c-a-b)*(c-a-b))flag = false;
  flag ? cout << "Yes" << endl : cout << "No" << endl;


  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  string s;
  string a,b,c;
  cin >> s;
  rep(i,5) a+=s[i];
  rep(i,7) b+=s[i+6];
  rep(i,5) c+=s[i+14];
  cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,i,flg;
	scanf("%d %d",&a,&b);
	if(a<10&&b<10) a*=10;
	else if(a<10&&b>=10&&b<100) a*=100;
	else if(a>=10&&a<100&&b>=10&&b<100) a*=100;
	else if(a>=100&&b>=100) a*=1000;
	else if(b<10&&a>=10&&a<100) a*=10;
	else if(b<10&&a>=100) a*=10;
	flg=0;
	//printf("%d\n",a+b);
	for(i=1;i<=100;i++){
		if(i*i==a+b) flg=1;
		if(flg==1) break;
	}
	if(flg==1) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;

long long func(long long k,long long n) {
    vector<int> p{3,5,7};
    if(k > n) {
        return 0;
    }
    long long ret = 0;
    for(int i = 0; i < 3; i++) {
        long long x = k*10+p[i];
        ret += func(x,n);
    }
    // ある値kのとき、7,5,3の三つだけが格納されていることの確認
    string S = to_string(k);
    set<char> X;
    for(int i = 0; i < S.size(); i++) {
        X.insert(S[i]);
    }
    if(X.size() == 3) {
        ret++;
    }
    return ret;
}

int main() {
    long long n;
    cin >> n;
    long long ans = func(0,n);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int a[100100];
vector<int> hi,lo;
int main()
{
	int n,out=0;
	cin>>n;
	rep(i,n) cin>>a[i];
	sort(a,a+n);
	lo.pb(a[0]);hi.pb(a[n-1]);
	REP(i,1,n-1){
		if(a[i]>0) hi.pb(a[i]);else lo.pb(a[i]);
	}
	rep(i,lo.size()) out-=lo[i];
	rep(i,hi.size()) out+=hi[i];
	cout<<out<<endl;
	int x=lo.size(),y=hi.size();
	if(y<2){
		int now=hi[0]-lo[0];
		cout<<hi[0]<<' '<<lo[0]<<endl;
		REP(i,1,x){
			cout<<now<<' '<<lo[i]<<endl;
			now-=lo[i];
		}
	}
	else{
		int now=lo[0]-hi[0];
		cout<<lo[0]<<' '<<hi[0]<<endl;
		REP(i,1,y-1){
			cout<<now<<' '<<hi[i]<<endl;
			now-=hi[i];
		}
		cout<<hi[y-1]<<' '<<now<<endl;
		now=hi[y-1]-now;
		REP(i,1,x){
			cout<<now<<' '<<lo[i]<<endl;
			now-=lo[i];
		}
	}
}


Measured memory_bytes: 2808
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,c = LI()
    if a+b+c >= 22:
        print("bust")
    else:
        print("win")
    return

#Solve
if __name__ == "__main__":
    solve()


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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

int main() {
   ll i,j,k;
    ll x,y,n,ans=0;
    cin >> y>>x>>n;

    if(x>y)
    {
        if(n%x==0)
        {
            ans=n/x;
        }else
        {
            ans=n/x+1;
        }
    }else 
    {
        if(n%y==0)
        {
            ans=n/y;
        }else
        {
            ans=n/y+1;
        }

    }
  cout <<  ans<< endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;

int main()
{
  int x;
  cin >> x;
  if(x == 7 || x == 5 || x == 3)
  {
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
	return 0;
}


Measured memory_bytes: 256
l, r = [int(x) for x in input().split()]
m = 2019

ml = (l % 2019)
mr = (r % 2019)
t = l + 2019
if r > t:
    m = 0
else:
    if ml < mr:
        for i in range(ml, mr):
            for j in range(i+1, mr+1):
                m = min(m, (i * j) % 2019)
    else:
        m = 0
print(m)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
    // 入力受け取り, 入次数も管理する
int k,x;
    cin >> k >>x;
for(int i=-1000000;i<=1000000;i++){
if(x-k<i && i<x+k)cout << i << " ";
}





   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, m, l, r, res1 = -INF, res2 = INF;
    string s;
    in(n, m);
    rep(i, m){
        in(l, r);
        if(l > res2 || r < res1){
            print(0);
            return 0;
        }
        chmax(res1, l);
        chmin(res2, r);
    }
    print(res2 - res1 + 1);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll m;cin>>m;
  cout<<48-m<<endl;
  return 0;
}

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

using namespace std;

const int N = 1e5 + 5;

int n;
pair <int, int> a[N];

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i].first, a[i].second = i;
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) cout << a[i].second << " ";
    return 0;
}

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

int main(){
  string ans;
  long long int N;
  cin >> N;
  N--;
  while(true){
    ans += (char)('a'+N%26);
    if(N/26 > 0) N /= 26;
    else break;
    N--;
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  bool f=true;
  rep(i, n){
    if(a[i]%2==0 && (a[i]%3!=0 && a[i]%5!=0))f=false;
  }

  if(f)cout<<"APPROVED";
  else cout<<"DENIED";

  return 0;
}

Measured memory_bytes: 256
/*================================================================
*   Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
*   创 建 者： badcw
*   创建日期： 2020/1/26
*
================================================================*/
#include <bits/stdc++.h>

#define ll long long
using namespace std;

const int maxn = 2e5+50;
const int mod = 1e9+7;
ll qp(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;
}

template <class T>
inline bool scan(T& ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return 0; // EOF
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

//template <class T>
//inline void out(T x) {
//    if (x > 9) out(x / 10);
//    putchar(x % 10 + '0');
//}

ll dfs(ll n) {
    if (n == 1) return 1;
    if (n == 0) return 0;
    if (n == 2) return 3;
    return dfs(n / 2) * 2 + 1;
}

int main(int argc, char* argv[]) {
    ll n;
    cin >> n;
    cout << dfs(n) << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int n, x=0, y=0;
    cin >> n;
    int maxprice = -10000000;
    vector<int>c(n), v(n);
    rep(i, n)cin >> c[i];
    rep(i, n)cin >> v[i];

    for (int i = 0; i < (1 << n); i++) {
        x = 0, y = 0;
        rep(j, n)if (i & (1 << j)) {
            x += v[j];
            y += c[j];
        }
        maxprice = max(maxprice, y - x);
    }

    cout << max(maxprice, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<char,int> pci;
typedef vector<pair<int,int>> vpii;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
#define sci(a) scanf("%d",&a)
#define scii(a,b) scanf("%d %d",&a,&b)
#define sciii(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sciiii(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define scl(a) scanf("%lld",&a)
#define scll(a,b) scanf("%lld %lld",&a,&b)
#define sclll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c
#define scllll(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define print(a) printf("%d ",a)
#define println(a) printf("%d\n",a)
#define ln printf("\n")
#define pb(a) push_back(a)
#define m_p(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define rep(i,s,n) for(int i=s;i<=n;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define repv(i,m) for(auto i = m.begin();i != m.end();i++)
#define FileIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const long long INF = 4000000000000000000LL;
/************************************* Chocolate *************************************/
int main(){
    int n;
    sci(n);
    vvi work(n,vi(3));
    rep(i,0,n-1){
        rep(j,0,2){
            sci(work[i][j]);
        }
    }
    vvll dp(n,vll(3));
    rep(i,0,2){
        dp[0][i] = work[0][i];
    }
    rep(i,1,n-1){
        dp[i][0] = work[i][0] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = work[i][1] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = work[i][2] + max(dp[i-1][0],dp[i-1][1]);
    }
    cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}) << endl;
}

Measured memory_bytes: 14088
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX = 100;

int main() {
	int N, a[MAX];
	cin >> N;
	for (int i = 0;i < N;i ++) cin >> a[i];
	sort(a, a+N);
	cout << a[N-1]-a[0];
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

a.sort()
alice=[]
bob=[]
for i in range(n):
    x=a.pop(-1)
    if i%2==0:
        alice.append(x)
    else:
        bob.append(x)

print(sum(alice)-sum(bob))
        



Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 n;
    cin >> n;
    map<int64,int64> mp;
    vector<int64> a(n);
    for (int64 i=0; i<n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }

    int64 ans = 0;
    vector<map<int64,int64>> tmp(2);
    for (auto p : mp) {
        int64 x,c;
        tie(x,c) = p;
        ans += tmp[0][x] = c*(c-1)/2;
        tmp[1][x] = (c-2)*(c-1)/2;
    }

    for (int64 i=0; i<n; i++) {
        cout << ans - tmp[0][a[i]] + tmp[1][a[i]] << endl;
    }
}

Measured memory_bytes: 26880
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n;
	unsigned long long l[87];
	cin>>n;
	l[0]=2;
	l[1]=1;
	for(i=2;i<=n;i++)
		{
			l[i]=l[i-1]+l[i-2];
			
		}
	printf("%llu\n",l[n]);
	return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String input = br.readLine();
			String[] param = input.split(" ");
			String op = param[1];
			Integer a = Integer.parseInt(param[0]);
			Integer b = Integer.parseInt(param[2]);
			if(op.equals("+")){
				System.out.println(a + b);
			}
			else if(op.equals("-")){
				System.out.println(a - b);
			}
			else if(op.equals("*")){
				System.out.println(a * b);
			}
			else if(op.equals("/")){
				System.out.println(a / b);
			}
			else{
				break;
			}
		}
	}
}

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

int main()
{
  int N;cin>>N;
  vector<long long> L(N+1);L[0]=2;L[1]=1;
  for(int i=2;i<N+1;i++)L[i]=L[i-1]+L[i-2];
  printf("%lld\n",L[N]);
}


Measured memory_bytes: 3720
from collections import defaultdict
def main():
    N = int(input())
    ans = 0
    s = defaultdict(int)
    for _ in range(N):
        a = input()
        s[a] += 1
    M = int(input())
    for _ in range(M):
        b = input()
        s[b] -= 1
    for v in s.items():
        ans = max(ans,v[1])
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll n, m;
int main() {
	cin >> n >> m;
	REP(i, n + 1) {
		REP(j, n + 1) {
			ll s = i * 10000 + j * 5000;
			if (m - s >= 0 and m - s == (n - (i + j)) * 1000) {
				cout << i << " " << j << " " << (m - s) / 1000 << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
}



Measured memory_bytes: 764