akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpl vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<ll>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define mz(a)   memset(a,0,sizeof(a))
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const ll mod=1e9+7;
ll fast_expo(ll n,ll m, ll md)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%md;
        n=(n*n)%md;
        m/=2;
    }
    return a%md;
}
int main() {
    zoom;
    ll n;
    in1(n);
    if (n==1 || n==2)out1(0);
    else{
        ll dp[n+1];
        dp[3]=1;
        forsn(i,4,n+1){
            dp[i]=1;
            forsn(j,3,i-2){
                dp[i]=(dp[j]+dp[i])%mod;
            }
        }
        out1(dp[n]%mod);
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <climits>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n], dp[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        dp[i] = INT_MAX;
    }
    dp[0] = 0;
    for(int i=1;i<n;i++){
        for(int j=i;j>=max(0, i-2);j--){
            dp[i] = min(dp[i], dp[j]+abs(a[i]-a[j]));
        }
    }
    cout << dp[n-1]<< endl;
}

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

const int INF=1e9;
typedef long long ll;
typedef pair<int,int> P;

ll N,W; 
P wv[105];
vector<int> v[5];
ll cnt[5][105];
  
int main(){
 
cin>>N>>W;

int Min=INF;
for(int i=0; i<N; i++){
    scanf("%d %d",&wv[i].first,&wv[i].second); Min=min(Min,wv[i].first);
}

for(int i=0; i<N; i++){
    if(wv[i].first==Min){
        v[0].push_back(wv[i].second);
    }
    if(wv[i].first==Min+1){
        v[1].push_back(wv[i].second);
    }
    if(wv[i].first==Min+2){
        v[2].push_back(wv[i].second);
    }
    if(wv[i].first==Min+3){
        v[3].push_back(wv[i].second);
    } 
}

sort(v[0].begin(),v[0].end()); reverse(v[0].begin(), v[0].end());
sort(v[1].begin(),v[1].end()); reverse(v[1].begin(), v[1].end());
sort(v[2].begin(),v[2].end()); reverse(v[2].begin(), v[2].end());
sort(v[3].begin(),v[3].end()); reverse(v[3].begin(), v[3].end());

for(int i=0; i<v[0].size(); i++) cnt[0][i+1]=cnt[0][i]+v[0][i];
for(int i=0; i<v[1].size(); i++) cnt[1][i+1]=cnt[1][i]+v[1][i];
for(int i=0; i<v[2].size(); i++) cnt[2][i+1]=cnt[2][i]+v[2][i];
for(int i=0; i<v[3].size(); i++) cnt[3][i+1]=cnt[3][i]+v[3][i];

ll w0=Min,w1=w0+1,w2=w1+1,w3=w2+1; ll Max=0LL;

for(ll l=0; l<=N; l++){
    if(l*w0>W) continue;
    for(ll k=0; k<=N; k++){
        if(l*w0+k*w1>W) continue;
        for(ll i=0; i<=N; i++){
            if(l*w0+k*w1+i*w2>W) continue;
            for(ll j=0; j<=N; j++){
                if(l*w0+k*w1+i*w2+j*w3>W) continue;
                Max=max(Max,cnt[0][l]+cnt[1][k]+cnt[2][i]+cnt[3][j]);
            }
        }
    }
}

cout<<Max<<endl;

}

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

list_X.sort()
list_Y = []

for i in range(m-1):
    list_Y.append(list_X[i+1]-list_X[i])

list_Y.sort()

if n >= m:
    print(0)
else:
    print(sum(list_Y[:m-n]))

Measured memory_bytes: 13968
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int a,b,c;
	int f=0,s=0;
	cin>>a>>b>>c;
	if(a==5)f++;
	else if(a==7)s++;
	if(b==5)f++;
	else if(b==7)s++;
	if(c==5)f++;
	else if(c==7)s++;
	if(f==2&&s==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int lli;
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define forab(i,a,b) for(int i = a; i<b; i++)
#define forll(i,a,b) for(lli i = a; i<b; i++)
#define mp make_pair
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define mod1 1000000007
#define mod2 998244353
#define debug(x) cout<<#x<<" : "<<x<<endl

int main()
{
	optimize

	int n;
	lli k;
	cin>>n>>k;
	vector<int>done(200001, 0);

	vector<int>v(n);
	forab(i,0,n)
	{
		cin>>v[i];
	}

	vector<int>path;
	map<int,int>m;

	int x = v[0];
	path.pb(1);
	forab(i,0,n)
	{
		if(done[x-1] == 0)
		{
			path.pb(x);
		}
		else
			break;

		done[x-1] = 1;
		x = v[x-1];
	}

	auto it = find(path.begin(), path.end(), x);

	int lin = it-path.begin();

	int cyc = path.size()-lin;

	if(k<lin)
	{
		cout<<path[k]<<endl;
	}
	else
	{	
		k-=(lli)lin;

		int rem = k%(lli)cyc;

		cout<<path[lin+rem]<<endl;
	}
}

Measured memory_bytes: 5832
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();

        if (a % 2 == 0 || b % 2 == 0) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 20564
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

A, B, C, K = map(int, input().split())

ans = 0
ans += min(K, A)
K -= A
if K > 0:
    K -= B
if K > 0:
    ans -= min(K, C)
    K -= C

print(ans)

Measured memory_bytes: 9664
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String target = "keyence";

        int index;
        if ((index = s.indexOf(target)) >= 0 && index == 0 || index + target.length() == s.length()) {
            System.out.println("YES");
            return;
        }

        for (int i = 1; i < target.length(); i++) {
            int fi;
            if ((fi = s.indexOf(target.substring(0, i))) != 0) {
                continue;
            }
            if (s.indexOf(target.substring(i), fi + i) > 0
                    && s.endsWith(target.substring(i))) {
                System.out.println("YES");
                return;
            }

        }

        System.out.println("NO");
    }
}


Measured memory_bytes: 21972
n = int(input())
S = list(map(int, input().split(' ')))
q = int(input())
T = list(map(int, input().split(' ')))

def search(a, v):
  l = 0
  r = len(a)
  while l + 1 < r:
    i = int((l + r) / 2)
    if a[i] <= v:
      l = i
    else:
      r = i
  return a[l] == v

print(sum(list(map(lambda e: search(S, e), T))))


Measured memory_bytes: 16708
import math
x = int(input())
ans = 0
if x == 1:
    print(1)
    exit()
for i in range(2, math.floor(math.sqrt(x))+1):
    max = 0
    p = 1
    for j in range(10000):
        if i ** p <= x:
            max = i ** p
            p += 1
        else:
            break
    if max > ans:
        ans = max
print(ans)

Measured memory_bytes: 3060
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a_list = na()

c = {abs((n-1-i)-i): 0 for i in range(n//2 + 1)}

for a in a_list:
    if a not in c or c[a]==2:
        print(0)
        exit(0)
    c[a] += 1

cnt = 1
for k,v in c.items():
    if v==2 or k==0:
        cnt *= v
        cnt %= mod
    else:
        print(0)
        exit(0)

print(cnt)


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


int main()
{
    int n, k, cal;
    long ans=1000000000;
    cin >> n >> k;
    vector<int> data(n);
    vector<int> Cdata(n);
    //vector<int> ansdata(m);

    
    for(int i=0;i<n;i++)
    {
        cin >> data.at(i);
        Cdata.at(i) = -1*data.at(i);
        
    }
    
    sort(Cdata.begin(),Cdata.end() );
    
    for(int i=0;i<n;i++)
    {
        data.at(i) = -1*Cdata.at(i);
    }
    
    for(int i=0;i<=(n-k);i++)
    {
        cal = data.at(i)-data.at(k+i-1);
    
        if(cal < ans)
        {
            ans = cal;
        }
    }

    cout << ans << endl;
                           
}

        

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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	int N,M; cin >> N >> M;
	vector<pair<int,int>> ans;
	if(N%2==0) N--;
	int o_s = 0,e_s = 0;
	for(int i = 1; i <= M; ++i) {
		(i&1?o_s:e_s) = i;
	}
	int o_l=1,e_l=2+o_s;
	for(int i = M; 1 <= i; --i) {
		if(i&1){
			ans.emplace_back(o_l,o_l+i);
			o_l++;
		}
		else{
			ans.emplace_back(e_l,e_l+i);
			e_l++;			
		}
	}

	for(auto& e:ans){
		cout << e.first << " " << e.second << endl;
	}
    return 0;
}


Measured memory_bytes: 4260
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n); i >= 0; i--)
#define revrepr(i, a, b) for (int i = (a); i >= b; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

int main() {
    int n, r;
    cin >> n >> r;
    if (10 <= n) cout << r << endl;
    else cout << r + 100 * (10 - n) << endl;
}

Measured memory_bytes: 256
#include <iostream>

int n, sum, ans;

void solve(int n, int sum, int less);

int main(){
	while(true){
		ans = 0;
		std::cin >> n >> sum;
		if(n == 0 && sum == 0)
			break;
		solve(n, sum, 0);
		std::cout << ans << std::endl;
	}
	return 0;
}

void solve(int n, int sum, int less){
	if(n == 0){
		if(sum == 0){
			++ans;
			return;
		}
	}

	for(int i = less; i < 10; ++i){
		if(sum - i >= 0)
			solve(n - 1, sum - i, i + 1);
	}

	return;
}

Measured memory_bytes: 1160
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

num = int(input())
yakusu_list = make_divisors(num)
nine = [1,2,3,4,5,6,7,8,9]
yakusu_pair_list = []
a = 0
b = 0
for i, yakusu in enumerate(yakusu_list):
    
    if len(yakusu_list) % 2 == 0:
        if i % 2 == 0:
            a = yakusu
        else:
            b = yakusu
            yakusu_pair_list.append([a, b])
    else:

        if i == len(yakusu_list) -1:
            yakusu_pair_list.append([yakusu, yakusu])
    
        else:
            if i % 2 == 0:
                a = yakusu
            else:
                b = yakusu
                yakusu_pair_list.append([a, b])
best_pair = yakusu_pair_list[0]
best_move_num = best_pair[0] + best_pair[1] -2
for yakusu_pair in yakusu_pair_list:
    this_move_num = yakusu_pair[0] + yakusu_pair[1] -2
    if this_move_num < best_move_num:
        best_pair = yakusu_pair    
        best_move_num = this_move_num
print(best_move_num)

Measured memory_bytes: 3548
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
#define MS(x, y) memset(x, y, sizeof(x))
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b > a)a = b; }
template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b < a)a = b; }
const int N = 0, M = 0, Z = 1e9 + 7, inf = 0x3f3f3f3f;
template <class T1, class T2>inline void gadd(T1 &a, T2 b) { a = (a + b) % Z; }
int casenum, casei;
int n;
char s[2][60], t[2][60];

int f[60][4][4];
int solve()
{
	int m = 0;
	for (int i = 1; i <= n; ++i)
	{
		++m;
		if (s[0][i] == s[1][i])
		{
			t[0][m] = t[1][m] = s[0][i];
		}
		else
		{
			if (s[0][i] != s[0][i + 1])return 0;
			if (s[1][i] != s[1][i + 1])return 0;
			t[0][m] = s[0][i];
			t[1][m] = s[1][i];
			++i;
		}
	}
	n = m;
	memcpy(s, t, sizeof(t));

	MS(f, 0);
	f[0][3][3] = 1;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= 3; ++j)
		{
			for (int k = 0; k <= 3; ++k)
			{
				if (s[0][i] == s[1][i])
				{
					for (int u = 0; u < 3; ++u)if (u != j && u != k)
					{
						gadd(f[i][u][u], f[i - 1][j][k]);
					}
				}
				else
				{
					for (int u = 0; u < 3; ++u)if (u != j)
					{
						for (int v = 0; v < 3; ++v)if (v != k && v != u)
						{
							gadd(f[i][u][v], f[i - 1][j][k]);
						}
					}
				}
			}
		}
	}
	int ans = 0;
	for (int j = 0; j < 3; ++j)
	{
		for (int k = 0; k < 3; ++k)
		{
			gadd(ans, f[n][j][k]);
		}
	}
	return ans;
}
int simple()
{
	LL ans;
	for (int i = 1; i <= n; ++i)
	{
		if (s[0][i] == s[1][i])
		{
			if (i == 1)
			{
				ans = 3;
			}
			else if (s[0][i - 1] == s[1][i - 1])
			{
				ans = ans * 2 % Z;
			}
			else
			{

			}
		}
		else
		{
			if (i == 1)
			{
				ans = 6;
			}
			else if (s[0][i - 1] == s[1][i - 1])
			{
				ans = ans * 2 % Z;
			}
			else
			{
				ans = ans * 3 % Z;
			}
			++i;
		}
	}
	return ans;
}
int main()
{
	while (~scanf("%d", &n))
	{
		scanf("%s%s", s[0] + 1, s[1] + 1);
		//printf("%d\n", solve());
		printf("%d\n", simple());
	}
	return 0;
}
/*
【trick&&吐槽】


【题意】
http://arc081.contest.atcoder.jp/tasks/arc081_b
给你一个2 * n的棋盘，相同的大写或小写字符表示一个1 * 2的骨牌
我们要为每个骨牌染上相同的颜色，使得任意两个相邻（边相邻）的骨牌拥有不同色。
问染色方案数。

【分析】
我首先采用了O(n * 3^4)的DP，但是这个是比较sb的
通过适当讨论的方式，可以得到更加优秀的做法（见simple()）

【时间复杂度&&优化】


*/

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

int main(){
  int N, T, count = 0;
  cin >> N >> T;
  int ct[N][2];
  vector<int> cost;
  for (size_t i = 0; i < N; i++) {
    for (size_t j = 0; j < 2; j++) {
      cin >> ct[i][j];
    }
    if(ct[i][1] <= T) cost.push_back(ct[i][0]);
    else count++;
  }
  if(count == N) cout << "TLE" << endl;
  else{
    sort(cost.begin(), cost.end());
    cout << cost[0] << endl;
  }
  return 0;
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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 coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	vector<int> p(3);
	rep(i, 3)cin>>p[i];

	SORT(p);
	cout << (p[0] + p[1]) << endl;
}


Measured memory_bytes: 3620
import java.util.*;

public class Main {
	public static void main(String[] args) {
		HashMap<String,String> h = new HashMap<String,String>();
		h.put("D","A"); h.put("E","B"); h.put("F","C");
		h.put("G","D"); h.put("H","E"); h.put("I","F");
		h.put("J","G"); h.put("K","H"); h.put("L","I");
		h.put("M","J"); h.put("N","K"); h.put("O","L");
		h.put("P","M"); h.put("Q","N"); h.put("R","O");
		h.put("S","P"); h.put("T","Q"); h.put("U","R");
		h.put("V","S"); h.put("W","T"); h.put("X","U");
		h.put("Y","V"); h.put("Z","W"); h.put("A","X");
		h.put("B","Y"); h.put("C","Z");
		Scanner sc = new Scanner(System.in);
		String in = sc.next() , result = "";
		for( int i = 0; i < in.length(); i++ )
			result += h.get(in.charAt(i)+"");
		System.out.println(result);
	}
}

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

int main() {
    vector<int> t(5);  cin >> t[0] >> t[1] >> t[2]  >> t[3] >> t[4];
    int tt[4] = {0};
    int ans = 0;
    int a;

    for (int i=0; i<5; ++i) {
        a = t[i]%10;
        ans += t[i];
        if(a) {
            ans += 10 - a;
            tt[i] = 10 - a;
        }
    }

    ans -= max({tt[0], tt[1], tt[2], tt[3]});

    cout << ans << endl;
    return 0;
}

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

int main(){
	int n;
	scanf("%d",&n);
	double sum=0,x;
	for(int i=0;i<n;i++){
		scanf("%lf",&x);
		sum+=1/x;
	}
	printf("%lf",1/sum);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define ft first
#define sd second
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mp make_pair
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
const int MOD = 1e9+7;
const ll INF =1e18;

int main(){
    ll n, W;cin >> n >> W;
    vl weight(n), value(n);
    fr(i,n) cin >> weight[i] >> value[i];
    ll dp[110][100010] = {0};
    fr(i,n){
        fr(sum_w, W+1){
            if(sum_w>=weight[i]) dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w-weight[i]] + value[i]);
            else dp[i+1][sum_w] = dp[i][sum_w];
        }
    }
    cout << dp[n][W] << endl;
}

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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector< vector<long long> > lmat;

typedef vector<string> svec;
typedef vector< vector<string> > smat;
const ll infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

ll gcd(ll x, ll y){
    ll r = x%y;
    if(r == 0) return y;
    else return gcd(y, r);
} 

ll lcm(ll x, ll y){
    return x*y/gcd(x,y);
}

ll getnum(ivec &x){
    int y=0;
    for (size_t i = 0; i < 60; i++)
    {
        y+=(1ll << i)*x[i];
    }
    return y;

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, dm=60;
    cin >> n;
    lvec a(n);
    lmat s(dm);
    lvec ss(61, 0);
    // lvec ss;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < dm; i++){
        s[i].push_back((a[0] >> i) % 2);
        for (int j=1; j<n; j++){
            int d = (a[j] >> i) % 2;
            s[i].push_back(s[i][j-1] + d);
        }
    }

    /*
    for (auto &x : s){
        ss.push_back((n - x[n-1])*x[n-1]);
    }
    */

    for (int i = 0; i < n-1; i++){
        for (int j=0; j<dm; j++){
            if((a[i] >> j)%2) ss[j] += (n-1-i) - (s[j][n-1] - s[j][i]);
            else ss[j] += (s[j][n-1] - s[j][i]);
        }
    }
    
    ll d = 1e9 + 7;
    ll ans=0;
    for (int i = 0; i < dm; i++)
    {   
        ll rr = ((1ll << i)%d * (ss[i]%d))%d;
        ans += rr;
    }
    
    cout << ans%d <<endl;

}


Measured memory_bytes: 240876
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[200009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(b=1; b<=a; b++) cin>>f[b];
	sort(f+1,f+a+1);
	if(f[a/2]==f[a/2+1]){
		cout<<0;
		return 0;
	}
	cout<<f[a/2+1]-f[a/2];
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    int n,x,t;
    cin >> n >> x >> t;

    cout<<((n+x-1)/x)*t<<endl;
    

 return 0;
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(void){
    while(true){
        int max=0;
        char num;
        for(int i=0;i<5;i++){
            int a,b;
            cin >> a >> b;
            if(i==0 && (a|b)==0)return 0;
            if(max<(a+b)){
                max=a+b;
                num ='A'+i;
            }
        }
        cout << num << " " << max << endl;
    }
    return 0;
}



Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    int A[N], B[N];
    rep(i, N) cin >> A[i] >> B[i];
    sort(B, B+N);
    sort(A, A+N, greater<ll>());
    if(N%2 == 1) cout << B[N/2]-A[N/2]+1 << endl;
    else cout << (B[N/2]+B[N/2-1])-(A[N/2]+A[N/2-1])+1 << endl;
}

Measured memory_bytes: 5188
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
int main(){
  int A,B,C,D=0;
  str N;
  cin>>A>>B;
  if(A*B%2==0)cout<<"Even"<<endl;
  else cout<<"Odd"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a,b;
  char c;
  scanf("%d",&a);
  scanf(" %c",&c);
  scanf("%d",&b);
  while (!((c=='?'))){
    if (c=='+'){
      printf("%d\n",a+b);
    }else if(c=='-'){
      printf("%d\n",a-b);
    }else if(c=='*'){
      printf("%d\n",a*b);
    }else if(c=='/'){
      printf("%d\n",a/b);
    }
    scanf("%d",&a);
    scanf(" %c",&c);
    scanf("%d",&b);
  }
 
 
 
  return 0;
}

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

using namespace std;
const long long MAXN = 1e6+5;
const long long MOD = 1e9+7;
long long arr[MAXN];
long long pow2[MAXN];
int main(){
    long long n;
    cin>>n;
    pow2[0] = 1;
    for(long long i=1;i<=n;i++){
        cin>>arr[i];
        pow2[i] = pow2[i-1]*2;
        pow2[i]%=MOD;
    }
    long long st;
    long long curr = 2;
    sort(arr+1,arr+n+1);
    if(n%2){
        st = 2;
        curr = 2;
        if(arr[1]!=0){
            cout<<0<<endl;
            return 0;
        }
    }else{
        st = 1;
        curr = 1;
    }
    
    for(long long i=st;i<=n;i+=2){
        if(arr[i] == arr[i+1] && arr[i] == curr){
            curr+=2;
            continue;
        }else{
            cout<<0<<endl;
            return 0;
        }
    }
    cout<<pow2[n/2]<<endl;
}

Measured memory_bytes: 5120
#include<stdio.h>
#define N 100

int main(){
  int A[N];
  int i,j,k,n,num,minj,temp;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }

  for(i = 0; i <= n-1; i++){

    minj = i;
    
    for(j = i; j <= n-1; j++){

      if(A[j] < A[minj]){
	minj = j;
      }
      
    }//for

    if(i != minj){
      
      temp = A[i];
      A[i] = A[minj];
      A[minj] = temp;
      num++;
    
    }
    

  }//for

  for(k=0;k<n;k++){

    printf("%d",A[k]);
    if(k!=n-1)printf(" ");
    else printf("\n");
    
  }

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

  return 0;
  
}



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

int main(){
    string s, t;
    cin >> s >> t;

    bool f = s == t;
    for(int i = 0; i < s.size(); i++){
        if(s == t){
            f = true;
            break;
        }
        s = s.back() + s.substr(0, s.size()-1);
    }

    if(f == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  string s;
  cin>>s;
  rep(i,s.size()/2){
    if(s[i]==s[s.size()-i-1]) continue;
    else{cout<<"No"<<endl;return 0;}
  }
  cout<<"Yes"<<endl;
  return 0;
}



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

using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back

int main(){
	fast;
	lli a,b,c,d;
	cin>>a>>b>>c>>d;
	int i=0;
	while (a>0 && c>0){
		if (i%2==0) c-=b;
		else a-=d;
		i++;
	}
	if (a<=0) cout<<"No"<<endl;
	else cout<<"Yes"<<endl; 
}

Measured memory_bytes: 3644
while
x = gets()
x = x.split
m = x[0].to_i
f = x[1].to_i 
r = x[2].to_i
if m == -1 && f == -1 && r == -1;break
end
    if m == -1 || f == -1
    puts "F"
    elsif 80 <= m + f
    puts "A"
    elsif 65 <= m + f && m + f < 80
    puts "B"
    elsif 50 <= m + f && m + f < 65
    puts "C"
    elsif 30 <= m + f && m + f < 50 && r < 50
    puts "D"
    elsif 30 <= m + f && m + f < 50 && 50 <= r
    puts "C"
    elsif m + f < 30
    puts "F"
    end
    
end



Measured memory_bytes: 6852
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	V<int> d;
	for(int i=a;i<min(b+1,a+c);i++){
			d.pb(i);
	}
	for(int i=b;i>max(a-1,b-c);i--){
			d.pb(i);
	}
	Sort(d);
    d.erase(unique(d.begin(),d.end()),d.end());
    fo(i,d.sz)
    cout<<d[i]<<endl;
}

Measured memory_bytes: 256
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
    
	if 0 in A:
		print(0)
		return
      
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return
          
	print(prod)
main ()

Measured memory_bytes: 21784
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int P = sc.nextInt();
        String caps = sc.next();
        String[] capsArray = caps.split("");
        int r = 0;
       int b = 0;
for(String cap : capsArray){
   if(cap.equals("R")){
      r += 1;
   }else{
      b += 1;
   }
}
   
if(r > b){
    System.out.println("Yes"); 
}else{
    System.out.println("No");
}
    }
}

Measured memory_bytes: 22996
import qualified Data.ByteString.Char8 as B

solve :: B.ByteString -> String
solve bs = loop $ B.reverse bs
    where
        dream = B.pack $ reverse "dream"
        dreamer = B.pack $ reverse "dreamer"
        erase = B.pack $ reverse "erase"
        eraser = B.pack $ reverse "eraser"
        loop sb
            | B.null sb = "YES"
            | B.take 5 sb == dream || B.take 5 sb == erase = loop $ B.drop 5 sb
            | B.take 6 sb == eraser = loop $ B.drop 6 sb
            | B.take 7 sb == dreamer = loop $ B.drop 7 sb
            | otherwise = "NO"

main = do
    str <- B.getLine
    putStrLn $ solve str

Measured memory_bytes: 764
# coding: UTF-8
def find_comb(n,x):
    count = 0
    #探索
    for i in range(1,n-1):
        for j in range(i+1,n):
            k = x - i - j #←がi < j < k <= nを満たせばその時点で総和がxとなる
            if  j < k <= n:
                count += 1
    print count
while(1):
    n,x = map(int, raw_input().split(" "))
    if(n == 0 and x == 0):
        break
    find_comb(n,x)


Measured memory_bytes: 4656
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<string.h>
#include<cstring>
#include<set>
#include<queue>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<map>
#include<stack>
#include<list>
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pil pair<int, LL>
#define pli pair<LL, int>
#define mp make_pair
#define pb push_back
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MINF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const LL LLINF = 1e18;
const int INF = 1e9;
const int MOD = 998244353;
const int HMOD = 999959;
const int VMOD = 5000000;
const int MAXN = 3e3+10;
const int MAXM = 5e5+10;
const int INV = 10050505;
const LL LLINV = 1e18;
const double eps = 1e-3;
int dirx[5] = {0, -1, 1, 0, 0}, diry[5] = {0, 0, 0, -1, 1};

LL dp[MAXN][MAXN];
int a, b, c, d;

int main()
{
IOS;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    dp[a][b] = 1;
    for (int i = a+1;i <= c; ++i) dp[i][b] = dp[i-1][b]*b%MOD;
    for (int i = b+1;i <= d; ++i) dp[a][i] = dp[a][i-1]*a%MOD;
    for (int i = a+1;i <= c; ++i) for (int j = b+1;j <= d; ++j)
    {
        dp[i][j] = (dp[i-1][j]*j%MOD+dp[i][j-1]*i%MOD-dp[i-1][j-1]*(i-1)%MOD*(j-1)%MOD+MOD)%MOD;
    }
    printf("%lld\n", dp[c][d]);

    return 0;
}



Measured memory_bytes: 74352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;


int main(){
    ll N, Q;
    string S;
    cin>>N;
  	cin>>S;
    cin>>Q;
    vector<set<ll>> T(30);
    rep(i, N){
        T.at(S.at(i)-'a').insert(i);
    }
  	rep(i, 26){
      	T.at(i).insert(N);
    }
    rep(i, Q){
        ll Num;
        cin>>Num;
        if(Num==1){
            ll X;
            char Y;
            cin>>X;
          	cin>>Y;
          	X--;
            ll P=Y-'a';
          	//cout<<Y<<" "<<P<<endl;
            char W=S.at(X);
          	S.at(X)=Y;
          	T.at(W-'a').erase(X);
            T.at(P).insert(X);
        }
        else{
            ll X, Z;
            cin>>X>>Z;
          	X--;
          	Z--;
            ll Cou=0;
          	//cout<<"X="<<X<<", Z="<<Z<<", ";
            rep(j, 26){
                ll E=*T.at(j).lower_bound(X);
                ll F=*T.at(j).lower_bound(Z+1);
                if(F>E)Cou++;
            }
            cout<<Cou<<endl;
        }
    }
}



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

string S;

int main(void) {
  cin >> S;

  REP(i, 0, S.length() - 1) {
    if(S[i] == 'A' && S[i + 1] == 'C') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 764
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

int main(){
    string s;
    cin >> s;
    if(s=="SUN"){p(7);}
    else if (s=="SAT"){p(1);}
    else if (s=="FRI"){p(2);}
    else if (s=="THU"){p(3);}
    else if (s=="WED"){p(4);}
    else if (s=="TUE"){p(5);}
    else{p(6);}
}


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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
	int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

const int MAXN = 1e5;
int n, firMax[2], secMax[2], firRes[2], secRes[2], tot[2][MAXN + 5];

int main() {
	read(n);
	for (int x, i = 1; i <= n; ++i) {
		read(x);
		++tot[i & 1][x];
	}
	for (int i = 1; i <= MAXN; ++i)
		for (int j = 0; j <= 1; ++j) {
			if (tot[j][i] > firMax[j]) {
				secMax[j] = firMax[j], secRes[j] = firRes[j];
				firMax[j] = tot[j][i], firRes[j] = i;
			} else if (tot[j][i] > secMax[j])
				secMax[j] = tot[j][i], secRes[j] = i;
		}
	if (firRes[0] != firRes[1]) write(n - firMax[0] - firMax[1]);
	else write(n - max(firMax[0] + secMax[1], secMax[0] + firMax[1]));
	putchar('\n');
	return 0;
}

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

int main() {
  char a, b;
  cin >> a >> b;

  if (a == 'H') {
    cout << b << endl;
  } else if (a == 'D' && b == 'H') {
    cout << 'D' << endl;
  } else {
    cout << 'H' << endl;
  }
}


Measured memory_bytes: 256
Scanf.scanf "%d %d" (fun n m ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a - 1)) in
    let hist = Array.make n 0 in
    let mask = Array.make n 0 in
    Array.iter (fun v ->
        hist.(v) <- hist.(v) + 1;
        let o = max 0 (v - hist.(v) + 1) in
        mask.(o) <- mask.(o) + 1;
    ) a;
    let rec loop i hall =
        if i < m then (
            let hall =
                Scanf.scanf " %d %d" (fun z y ->
                    let x = a.(z - 1) in let y = y - 1 in
                    a.(z - 1) <- y;

                    let o = max 0 (x - hist.(x) + 1) in
                    mask.(o) <- mask.(o) - 1;
                    hist.(x) <- hist.(x) - 1;

                    let hall = if mask.(o) = 0 then hall + 1 else hall in

                    hist.(y) <- hist.(y) + 1;
                    let o = max 0 (y - hist.(y) + 1) in
                    mask.(o) <- mask.(o) + 1;
                    
                    let hall = if mask.(o) = 1 then hall - 1 else hall in
                    Printf.printf "%d\n" hall;
                    hall
                )
            in
            loop (i + 1) hall
        )
    in
    loop 0 (Array.fold_left (fun acc v -> if v = 0 then acc + 1 else acc) 0 mask)
)

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

int n;
vector<long long int> arr;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    arr.resize(n);
    for (int i=0; i<n; i++) cin >> arr[i];
    long long int ans = 0, mx = 0;
    for (int i=0; i<arr.size(); i++) {
        mx = max(mx, arr[i]);
        ans += (mx - arr[i]);
    }
    cout << ans << "\n";
    return 0;
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
      string s;
      cin >> s;
      int len = s.length();
      for(int i = 0; i < len; i++)
      {
          cout << "x";
      }
      cout << endl;

    return 0;
}


Measured memory_bytes: 256
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>

typedef long long llong;
using namespace std;

int main() {
	int n;
	int score[1100];
	double mean, var;
	while (1) {
		scanf("%d", &n);
		if (!n)break;
		mean = 0; var = 0;
		for (int i = 0; i < n; i++) {
			scanf("%d", &score[i]);
			mean += (double)score[i];
		}
		mean /= n;
		for (int i = 0; i < n; i++) {
			var += ((double)score[i] - mean)*((double)score[i] - mean);
		}
		var /= n;
		cout << fixed << setprecision(10) << sqrt(var) << endl;
		

	}
	return 0;
}



Measured memory_bytes: 3304
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define int long long
const int N = 1e6;

int n;
int a[N], s;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], s += a[i];
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (abs(a[i] * n - s) < abs(a[ans] * n - s)) ans = i;
    }
    cout << ans;
}


Measured memory_bytes: 256
const calculateK = (a: number, b: number): number|string {
  return ((a + b) % 2 === 0) ? (a + b) / 2 : "IMPOSSIBLE";
}


const  main = (standardInput) => {
  const  lengthList: string[] = standardInput.split(' ');
  const a: number = Number.parseInt(lengthList[0]);
  const b: number = Number.parseInt(lengthList[1]);
  
  console.log(calculateK(a, b));
  	
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;

//----***Like a Pythonista***----
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(all(a)); }
template<class T> inline auto min(const T& a){ return *min_element(all(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

//----***定数***----
const int MOD=1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***----
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define HERE  cout<<"Here"<<endl;

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

int N,X,Y;
vector<int> ans(2000,0),used1(2000,0),used2(2000,0);

void bfs(vector<vector<int>> G,int idx){
  // debug(idx);
  int cnt=0;
  used2[idx]=1;
  ans[cnt]++;
  queue<int> que;
  que.push(idx);
  while(que.size()){
    int v=que.front();que.pop();
    cnt++;
    REP(i,0,G[v].size()){
      int e=G[v][i];
      if(used2[e])continue;
      used2[e]=1;
      ans[cnt]++;
      que.push(e);
    }
  }
  return ;
}

signed main(){
  cin>>N>>X>>Y;
  X--;Y--;
  vector<vector<int>> G(N);
  REP(i,0,N-1){
    G[i].push_back(i+1);
    G[i+1].push_back(i);
  }
  G[X].push_back(Y);
  G[Y].push_back(X);

  REP(i,0,N-1){
    used1[i]=1;
    REP(j,0,N){used2[j]=0;}
    int cnt=-1;
    used2[i]=1;
    queue<pair<int,int>> que;
    que.push(pair<int,int>(i,-1));
    while(que.size()){
      pair<int,int> v=que.front();que.pop();
      bool flg=false;
      each(e,G[v.first]){
        if((!used2[e]))flg=true;
      }
      if(!flg){
        continue;}
      v.second++;
      each(e,G[v.first]){
        if((used2[e]))continue;
        used2[e]=1;
        //debug(e);
        //{print(i<<" "<<v<<" "<<e);}
        if(!used1[e]){
          //{print(i<<" "<<v<<" "<<e<<" "<<cnt);}
          ans[v.second]++;
        }
        que.push(pair<int,int>(e,v.second));
      }
    }
  }
  REP(i,0,N-1){
    print(ans[i])
  }

}


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

using namespace std;
typedef long long ll; 


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

	vector<int> d(N);

	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}

 	if (d[0] != 0) {
 		cout << 0 << endl;
 		return 0;
 	}

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

 	int max_value = d[N - 1];
 	vector< ll > count(max_value + 1, 0);

 	if (d[1] == 0) {
  		cout << 0 << endl;
 		return 0;		
 	}

 	for (int i = 0; i < N; i++) {
 		count[d[i]]++;
 	}

 	ll ans = 1; 
 	for (int i = 1; i <= max_value; i++) {
		//cout << "i:" << i << endl;
		//cout << "count[i - 1]:" << count[i - 1] << endl;
		//cout << "count[i]:" << count[i] << endl;
 
 		if (count[i] == 0) {
  			cout << 0 << endl;
 			return 0;			
 		}

 		ll  tmp = 1;
 		for (int j = 0; j < count[i]; j++) {
 			tmp *= count[i - 1];
 			tmp = (tmp % 998244353); 
 		}
 		//cout << "tmp:" << tmp << endl;

 		ans *= tmp;
 		ans = (ans % 998244353);

 		//cout << "ans:" << ans << endl;

 	}

 	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    long long c, b = 0;

    cin >> c;
    if (c != 0)
    {
        b = b + 1000 * (c/500);
        c = c % 500;
    }

    if (c != 0)
    {
        b = b + 5 * (c/5);
        c = c / 5;
    }

    cout<<b;

}

Measured memory_bytes: 256
import math
a,b,c = map(int,input().split())
c = math.radians(c)
s = (1 / 2) * a * b * math.sin(c)
l = a + b + math.sqrt((a**2) + (b**2) - (2 * a * b * math.cos(c)))
h = b * math.sin(c)
print("{0:.8f}".format(s))
print("{0:.8f}".format(l))
print("{0:.8f}".format(h))


Measured memory_bytes: 5712