akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    res = INF;
    vector<vector<int>> G(N,vector<int>(N,-1));
    
    function<void(vector<int>,int)> rec = [&](vector<int> vs,int dep){
        int n = (int)vs.size();
        if(n == 1) return;
        for(int i = 0; i < n;i++){
            for(int j = i+1; j < n;j++){
                if((j-i)%2==1){
                    G[vs[i]][vs[j]] = dep;
                    G[vs[j]][vs[i]] = dep;
                }
            }
        }
        
        vector<int> l,r;
        for(int i = 0; i < n;i++){
            if(i%2 == 0) l.push_back(vs[i]);
            else r.push_back(vs[i]);
        }
        rec(l,dep+1);
        rec(r,dep+1);
    };
    
    vector<int> order(N); iota(order.begin(),order.end(),0);
    rec(order,1);
    
    for(int i = 0; i < N;i++){
        for(int j = i+1; j < N;j++){
            cout << G[i][j] << " ";
        }cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    vector<int> m(n);
    rep(i, n) cin >> a[i];
    rep(i, n) m[i]=a[i];
    if(!prev_permutation(a.begin(),a.end())) {}
    else {
        rep(i ,n - 1) cout << a[i] << " ";
        cout << a[n-1] << endl;
    }
    rep(i ,n - 1) cout << m[i] << " ";
    cout << m[n-1] << endl;
    if(!next_permutation(m.begin(),m.end())) {}
    else {
        rep(i ,n - 1) cout << m[i] << " ";
        cout << m[n-1] << endl;
    }
}


Measured memory_bytes: 3092
using System;
using System.Diagnostics;
using System.IO;

namespace AtCoder.MinPuro2019 {
    class B {
        static void Main() => CustomMain();

        static void Solve() {
            var r = new int[3][];
            r[0] = ReadIntArray();
            r[1] = ReadIntArray();
            r[2] = ReadIntArray();
            var c = new int[4];

            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 2; j++) {
                    c[r[i][j] - 1]++;
                }
            }

            for (int i = 0; i < c.Length; i++) {
                if (3 <= c[i]) {
                    WriteAnswer("NO");
                    return;
                }
            }

            WriteAnswer("YES");
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());
        static float ReadFloat() => float.Parse(Console.ReadLine());
        static double ReadDouble => double.Parse(Console.ReadLine());
        static string ReadString() => Console.ReadLine();

        static int[] ReadIntArray() => Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(Console.ReadLine().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
        static string[] ReadStringArray() => Console.ReadLine().Split(' ');

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<algorithm> 
#include<cstdio>
#include<cctype>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int maxn= 2e5+5;
const double pi = acos(-1.0);
const ll mod = 1e9+7;
int main(){
   
     double a,b,h,m,d1,d2,d3,ans;
     cin>>a>>b>>h>>m;
     d2=m*6;
     d1=h*30+1.0*m/2;
     d3=abs(d1-d2);
     
     ans=sqrt(a*a+b*b-2*a*b*cos(d3*pi/180));
     printf("%.20lf",ans);
     return 0;
 }

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

ll gcd (ll a, ll b) {
    if (b > a) {
        ll tmp = b;
        b = a;
        a = tmp;
    }
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A.at(i);

    sort(A.begin(), A.end());
    ll a = A.at(0);
    for (int i = 1; i < N; i++) {
        a = gcd(a, A.at(i));
    }

    cout << a << endl;
    return 0;
}

Measured memory_bytes: 3932
#include<iostream>
#include<string>
#define NUM 26
using namespace std;

int gcd(int a, int b){
	if(a%b){
		return gcd(b, a%b);
	}
	return b;
}

int main(){
	int a, y, b, n, i, j, k, fy;
	int ay[257];
	string str, tmpstr;
	cin>>n;cin.ignore();
	for(i=0;i<n;i++){
		getline(cin, str);
		y=0;
		tmpstr = str;
		while(true){
			tmpstr=str;
			while(true){
				y++;
				if(gcd(NUM, y) == 1){
					break;
				}
			}
			for(j=0;j<tmpstr.size();j++){
				if(tmpstr[j] != ' '){
					ay[j] = int(tmpstr[j] - 'a') * y;
				}else{
					ay[j] = -1;
				}
			}
			for(b=0;b<NUM;b++){
				for(j=0;j<tmpstr.size();j++){
					if(ay[j] == -1){
						tmpstr[j] = ' ';
					}else{
						tmpstr[j] = 'a' + ((ay[j] + b) % NUM);
					}
				}
				if(tmpstr.find("this") != string::npos)break;
				if(tmpstr.find("that") != string::npos)break;
				tmpstr = str;
			}
			if(b!=NUM)break;
		}
		cout << tmpstr << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<int,int>
#define iil pair<ll,ll>
#define se second
#define ld long double
#define mod 1000000007
#define popcount __builtin_popcountll
#define x0 zxcxzcsacasd
#define x1 ghfghujfgfg
#define y0 olkjhdnncvcv
#define y1 bhvgrewm345345435
#define debug(x) std::cerr<<#x<<": "<<(x)<<'\n'
#define all(x) x.begin(), x.end()
using namespace std;

int main(){
	ll a, b, c, d;
	cin>>a>>b>>c>>d;
	set<ll>s1, s2;
	for(ll i=0;i<=5;i++){
		if(i + a<=b)s1.insert(i + a);
		if(b - i>=a)s1.insert(b - i);
		
		if(i + c<=d)s2.insert(i + c);
		if(d - i>=c)s2.insert(d - i);
	}
	ll amid = a * c;
	for(auto x:s1){
		for(auto xx:s2){
			amid = max(amid, x*xx);
		}
	}
	cout<<amid<<endl;
}


Measured memory_bytes: 3632
import sys
from collections import deque

queue = deque()

for _ in range(int(sys.stdin.readline())):
    commands = sys.stdin.readline()[:-1].split(" ")
    if commands[0] == "insert":
        queue.appendleft(commands[1])
    elif commands[0] == "delete":
        try:
            queue.remove(commands[1])
        except ValueError:
            pass
    elif commands[0] == "deleteFirst":
        queue.popleft()
    elif commands[0] == "deleteLast":
        queue.pop()

print(" ".join(queue))

Measured memory_bytes: 71948
C = []
SUM = 0
for i in range(3):
    temp = input().split(" ")
    temp = [int(i) for i in temp]
    C.append(temp)
count = 0
for i in range(101):
    a1 = i
    b1 = C[0][0] - a1
    b2 = C[0][1] - a1
    b3 = C[0][2] - a1
    a2 = C[1][0] - b1
    a3 = C[2][0] - b1
    a = [a1,a2,a3]
    b = [b1,b2,b3]
    #print(a,b)
    for j in range(3):
        for k in range(3):
            judge = a[j] + b[k]
            if judge == C[j][k]:
                count += 1
    if count == 9:
        print("Yes")
        break

if count != 9:
	print("No")

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

s=input().rstrip()
if s=="AAA" or s=="BBB":
    print("No")
else:
    print("Yes")

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

#define PI 3.14159265359
#define eps 1e-8
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
typedef long long int ll;
const int INF = 1<<29;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

double tick() { 
	static clock_t oldticks;
	clock_t newticks = clock();
	double diff = 1.0 * (newticks - oldticks) / CLOCKS_PER_SEC; 
	oldticks = newticks;
	return diff;
}

bool prime[10000010];
inline void sieve(){
	prime[0]=prime[1]=0;
	for(int i=2;i<10000010;i++)
		prime[i]=1;
	for(int i=2;i<sqrt(10000010);i++){
		if(prime[i]==1){
			for(int j=i*i;j<10000010;j+=i)
				prime[j]=0;
		}
	}
}

inline bool isPrime(ll n){
    if (n <= 1)
        return false; 
    for (int i = 2; i < n; i++)
        if (n % i == 0)
            return false;
    return true;
}

inline int toInt(string s){
	//return atoi(s.c_str());
	int x=(int)s[0]-48;
	return x;
}

inline int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}

inline int lcm(int a,int b){
	return a*(b/gcd(a,b));
}

inline bool isLeap(int yy){
	return ((yy%4 == 0 && yy%100 != 0) || yy%400 == 0);
}

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("output.txt","w",stdout);	
	

    string s;
    cin >> s;

    bool c[100005];
    memset(c,false,sizeof(c));
    c[0]=true;

    FORN(i,5,(int)s.size()){
        if(c[i-5] && s.substr(i-5,5)=="dream")
            c[i]=true;
        if(i>=7 && c[i-7] && s.substr(i-7,7)=="dreamer")
            c[i]=true;
        if(c[i-5] && s.substr(i-5,5)=="erase")
            c[i]=true;
        if(i>=6 && c[i-6] && s.substr(i-6,6)=="eraser")
            c[i]=true;
    }

    cout << (c[s.size()]?"YES\n":"NO\n");

    //cerr << tick();

	return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define int long long


const int MAX = 1000002;
const int MOD = 1000003;
//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
    
    // 前処理
    COMinit();
    int Q,x,d,n,dn,p,q;
    cin>>Q;
    for(int i=0;i<Q;i++){
        cin>>x>>d>>n;
        if(d==0){
            p=1;q=x;dn=1;
            while(n>=p){
           if(n&p)dn=(dn*q)%MOD;
           p*=2;
           q=(q*q)%MOD;
       }
        cout<<dn<<endl;
            continue;
        }
        if(n>=1000003){
            cout<<0<<endl;
            continue;
        }
       if(((MOD-x)*inv[d])%MOD<n){
           cout<<0<<endl;
           continue;
       }
       p=1;q=(MOD-d);dn=1;
       while(n>=p){
           if(n&p)dn=(dn*q)%MOD;
           p*=2;
           q=(q*q)%MOD;
       }
       cout<<(((fac[((MOD-x)*inv[d])%MOD]*finv[((MOD-x)*inv[d])%MOD -n])%MOD)*dn)%MOD<<endl;


     
        

    }
}


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

int main(void){
    string S,T;
    int sum=0;
    cin >> S ;
    cin >> T;
    rep(i,3)if(S[i]==T[i])sum++;
    cout << sum <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
constexpr ll mod = 1000000007;

#define NMAX 300010
ll op(ll a, ll b) { return max(a, b); }
ll e() { return 0; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];

    segtree<ll, op, e> t(NMAX);
    ll ans = 0;
    rep(i, 0, n) {
        ll l = max(a[i] - k, 0LL);
        ll r = min(a[i] + k, (ll)NMAX-1LL);
        ll tmp = t.prod(l, r+1) + 1;
        ans = max(ans, tmp);
        t.set(a[i], tmp);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16116
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;
// ついでに有理数型
using rat = boost::rational<bint>;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()


int main(){
    ll N;string c;
    cin >> N >> c;
    ll w=0,r=0;
    for (int i = 0; i < N; i++) {
      if(c[i] == 'R')r++;
      else w++;
    }if(w == N){cout << 0 << endl; return 0;}
    w = 0;
    ll ans = LLONG_MAX;
    for (int i = 0; i < N; i++) {
      if(c[i] == 'W')w++;
      else r--;
      ll x = min(w,r) + abs(r-w);
      ans = min(ans , x);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3752
#include<stdio.h>
int main(void){
    int x,y,i;
    for(i=0;i<3000;i++){
        scanf("%d %d\n",&x,&y);
        if(x==0&&y==0)break;
        if(x>y){
            printf("%d %d\n",y,x);
        }else{
            printf("%d %d\n",x,y);
        }
    }
}


Measured memory_bytes: 2040
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	A := sc.i()
	B := sc.i()
	fmt.Println(A * B)

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 1760
#include<stdio.h>
#include <iostream>
#include <string.h>

using namespace std;

typedef struct{
	char name[11];
	int time;
}Process;

class ProcessQueue{
public:
	ProcessQueue(int size):
		m_size(size),
		m_head(0),
		m_tail(0),
		number(0)
	{
		m_process = new Process[m_size];
	};

	~ProcessQueue(){
		delete[] m_process;
	};

	void enQueue(Process process){
		

		m_process[m_tail] = process;	

		number++;

		if(m_tail < m_size-1){
			m_tail++;
		}else{
			m_tail = 0;
		}
	};

	Process deQueue(){
		number--;
		if(m_head < m_size-1){
			m_head++;
			return m_process[m_head-1];
		}else{
			m_head = 0;
			return m_process[m_size-1];
		}
	};

	int getNumber(){
		return number;
	}

private:
	int m_head;
	int m_tail;
	int m_size;
	int number;
	Process* m_process;

};

int main(){

	int n,q,totaltime=0;
	scanf("%d%d",&n,&q);

	ProcessQueue queue(n);

	Process tmp;
	for(int i = 0; i < n; i++){
		scanf("%s%d",&tmp.name,&tmp.time);
		queue.enQueue(tmp);
	}

	while(queue.getNumber() != 0){
		tmp = queue.deQueue();
		if(tmp.time - q > 0){
			totaltime += q;
			tmp.time -= q;
			queue.enQueue(tmp);
		}else{
			totaltime += tmp.time;
			printf("%s %d\n",tmp.name,totaltime);
		}
	}

}



Measured memory_bytes: 3496
import math
a,b,x=map(int,input().split())

bottle=(a**2)*b

if x <= bottle/2:
  # 半分以上傾ける場合
  soko=(x*2/b)/a
  
  #bに対してtangent(r)がsokoとなるrを求める
  r=90-(math.degrees(math.atan(soko/b)))
  
else:
  # 半分傾けられない場合
  takasa=((a**2)*b-x)*2/(a**2)
  
  #takasaに対してtangent(r)がaとなるrを求める
  if takasa==0:
    r=0
  else:
      r=90-(math.degrees(math.atan(a/takasa)))

print(r)

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

int main()
{
	string S;
	cin >> S;

	string T( "AKIHABARA" );
	int loc[4] = { 0, 4, 6, 8 };
	int N = T.size();
	vector<string> vt;
	for( int mask = 0; mask < 1 << 4; mask++ ) {
		string t = T;
		for( int i = 0; i < 4; i++ ) {
			if( mask >> i & 1 ) {
				t[ loc[i] ] = '0';
			}
		}
		for( int j = t.size() - 1; j >= 0; j-- ) {
			if( t[j] == '0' ) t.erase( t.begin() + j );
		}
		vt.push_back( t );
	}
	string ans = "NO";
	for( int i = 0; i < vt.size(); i++ ) {
		if( vt[i] == S ) {
			ans = "YES";
			break;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
const long long INFll=1ll*INF*INF;
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define debug(x) cout << x << endl;
#define sz(a) int((a).size())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
long long genrand(long long L,long long R)
{
	return uniform_int_distribution<long long>(L, R)(rng);
}
//use brackets before operations if taking MOD
//use map only when necessary
//give long long to arrays and variables properly
int mul(int a, int b,int mod = MOD) {
	return int(a * 1ll * b % mod);
}
int norm(int a,int mod = MOD) {
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
	//a = (a%mod+mod)%mod;
	return a;
}
int powmod(int x,int y,int mod = MOD){
	int res = 1;
	while(y>0)
	{
		if(y&1)
			res = mul(res,x,mod);
		x = mul(x,x,mod);
		y=y>>1;
	}
	return res;
}
int inv(int a,int mod = MOD) {
	return powmod(a, mod - 2);
}
int main() {

	fast();

	int n, k; cin>>k>>n;
	int a[n];
	for(int i = 0;i<n;i++){
		cin>>a[i];
	}
	int ans = k-a[n-1]+a[0];
	for(int i = 1;i<n;i++){
		ans = max(ans, a[i] - a[i-1]);
	}
	cout<<k-ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
import sys

def main():
    N,M = map(int,input().split())
    arr = []
    for i in range(M):
        x,y = map(int,input().split())
        arr.append(x)
    arr = sorted(arr,reverse=True)
    ans = 0
    cnt = 0
    for x in arr:
        if cnt >= M-1:
            break
        cnt += 1
        if x < N:
            ans += N - x
    print(ans)
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 7660
#include<stdio.h>
int main()
{
    double r,area,circum;
    scanf("%lf",&r);
    area = 3.141592653589*r*r;
    circum = 2*3.141592653589*r;
    printf("%.6lf %.6lf\n",area,circum);
    return 0;
}


Measured memory_bytes: 2128
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if (a > b) swap(a,b);
    if (a > c) swap(a,c);
    if (b > c) swap(b,c);
    printf("%d %d %d\n",a,b,c);
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> heights;
  int h;
  for (int i=0; i<N; i++) {
    cin >> h;
    heights.push_back(h);
  }

  int prev = heights.at(0);
  for (int i=1; i<N-1; i++) {
    if (heights.at(i+1) - heights.at(i) >= 0) {
      if (heights.at(i) - 1 - prev >= 0) {
        prev = heights.at(i) - 1;
      } else {
        prev = heights.at(i);
      }
      continue;
    }

    if (heights.at(i) - heights.at(i+1) == 1 && heights.at(i) - 1 - prev >= 0) {
      prev = heights.at(i) - 1;
      continue;
    }

    cout << "No";
    return 0;
  }

  cout << "Yes";

  return 0;
}


Measured memory_bytes: 892
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    
	    Scanner sc = new Scanner(System.in);  //標準入力の宣言

		int N = sc.nextInt();        //標準入力(入力人数)をNに代入

		int[] intArray;          //int型の1次元配列intArrayを宣言
		intArray = new int[N];   //N個1次元配列intArrayを宣言

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

	//配列を順番に読む
	int kotae = 0;    //答えの変数を宣言
	for(int i=0; i<N; i++) {
		for(int j=i+1; j<N; j++) {
			kotae = kotae + (intArray[i] * intArray[j]);
		}
	}
			
		System.out.println(kotae);

  }
}

Measured memory_bytes: 35748
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	static ArrayList<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		makePrimeList();
		while(stdIn.hasNext()) {
			int n = stdIn.nextInt();
			int min = 0;
			int max = 0;
			for(int i = 0; i < list.size()-1; i++) {
				if(list.get(i) < n && list.get(i+1) >= n) {
					min = list.get(i);
					if(list.get(i+1) != n) {
						max = list.get(i+1);
					}
					else {
						max = list.get(i+2);
					}
				}
			}
			System.out.println(min + " " + max);
		}
	}
	public static void makePrimeList() {
		boolean[] isNotPrime = new boolean[60000];
		isNotPrime[0] = isNotPrime[1] = true;
		for(int i = 2; i < 60000; i++) {
			if(!isNotPrime[i]) {
				list.add(i);
				for(int j = i*2; j < 60000; j+= i) {
					isNotPrime[j] = true;
				}
			}
		}
		
		
	}
}

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

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

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
	(0..n).map(|_| read_vec()).collect()
}

pub trait LexicalPermutation {
	/// Return `true` if the slice was permuted, `false` if it is already
	/// at the last ordered permutation.
	fn next_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T] where T: Ord {
	/// Original author in Rust: Thomas Backman <serenity@exscape.org>
	fn next_permutation(&mut self) -> bool {
		// These cases only have 1 permutation each, so we can't do anything.
		if self.len() < 2 { return false; }

		// Step 1: Identify the longest, rightmost weakly decreasing part of the vector
		let mut i = self.len() - 1;
		while i > 0 && self[i-1] >= self[i] {
			i -= 1;
		}

		// If that is the entire vector, this is the last-ordered permutation.
		if i == 0 {
			return false;
		}

		// Step 2: Find the rightmost element larger than the pivot (i-1)
		let mut j = self.len() - 1;
		while j >= i && self[j] <= self[i-1]  {
			j -= 1;
		}

		// Step 3: Swap that element with the pivot
		self.swap(j, i-1);

		// Step 4: Reverse the (previously) weakly decreasing part
		self[i..].reverse();

		true
	}
}

fn main() {
	let tmp: Vec<usize> = read_vec();
	let (l, r) = (tmp[0], tmp[1]);
	let mut l_mod = l % 2019;
	let mut r_mod = r % 2019;
	if r_mod < l_mod {
		let tmp = r_mod;
		r_mod = l_mod;
		l_mod = tmp;
	}
	if r-l >= 2019 {
		println!("0");
		return;
	}
	let mut min: usize = 1001001001;
	for i in l_mod..r_mod {
		for j in i+1 .. r_mod+1 {
			min = std::cmp::min((i*j)%2019, min);
		}
	}
	println!("{}", min);
}


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

using namespace std;

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

    int sumx = 0, sumx2 = 0;
    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;
        sumx += x, sumx2 += x * x;
    }

    int ans = 1000000;
    for (int i = 1; i <= 100; ++i) {
        int tmp = sumx2 - 2 * i * sumx + i * i * N;
        ans = min(ans, tmp);
    }

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


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


public class A
{
	public static void Main()
	{
		int N = GetInt();
		var a = new List<long>(3 * N);
		for(int i = 0; i < 3 * N; i++)
			a.Add(GetLong());
		a.Sort();

		long sum = 0;
		for(int i = 0; i < N; i++)
			sum += a[N + 2 * i];
		Console.WriteLine(sum);
	}
}


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(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

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

int main(){
  long long N,K;
  cin>>N>>K;
  long long total=K;
  for(int i=1;i<N;i++){
    total=total*(K-1);
  }
  cout<<total<<endl;
    
  return 0;
}

    
      
  
  

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include <numeric>

int gcd(int x, int y)
{
    int r;

    if(x == 0 || y == 0)  // 引数チェック
    {
        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    // ユーグリッドの互除法
    while((r = x % y) != 0) // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}

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


  int NN, X;
  std::cin >> NN>>X;


  // int x[NN];
  std::vector<int> x(NN+1);
  int y[NN], z[NN];

  for (size_t i = 0; i < NN; i++) {
    std::cin >> x[i];
  }

  x[NN] = X;



  std::sort(x.begin(), x.end());

  // std::cout << "/* sort! */" << '\n';
  //
  // for (size_t i = 0; i < NN+1; i++) {
  //   std::cout << x[i] << ' ';
  // }


  //
  // if (x[NN-1] < 0) {
  //   NN++;
  //   x[NN] = 0;
  // }
  //
  // if (x[0] > 0) {
  //   NN++;
  //   for (size_t i = 0; i < NN; i++) {
  //     x[NN - i] = x[NN - i - 1];
  //   }
  //   x[0] = 0;
  // }

  // std::cout << "NN" << NN << '\n';

  NN += 1;

  for (size_t i = 0; i < NN; i++) {
    y[i] = x[i] - X;

  }

  for (size_t i = 0; i < NN-1; i++) {
    if (y[i+1] * y[i] < 0) {
      z[i] = -y[i];
    }else{
      z[i] = y[i+1] - y[i];

    }
  }

  //
  // std::cout << "/* message */" << '\n';
  //
  // for (size_t i = 0; i < NN; i++) {
  //   std::cout << y[i] << ' ';
  // }
  // std::cout << "/* message */" << '\n';
  //
  // for (size_t i = 0; i < NN-1; i++) {
  //   std::cout << z[i] << ' ';
  // }

  int ans = z[0];
  // std::cout << ans << '\n';

  for (size_t i = 1; i < NN-1; i++) {
    ans = gcd(ans, z[i]);
  }

  std::cout << ans << '\n';

  // if (NN == 1) {
  //   ans = x[0] - X;
  //   if (ans < 0) {
  //     ans *= -1;
  //   }
  //   std::cout << ans << '\n';
  // }else{
  //   std::cout << ans << '\n';
  // }

  return 0;
}


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

using namespace std;

const int MaxN = 100005;

int n, m;
string s, t;
int psS[MaxN], psT[MaxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> s;
    cin >> t;
    n = s.length(), m = t.length();
    psS[0] = psT[0] = 0;
    for (int i = 0; i < n; i++)
    {
        psS[i + 1] = psS[i] + s[i] - 'A' + 1;
    }
    for (int i = 0; i < m; i++)
    {
        psT[i + 1] = psT[i] + t[i] - 'A' + 1;
    }
    int q, a, b, c, d;
    cin >> q;
    while (q--)
    {
        cin >> a >> b >> c >> d;
        cout << ((psS[b] - psS[a - 1]) % 3 == (psT[d] - psT[c - 1]) % 3 ? "YES\n" : "NO\n");
    }
    return 0;
}


Measured memory_bytes: 1744
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 190;

int n, m;
char str[MAXN][MAXN];
int sum[MAXN][MAXN];
int dp1[MAXN][MAXN][MAXN], dp2[MAXN][MAXN][MAXN];
int nxt1[MAXN][MAXN][MAXN], nxt2[MAXN][MAXN][MAXN];

int good(int sx, int ex, int sy, int ey){
	int ret = sum[ex][ey] - sum[sx-1][ey] - sum[ex][sy-1] + sum[sx-1][sy-1];
	if(ret == 0 || ret == (ex - sx + 1) * (ey - sy + 1)) return 1;
	return 0;
}

void Share(){
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			int val = m + 1;
			int nxt1[MAXN] = {};
			int nxt2[MAXN] = {};
			for(int k=i; k<=n; k++){
				int frontier = dp1[i][k][j];
				while(val > frontier){
					nxt2[--val] = k;
				}
			}
			while(val > j) nxt2[--val] = n + 1;
			val = n + 1;
			for(int k=j; k<=m; k++){
				int frontier = dp2[j][k][i];
				while(val > frontier){
					nxt1[--val] = k;
				}
			}
			while(val > i) nxt1[--val] = m + 1;
			for(int k=i; k<=n; k++) dp1[i][k][j] = max(dp1[i][k][j], nxt1[k]);
			for(int k=j; k<=m; k++) dp2[j][k][i] = max(dp2[j][k][i], nxt2[k]);
		}
	}
}
int main(){
	cin >> n >> m;
	for(int i=1; i<=n; i++){
		scanf("%s", str[i] + 1);
		for(int j=1; j<=m; j++){
			sum[i][j] = (str[i][j] == '#');
			sum[i][j] += sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1];
		}
	}
	for(int i=1; i<=n; i++){
		for(int j=i; j<=n; j++){
			int l = 1;
			for(int k=1; k<=m; k++){
				while(l <= m && good(i, j, k, l)) l++;
				dp1[i][j][k] = l;
			}
		}
	}
	for(int i=1; i<=m; i++){
		for(int j=i; j<=m; j++){
			int l = 1;
			for(int k=1; k<=n; k++){
				while(l <= n && good(k, l, i, j)) l++;
				dp2[i][j][k] = l;
			}
		}
	}
	int ans = 0;
	while(dp1[1][n][1] <= m){
		for(int i=1; i<=n; i++){
			for(int j=i; j<=n; j++){
				for(int k=1; k<=m; k++){
					int curp = dp1[i][j][k];
					if(curp != m + 1) curp = dp1[i][j][curp];
					nxt1[i][j][k] = curp;
				}
			}
		}
		for(int i=1; i<=m; i++){
			for(int j=i; j<=m; j++){
				for(int k=1; k<=n; k++){
					int curp = dp2[i][j][k];
					if(curp != n + 1) curp = dp2[i][j][curp];
					nxt2[i][j][k] = curp;
				}
			}
		}
		memcpy(dp1, nxt1, sizeof(dp1));
		memcpy(dp2, nxt2, sizeof(dp2));
		Share();
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 107392
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)


typedef map<string, int> map_type;
typedef pair<string, int> value_type;

struct second_order {
  bool operator()(const value_type& x, const value_type& y) const {
    if( x.second != y.second) return x.second < y.second;
    return x.first > y.first;
  }
};

typedef priority_queue<value_type, vector<value_type>, second_order> pqueue_type;


pqueue_type map_to_pqueue(map_type m) {
    pqueue_type que;
    for(auto it=m.begin(); it!=m.end(); ++it) {
        que.push(*it);
    }
    return que;
}


int main(void){
    int h, w;
    cin >> h >> w;
    REP(i, w+2) cout << "#";
    cout << endl;
    
    REP(i, h) {
        string s;
        cin >> s;
        cout << "#" << s << "#" << endl;
    }
    REP(i, w+2) cout << "#";
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
          using namespace std;
          #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
          #define M_PI 3.14159265358979323846
          #define data data_
          #define ff first
          #define ss second
          #define pb push_back
          #define ll long long
          #define ld long double

          int main()
          {
               tani_nachi_ke  

            map<string,int> mp;
            string s,t;
            cin >> s >> t;
            int a,b;
            cin >> a >> b;
            mp[s] += a;

            mp[t] += b;
            string u;
            cin >> u;

            mp[u]--;
            cout << mp[s] << " " << mp[t] << endl;




         
               return 0;
          }

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), c
  cout << fixed << setprecision(15);

  ll h, w, d;
  cin >> h >> w >> d;

  ll const maxn = 305*305;
  vll ys(maxn, 0), xs(maxn, 0);
  repLRE(i, 1, h) repLRE(j, 1, w){
    ll a;
    cin >> a;
    ys[a] = i, xs[a] = j;
  }

  vll dist(maxn, 0);
  repLRE(i, d, maxn-1){
    dist[i] = dist[i-d] + abs(ys[i] - ys[i-d]) + abs(xs[i] - xs[i-d]);
  }

  ll q;
  cin >> q;
  while(q--){
    ll l, r;
    cin >> l >> r;
    cout << dist[r] - dist[l] << endl;
  }

  return 0;
}


Measured memory_bytes: 5376
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    putStrLn $ unwords . map (show . snd) . sort $ zip as [1..n]

Measured memory_bytes: 28284
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 2e5;

int l, r, n, m, s, t;
struct Edge {
	int	to, next, oppo;
	int	done, maxx;
} edge[(N << 3) + 1];
int tot, start[N + 1], cur[N + 1];
queue<int> q;
int vis[N + 1], dep[N + 1];
int to[N + 1], viss[N + 1];
vector<int> in[N + 1];
int ans;
int ansa[N + 1], ansb[N + 1];

inline void addedge(int u, int v, int flow)
{
	edge[++tot] = Edge{ v, start[u], tot + 1, 0, flow };
	start[u] = tot;
	edge[++tot] = Edge{ u, start[v], tot - 1, 0, 0 };
	start[v] = tot;
	return;
}
inline bool bfs()
{
	for (int i = 0; i <= (n << 1) - 1; i++)
		vis[i] = dep[i] = 0;
	q.push(s);
	dep[s] = vis[s] = 1;
	while (q.size()) {
		int u = q.front();
		q.pop();
		for (int i = start[u]; i; i = edge[i].next) {
			int v = edge[i].to;
			if (!vis[v] && edge[i].done < edge[i].maxx) {
				dep[v] = dep[u] + 1;
				vis[v] = 1;
				q.push(v);
			}
		}
	}
	return dep[t];
}
inline int dfs(int u, int flow)
{
	if (u == t || !flow)
		return flow;
	int val = 0;
	for (int &i = cur[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (dep[v] == dep[u] + 1) {
			int w = dfs(v, min(flow, edge[i].maxx - edge[i].done));
			if (w > 0) {
				edge[i].done += w;
				edge[edge[i].oppo].done -= w;
				val += w;
				flow -= w;
				if (!flow)
					break;
			}
		}
	}
	return val;
}
inline void dinic()
{
	while (bfs()) {
		for (int i = 0; i <= (n << 1) - 1; i++)
			cur[i] = start[i];
		ans += dfs(s, 2147483647);
	}
	return;
}
inline int solve()
{
	for (int i = 1; i < n; i++) {
		for (int j = start[i]; j; j = edge[j].next) {
			if (edge[j].to)
				if (edge[j].done)
					to[i] = edge[j].to - n + 1;
		}
	}
	q.push(n);
	int link = 0;
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		for (int i = 0; i < in[u].size(); i++) {
			int v = in[u][i];
			if (viss[v])
				continue;
			link++;
			ansa[v] = u;
			ansb[v] = to[v];
			q.push(to[v]);
			viss[v] = 1;
		}
	}
	return link;
}
int main()
{
	n = read();
	s = 0;
	t = (n << 1) - 1;
	for (int i = 1; i < n; i++) {
		int k = read();
		for (int j = 1; j <= k; j++) {
			int x = read();
			if (x != n)
				addedge(i, n + x - 1, 1e9);
			in[x].push_back(i);
		}
	}
	for (int i = 1; i < n; i++)
		addedge(0, i, 1);
	for (int i = 1; i <= n; i++)
		addedge(i + n - 1, (n << 1) - 1, 1);

	dinic();

	if (ans < n - 1) {
		printf("-1\n");
		return 0;
	}
	if (solve() < n - 1) {
		printf("-1");
		return 0;
	}
	for (int i = 1; i < n; i++)
		printf("%d %d\n", ansa[i], ansb[i]);
	return 0;
}


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

#define read(a) cin >> a
#define out(a)  cout << a
#define ull unsigned long long
#define ll long long
#define FOR(i, l, r) for (ll i = l; i <= r; i++)
#define FOD(i, l, r) for (ll i = l; i >= r; i--)
#define fast ios_base::sync_with_stdio(false);
#define mod 1000000007

ll arr[105];
ll n, d = 0;

int main()
{
    fast;
    cin >> n;
    FOR(i, 1, n) cin >> arr[i];

    FOR(i, 1, n)
    {
        FOR(j, i + 1, n)
        {
            FOR(k, j + 1, n)
            {
                if (
                    arr[i] + arr[j] > arr[k]
                    && arr[i] + arr[k] > arr[j]
                    && arr[k] + arr[j] > arr[i] && arr[i] != arr[j] && arr[i] != arr[k] && arr[j] != arr[k]) d++;
            }
        }
    }
    cout << d;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
using namespace std;

void output(int second){
    printf("%02d:",second/60/60);
    second -= second/60/60*60*60;
    printf("%02d:",second/60);
    second -= second/60*60;
    printf("%02d\n",second);
}

int main(){
    int hour, minutes, second;
    int allSecond;
    while(cin >> hour >> minutes >> second, hour+minutes+second!=-3){
        second += minutes*60+hour*60*60;
        allSecond = second;
        second = 2*60*60 - second;
        output(second);
        second = (2*60*60 - allSecond)*3;
        output(second);
    }
}

Measured memory_bytes: 1160
N = int(input())
a = [[0] * 3 for _ in range(N)]
for i in range(N):
    a[i][0], a[i][1], a[i][2] = map(int, input().split())

dp = [[0] * 3 for _ in range(N+1)]

for i in range(1, N+1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            #前の値がdp[i-1][j]で今選んでいるのがa[i-1][k]
            dp[i][k] = max(dp[i][k], dp[i-1][j] + a[i-1][k])

print(max(dp[N]))

Measured memory_bytes: 42540
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <bitset>
#include <vector>

using namespace std;

const int N = 100000 + 5;
int n;
int a[N];

void solve()
{
    cin >> n;
    for(int i = 0; i < n; ++ i) {
        scanf("%d", a + i);
    }
    long long l = 2, r = 2;
    for(int i = n - 1; i >= 0; -- i) {
        long long nr = r / a[i] * a[i];
        long long nl = (l - 1) / a[i] * a[i] + a[i];
        if (nl > nr) {
            cout << -1 << endl;
            return;
        }
        nr += a[i] - 1;
        l = nl; r = nr;
    }
    cout << l << ' ' << r << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 640
import math
x=input()
N=len(x)
flag=True
for i in range(math.floor(N/2)):
    if x[i]!=x[-(i+1)]:
        flag=False
        break
        
for i in range(math.floor(N/4)):
    if x[i]!=x[(math.floor((N-1)/2)-i-1)]:
        flag=False
        break
    if x[math.floor((N+3)/2)+i-1]!=x[(N-i)-1]:
        flag=False
        break
if flag==True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064