akhauriyash/Code-Regression huggingface dataset:
import sys
from itertools import accumulate
import bisect
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N = int(input())
L= inputs()
L.sort()
b= 0
ans = 0
for i in range(N-1,-1,-1):
    for j in range(i-1,-1,-1):
        b= L[i]-L[j]
        insert_index = bisect.bisect_right(L,b)
        #print(L,b,i,j,insert_index)
        ans += max(j-insert_index,0)
        #print(ans)
print(ans)


Measured memory_bytes: 44124
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    string s;
    int min=1000;
    cin>>s;
    for(int i=0;i<s.length()-2;i++){
        if(abs((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')-753)<min) min=abs((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')-753);
    }
    cout<<min<<endl;
    return 0;
}


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

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int N;
    cin >> N;
    vector<lli> a(N);
    lli sum = 0;
    REP (i, 0, N) {
        cin >> a[i];
        sum += a[i];
    }
    vector<lli> s(N + 1, 0);
    REP (i, 0, N) {
        s[i + 1] = s[i] + a[i];
    }
    lli ans = 1LL << 60;
    REP (i, 1, N) {
        lli f = s[i];
        lli sec = sum - f;
        ans = min(ans, abs(f - sec));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "limits.h"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
using namespace std;

string s;
int cnt;


int main(){
	cin >> s;
	cnt = 0;
	lp(s.size() - 1) {
		if (s[i] != s[i + 1])cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ll long long
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1.0),eps=1e-8;
const ll mod = 1e9+7;
const int inf = 1e18;
const int maxn = 1e6+5;
ll POW(ll a, ll b){
	ll ans = 1;
	b %= (mod - 1);
	while(b){
		if(b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}
ll inv(ll a){
	return POW(a, mod - 2);
}
ll fac[maxn], ifac[maxn];
void init(){
	fac[0] = fac[1] = 1;
	for(int i = 2; i < maxn; i ++) fac[i] = fac[i - 1] * i % mod;
	ifac[maxn - 1] = inv(fac[maxn - 1]);
	for(int i = maxn - 2; i >= 0; i --) ifac[i] = ifac[i + 1] * (i + 1) % mod;
}
ll getc(int n, int m){
	if(n < m || m < 0) return 0;
	return fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}
int main(){
	int n;
	cin >> n;
	init();
	if(n == 1) cout << 0 << endl;
	else if(n == 2) cout << 2 << endl;
	else{
		ll ans = POW(10, n);
		ans = (ans + mod - POW(8, n)) % mod;
		ll res = 1;
		for(int i = 1; i <= n; i ++){
			res = (res + getc(n, i) % mod * POW(8, n - i) % mod) % mod;
		}
		ans = (ans + mod - res * 2 % mod) % mod;
		cout << (ans + 2) % mod << endl;

	}
	return 0;
}


Measured memory_bytes: 18824
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
int main()
{
    //freopen("inputfile.txt","r",stdin);
    ll n;cin>>n;
    ll ar[n];
    for(ll i=0;i<n;i++)cin>>ar[i];
    ll count = 0;
    for(ll i=1;i<n;i++)
    {
        if(ar[i-1]>ar[i])
        {
            count += ar[i-1]-ar[i];
            ar[i] = ar[i-1];
        }
    }
    cout<<count<<endl;
    return 0;
}


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

int main(){
    string s, t; cin >> s >> t;
    int N = s.size();
    vector<char> m1(27,0), m2(27,0);
    for (int i = 0; i < N; i++)
    {
        int si = s[i]-'a';
        int ti = t[i]-'a';
        if(m1[si]==0 && m2[ti]==0){
            m1[si] = t[i];
            m2[ti] = s[i];
            continue;
        }
        if(m1[si]==0) m1[si] = t[i];
        if(m2[ti]==0) m2[ti] = s[i];
        
        if(m1[si] != t[i] || m2[ti] != s[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 776
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 1000000000;

        static int N;
        static string S;
        static long[] ans;

        
        
        public static void Input()
        {
            N = int.Parse(Console.ReadLine());
            S = Console.ReadLine();
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            ans = new long[N];
            ans[0]= S.ToCharArray().Count(x => x == 'E');
            if (S[0] == 'E') { ans[0]--; }

            for(var i = 1; i < N; i++)
            {
                ans[i] = ans[i - 1];
                if (S[i - 1] == 'W') { ans[i]++; }
                if (S[i] == 'E') { ans[i]--; }
            }

            Console.WriteLine(ans.Min());
           
           

            //Console.Out.Flush();

            

        }

        
    }

    
}



Measured memory_bytes: 16284
import kotlin.math.max

fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main() {
    val (n, k) = intList()
    var c = 0L
    if (k == 0) {
        println((n.toLong() * n.toLong()).toString())
        return
    }
    1.until(n + 1).forEach {
        val p = n / it
        val r = n % it
        c += max(0, it - k) * p + max(0, r - k + 1)
    }
    println(c.toString())
}


Measured memory_bytes: 36544
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    a = [int(input()) for _ in range(n)][::-1]
    ans = 0

    for i in range(n):
        p, q = divmod(a[i], 2)
        ans += p

        if q == 1:
            if (i + 1 <= n - 1) and (a[i + 1] >= 1):
                ans += 1
                a[i + 1] -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7964
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
string s;

struct mod_fac{
    private:
        vector<ll> f,i_f;
        int n;ll MOD;
    public:
        void init(int n,ll m){
            MOD=m;
            f.resize(n+1,0);
            i_f.resize(n+1,0);
            f[0]=1;
            rep(i,n){
                f[i+1]=f[i]*(i+1)%MOD;
            }
            i_f[n]=power(f[n],MOD-2);
            per(i,n){
                i_f[i]=(i_f[i+1]*(i+1))%MOD;
            }
        }
        ll power(ll a ,ll x){
            if (x==0) return 1;
            if (x==1) return a%MOD;
            if (x==2) return (a*a)%MOD;
            if (x%2==1) return (a*power(power(a,(x-1)/2),2))%MOD;
            return (power(power(a,x/2),2))%MOD;
        }
        ll fac(int x){
            return f[x];
        }
        ll invfac(int x){
            return i_f[x];
        }
        ll comb(int m,int k){
            if (m<0 or k<0) return 0;
            if (m<k) return 0;
            return (((f[m]*i_f[k])%MOD)*i_f[m-k])%MOD;
        }
};

void solve(){
    cin >> n;
    cin >> s;
    mod_fac mo;mo.init(n,mod);
    ll m=0;
    ll ans=1;
    rep(i,2*n){
        if (s[i]=='B'){
            if (m%2==0) m+=1;
            else {
                ans*=m;
                ans%=mod;
                m-=1;
            }
        } 
        if (s[i]=='W'){
            if (m%2==1) m+=1;
            else {
                ans*=m;
                ans%=mod;
                m-=1;
            }
        } 
        //cout << m << endl;
    }
    if (m!=0) {
        cout << 0 << endl;
        return;
    }
    cout << ans*mo.fac(n)%mod << endl;
}

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

Measured memory_bytes: 2196
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n;cin>>n;
    std::vector<ll> a(n);
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    }
    std::vector<std::vector<ll> > dp(n+1,std::vector<ll>(n));
    for (int i = 0; i <n; ++i)
    {
    	dp[1][i]=a[i];
    }
    for (int i = 2; i <=n; ++i)
    {
    	for (int j = 0; j <=(n-i) ; ++j)
    	{
    		dp[i][j]=max(a[j]-dp[i-1][j+1],a[j+i-1]-dp[i-1][j]);
    	}
    }
    cout<<dp[n][0]<<"\n";
    
}


Measured memory_bytes: 70784
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
constexpr ll MOD = 1000000007;
 
#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}
 
#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif


int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    string ans="No";

    string n;

    cin >> n;

    ll sum = 0;

    for(auto&& ch : n){
        sum += ch-'0';
    }

    if(sum%9==0){
        ans = "Yes";
    }

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



Measured memory_bytes: 3700
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    cin >> s;
    long long int q;
    cin >> q;
    
    for(long long int i=0;i<q;i++){
        string in;
        cin >> in;
        if(in=="print"){
            long long int a,b;
            cin>>a>>b;
            cout<< s.substr(a,b-a+1)<<endl;
            
        }else if(in=="reverse"){
            long long int a,b;
            cin>>a>>b;
            string k=s;
            for(long long int j=a;j<=b;j++){
                s[j]=k[a+b-j];
            }
        }else if (in=="replace"){
            long long int a,b;
            cin>>a>>b;
            for(long long int j=a;j<=b;j++){
                char c;
                cin>>c;
                s[j]=c;
            }
        }
    }
}



Measured memory_bytes: 3188
from collections import defaultdict
import sys
sys.setrecursionlimit(20000000)
connection = defaultdict(lambda: [])

n = int(input())

ab = []
for i in range(n-1):
    a, b = map(int, input().split())
    connection[a].append(b)
    connection[b].append(a)
    ab.append((a, b))

c = list(map(int, input().split()))
c.sort()

ans = [0] * (n+1)

checked_list = []
def dfs(num):
    checked_list.append(num)
    ans[num] = c.pop()
    for next_num in connection[num]:
        if next_num not in checked_list:
            dfs(next_num)


l = []
for i in range(1, n+1):
    l.append([i, len(connection[i])])
l.sort(key=lambda x: x[1], reverse=True)
dfs(1)

score = 0

for a, b in ab:
    score += min(ans[a], ans[b])

print(score)
print(" ".join(map(str, ans[1:])))


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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

// https://qiita.com/ta-ka/items/a023a11efe17ab097433
struct Edge {
    ll to, cost;
};

class Dijkstra {
    ll vector_count;

    vector<ll> distances;
    vector<vector<Edge>> edges;

public:
    Dijkstra(ll n) {
        vector_count = n;
        distances.resize(n, INF);
        edges.resize(n);
    }

    void insertTowWay(ll from, ll to, ll cost) {
        edges[from].push_back({to, cost});
        edges[to].push_back({from, cost});
    }

    void dijkstra(ll k) {
        distances[k] = 0;  // 始点sへの最短距離は0

        priority_queue<P, vector<P>, greater<P>> que;  // 距離が小さい順に取り出せるようgreater<P>を指定
        que.push(P(0, k));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;  // 更新した頂点の中で距離が最小の頂点v
            if (distances[v] < p.first) {
                continue;
            }
            for (auto e : edges[v]) {  // 頂点vから出る辺eを走査
                if (distances[e.to] > distances[v] + e.cost) {
                    distances[e.to] = distances[v] + e.cost;
                    que.push(P(distances[e.to], e.to));
                }
            }
        }
    }

    ll calcDistance(ll to) {
        return distances[to];
    }

};


int main() {

    ll n, m;
    cin >> n >> m;

    Dijkstra dijkstra(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;

        a--;
        b--;
        dijkstra.insertTowWay(a, b, 1);
    }
    dijkstra.dijkstra(0);

    ll cost = dijkstra.calcDistance(n - 1);

    if (cost <= 2) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

}

Measured memory_bytes: 18912
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;
using System.IO;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var P = GetString();
            char[] P2 = new char[P.Length];

            for (int i = 0; i < P.Length; i++)
            {
                if (P[i] != '?')
                {
                    P2[i] = P[i];
                }
                else
                {
                    P2[i] = 'D';
                    /*
                    if (i == 0)
                    {
                        if (P[i + 1] == 'P')
                        {
                            P2[i] = 'D';
                        }
                        else
                        {
                            P2[i] = 'P';
                        }
                    }
                    else if (P[i - 1] == 'D')
                    {
                        if (i != P.Length - 1 || P[i + 1] == 'D')
                            P2[i] = 'D';
                    }
                    else
                    {
                        P2[i] = 'D';
                    }
                    */
                }
            }

            Console.WriteLine(P2);



            return;
        }
    }
}

public static class MyIO
{
    private static string[] args = null;
    private static int num = -1;
    private static int used = -1;

    private static string getArg()
    {
        if (used == num)
        {
            args = Console.ReadLine().Split(' ');
            num = args.Length;
            used = 0;
        }
        return args[used++];
    }

    public static int GetInt() => int.Parse(getArg());
    public static long GetLong() => long.Parse(getArg());
    public static double GetDouble() => double.Parse(getArg());
    public static string GetString() => getArg();
    public static char GetChar() => getArg()[0];
    public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
    public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
    public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
    public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

Measured memory_bytes: 26992
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[1200000];
int main(){
	while(true){
	cin>>n;
	if(n==0){break;}
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int v=-1,cnt=1;if(n==1)v=a[0];
	for(int i=1;i<n;i++){
		if(a[i]==a[i-1]){
			cnt++;
			if(cnt>n/2)v=a[i];
		}
		else{
			cnt=1;
		}
	}
	if(v>=0)cout<<v<<endl;
	else{cout<<"NO COLOR"<<endl;}
	}
	return 0;
}

Measured memory_bytes: 5272
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;

const ll mod = 1000000007;
const int N = 5e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n;
ll a[N];
int main() {
	scanf("%d",&n);
	rep(i, 0, n) scanf("%lld",a+i);
	ll ret = 0;
	rep(i, 0, 60) {
		ll tmp = 1ll << i; tmp %= mod;
		vi L, R;
		L.clear(); R.clear();
		rep(j, 0 ,n) {
			if((1ll<<i)&a[j]) R.pb(j);
			else L.pb(j);
		}
		int l = 0, r = 0;
		int cntL = sz(L), cntR = sz(R);
		ll cur = 0;
		while(l < cntL && r < cntR) {
			if(L[l] < R[r]) {
				cur += 1ll * (cntR - r) * tmp;
				l++;
			} else {
				cur += 1ll * (cntL - l) * tmp;
				r++;
			}
			cur %= mod;
		}
		ret += cur;
		ret %= mod;
	}
	printf("%lld\n", ret);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> ret(N+1, 0);
  for(int i=2; i<=N; ++i) {
    int A;
    cin >> A;
    ret[A]++;
  }
  for(int i=1; i<=N; ++i) {
    cout << ret[i] << endl;
  }
}

Measured memory_bytes: 4052
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
  //↓見なくていいよ！ここから------------------------------------------
  static public class InputIterator{
    ArrayList<String> inputLine = new ArrayList<String>(1024);
    int index = 0; int max;
    InputIterator(){
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      while(true){
        String read;
        try{
          read = br.readLine();
        }catch(IOException e){
          read = null;
        }
        if(read != null){
          inputLine.add(read);
        }else{
          break;
        }
      }
      max = inputLine.size();
    }
    public boolean hasNext(){return (index < max);}
    public String next(){
      if(hasNext()){
        String returnStr = inputLine.get(index);
        index++;
        return returnStr;
      }else{
        throw new IndexOutOfBoundsException("これ以上入力はないよ。");
      }
    }
  }
  
  static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと
  static PrintWriter out = new PrintWriter(System.out);
  static void flush(){out.flush();}
  static void myout(Object t){out.println(t);}
  static void myerr(Object t){System.err.println(t);}
  static String next(){return ii.next();}
  static int nextInt(){return Integer.parseInt(next());}
  static long nextLong(){return Long.parseLong(next());}
  static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}
  static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(" ")));}
  static ArrayList<String> nextCharArray(){return mySingleSplit(next());}
  static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split("")));}
  static ArrayList<Integer> nextIntArray(){
    ArrayList<Integer> ret = new ArrayList<Integer>();
    ArrayList<String> input = nextStrArray();
    for(int i = 0; i < input.size(); i++){
      ret.add(Integer.parseInt(input.get(i)));
    }
    return ret;
  }
  static ArrayList<Long> nextLongArray(){
    ArrayList<Long> ret = new ArrayList<Long>();
    ArrayList<String> input = nextStrArray();
    for(int i = 0; i < input.size(); i++){
      ret.add(Long.parseLong(input.get(i)));
    }
    return ret;
  }
  static String kaigyoToStr(String[] list){return String.join("\n",list);}
  static String kaigyoToStr(ArrayList<String> list){return String.join("\n",list);}
  static String hanSpToStr(String[] list){return String.join(" ",list);}
  static String hanSpToStr(ArrayList<String> list){return String.join(" ",list);}
  public static void main(String[] args){
    solve();
    flush();
  }
  //↑見なくていいよ！ここまで------------------------------------------
  static public void solve(){//ここがメイン関数代わり
    ArrayList<Integer> one = nextIntArray();
    myout(one.get(0) * one.get(1));
  }
  //Method addition frame start

  //Method addition frame end
}


Measured memory_bytes: 32900
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int a, b, c;

signed main() {
    cin >> a >> b >> c;
    rep(i,0,100) {
        int t = 60 * i + c;
        int span = a + b;
        int sptime = t - t / span * span;
        if(sptime <= a) {
            cout << t << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
const int maxn=10100;
const int maxm=10000*10000/2;
int par[maxn],rankl[maxn];

//??¶??\???
void init(int n)
{
	for(int i=0;i<=n;i++)
	{
		par[i]=i;
		rankl[i]=0;
	}
}
int findl(int x)
{
	if(par[x]==x)
		return x;
	else
		return par[x]=findl(par[x]);
}
void unite(int x,int y)
{
	x=findl(x);
	y=findl(y);
	if(x==y)  return;
	if(rankl[x]<rankl[y]){
		par[x]=y;
	}else
	{
		par[y]=x;
		if(rankl[x]==rankl[y])  rankl[x]++;
	}
}
bool same(int x,int y)
{
	return findl(x)==findl(y);
}
struct edge{
	int u,v;
	double cost;
};
bool cmp(const edge e1,const edge e2)
{
	return e1.cost<e2.cost;
}
edge es[maxm];
int n,m;
double kruskal()
{
	sort(es+1,es+m+1,cmp);
	init(n);
	double res=0;
	for(int i=1;i<=m;i++){
		edge e=es[i];
		if(!same(e.u,e.v)){
			unite(e.u,e.v);
			res+=e.cost;
		}
	}
	return res;
}
double  a[maxn],b[maxn];
struct app
{
	int x,y;
};
app s[maxm];
double distance(double x1,double y1,double  x2,double  y2)
{
	double t1=(x1-x2)*(x1-x2);
	double t2=(y1-y2)*(y1-y2);
	return sqrt(t1+t2);
}
int main()
{
    while(cin>>n>>m)
	{
		memset(a,0,sizeof(a));
		memset(b,9,sizeof(b));
		for(int i=1;i<=n;i++)     //?????\????????????
		{
			scanf("%lf%lf",&a[i],&b[i]);
		}
		double hh=0.0;
		for(int i=1;i<=m;i++)   //?????\????????????
		{
			scanf("%d%d",&s[i].x,&s[i].y);
			int x=s[i].x,y=s[i].y;
			es[i].u=x,es[i].v=y;
			es[i].cost=-distance(a[x],b[x],a[y],b[y]);
			 hh+=-es[i].cost;
		}
		double tt=0-kruskal();
		printf("%.3lf\n",hh-tt);
	}
    return 0;
}

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

typedef long long ll;

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

// chmax, chmin
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; }

int main() {
    int N,K;
    cin >> N >> K;
    
    vector<int> A(N);
    REP(i,N){
        cin >> A[i];
    }
    
    int ng = 0, ok = 1e+9;
    while ( ok - ng > 1 ){
        int mid = (ok+ng) / 2;
        int num = 0;
        REP(i,N){
            int sho,amari;
            sho = A[i] / mid;
            amari = A[i] % mid;
            if ( amari != 0 ) ++sho;
            num += sho;
        }
        if ( num > K+N ) ng = mid;
        else ok = mid;
    }
    
    cout << ok << endl;
    
    
    return 0;
}

Measured memory_bytes: 3988
#include <iostream>
#include <string>
#include <set>
#include <cctype>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <limits>
#include <cmath>
#include <typeinfo>

using namespace std;
 
int main() {
	int n = 0, m = 0;
	cin >> n >> m;
	if(n == m) {
		for(int i = 0; i < n; i++) {
			cout << n;
		}
		return 0;
	}
	if(n > m) {
		for(int i = 0; i < n; i++) {
			cout << m;
		}
		return 0;
	}
	if(n < m) {
		for(int i = 0; i < m; i++) {
			cout << n;
		}
		return 0;
	}

	return 0;		
    
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>
using namespace std;

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

int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w;
    cin >> h >> w;
    queue<vector<int>> black_q;
    vector<vector<char>> c(h, vector<char>(w, 'X'));
    vector<vector<int>> a(h, vector<int>(w, -1));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> c.at(i).at(j);
            if (c.at(i).at(j) == '#') {
                black_q.push({i, j});
                a.at(i).at(j) = 0;
            }
        }
    }
    int num = 0;
    while (black_q.size()) {
        int x = black_q.front().at(0), y = black_q.front().at(1);
        black_q.pop();
        for (int i = 0; i < 4; i++) {
            if (x + dx[i] < 0 || h <= x + dx[i] || y + dy[i] < 0 || w <= y + dy[i]) continue;
            if (c.at(x + dx[i]).at(y + dy[i]) == '.' && a.at(x + dx[i]).at(y + dy[i]) == -1) {
                black_q.push({x + dx[i], y + dy[i]});
                a.at(x + dx[i]).at(y + dy[i]) = a.at(x).at(y) + 1;
                num = max(num, a.at(x + dx[i]).at(y + dy[i]));
            }
        }
    }
        
    cout << num << endl;
    
    return 0;
}


Measured memory_bytes: 60724
//=template===================================================================//
// include
#include <vector>
#include <list>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

// namespace
using namespace std;

// define
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,n) FOR(i,0,n)
#define MIN_V(v) *min_element(v.begin(), v.end())
#define MAX_V(v) *max_element(v.begin(), v.end())

// typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef long long LL;
typedef unsigned long long ULL;
typedef struct {
  LL cost;
  bool done;
} node_t;

// conversion
inline int
toInt(string s)
{
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline int countChar(string s, char c) {int cnt,i; cnt=0; REP (i,s.size()) {if (s[i]==c) cnt++;} return cnt;}
template<class T> inline string toString(T x) {ostringstream sout; sout<<x; return sout.str();}
//============================================================================//

//=variables==================================================================//

//============================================================================//
int main(void)
{
  // Scan begin.
  int a, b, c;
  cin >> a >> b >> c;
  // Scan done.

  // Code begin.
  if (a == b && a != c) {
      cout << "Yes" << endl;
  }
  else if (a == c && a != b) {
      cout << "Yes" << endl;
  }
  else if (b == c && a != b) {
      cout << "Yes" << endl;
  }
  else {
      cout << "No" << endl;
  }
  // Code done.

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	long int D,N;
	cin>>D>>N;
	int ans=0;
	
	if(D==0)
	ans=1;
	else if(D==1)
	ans=100;
	else
	ans=10000;
	if(N==100){
	cout<<101*ans<<endl;
	return 0;
	}
	
	cout<<ans*N<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
		sort(a+1,a+n+1);
	for(int i=n,b=0;i>0;--i){
		if(a[i]==a[i-1]){
			if(b){printf("%lld",1ll*b*a[i]);return 0;}
			else b=a[i],--i;
		}
	}
	puts("0");
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

#define PRINT(x) cout << x << endl;
#define REP(i, n) for(int i = 0; i < n; i++)
#define INF 1e17

using namespace std;
typedef long long ll;

ll g[300][300];
ll dist[300][300];

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

int main() {
	ll N, M, L;
	ll A, B, C;

	cin >> N >> M >> L;

	REP(i, N) {
		REP(j, N) {
			g[i][j] = dist[i][j] = INF;
		}
		g[i][i] = dist[i][i] = 0;
	}

	REP(i, M) {
		cin >> A >> B >> C;
		chmin(g[A - 1][B - 1], C);
		chmin(g[B - 1][A - 1], C);
	}

	REP(k, N) REP(i, N) REP(j, N) chmin(g[i][j], g[i][k] + g[k][j]);

	REP(i, N) REP(j, N) if (i != j && g[i][j] <= L) dist[i][j] = 1;

	REP(k, N) REP(i, N) REP(j, N) chmin(dist[i][j], dist[i][k] + dist[k][j]);

	int Q, s, t;
	cin >> Q;

	REP(i, Q) {
		cin >> s >> t;
		if (dist[s - 1][t - 1] == INF) PRINT(-1)
		else PRINT(dist[s - 1][t - 1] - 1);
	}

	return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
int main(void) {
	int a,b;
	while(scanf("%d %d",&a,&b)>=0){
		int i=0,c;
		c=a+b;
		while(c!=0){
			c=c/10;
			i++;
		}
		printf("%d\n",i);
	}
	return 0;
}


Measured memory_bytes: 1920
/*
h s, d't skp th si tll i's sved
 * ABC141 E
 * ABC145 D
 * ABC147 F
 * ABC174 F
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
bool slv(string s)
{
for(int i=0;i<s.length()/2;i++)
{
if(s[i]!=s[s.length()-1-i])
{
return 0;
}
}
return 1;
}
int main()
{
string s;
cin>>s;
int n=s.length();
if(slv(s) && slv(s.substr(0,(n-1)/2)) && slv(s.substr((n+3)/2-1,n)))
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No";
}
}



/*
 * ||||


 */

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) (int)(a.size())
#define x first
#define y second
using namespace std;
const int MAXV = 405;
const int MAXT = 10005;
vector<pair<int, int> > g[MAXV];
int id[MAXT] , dst[MAXT] , Tmax , n , m;
void inputG()
{
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int u, v, d; cin >> u >> v >> d;
		u--; v--;
		g[u].push_back({v, d});
		g[v].push_back({u, d});
	}
}
void inputQueries()
{
	
	cin >> Tmax;
	memset(id , -1 , sizeof id);
	for(int i = 0; i < Tmax; i++) {
		int Nnew; cin >> Nnew;
		for(int j = 0; j < Nnew; j++) {
			cin >> id[i] >> dst[i];
		}
	}
}
vector<pair<int , int> > spanTree[MAXV];
int p[MAXV];
int find(int u)
{
	return p[u] = p[u] == u ? u : find(p[u]);
}
void unite(int u , int v , int c)
{
	int U = find(u) , V = find(v);
	if(U != V)
	{
		p[V] = U;
		spanTree[u].pb({v , c});
		spanTree[v].pb({u , c});
	}
}

void buildSpan()
{
	for(int u = 0; u < n; u++)p[u] = u;
	vector<pair<int , pair<int , int> > > edges;
	for(int u = 0; u < n; u++)
		for(auto v : g[u])
			if(u < v.x)
				edges.pb({v.y , {u , v.x}});
	sort(edges.begin() , edges.end());
	for(auto e : edges)
		unite(e.y.x , e.y.y , e.x);
}

vector<int> route;
void dfs(int u , int p = -1)
{
	for(auto v : spanTree[u])
		if(v.x != p)
		{
			for(int i = 0; i < v.y; i++)
				route.pb(v.x);
			dfs(v.x , u);
			for(int i = 0; i < v.y; i++)
				route.pb(u);
		}
			
}
void findRoute()
{
	dfs(0);
}
int main() {
	inputG();
	inputQueries();
	buildSpan();
	findRoute();
	int cntStop = 0;
	for(int i = 0; i < Tmax; i++)
	{
		if(i < cntStop)
			cout << -1 << endl;
		else
			cout << route[(i - cntStop) % sz(route)] + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ieps (int) 1e6
#define eps (int) 1e9
#define pii pair<int,int>



int32_t main(){
	string s;
	cin>>s;
	for(int i = 0;i<s.size();i++){
		if(s[i] != s[s.size()-i-1]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
<?php

$n = trim(fgets(STDIN));

$ac = 0;
$wa = 0;
$tle = 0;
$re = 0;

for($i=0; $i<$n; $i++){
    $s = trim(fgets(STDIN));
    if($s == 'AC'){
        $ac++;
    }elseif($s == 'WA'){
        $wa++;
    }elseif($s == 'TLE'){
        $tle++;
    }else{
        $re++;
    }
}

echo "AC x ". $ac,PHP_EOL;
echo "WA x ". $wa,PHP_EOL;
echo "TLE x ". $tle,PHP_EOL;
echo "RE x ". $re,PHP_EOL;


Measured memory_bytes: 16280
fun main(args: Array<String>) {
    val (A, B, H, M) = readLine()!!.split(" ").map(String::toInt)
    val h = H * 60 + M
    val xh = A * Math.cos((180 - h) * Math.PI / 360)
    val yh = A * Math.sin((180 - h) * Math.PI / 360)
    val xm = B * Math.cos((15 - M) * Math.PI / 30)
    val ym = B * Math.sin((15 - M) * Math.PI / 30)
    println(Math.sqrt((xh - xm) * (xh - xm) + (yh - ym) * (yh - ym)))
}

Measured memory_bytes: 36584
#include <iostream>
#include <algorithm>
#include <list>
using namespace std;



int main() {
    int N;
    cin >> N;
    int l, i=0, L[N];
    while(cin >> l) {
        L[i] = l;
        i++;
        if(i==N) break;
    }

    int j, k, z, count=0;
    for(i=0; i<N; i++) {
        for(j=i+1; j<N; j++) {
            if(L[i]==L[j]) continue;
            for(k=j+1; k<N; k++) {
                if(L[i]==L[k] || L[j]==L[k]) continue;
                z = max({L[i], L[j], L[k]});
                if(z < L[i]+L[j]+L[k]-z) count++;
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n,k; cin >> n >> k;
	vl a(n); rep(i,n) cin >> a[i];
	if(k>=n) puts("0");
	else{
		ll sum = 0;
		sort(all(a));
		rep(i,n-k) sum += a[i];
		cout << sum << endl;
	}
}

Measured memory_bytes: 1792
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// ??\????????????????????????
            
            String line = br.readLine();
            String[] dataArray = line.split(" ");
            int x = Integer.parseInt(dataArray[0]);
            int y = Integer.parseInt(dataArray[1]);
            if(x<y) System.out.println(Result.LessThan.getValue());
            if(x==y) System.out.println(Result.Equal.getValue());
            if(x>y) System.out.println(Result.GreaterThan.getValue());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // private static void processLine(String line) {
    // System.out.println(line);
    // }
   public enum Result{
    	LessThan("a < b"),
    	Equal("a == b"),
    	GreaterThan("a > b");
	   
		// ?????£??????????????????
	    private String name;
	    
	    // ??????????????????????????????
	    private Result(String name) {
	        this.name = name;
	    }
	    
	    // ????????????
        public String getValue() {
            return this.name;
        }
   };
}

Measured memory_bytes: 24296
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  ll N, K;
  cin >> N >> K;
  vll a(N), aa(N);
  vll highest(N), highestt(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    if(i == 0) highest.at(0) = a.at(0);
    else if(a.at(i) > highest.at(i-1)) highest.at(i) = a.at(i);
    else highest.at(i) = highest.at(i-1);
  }
  aa = a; highestt = highest;


  ll result = INF;
  for(int tmp = 0; tmp < (1 << (N-1)); tmp++){
    bitset<14> bit(tmp);
    if(bit.count() !=  K-1) continue;
    a = aa; highest = highestt;
    ll sum = 0;
    for(int i = 0; i < N-1; i++){
      if(bit.test(i)){ //i+1番目がみえる
        if(a.at(i+1) <= highest.at(i)){
          sum += (highest.at(i) + 1LL - a.at(i+1));
          a.at(i+1) = highest.at(i) + 1LL;
        }
      }
      highest.at(i+1) = max(a.at(i+1), highest.at(i));  // ハマった原因は、見えるようにしたいビルでしかhighestを更新していなかったこと。見えるようにしたいビル以外もhighestを更新していることがある。
    }
    chmin(result, sum);
  }
  cout << result << endl;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; ll k; cin >> n >> k;
    vector<pair<int, int>> p(n);
    for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());
    for (int i = 0; i < n; i++) {
        if (k <= p[i].second) {
            cout << p[i].first << endl;
            return 0;
        }
        k -= p[i].second;
    }
    return 0;
}


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

ll extended_gcd(ll a, ll b, ll &x, ll &y)
{
    if(a==0)
    {
        x = 0;
        y = 1;
        return b;
    }
    
    ll x1,y1;
    ll g = extended_gcd(b%a, a, x1, y1);
    
    x = y1-(b/a)*x1;
    y = x1;
    return g;
}

ll powe(ll x,ll n) {
  if(x==0) return 0;
  if(n==0) return 1;
  ll val = powe(x,n/2);
  if(n%2) return (((val*val)%N)*x)%N;
  return (val*val)%N;
}

// ll comb(ll n, ll k) { 
//     if(k==0) return 1;
//     if(k==n) return 1;
//     return (((mods[n]*invmods[n-k])%N)*invmods[k])%N;
// }

ll cofac(vector<vector<ll> > &adj) {
  ll tot = 1, idx;
  ll res = 1;

  for(ll i=1;i<adj.size();i++) {
    idx = i;

    while(idx<adj.size() && !adj[idx][i])
      idx++;

    if(idx==adj.size())
      return 0;

    if(idx!=i) {
      swap(adj[i],adj[idx]);
      if((idx-i)%2)
        res = -res;
    }

    vector<ll> temp(adj[i].begin(),adj[i].end());

    ll val = temp[i];
    for(ll j=i+1;j<adj.size();j++) {
      ll curr = adj[j][i];

      for(ll k=i+1;k<adj.size();k++) {
        adj[j][k] = ((val*adj[j][k])%N - (curr*temp[k])%N + 2*N)%N;
      }

      tot = (tot*val)%N;
    } 
  }

  for(ll i=1;i<adj.size();i++)
    res = (res * adj[i][i])%N;
  
  ll x,y;
  extended_gcd(tot,N,x,y);
  // cout<<(res*x)%N<<endl;
  return (2*N+(res*x)%N)%N;
}

int main() {

  int a;
  string s;

  cin>>a>>s;
  if(a>=3200) cout<<s<<endl;
  else cout<<"red"<<endl;


  return 0;
} 


Measured memory_bytes: 256
import sys
from statistics import *
from collections import *
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
li = [[0, 0, 0]]
for i in range(1, n):
    li.append(na())
for i in range(1, n):
    t = 0
    for j in range(i, n):
        c, s, f = li[j]
        if t < s:
            t = s
        else:
            for k in range(t, t+f+1):
                if k % f == 0:
                    t = k
                    break
        t += c
    print(t)
print(0)

Measured memory_bytes: 5276
#include <bits/stdc++.h>
#define sf sacnf
#define pf printf
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define ii pair <int,int>
#define iii pair <int,ii>
#define pll pair <ll,ll>
#define plll pair <ll,pll>
#define Ziru 0
using namespace std;

int main(){
    int a,b;

    while(cin>>a>>b, a&&b){
        for(int i=1; i<=a; i++){
            for(int j=1; j<=b; j++){
                if(i==1 || i==a) cout<<"#";
                else if((i!=1 || i!=a) && (j==1 || j==b)) cout<<"#";
                else cout<<".";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return Ziru;
}



Measured memory_bytes: 3012
/**
 *      ABC 89 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-01 01:48:47
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; cin >> N;
    vector<char> S;
    for (int i = 0; i < N; ++i) {
        char x; cin >> x;
        S.push_back(x);
    }
    int p = 0; int w = 0; int g = 0; int y = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'P'){
            ++p;
        }
        else if (S[i] == 'W'){
            ++w;
        }
        else if (S[i] == 'G'){
            ++g;
        }
        else if (S[i] == 'Y'){
            ++y;
        }
        
    }
    p * w * g * y == 0 ? cout << "Three" << endl : cout << "Four" << endl; 
    return 0;
}



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

int main() {
    while (true) {
        int n; cin >> n;
        if (n == 0) break;
        vector<string> s(n);
        for (int i = 0; i < n; i++) {
            cin >> s[i];
        }
        for (int i = 0; i < n; i++) {
            //cout << i << endl;
            int cnt = 0;
            int state = 0;
            for (int j = i; j < n; j++) {
                cnt += s[j].size();
                if (state == 0) {
                    if (cnt == 5) {
                        state = 1;
                    }
                    else if (cnt > 5) {
                        break;
                    }
                }
                else if (state == 1) {
                    if (cnt == 12) {
                        state = 2;
                    }
                    else if (cnt > 12) {
                        break;
                    }
                }
                else if (state == 2) {
                    if (cnt == 17) {
                        state = 3;
                    }
                    else if (cnt > 17) {
                        break;
                    }
                }
                else if (state == 3) {
                    if (cnt == 24) {
                        state = 4;
                    }
                    else if (cnt > 24) {
                        break;
                    }
                }
                else if (state == 4) {
                    if (cnt == 31) {
                        state = 5;
                        break;
                    }
                    else if (cnt > 31) {
                        break;
                    }
                }
            }
            //cout << state << endl;
            if (state == 5) {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3164
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

from math import gcd
k = inn()
sm = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        g = gcd(i,j)
        if g==1:
            sm += k
        else:
            for m in range(1,k+1):
                sm += gcd(g,m)
print(sm)


Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
 
string a, b, c;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    cin >> a >> b >> c;
    cout << a[0] << (char) toupper(b[0]) << c[0] << '\n';
   	
    return 0;
}

Measured memory_bytes: 256