akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int res = MOD;
	int n, c;
	cin>>n>>c;
	int trans[c][c], canco[3][c], cols[3], ord[3];
	mem(canco, 0);
	fore(i, 0, c) fore(j, 0, c) cin>>trans[i][j];
	int a;
	int opo;
	fore(i, 0, n) fore(j, 0, n) {cin>>a; canco[(i + j) % 3][a-1]++;}
	fore(i, 0, c - 2)
	{
		cols[0] = i;
		fore(j, i + 1, c - 1)
		{
			cols[1] = j;
			fore(k, j + 1, c)
				{
					cols[2] = k;
					fore(i, 0, 3) ord[i] = i;
					do
					{
						opo = 0;
						fore(i, 0, 3)
						{
							fore(j, 0, c)
							{
								opo += trans[j][cols[ord[i]]] * canco[i][j];
							}
						}
						res = min(res, opo);
					}
					while(next_permutation(ord, ord + 3));
				}
		}
	}
	cout<<res<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b)
			System.out.println("a < b");
		else if (a > b)
			System.out.println("a > b");
		else
			System.out.println("a == b");

		}
}

Measured memory_bytes: 26188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    string s, t;
    cin >> s >> t;
    if(t.substr(0, t.size()-1) == s) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3640
<?php

if (!empty($argv[1])) {
    Util::enablingDebug();
}

myMain();

// bench
Util::printBench();

class Util
{
    private static $isDebug = false;
    private static $startTime;

    public static function input($isSplitSpace = false)
    {
        $input = trim(fgets(STDIN));
        if (!$isSplitSpace) {
            return $input;
        }

        return explode(' ', $input);
    }

    public static function arrToStr($arr)
    {
        return implode(",", $arr);
    }

    public static function enablingDebug()
    {
        self::$isDebug = true;
        self::$startTime = time();
    }

    public static function isDebug()
    {
        return self::$isDebug;
    }

    public static function debugLog($text, $isReturn = true)
    {
        if (self::$isDebug) {
            echo $text;
            if ($isReturn) {
                echo PHP_EOL;
            }
        }
    }

    public static function varDump($obj)
    {
        if (self::$isDebug) {
            var_dump($obj);
        }
    }

    public static function arrFirst($arr)
    {
        if (empty($arr) || !is_array($arr)) {
            return null;
        }

        return current($arr);
    }

    public static function arrLast($arr)
    {
        if (empty($arr) || !is_array($arr)) {
            return null;
        }

        return end($arr);
    }

    public static function printBench()
    {
        if (!self::$isDebug) {
            return;
        }

        echo sprintf("Fin. Time: %.3f s  MemoryPeakUsage: %.3f KB" . PHP_EOL, time() - self::$startTime, memory_get_peak_usage() / 1024);
    }

    public static function getDigit($num)
    {
        return (int)ceil(log10($num));
    }
}


function myMain()
{
    // START
    $n = Util::input();
    $graph = new Graph();
    for ($i = 0; $i < $n; ++$i) {
        $input = Util::input(true);
        $graph->add($input[0], $input[1], array_slice($input, 2));
    }

    for ($i = 1; $i <= $n; ++$i) {
        $graph->dfs($i);
    }
    $graph->printResult();
}

class Graph
{
    private $_list = [];

    // for dfs
    private $_time = 0;
    private $_visitTimeList = [];
    private $_completeTimeList = [];

    public function add($u, $k, $vList)
    {
        if (empty($vList)) {
            $vList = [];
        }
        $this->_list[$u] = $vList;
    }

    public function dfs($vIndex)
    {
        if (!empty($this->_visitTimeList[$vIndex])) {
            return;
        }

        $this->_time += 1;
        $this->_visitTimeList[$vIndex] = $this->_time;

        foreach ($this->_list[$vIndex] as $v) {
            $this->dfs($v);
        }

        $this->_time += 1;
        $this->_completeTimeList[$vIndex] = $this->_time;
    }

    public function printResult()
    {
        foreach ($this->_list as $vIndex => $v) {
            echo sprintf("%s %s %s" . PHP_EOL,
                $vIndex,
                $this->_visitTimeList[$vIndex],
                $this->_completeTimeList[$vIndex]
            );
        }
    }
}



Measured memory_bytes: 9528
#include<bits/stdc++.h>
using namespace std;
int ans;
int main() {
	int A,B,C,x;
	cin>>A>>B>>C>>x;
	for(int i=0; i<=A; i++)
		for(int j=0; j<=B; j++)
			for(int k=0; k<=C; k++) {

				if(i*500+100*j+50*k==x) {
					ans++;
				}
			}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    int x, a, b;
    cin >> x >> a >> b;

    if(abs(x - a) < abs(x - b)) cout << "A";
    else cout << "B";
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
int main(){
    cin>>N;
    ll now=1;
    ll ans=0;
    for(ll i=0;i<N;i++){
        ll a;
        cin>>a;
        if(now==a){
            now++;
        }else{
            ans+=(a-1)/now;
            if(now==1)now=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python
# coding: utf-8

# In[19]:


N,K = map(int, input().split())
mydict = {}
for _ in range(N):
    a,b = map(int, input().split())
    if a not in mydict:
        mydict[a] = b
    else:
        mydict[a] += b


# In[20]:


mydict_s = sorted(mydict.items(), key=lambda x:x[0])
cnt = 0
for i,items in enumerate(mydict_s):
    cnt += items[1]
    if cnt >= K:
        ans = items[0]
        break
print(ans)


# In[ ]:






Measured memory_bytes: 20968
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		String st = t.substring(0,s.length());
		if (s.matches(st) && s.length() + 1 == t.length()) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}	
		sc.close();
	}

}

Measured memory_bytes: 35704
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,k;
    cin>>n>>k;
    if(k>((n-1)*(n-2))/2)
    cout<<"-1";
    else{
    vector <pair<lli,lli> > vect;
    rep(i,n-1){
    	vect.pb(mp(1,i+2));
	}
	lli j=2;
	lli loop=((n-1)*(n-2))/2-k;
	while(loop>0){
		for(lli p=j+1;p<=n && loop>0;p++){
			vect.pb(mp(j,p));
			loop--;
		}
		j++;
	}
	cout<<vect.size()<<"\n";
	rep(i,vect.size()){
		cout<<vect[i].ft<<" "<<vect[i].sc<<"\n";
		}
	}
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <map>

using namespace std;

int main() {
    int len;
    cin >> len;
    map<string, int> m;
    for (int i = 0; i < len; i++){
        string str;
        cin >> str;
        m[str] += 1;
    }
    int maxscore;
    for (auto itr = m.begin(); itr != m.end(); ++itr){
        if (maxscore < itr->second){
            maxscore = itr->second;
        }
    }
    for (auto itr = m.begin(); itr != m.end(); ++itr){
        if (itr->second == maxscore){
            cout << itr->first << endl;
        }
    }
}


Measured memory_bytes: 25216
from functools import reduce


def f(m, xs):
    return sum([m%x for x in xs])

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // gcd(a, b)

N = input()
xs = input().split(' ')
xs = [int(x) for x in xs]
M = reduce(lcm, xs)
p = f(M-1, xs)
print(p)

Measured memory_bytes: 3812
#include <iostream>

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

  int N,X,mi = 2000,m;
  std::cin >> N >> X;
  for (int i = 0; i < N; i++)
  {
    std::cin >> m;
    X -= m;
    mi = std::min(mi,m);
  }
  std::cout << N + X/mi << '\n';
}


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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  ll N, A, B;
  std::cin >> N >> A >> B;

  ll cnt = N / (A + B);
  ll ans = A * cnt;
  ans += std::min(A, N - cnt * (A + B));
  std::cout << ans << '\n';
}


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

using namespace std;

int main()
{
  string s, p;
  cin >> s >> p;
  s = s + s;
  for(int i = 0;i < s.size() - p.size();i++)
  {
    string flag = s.substr(i, p.size());
    if(flag == p)
    {
      cout << "Yes" << endl;
      exit(0);
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3200
class BIT:
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.bisect_K = [1 << k for k in reversed(range(N.bit_length()))]

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def bisect(self, w):
        bit, N = self.tree, self.size
        i = 0
        for k in self.bisect_K:
            if i + k <= N and bit[i + k] < w:
                i += k
                w -= bit[i]
        return i + 1


class Multiset:
    def __init__(self, N):
        self.N = N
        self.bit = BIT(N)

    def insert(self, x):
        self.bit.add(x, 1)

    def erase(self, x):
        self.bit.add(x, -1)

    def lower_bound(self, x):
        s = self.bit.sum(x)
        return self.bit.bisect(s) if s else 0

    def size(self):
        return self.bit.sum(self.N)


N, *A = map(int, open(0).read().split())

memo = {a: i for i, a in enumerate(sorted(set(A)), 1)}
M = len(memo)

ms = Multiset(M)
for b in (memo[a] for a in A):
    i = ms.lower_bound(b - 1)
    if i != 0:
        ms.erase(i)
    ms.insert(b)

print(ms.size())


Measured memory_bytes: 71228
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	string s;cin>>s;
	int cnt=(s.length()-1)-1;
	ostringstream oss;
	oss<<cnt;
	cout<<s[0]<<cnt<<s[s.length()-1]<<endl;
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;


int main() {
    ios_base::sync_with_stdio(false);
    string s, s1, s2;
    cin >> s >> s1 >> s2;
    if (s[s.length()-1] == s1[0] && s1[s1.length()-1] == s2[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    /*long long t,i,cnt=0;
    string str;
    cin>>t;
   while(t--)
    {
        cin>>str;
        if(str=="X++"||str=="++X")
        {
            cnt++;
        }
        if(str=="X--"||str=="--X")
        {
            cnt--;
        }
    }
    cout<<cnt;*/
    long long n;
    cin>>n;
long long  res= n%1000;
    if(res==0)
    cout<<"0"<<endl;
    else
    {
        cout<<1000-res;
    }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int N; int d[100];
  cin >> N;
  for(int i=0; i<N; ++i) cin >> d[i];
  ll ans=0;
  for(int i=0; i<N;++i){
    for(int j=i+1; j<N;++j) ans += d[i]*d[j];
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string S,T;
  cin>>S>>T;
vector<char>A(26,'0');
  vector<char>B(26,'0');
  bool flag=true;
  
  for(int i=0;i<S.size();i++){
    if(A[S[i]-'a']=='0'){
      A[S[i]-'a']=T[i];
    }
    
    else{
if(A[S[i]-'a']!=T[i]){
  flag=false;
}
    }
  }
  
    for(int i=0;i<S.size();i++){
    if(B[T[i]-'a']=='0'){
      B[T[i]-'a']=S[i];
    }
    
    else{
if(B[T[i]-'a']!=S[i]){
  flag=false;
}
    }
  }



  if(flag){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

}

Measured memory_bytes: 776
x, y, z, k = gets.chomp.split.map &:to_i
a = gets.chomp.split.map &:to_i
b = gets.chomp.split.map &:to_i
c = gets.chomp.split.map &:to_i

a = a.sort{ |a1, b1| b1 <=> a1}
b = b.sort{ |a1, b1| b1 <=> a1}
c = c.sort{ |a1, b1| b1 <=> a1}

pool = []

(0...a.size).each{ |i|
	(0... [3000/(i+1), b.size].min).each{ |j|
		(0...[3000/(i+1)/(j+1), c.size].min).each{ |k|
			pool << a[i] + b[j] + c[k]
		}
	}
}

pool.sort!{ |a1,b1| b1 <=> a1 }

k.times{ |i|
	puts pool[i]
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
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;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    bool abc[26];
    fill(abc,abc+26,true);
    string s;
    cin >> s;
    for (ll i=0;i<s.size();i++){
        abc[s[i]-'a']=false;
    }
    for (ll i=0;i<26;i++){
        if (abc[i]){
            cout << s;
            cout << (char)('a'+i) << endl;
            return 0;
        }
    }
    if (s.size()==26){
        for (ll i=s.size()-1;i>=0;i--){
            for (ll j=(s[i]-'a');j<26;j++){
                if (abc[j]){
                     for (ll k=0;k<i;k++){
                         cout << s[k];
                     }
                     cout << (char)('a'+j) << endl;
                     return 0;
                }
            }
            abc[s[i]-'a']=true;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3644
N,T = map(int,input().split())

min_c = -1
for i in range(N):
    c,t1 = map(int,input().split())
    if t1 <= T:
        if min_c == -1 or min_c > c:
            min_c = c

if min_c == -1:
    print("TLE")
else:
    print(min_c)


Measured memory_bytes: 2940
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    int N;
    string c;

    cin>>N;
    cin>>c;

    int wc=0;
    for(int i=0;i<N;i++){
        if(c[i]=='W') wc++;
    }

    int n=0;
    for(int i=N-1;i>N-1-wc;i--){
        if(c[i]=='R') n++;
    }

    cout<<n<<endl;
}



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


using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;

const int W = 200007;
const int N = 207;

LL w[N], v[N];
LL dp[W];
LL czy[W];

int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    int n, WW;
    cin >> n >> WW;
    for(int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    czy[0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = WW; j >= w[i]; j--){
            dp[j] = max(dp[j], czy[j-w[i]]*(dp[j-w[i]]+v[i]));
            czy[j] = max(czy[j-w[i]], czy[j]);
        }
    }
    LL res = 0;
    for(int i = 1; i <= WW; i++){
        res = max(dp[i], res);
    }
    cout << res << '\n';
    
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A;
  cin>>A;
  char a,b,c,d;
  cin>>a>>b>>c>>d;
  ll B=(a-'0')*100+(c-'0')*10+(d-'0');

  
  cout<<A*B/100<<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
const int maxn = 500000 + 10;
char s[maxn];
int n;
int f[maxn], g[maxn];
void calc(int * p)
{
	for(int i = 2; i <= n; ++i)
	{
		int j = p[i - 1];
		while(j && s[j + 1] != s[i]) j = p[j];
		if(s[j + 1] == s[i]) ++j;
		p[i] = j;
	}
}
inline bool good(int n, int pn)
{
	int len = n - pn;
	return n % len != 0 || n / len == 1;
}
int main()
{
	scanf("%s", s + 1); 
	n = strlen(s + 1);
	calc(f);
	int len = n - f[n];
	if(len == 1)
	{
		printf("%d\n%d\n", n, 1);
		return 0;
	}
	else if(good(n, f[n]))
	{
		printf("%d\n%d\n", 1, 1);
		return 0;
	}
	reverse(s + 1, s + n + 1);
	calc(g);
	printf("%d\n", 2);
	int ans = 0;
	for(int i = 1; i <= n; ++i)
		if(good(i, f[i]) && good(n - i, g[n - i]))
			++ans;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8044
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define vi vector <int>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	string s,t; cin>>s>>t;
	int l1 = s.length(), l2 = t.length();
	int ans = 0;
	for(int i=0;i+l2<=l1;i++)
	{
		int cc = 0;
		int id = 0;
		while(id<l2)
		{
			if( s[id+i] == t[id] ) cc++;
			id++;
		}
		ans = max( ans , cc );
	}
	cout<<l2 - ans;

	return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
#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##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
constexpr ll pow2(const int n) { return 1ll << n; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

string s;
int x, y;

vi X, Y;

int main() {
    cin >> s >> x >> y;

    int Tcnt = 0;
    X.push_back(0);
    Y.push_back(0);
    rep(i, sz(s)) {
        if (s[i] == 'T') {
            Tcnt++;
            if (Tcnt % 2) Y.push_back(0);
            else X.push_back(0);
        }
        else {
            if (Tcnt % 2) {
                Y.back()++;
            }
            else {
                X.back()++;
            }
        }
    }

    int ans = 1;

    const int range = 1 << 13; // 8192
    vector<vector<bool>> dp;
    dp.resize(sz(X), vector<bool>(range * 2, false));

    dp[0][X[0] + range] = true;
    rep(i, 1, sz(X)) {
        rep(j, range * 2) {
            if (dp[i - 1][j]) {
                dp[i][j + X[i]] = dp[i][j - X[i]] = true;
            }
        }
    }
    if (not dp[sz(X) - 1][x + range]) ans = 0;

    dp.assign(sz(Y), vector < bool >(range * 2, false));

    dp[0][Y[0] + range] = true;
    rep(i, 1, sz(Y)) {
        rep(j, range * 2) {
            if (dp[i - 1][j]) {
                dp[i][j + Y[i]] = dp[i][j - Y[i]] = true;
            }
        }
    }
    if (not dp[sz(Y) - 1][y + range]) ans = 0;

    write(ans ? "Yes" : "No");
}

Measured memory_bytes: 11264
import java.io.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" ");
        int d=Integer.parseInt(s[0]),t=Integer.parseInt(s[1]),sp=Integer.parseInt(s[2]);
        if(t*sp>=d) sb.append("Yes");
        else sb.append("No");
        System.out.print(sb);
    }
}


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

// Common file
#include <ext/pb_ds/assoc_container.hpp>
// Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>



#define pb push_back
#define F first
#define S second
#define rep(i,n) for(int i = 0; i < (n); i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}

/*****************************************************/

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

    string s1 = "AC" , s2 = "WA" , s3 = "TLE" , s4 = "RE" , ss;
    int c0 = 0 , c1 = 0 , c2 = 0 , c3 = 0;

    while(n--) {
        cin >> ss;

        if(ss == s1)
            c0++;
        else if(ss == s2)
            c1++;
        else if(ss == s3)
            c2++;
        else
            c3++;
    }

    cout << s1 << " x " << c0 << "\n";
    cout << s2 << " x " << c1 << "\n";
    cout << s3 << " x " << c2 << "\n";
    cout << s4 << " x " << c3 << "\n";

    return 0;
}


Measured memory_bytes: 3620
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int ll;
ll powmod(ll a, ll b) {
    ll res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
int nxt() {
    int x;
    scanf("%d", &x);
    return x;
}

void min_self(int &a, int b) {
    a = min(a, b);
}

int main() {
    int n = nxt();
    VI a(n);
    generate(all(a), nxt);
    VI memo(n, INF);
    memo[0] = 0;
    REP(i, n) {
        if (i + 1 < n) min_self(memo[i + 1], memo[i] + abs(a[i + 1] - a[i]));
        if (i + 2 < n) min_self(memo[i + 2], memo[i] + abs(a[i + 2] - a[i]));
    }
    printf("%d\n", memo[n - 1]);
    return 0;
}


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

int main () {
  int h, w;
  cin >> h >> w;

  vector<vector<int>> a(h, vector<int>(w));
  for(int i = 0; i < h; ++i) {
    for(int j = 0; j < w; ++j) {
      cin >> a[i][j];
    }
  }

  vector<int> from_x;
  vector<int> from_y;
  vector<int> to_x;
  vector<int> to_y;

  for(int i = 0; i < h; ++i) {
    for(int j = 0; j < w; ++j) {
      if(a[i][j] % 2 == 1) {
        for(int k = j+1; k < w; ++k){
          if(a[i][k] % 2 == 1){
            for(int l = j; l < k; ++l) {
              a[i][l]--;
              from_x.push_back(l);
              from_y.push_back(i);
              a[i][l+1]++;
              to_x.push_back(l+1);
              to_y.push_back(i);
            }
            break;
          }
        }
      }
    }
  }

  for(int i = 0; i < h; ++i) {
    for(int j = 0; j < w; ++j) {
      if (a[i][j] % 2 == 1){
        for(int k = j; k < w-1; ++k){
          a[i][k]--;
          from_x.push_back(k);
          from_y.push_back(i);
          a[i][k+1]++;
          to_x.push_back(k+1);
          to_y.push_back(i);
        }
        break;
      }
    }
  }

  for(int i = 0; i < h; ++i) {
    if(a[i][w-1] % 2 == 1) {
      for(int j = i+1; j < h; ++j) {
        if(a[j][w-1] % 2 == 1) {
          for(int k = i; k < j; ++k){
            a[k][w-1]--;
            a[k+1][w-1]++;
            from_x.push_back(w-1);
            from_y.push_back(k);
            to_x.push_back(w-1);
            to_y.push_back(k+1);
          }
          break;
        }
      }
    }
  }
  cout << from_x.size() << endl;
  for(int i = 0; i < from_x.size(); ++i) {
    cout << from_y[i]+1 << " " << from_x[i]+1 << " " << to_y[i]+1 << " " << to_x[i]+1 << endl;
  }

}

Measured memory_bytes: 5224
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
struct node{
	int l;
	int r;
}a[100009];
bool cmp(node a,node b){
	if (a.r == b.r) return a.l > b.l;
	return a.r < b.r;
}

int main ()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i = 1;i <= m; i++)
		scanf("%d%d",&a[i].l,&a[i].r);
	sort(a+1,a+1+m,cmp);
	int now = a[1].r;
	int s = 1;
	for (int i = 2; i <= m; i++){
		if (a[i].l < now) continue;
		now = a[i].r;
		s++;
		}
		printf("%d\n",s);
}

Measured memory_bytes: 1024
#include<algorithm>
#include<typeinfo>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iterator>
#include<functional>
#define eps 0.01
#define pi acos(-1)
#define e exp(1)
using namespace std;
typedef long long ll;
int main() {
    ll n;
    while (cin >> n) {
        if (n & 1)
            n *=2;
        cout << n << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    int N;
    cin >> N;
    int ok = 0; //解が存在する値
    int ng = N; //解が存在しない値

    cout << 0 << endl;
    int state;
    string s;
    cin >> s;
    if(s == "Vacant") return 0;
    else if(s == "Male") state = 0;
    else state = 1;

    while(abs(ok - ng) > 1){
        int mid = (ok + ng)/2;
        int nst;
        cout << mid << endl;
        cin >> s;
        if(s == "Vacant"){
            return 0;
        }else if(s == "Male"){
            nst = 0;
        }else {
            nst = 1;
        }
        if(mid%2 == 0){
            if(nst == state) ok = mid;
            else ng = mid;
        }else{
            if(nst == state) ng = mid;
            else ok = mid;
        }
    }
    cout << ok << endl;
}

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

int main() {

  int n;
  while( cin >> n, n ) {
    int data[10000]={0};
    for(int i=0; i<n; i++) {
      int num;
      cin >> num;
      data[num]++;
    }

    for(int i=0; i<10; i++) {
      if( !data[i] ) cout << '-' << endl;
      else {
	for(int j=0; j<data[i]; j++) {
	  cout << '*';
	}
	cout << endl;
      }
    }
  }
}

Measured memory_bytes: 1196
#include <cstdio>

int main(void){
	int h, w;
    while(true){
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if ((i == 0 || i == h - 1) ||
                    (j == 0 || j == w - 1)) {
                    printf("#");
                } else {
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
}



Measured memory_bytes: 2560
class SegmentTreeDual():
    def __init__(self,arr,op=lambda x,y:y if y != -1 else x,ie=-1):
        self.h = (len(arr)-1).bit_length()
        self.n = 2**self.h
        self.ie = ie
        self.op = op
        self.val = [ie for _ in range(self.n)]
        self.laz = [ie for _ in range(2*self.n)]
        for i in range(len(arr)):
            self.val[i] = arr[i]

    def propagate(self,k):
        if self.laz[k] == self.ie: return
        if self.n <= k:
            self.val[k-self.n] = self.op(self.val[k-self.n],self.laz[k])
            self.laz[k] = self.ie
        else:
            self.laz[2*k] = self.op(self.laz[2*k],self.laz[k])
            self.laz[2*k+1] = self.op(self.laz[2*k+1],self.laz[k])
            self.laz[k] = self.ie

    def update(self,left,right,x):
        left += self.n
        right += self.n
        #可換なら不要?
        for i in range(self.h)[::-1]:
            self.propagate(left>>i)
            self.propagate(right>>i)
        #
        while right-left>0:
            if right & 1:
                right -= 1
                self.laz[right] = self.op(self.laz[right],x)
            if left & 1:
                self.laz[left] = self.op(self.laz[left],x)
                left += 1
            left >>= 1
            right >>= 1
    def get(self,index):
        res = self.val[index]
        index += self.n
        while index>0:
            res = self.op(res,self.laz[index])
            index //= 2
        return res


from bisect import bisect_left,bisect_right
import sys
input = sys.stdin.readline
INF = 10**18

N,Q = map(int,input().split())
P = [-INF,INF]
R = []

for i in range(N):
    s,t,x = map(int,input().split())
    R.append((s-x,t-x,x))
    P.append(s-x)
    P.append(t-x)
D = []
for i in range(Q):
    d = int(input())
    D.append(d)
    P.append(d)

R = sorted(R,key=lambda x:x[2],reverse=True)
P = sorted(set(P))
S = dict()
for i in range(len(P)):
    S[P[i]] = i

st = SegmentTreeDual(
                    arr = [-1 for _ in range(len(P))],
                    op = lambda x,y:y if y != -1 else x,
                    ie = -1
                    )
for i in range(N):
    st.update(S[R[i][0]],S[R[i][1]],R[i][2])

ans = []

for i in range(Q):
    ans.append(st.get(S[D[i]]))

print('\n'.join(map(str,ans)))

Measured memory_bytes: 226256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define INF (int)1e9+4
#define INFL (ll)1e18+4
#define md (int)1e9+7
#define mx 10000000
#define mk make_pair
#define pi pair<int,int>
#define ss second
#define ff first
#define pb emplace_back 
#define onell(x) __builtin_popcountll(x)
#define one(x) __builtin_popcount(x)
#define all(s) s.begin(),s.end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(x, a) for (auto& x: a)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
#define metr(s) memset(s,true, sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;
void solve(){
ll n=0,k=0,ans=0,r=0,m=0,x=0,y=0,z=0;
cin>>n;
vl a(n);
rep(i,0,n)cin>>a[i];
rep(i,0,n-2){
	rep(j,i+1,n-1){
		rep(k,j+1,n){
			if(a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k]){
				if(a[i]+a[j]>a[k] && a[k]+a[j]>a[i] && a[k]+a[i]>a[j])
			ans++;}
		}
	}
}
cout<<ans;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
   //cin>>t;
  while(t--){
  	solve();
  }
  return 0;
}

Measured memory_bytes: 3660
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 05/17/20 20:37:02
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr double PI = 3.14159265358979323846;

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

  int a,b,h,m; cin>>a>>b>>h>>m;
  double sita = abs((2*PI*m/60) - (h*2*PI/12 + 2*PI*m/12/60));
  double c = sqrt(a*a+b*b-2*a*b*cos(sita));
  cout <<fixed<<setprecision(10)<< c << endl;

  return 0;
}


Measured memory_bytes: 4248
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.stream.Stream;

class Main {
    public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String str = scanner.next();
		String str2 = scanner.next();
		
		Pattern pattern = Pattern.compile("^[a-z]+$");
		
		boolean isClear = Stream.of(str, str2).allMatch(s -> pattern.matcher(s).find() && s.length() >= 1 && s.length() <= 100);
		if (isClear) {
			System.out.println(str2 + str);
		}
	}
}

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

int N, A[11];
int main() {
    for(int i = 0; i < 3; i++) {
        scanf("%d", &N);
        A[N]++;
    }

    if(A[5] == 2 && A[7] == 1) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;





int main(void) {
    
    string s;
    cin>>s;
    int K;
    cin>>K;
    int  dp[110][2][4];
    rep(i,s.size()+10)rep(j,2)rep(k,4)dp[i][j][k]=0;
    dp[0][0][0]=1;
    rep(i,110)rep(j,2)rep(k,4){
        if(i>s.size())continue;
        rep(d,10){
            int ni=i+1,nj=j,nk=k;
            if(d!=0)nk++;
            if(nk>K)continue;
            if(nj==0){
                if(s[i]-'0'<d)continue;
                else if(s[i]-'0'>d)nj=1;
            }
            dp[ni][nj][nk]+=dp[i][j][k];
        }
    }
    fin(dp[s.size()][0][K]+dp[s.size()][1][K]);
    
}


Measured memory_bytes: 256
Tmp = []
Tmp = input().rstrip().split(' ')

A = int(Tmp[0])
B = int(Tmp[1])
C = int(Tmp[2])

N = int(input())
Max = A
Tmp1 = B
Tmp2 = C
TmpN = 0

if Max < B:
    Tmp1 = Max
    Max = B

if Max < C:
    Tmp2 = Max
    Max = C

for i in range(N):
    Max *= 2

TmpN = Max + Tmp1 + Tmp2

print(TmpN)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>

using namespace std;

int main()
{
  vector<int> data;

  for(int i=0;i<10;i++)
  {
    int input;
    cin>>input;
    data.push_back(input);
  }
  
  sort(data.begin(),data.end(),greater<int>());

  for(int i=0;i<3;i++)
  {
    cout<<data[i]<<endl;
  }
}

Measured memory_bytes: 1216
n,a,b=map(int,input().split())
s=input()
cnt=kai=0
for i in range(0,len(s)):
    if s[i]=='a':
        if a+b>cnt:
            cnt+=1
            print("Yes")
        else:
            print("No")
    elif s[i]=='b':
        kai+=1
        if a+b>cnt and b>=kai:
            cnt+=1
            print("Yes")
        else:
            print("No")
    else:
        print("No")
    


Measured memory_bytes: 4016
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on
void main()
{
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long[] x = new long[](cast(size_t)(N));
    long[] y = new long[](cast(size_t)(N));
    foreach (i; 0 .. cast(size_t)(N))
    {
        x[i] = input.front.to!long;
        input.popFront;
        y[i] = input.front.to!long;
        input.popFront;
    }

    solve(N, x, y);
}

void solve(long N, long[] x, long[] y)
{
    long maxv = long.min;
    long minv = long.max;
    long maxw = long.min;
    long minw = long.max;
    foreach (i; 0 .. N)
    {
        long v = x[i] + y[i];
        long w = x[i] - y[i];
        maxv = max(maxv, v);
        minv = min(minv, v);
        maxw = max(maxw, w);
        minw = min(minw, w);
    }
    max(abs(maxv - minv), abs(maxw - minw)).writeln();

}


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

map<ll, ll> mp;
ll N, K, a, b;

int main()
{
    cin >> N >> K;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        mp[a] += b;
    }
    ll r = 0;
    for (auto x : mp)
    {
        r += x.second;
        if (r >= K)
        {
            cout << x.first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 4224
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Integer[] sticks = new Integer[n];
    Arrays.setAll(sticks, i -> sc.nextInt());
    Arrays.sort(sticks, Collections.reverseOrder());
    int count = 0;
    for (int i = 0; i < n - 2; i++)
      for (int j = i + 1; j < n - 1; j++)
        for (int k = j + 1; k < n; k++)
          if (sticks[i] - sticks[j] < sticks[k])
            count++;
    	  else
            break;
    System.out.println(count);
  }
}

Measured memory_bytes: 29364
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int a,p; cin>>a>>p;
    p+=a*3;
    cout<<p/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
  int N;
  cin >> N;

  vector<long>num(N,0);
  for(int i=0;i<N;i++){
    cin >> num[i];
  }

  for(int i=1;i<N;i++){
    num[i] = num[i] + num[i - 1];
  }

  long sum = num[N - 1] / 2;

  long gap = 9999999999;
  int c = 0;
  for(int i=0;i<N - 1;i++){
    if(gap > abs(sum - num[i])){
      gap = abs(sum - num[i]);
      c = i;
    }
  }

  cout << abs(num[N - 1] - num[c] - num[c]) << endl;


  return 0;
}


Measured memory_bytes: 1792
using System;
using System.Linq;
public static class Program {
    static void Main(string[] args)
    {
        var n  = int.Parse(Console.ReadLine());
        var nums = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        long result = 1;
        if(nums.Contains(0))
        {
            Console.WriteLine("0");
            return;
        }
        foreach(var num in nums)
        {
          try{
            checked{
            result *= num; 
            if(result > 1000000000000000000)
            {
              Console.WriteLine("-1");
              return;
            }
            }
          }
          catch (OverflowException e){
              Console.WriteLine("-1");
              return;
          }
          
        }
       
       
        Console.WriteLine(result);
    }
}

Measured memory_bytes: 42464
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

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


#include <iostream>

int main()
{
    int A, B;
    cin >> A >> B;

    int C = A + B;
    int D = A - B;
    int E = A * B;

    cout << max(C,max(D,E)) << endl;
}


Measured memory_bytes: 256