akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  ll ans = 1e18;
  rep(k, 2) {
    ll sum = 0, now = 0;
    rep(i, n) {
      if(k % 2 == i % 2) {
        if(sum + a[i] <= 0) {
          now += abs(sum) - a[i] + 1;
          sum = 1;
        } else
          sum += a[i];
      } else {
        if(sum + a[i] >= 0) {
          now += abs(sum) + a[i] + 1;
          sum = -1;
        } else
          sum += a[i];
      }
    }
    ans = min(ans, now);
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

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

  if(u==s)cout<<a-1<<' '<<b;
  else if(u==t)cout<<a<<' '<<b-1;
  else cout<<a<<' '<<b;


  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
using namespace std;


vector<int> bfs(vector<vector<int> > &graph,int start){
	queue<int> todo;
	vector<int> dist(graph.size(),-1);
	dist[start] = 0;
	todo.push(start);
	while(!todo.empty()){
		int now = todo.front();
		todo.pop();
		for (int i=0;i<graph[now].size();i++){
			int nxt = graph[now][i];
			if (dist[nxt] != -1) continue;
			dist[nxt] = dist[now] + 1;
			todo.push(nxt);
		}
	}
	return dist;
}



int main(){
	int n; cin >> n;
	vector<vector<int> > graph(n+1);
	for (int i = 0; i < n; i++){
		int v, k; cin >> v >> k;
		for (int j = 0; j < k; j++) {
			int in; cin >> in;
			graph[v].push_back(in);
		}
	}
	vector<int> dist;
	dist = bfs(graph,1);


	for (int i=1;i<n+1;i++){
		cout << i << " " << dist[i] << endl;
	}

	return 0;
}




Measured memory_bytes: 3168
import math
from operator import mul
from functools import reduce
import sys

# sys.setrecursionlimit(int(2000000))
def main():
    X, Y = [int(n) for n in input().split()]
    if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0:
        print(0)
        return
    i = (2 * Y - X)//3
    j = (2 * X - Y)//3
    print(combinations_count(i+j, min(i,j),int(1e9+7)))

def combinations_count(n, k, M):
    if k == 0:
        return 1
    fn = 0
    fk = 0
    fnk = 0
    cur = 1
    M = int(1e9+7)
    for i in range(1, n+1):
        cur = (cur * i) % M
        if i == n:
            fn = cur
        if i == n-k:
            fnk = cur
        if i == k:
            fk = cur

    return (fn * (modpow(fk , (M-2), M)) * modpow(fnk , (M-2), M))%M
def modpow(a,b,M):
    if b == 1:
        return a % M
    if b % 2 == 1:
        return (modpow(a,(b-1)//2,M)**2 * a)%M
    return (modpow(a,b//2,M) ** 2) % M 
main()

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (ll i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 
const int mod = 1e9 + 7, mxn = 1e5 + 1;

int solve(){
    int n, ans = 0;
    cin>> n;
    vi v(n);
    rep(i, 0, n)
        cin>> v[i];
    rep(i, 0, n){
        rep(j, i, n){
            rep(k, j, n){
                if(v[i] != v[j]  and  v[j] != v[k]  and  v[i] != v[k]){
                    vi gg;
                    gg.pb(v[i]), gg.pb(v[j]), gg.pb(v[k]);
                    sort(all(gg));
                    if(gg[0] + gg[1] > gg[2])
                        ans++;
                }
            }
        }
    }
    cout<< ans<< "\n";
    return 0;
}
//Counting problems: Sometimes easier to find complement of the answer
 
int main()
{
    fast;
    int t = 1;
    //cin>> t;
    while(t--){  
        solve();
    }
    return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*  inv[1] = 1; // inv is ll
    for(int i=2; i<=mxn; ++i)
        inv[i]=mod-mod/i*inv[mod%i]%mod;*/
        
// lower bound   >=  
// upper bound   >
// vector<int>().swap(vec); //free memory from vec


Measured memory_bytes: 3668
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
}


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

int main() {
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v.at(i);
    sort(v.begin(), v.end());
    double ans = v.at(0);
    rep(i, n - 1) ans = (ans + v.at(i + 1)) / 2.0;
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n, k; cin >> n >> k;
    vector<ll> e(n + 1);
    e[0] = 0;
    FOR(i, 1, n + 1) { 
        ll p; cin >> p; p += 1;
        e[i] = e[i - 1] + p;
    }

    ll ans = 0;
    FOR(i, 0, n - k + 1) { 
        ans = max(ans, e[i + k] - e[i]);
    }
    cout << fixed << setprecision(10) << double(ans) / 2 << endl;
}


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

using namespace std;
using ll = long long;

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

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s; cin >> s;

    if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=0
b=0
c=0
d=0
for i in range(n):
	s=input()
	if s=="AC":
		a+=1
	elif s=="WA":
		b+=1
	elif s=="TLE":
		c+=1
	else:
		d+=1
print("AC x "+str(a))
print("WA x "+str(b))
print("TLE x "+str(c))
print("RE x "+str(d))


Measured memory_bytes: 9120
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

X, Y, Z, K = MAP()
A = sorted(LIST(), reverse = True)
B = sorted(LIST(), reverse = True)
C = sorted(LIST(), reverse = True)

AB = []
for i in range(X):
	for j in range(Y):
		AB.append(A[i]+B[j])

AB.sort(reverse = True)
AB = AB[:3000]
ABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)

for j in range(1, Z):
	ABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])
	ABC += ABC_tmp
	ABC.sort(reverse = True)
	ABC = ABC[:3000]

print(*ABC[:K], sep= "\n")



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

int main() {
	double A,B,C;
	double d;
	cin>>A>>B>>C;
	d=(acos(-1)*C)/180;
	printf("%lf\n",A*B*sin(d)/2);
	printf("%lf\n",A+B+sqrt(A*A+B*B-2*A*B*cos(d)));
	printf("%lf\n",B*sin(d));
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<" "
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define sp << " " <<
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);

int main()
{
    fast;
    ll n;
    cin >> n;
    ll a[n+1],dp[n+1][n+1];
    fr(i,1,n+1)
        cin >> a[i];
    fr(i,0,n+1)
    {
        fr(j,1,n+1)
        {
            ll k=j+i;
            if(k>n)
                break;
            if(j==k)
                dp[j][k]=a[j];
            else if(a[j]-dp[j+1][k]>a[k]-dp[j][k-1])
                dp[j][k]=a[j]-dp[j+1][k];
            else
                dp[j][k]=a[k]-dp[j][k-1];
        }
    }
    cout << dp[1][n];
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  if( S == "hi"){
    cout << "Yes" << endl;
  }else if ( S == "hihi"){
    cout << "Yes" << endl;
  }else if ( S == "hihihi"){
    cout << "Yes" << endl;
  }else if ( S == "hihihihi"){
    cout << "Yes" << endl;
  }else if ( S == "hihihihihi"){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

using namespace std;
#define ll long long

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif

int N;
vector<int> v;
bool era[300000];

void init()
{
	int diff = 5;
	for (int i = 6; i < 300000; i += diff) {
		diff = 7 - diff;
		if (era[i]) continue;
		v.PB(i);
		for (int j = i; j < 300000; j += i) era[j] = true;
	}
}

signed main()
{
	init();
	cin >> N;
	while (N-1) {
		cout << N << ":";
		for (int i = 0; i < (int) v.size(); i++) {
			int x = v[i];
			if (x  > N) {
				break;
			}
			if (N % x == 0) {
				cout << " " << x;
			}
		}
		cout << endl;
		cin >> N;
	}
}



Measured memory_bytes: 3540
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n, m; cin >> n >> m;
	priority_queue<ll> q;
	rep(i, n)
	{
		ll a; cin >> a;
		q.push(a);
	}
	rep(i, m)
	{
		ll x = q.top();
		q.pop();
		x /= 2;
		q.push(x);
	}
	ll res = 0;
	while (!q.empty())
	{
		res += q.top();
		q.pop();
	}
	cout << res << endl;
}

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

#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int main(){
  ll N,k;cin >> N >> k;
  ll ans = N*N;
  if(k == 0) {
    cout << ans << endl;
    return 0;
  }
  ans = 0;
  for(int b=k+1;b<=N;b++){
     ll n = (N + 1) / b;
        ll d = 0;
        
        d += 1LL * (b - k) * n;
        
        ll L = k + b * n;
        ll R = N;
        if (L <= R) d += R - L + 1;
        ans += d;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	vector<int> pnt(3);
	for (int i = 0; i < 3; i++) cin >> pnt[i];

	string T;
	cin >> T;

	// あいこ以上には必ずできる．
	// 勝ちにできるなら勝ちにする，そうでないならあいこにする

	auto id = [](char &c) {
		if (c == 'r') return 0;
		else if (c == 's') return 1;
		else return 2;
	};

	int ans = 0;
	vector<int> used(N, -1);
	for (int i = 0; i < N; i++) {

		if (i >= K && used[i - K] == (id(T[i]) + 2) % 3) continue;

		ans += pnt[(id(T[i]) + 2) % 3];
		used[i] = (id(T[i]) + 2) % 3;

	}

	DMP(used);

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 848
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var ans = 0;

            string C = cin.ReadLine;
            string[] a = new string[] { "a", "b", "c", "d","e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
            for (int i = 0; i < 47; i++)
            {
                if (a[i] == C)
                {
                    WriteLine(a[i + 1]);
                    break;
                }
            }


        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    pii p[5];
    rep(i,5){
        intl a;
        cin >> a;
        p[i] = mp((a%10 ? 10 - (a%10) : 0),a);
    }
    sort(p,p + 5);
    intl ans = 0;
    rep(i,4){
        ans += (p[i].second / 10 + (bool)p[i].first) * 10;
    }
    ans += p[4].second;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
  double X,x,Y,y,a=0,b=0;
  double C=0;
  cin >> X >> x >> Y >> y;
  if(X>Y){
    a=X-Y;
  }else{
    a=Y-X;
  }
  if(x>y){
    b=x-y;
  }else{
    b=y-x;
  }
  C=a*a+b*b;
  printf("%f\n",sqrt(C));
  return(0);
}
  



Measured memory_bytes: 3296
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}
func main() {
	sc.Split(bufio.ScanWords)
	a, b, c, d, e, k := nextInt(), nextInt(), nextInt(), nextInt(), nextInt(), nextInt()
	if int(math.Abs(float64((a - b)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((a - c)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64(a-d))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((a - e)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((b - c)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((b - d)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((b - e)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((c - d)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((c - e)))) > k {
		fmt.Println(":(")
		return
	}
	if int(math.Abs(float64((d - e)))) > k {
		fmt.Println(":(")
		return
	}

	fmt.Println("Yay!")
}


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


int a,b,n,x,y;
queue<int>box;
int dontgo[50][50]={};
bool memo[50][50]={};


void Keiro(){
    
    cin >> n;
    
    for (int i=1;i<=n;i++){
        cin >>  x >> y;
        memo[x][y]=true;
    }
    
    dontgo[1][1]=1;
    for(int i=1;i<=a;i++){
        for(int t=1;t<=b;t++){
            
            if(memo[i][t]){
            }else{
                dontgo[i][t]=dontgo[i-1][t]+dontgo[i][t-1]+dontgo[i][t];
            }
        }
    }
    
    box.push(dontgo[a][b]);
    
    for(int i=0;i<=49;i++){
        for(int t=0;t<=49;t++){
            dontgo[i][t]={};
            memo[i][t]={};
        }
    }
}


int main(){
    int judge=1;
    
    
    
    
    while(judge==1){
        cin >> a >> b;
        if(a==0&&b==0){
            goto end;
        }
        Keiro();
    }
    

    
    
    end:
    
    int z;
    z=box.size();
    for(int i=0;i<=z-1;i++){
        cout << box.front() << endl;
        box.pop();
    }
    
    
    

    return 0;
}

Measured memory_bytes: 3052
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include <ios>
#include <iomanip>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef tuple<ll,ll,ll> Tl;


int atcoder(){
    //入力
    ll n,k,x,y;
    cin >> n >> k >> x >> y;
    ll ans;
    
    if(n<=k) ans = n*x;
    else ans = k*x + (n-k)*y;

    cout << ans << ENT;
    
    return 0;
}

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


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

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_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(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    string s;cin>>s;
    int n = sz(s);
    if (n%2!=0){
        cout << "No" << endl;
        return 0;
    }

    rep(i, n){
        if (s[i]=='h'){
            if (s[i+1]!='i'){
                cout << "No" << endl;
                return 0;
            }
            i++;
        }
        else{
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


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

vector<pair<int, int>> f(vector<int> nums)
{
    map<int, int> counter;
    for (int n : nums) counter[n]++;
    vector<pair<int, int>> result(counter.begin(), counter.end());
    sort(result.begin(), result.end(), [](const pair<int, int>& x, const pair<int, int>& y) { return x.second > y.second; });
    return result;
}

int main()
{
    int N; cin >> N;
    vector<int> odds(N/2), evens(N/2);
    for (int i = 0; i < N/2; i++) cin >> odds[i] >> evens[i];
    auto vpodds = f(odds), vpevens = f(evens);
    int answer = N - vpodds[0].second - vpevens[0].second;
    if (vpodds[0].first == vpevens[0].first) {
        if (vpodds.size() == 1 && vpevens.size() == 1) answer = N/2;
        else {
            int o = vpodds.size() != 1 ? vpodds[1].second : 0;
            int e = vpevens.size() != 1 ? vpevens[1].second : 0;
            answer = N - vpodds[0].second - max(o, e);
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3900
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	int n, m;
	int[] vi, da, vo;

	double[][] comb, combSum;

	void run(){
		n=sc.nextInt();
		m=sc.nextInt();
		vi=new int[n];
		da=new int[n];
		vo=new int[n];
		for(int i=0; i<n; i++){
			vi[i]=sc.nextInt();
			da[i]=sc.nextInt();
			vo[i]=sc.nextInt();
		}
		solve();
	}

	void solve(){
		int M=2010;
		comb=new double[M][M];
		combSum=new double[M][M];
		// comb[n][k] = C(n,k)(1/3)^k(2/3)^{n-k}
		// combSum[n][k] = comb[n][k]+...+comb[n][n]

		comb[0][0]=1;
		for(int j=1; j<M; j++){
			comb[j][0]=comb[j-1][0]*(2/3.0);
			for(int i=1; i<M; i++){
				comb[j][i]=comb[j-1][i]*(2/3.0)+comb[j-1][i-1]*(2/3.0)*(1/2.0);
			}
		}
		for(int j=0; j<M; j++){
			combSum[j][M-1]=comb[j][M-1];
			for(int i=M-2; i>=0; i--){
				combSum[j][i]=combSum[j][i+1]+comb[j][i];
			}
		}

		double[] viE=calcE(vi, 5);
		double[] daE=calcE(da, 3);
		double[] voE=calcE(vo, 2);

		double max=-Double.MAX_VALUE;
		for(int i=0; i<=m; i++){
			for(int j=0; i+j<=m; j++){
				int k=m-(i+j);
				max=max(max, viE[i]+daE[j]+voE[k]);
			}
		}
		println(String.format("%.12f", max));
	}

	double[] calcE(int[] value, int point){
		double[] E=new double[m+1];
		for(int i=0; i<=m; i++){
			int myValue=value[0]*i;
			double[][] top3=new double[n][3];
			top3[0][0]=1;
			double worst=1;
			for(int j=1; j<n; j++){
				int a=(myValue+value[j]-1)/value[j];
				double p;
				if(a<=m){
					p=combSum[m][a];
				}else{
					p=0;
				}
				top3[j][0]=top3[j-1][0]*(1-p);
				top3[j][1]=top3[j-1][1]*(1-p)+top3[j-1][0]*p;
				top3[j][2]=top3[j-1][2]*(1-p)+top3[j-1][1]*p;
				worst*=p;
			}
			E[i]=point*(top3[n-1][0]+top3[n-1][1]+top3[n-1][2])-1*worst;
		}
		return E;
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 81000
import math
N, A, B = map(int, input().split())
if math.log10(N)>math.log10(A+B)+100:
    print(A*(10**100))
elif N % (A+B) <= A:
    print((N//(A+B)*A)+(N%(A+B)))
else:
    print((N//(A+B)*A)+A)

Measured memory_bytes: 62000
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    int a[x],b[x];
    for (int i=0;i<x;i++){
        cin>>a[i]>>b[i];
    }
    for (int i=2;i<x;i++){
        if (a[i]==b[i]){
            if (a[i-1]==b[i-1]){
                if (a[i-2]==b[i-2]){
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iomanip>
//#include <chrono>
//#include <random>

#define fio ios_base::sync_with_stdio(false)
#define pdl cout << "*" << endl
#define MOD 1000000007
#define INF 1000000000
#define INFLL 1000000000000000000ll
#define long int64_t
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ std::cerr << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args)
{ const char* comma = strchr(names + 1, ','); std::cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma+1, args...); }

using namespace std;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<> dis(0, INF<<1);

const int N = 101;

char a[N][N];
int dp[N][N];

int main()
{
	fio;
	int n, m;
	cin >> n >> m;
	for(int i=1; i<=n; i++)
		for(int j=1; j<=m; j++)
			cin >> a[i][j];
	for(int i=2; i<=n; i++)
		dp[i][0] = INF;
	for(int i=2; i<=m; i++)
		dp[0][i] = INF;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			int x = dp[i][j-1] + int(a[i][j] == '#' and a[i][j-1] != '#');
			int y = dp[i-1][j] + int(a[i][j] == '#' and a[i-1][j] != '#');
			dp[i][j] = min(x, y);
		}
	}
	cout << dp[n][m] << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	// 値を取得
	static int n = sc.nextInt();
	static int A = sc.nextInt();
	static int B = sc.nextInt();
	static int C = sc.nextInt();
	static int[] l = new int[n];

	public static int calc(final int i, final int a, final int b, final int c, final int cal) {
		if (i == n) {
			if (a == 0 || b == 0 || c == 0) {
				return Integer.MAX_VALUE;
			}
			return cal + Math.abs(A - a) + Math.abs(B - b) + Math.abs(C - c);
		}
		int res = calc(i + 1, a, b, c, cal);
		res = Math.min(res, calc(i + 1, a + l[i], b, c, cal + (a == 0 ? 0 : 10)));
		res = Math.min(res, calc(i + 1, a, b + l[i], c, cal + (b == 0 ? 0 : 10)));
		res = Math.min(res, calc(i + 1, a, b, c + l[i], cal + (c == 0 ? 0 : 10)));

		return res;
	}

	public static void main(String[] args) {

		for (int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}

		System.out.println(calc(0, 0, 0, 0, 0));

		sc.close();
	}
}


Measured memory_bytes: 23940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d;
    cin >> d;
    cout << "Christmas";
    for(int i=0;i<25-d;i++){
        cout << " Eve";
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int d,f,i;
	
	while((scanf("%d",&d)) != EOF){
		f=0;
		for(i=1;i*d < 600;i++){
			f+=(i*d)*(i*d) * d;
		}
		printf("%d\n",f);
	}
	return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n;
    cin >> n;
    vl a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    vl c(n);
    ll neg = 0;
    ll pos = 0;
    for (int i = 0; i < n; ++i) {
        c[i] = b[i] - a[i];
        if (c[i] > 0)
            pos += c[i] / 2;
        else
            neg -= c[i];
    }
    if (pos >= neg)
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}

Measured memory_bytes: 512
import sys
from collections import deque
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline

def main():
  N, M, K = map(int, input().split(' '))
  A = list(map(int, input().split(' ')))
  B = list(map(int, input().split(' ')))
  As = [0]
  Bs = [0]
  for i in range(len(A)):
    As.append(A[i] + As[i])
  for i in range(len(B)):
    Bs.append(B[i] + Bs[i])
  ans, i = 0, N
  for j in range(M+1):
    if(K < Bs[j]):
      break
    while(i >= 0 and K < Bs[j] + As[i]):
      i -= 1
    ans = max(ans, i+j)
  print(ans)

if __name__=='__main__':
  main()

Measured memory_bytes: 49424
#include <bits/stdc++.h>
#define inc(l,i,r) for (int i=l;i<=r;i++)
#define dec(r,i,l) for (int i=r;i>=l;i--)
#define SIZE(V) ((int) V.size())
#define forE(p,u) for (edge *p=head[u];p;p=p->nxt)
#define forV(i,V) for (int i=0;i<SIZE(V);i++)
#define pb push_back
#define In inline
#define fi first
#define se second
#define mp make_pair
#define It iterator
#define ___ putchar(10);
#define cnt(x) __builtin_popcount(x)
#define show(x) cout << #x << " = " << x << endl;
#define mid ((l+r) >> 1)
#define N 1010
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

struct pt {int x,y;};

int n, m, cnt, a[N][N], ans;
char s[N][N];
queue <pt> Q;

const int u[4] = {0,0,1,-1}, v[4] = {1,-1,0,0};

inline void check(int x,int y,int t) {
	if (1 <= x && x <= n && 1 <= y && y <= m && a[x][y] == -1) {
		a[x][y] = t;
		Q.push((pt) {x,y});
	}
}

int main() {
	scanf("%d%d",&n,&m);
	inc(1,i,n) inc(1,j,m) a[i][j] = -1;	
	inc(1,i,n) {
		scanf("%s",s[i]+1);
		inc(1,j,m) if (s[i][j] == '#') Q.push((pt) {i,j}), a[i][j] = 0;
	}
	
	while (!Q.empty()) {
		pt now = Q.front();  Q.pop();
		inc(0,k,3) check(now.x+u[k],now.y+v[k],a[now.x][now.y]+1);
	}

	inc(1,i,n) inc(1,j,m) ans = max(ans, a[i][j]);
	
	printf("%d",ans);
}

Measured memory_bytes: 13328
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val b = readLine()!!.split(' ').map { it.toInt() }

    var ans = b[0]

    for (i in b.indices) {
        ans += when (i) {
            b.lastIndex -> b.last()
            else -> listOf(b[i], b[i + 1]).min()!!
        }
    }

    println(ans)
}


Measured memory_bytes: 38152
n = int(input())
ans_max = 1
for i in range(n):
    ans_max = ans_max * 10 % 1000000007

ans_mid = 1
for i in range(n):
    ans_mid = ans_mid * 9 % 1000000007
ans_mid = ans_mid * 2 % 1000000007

ans_min = 1
for i in range(n):
    ans_min = ans_min * 8 % 1000000007
ans = (ans_max - (ans_mid - ans_min)) % 1000000007
print(ans)

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] iArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[] technique = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long H = iArray[0];
            long N = iArray[1];
            for(long p = 0; p < N; p++)
            {
               H = H - (technique[p]);
                if (H <= 0)
                {
                    break;
                }
            }
            if(H<=0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

Measured memory_bytes: 20832
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    vector<int> vec, P = { 0, 1, 2, 3, 4 };;
    rep (i, 0, 5) {
        int in; cin >> in;
        vec.push_back(in);
    }
    int final_answer = INF;
    do {
        int ans = 0;
        rep (i, 0, 5) {
            while (ans % 10 != 0) ans++;
            ans += vec[P[i]];
        }
        final_answer = min(final_answer, ans);
    } while (next_permutation(P.begin(), P.end()));
    cout << final_answer << endl;
}

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;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string S; cin >> S; int N = S.size(); int tmp=0; int ans=0;
  rep(i, N){
    if(S[i]=='T') tmp++;
    else tmp--;
    ans = max(ans, tmp);
  }
  cout << ans*2 << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>
//#include "show_vector.hh"


using namespace std;

#define debug false

int main(int argc, char *argv[]){

  string S;
  cin >> S;

  if (S.length() == 3) {
    char tmp = S[0];
    S[0] = S[2];
    S[2] = tmp;
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

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

int main(){
	int n;
	scanf("%d", &n);
	int pos[n];
	REP(i, 0, n){
		int a;
		scanf("%d", &a);
		pos[a-1] = i;
	}
	int r = 0, maxl = 0;
	REP(l, 0, n){
		if(l>r) r = l;
		while(r+1<n and pos[r+1]>pos[r]) r++;
		maxl = std::max<int>(maxl, r-l+1);
	}
	printf("%d\n", n-maxl);
	return 0;
}



Measured memory_bytes: 1024
function main(arg) {
    var arg2 = arg.split(/\n/g);
	var honbun = arg2[1];
	var alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	for(i=0;i<alphabet.length;i++){
		var iro = alphabet.substr(i,1);
		var regkun = new RegExp(iro+"+", 'g');
		honbun = honbun.replace(regkun,iro);
	}
	console.log(honbun.length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21192
#include<queue>
#include<cstdio>
#include<algorithm>

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

using namespace std;

#define bit(i,j) (1<<((i)<<2)+(j))

int main(){
	int n; scanf("%d",&n);
	vector<int> stamp;
	rep(i,n){
		int h,w; scanf("%d%d",&h,&w);
		for(int k=1-h;k<4;k++) for(int l=1-w;l<4;l++) for(int c=1;c<=3;c++) {
			int S=0;
			for(int y=k;y<k+h;y++) for(int x=l;x<l+w;x++) {
				if(0<=y && y<4 && 0<=x && x<4) S|=bit(y,x);
			}
			stamp.push_back(S);
		}
	}

	sort(stamp.begin(),stamp.end());
	stamp.erase(unique(stamp.begin(),stamp.end()),stamp.end());

	int goal[4][4];
	rep(i,4){
		char s[5]; scanf("%s",s);
		rep(j,4){
			if(s[j]=='R') goal[i][j]=0;
			if(s[j]=='G') goal[i][j]=1;
			if(s[j]=='B') goal[i][j]=2;
		}
	}

	bool visited[1<<16];
	rep(S,1<<16) visited[S]=(S==0);

	int ans;
	queue< pair<int,int> > qu; qu.push(make_pair(0,0));
	while(1){
		int S=qu.front().first;
		int cnt=qu.front().second; qu.pop();

		if(S==(1<<16)-1){ ans=cnt; break; }

		rep(k,stamp.size()) rep(c,3) {
			int S2=S;
			rep(i,4) rep(j,4) if(stamp[k]&bit(i,j)) {
				if(goal[i][j]==c) S2|=bit(i,j);
				else              S2&=~bit(i,j);
			}
			if(!visited[S2]){
				visited[S2]=true;
				qu.push(make_pair(S2,cnt+1));
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 1100
#include<bits/stdc++.h>
#define int long long
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int func(int n, int x){
    if(n == -1) return 0;
    else{
        return n/x + 1;
    }
}
signed main(){
    int a, b, x;
    cin >> a >> b >> x;
    cout << func(b, x) - func(a-1, x) << endl;
}

Measured memory_bytes: 3636
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n // 2)
    exit()

kisu = Counter(v[::2]).most_common(2)
gusu = Counter(v[1::2]).most_common(2)

if kisu[0][0] == gusu[0][0]:
    keep = max(kisu[1][1] + gusu[0][1],
               kisu[0][1] + gusu[1][1])
else:
    keep = kisu[0][1] + gusu[0][1]

print(n - keep)


Measured memory_bytes: 22340
#include<iostream>

using namespace std;

int data[10];

int main(){
  while(cin >> data[0]){
    double sum = data[0];
    char trash;
    cin >> trash;
    for(int i = 1; i < 10; i++){
      cin >> data[i] >> trash;
      sum += data[i];
      data[i] = sum;
    }
    int v[2];
    cin >> v[0] >> trash >> v[1];
    v[1] += v[0];
    sum /= v[1];
    sum *= v[0];
    int max = 0;
    for(int i = 0; i < 10; i++){
      if(sum <= data[i]){
	max = i+1;
	break;
      }
    }
    cout << max << endl;
  }
  return 0;
}

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

using namespace std;

 int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    string s;

    int k;
    cin>>k;

    cin>>s;
    if(k<s.size()){
    for(int i=0;i<k;i++){
        cout<<s[i];
    }cout<<"...";}
    else{
        for(int i=0;i<s.size();i++){
        cout<<s[i];
    }
    }
 return 0;

 }


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

using namespace std;

int main()
{
  int n, m, l;
  cin >> n >> m >> l;
  vector<vector <int> > nm(n, vector<int> (m)), ml(m, vector<int> (l));
  for(int i = 0;i < n;i++)
  {
    for(int j = 0;j < m;j++)
    {
      cin >> nm[i][j];
    }
  }
  for (int i = 0; i < m;i++)
  {
    for (int j = 0; j < l; j++)
    {
      cin >> ml[i][j];
    }
  }
  for(int i = 0;i < n;i++)
  {
    for(int j = 0;j < l;j++)
    {
      long long int ans = 0;
      for(int k = 0;k < m;k++)
      {
        ans += nm[i][k] * ml[k][j];
      }
      cout << ans;
      if(j != l - 1)
      cout << " ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

bool par(int n) {
    return (n%2==0);
}
    int v[4];

int main(){

    int n;

    cin >> n;

    for (int i=0; i<n; i++){
        string s;
        cin >> s;
        if (s == "AC") v[0]++;
        else if (s== "WA") v[1]++;
        else if (s== "TLE") v[2]++;
        else v[3]++; 
    }

    cout << "AC x " << v[0] << endl;
    cout << "WA x " << v[1] << endl;
    cout << "TLE x " << v[2] << endl;
    cout << "RE x " << v[3] << endl;

    return 0;
}

Measured memory_bytes: 3656
N = int(input())
p = list(map(float,input().split()))
dp = [[0]*(N+1) for _ in range(N+1)]
dp[0][0] = 1
for n in range(N+1):
    for m in range(N+1-n):
        dp[n][m] += p[n+m-1]*dp[n-1][m]+(1-p[n+m-1])*dp[n][m-1]

ans = 0
for n in range(N+1):
    m = N-n
    if n > m:
        ans += dp[n][m]
print(ans)

Measured memory_bytes: 276872