akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i32,
        k: i32,
    }

    let numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
    let mut s = "".to_string();
    let mut n = n;
    let mut r: i32;

    while n > 0 {
        r = n % k;
        s += numbers[r as usize];
        n = n / k;
    }

    println!("{}", s.len());
}


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

typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 11;
const int M = 1e6 + 11;
const int MOD = 1e9 + 7;

int main(int argc, char **args){
    int n, m; cin >> n >> m;
    vector<int> ve(n);
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> ve[i];
        sum += ve[i];
    }
    sort(ve.begin(), ve.end());
    bool flag = true;
    for(int i = n - 1, j = 1; j <= m && i >= 0; j++, i--){
        if(ve[i] < sum * 1.0/ (4 * m)) {
            flag = false;
             break;
        }
    }
    puts(flag ? "Yes" :"No");
return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)

	if sc.Scan() {
		num := strings.Split(sc.Text(), " ")
		a, _ := strconv.Atoi(num[0])
		b, _ := strconv.Atoi(num[1])

		if (a+b)%2 == 0 {
			fmt.Println((a + b) / 2)
		} else {
			fmt.Println("IMPOSSIBLE")
		}

	}
}


Measured memory_bytes: 640
import math


def isPrime(k):
    if k % 2 == 0 and k != 2:
        return False

    limitDivisor = math.floor(math.sqrt(k)) + 1
    for divisor in range(2, limitDivisor):
        if k % divisor == 0:
            return False

    return k


x = int(input())
limitX = 2 * x - 1

for i in range(x, limitX):
    if isPrime(i):
        print(i)
        exit()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long 
#define IOS ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define SIZE 100005
 
int main()
{
	int a, b;
	string ch,bh;
	cin >> ch >> bh;
	string ans = bh + ch;
	cout <<ans  << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int a,b; cin >> a >> b;
    cout << a*b << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n, k; cin >> n >> k;
	vector<int> v(n);
	int ans = 0;
	for( auto &i : v ) cin >> i;
	for( int l = 0; l <= n; ++l ){
		for( int r = 0; r <= n; ++r ){
			if(  l+r > n || l+r > k ) break;
			int sum = 0;
			priority_queue<int, vector<int>, greater<int>> pq;
			for( int i = 0; i < l; ++i ){
				sum += v[i];
				if( v[i] < 0 ) pq.push(v[i]);
			}
			for( int i = 0; i < r; ++i ){
				sum += v[n-1-i];
				if( v[n-1-i] < 0 ) pq.push(v[n-1-i]);
			}
			for( int i = 0; ( i < (k-(l+r)) && !pq.empty() ); ++i ){
				sum += (-1)*(pq.top());
				pq.pop();
			}
			ans = max(sum, ans);
		}
	}
	cout << ans << endl;
	return 0;
}

// 23:10

Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	K := sc.NextInt()
	S := sc.Next()
	if len(S) > K {
		S = S[:K] + "..."
	}
	fmt.Println(S)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1756
//dlang template---{{{
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;

// MIT-License https://github.com/kurokoji/nephele
class Scanner
{
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin)
  {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType))
  {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next()
  {
    if (idx < str.length)
    {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0)
    {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)()
  {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len)
  {
    T[] ret = new T[len];

    foreach (ref c; ret)
    {
      c = next!(T);
    }

    return ret;
  }

  void scan()()
  {
  }

  void scan(T, S...)(ref T x, ref S args)
  {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType))
  {
    str ~= s.to!(char[]).strip.split;
  }
}

//Digit count---{{{
int DigitNum(int num) {
  int digit = 0;

  while (num != 0) {
    num /= 10;
    digit++;
  }

  return digit;
}
//}}}
//}}}

void main() {
  Scanner sc = new Scanner;

  int N;
  sc.scan(N);
  int[] A = new int[N];

  foreach (i; 0 .. N)
    sc.scan(A[i]);

  int res = 0;

  Break1:
  while (true) {
    foreach (i; 0 .. N) {
      if (A[i] % 2 != 0)
        break Break1;
      else
        A[i] /= 2;
    }
    res++;
  }

  writeln(res);
}


Measured memory_bytes: 256
import sys

n=int(input())
h=list(map(int,input().split()))
h=h[::-1]
be=h[0]

for i in range(n):
  if h[i]-be==1:
    be=h[i]-1
    continue
    
  if h[i]>be:
    print("No")
    sys.exit()
  
  be=h[i]
  
print("Yes")

Measured memory_bytes: 20704
N=int(input())
a=list(map(int, input().split()))
A=[0]*8
G=0
for i in range(N):
    if a[i]<400:
        A[0]+=1
    elif a[i]<800:
        A[1]+=1
    elif a[i]<1200:
        A[2]+=1
    elif a[i]<1600:
        A[3]+=1
    elif a[i]<2000:
        A[4]+=1
    elif a[i]<2400:
        A[5]+=1
    elif a[i]<2800:
        A[6]+=1
    elif a[i]<3200:
        A[7]+=1
    else:
        G+=1
t=0
for i in range(8):
    if A[i]>0:
        t+=1
print(max(t,1),t+G)


Measured memory_bytes: 3064
from collections import Counter
n = int(input())
s = list(input())
c = Counter(s)
ans = c["R"]*c["G"]*c["B"]
for i in range(n-2):
  for j in range(1,n):
    if i+2*j >= n:
      break
    if sorted([s[i],s[i+j],s[i+2*j]]) == ["B","G","R"]:
      ans -= 1
print(ans)

Measured memory_bytes: 74584
#include <iostream>
#include <algorithm>
#include <stack>
#include <utility>
#include <queue>
#include <set>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB pash_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int Partition(int A[],int p,int r){
    int x = A[r];
    int i = p-1;
    FOR(j,p,r){
	if( A[j] <= x){
	    i++;
	    swap(A[i],A[j]);
	}
    }
    swap(A[i+1],A[r]);
    return i + 1;
}

int main(){

    int N;
    int arr[100000];
    scanf("%d",&N);
    REP(i,N) scanf("%d",&arr[i]);
    int p = Partition(arr,0,N-1);
    cout << arr[0];
    FOR(i,1,p) cout << " "<<arr[i]; 
    cout << " ["<<arr[p] <<"] ";
    FOR(i,p+1,N-1) cout << arr[i] << " " ;
    cout << arr[N-1] << endl;

    return 0;
}

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

int main(){
  long long int a,b,c;
  cin >> a >> b >> c;
  if(c>=a+b && 4*a*b<(c-(a+b))*(c-(a+b))){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#include<algorithm>

using namespace std;
typedef long long ll;

int main() {
    ll n, m, k;
    cin >> n >> m >> k;

    vector<ll> a(n+1, 0);
    vector<ll> b(m+1, 0);

    vector<ll> aSum(n+1, 0);
    vector<ll> bSum(m+1, 0);
    aSum[0] = bSum[0] = 0;

    FOR(i, 1, n){
        cin >> a[i];
        aSum[i] = aSum[i-1] + a[i];
    }
    FOR(i, 1, m){
        cin >> b[i];
        bSum[i] = bSum[i-1] + b[i];
    }

    ll maxBooks = 0;
    ll j = m;

    FOR(i, 0, n){
        if (aSum[i] > k) break;
        
        while(j >= 0 && aSum[i] + bSum[j] > k) j--;
        maxBooks = max(maxBooks, i + j);
    }

    cout << maxBooks << endl;

}

Measured memory_bytes: 9516
n,m=[int(i) for i in input().split()]
id=[[int(i) for i in input().split()]+[j] for j in range(m)]
pre_num=[0]*(n+1)
ans=[""]*m
id.sort(key=lambda x:x[1])
for p,y,i in id:
    pre_num[p]+=1
    ans[i]=str(p).zfill(6)+str(pre_num[p]).zfill(6)
print("\n".join(ans))

Measured memory_bytes: 34696
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define maxn 200005
#define mid ((nl+nr)>>1)
using namespace std;
typedef long long ll;
const ll mod=998244353;
int n,m;
int cnt[maxn];
map<int,int>pre;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		pre[i]=i;
		cnt[i-i]++;
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		int pos=-1;
		for(map<int,int> ::iterator it=pre.lower_bound(l);it!=pre.end() && it->first<=r+1;it=pre.erase(it))
		{
			if(it==pre.end()) break;
			pos=max(pos,it->second);
			cnt[-it->second+it->first]--;
		}
		if(pos!=-1 && r+1<=m)
		{
			pre[r+1]=pos;
			cnt[r+1-pos]++;
		}
		while(!cnt[ans] && ans<m) ans++;
		if(ans>=m)
			printf("-1\n");
		else
			printf("%d\n",i+ans);
	}
}

Measured memory_bytes: 13728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,r,g,b;
string s;
ll ans;
int main()
{
	cin>>n>>s;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='R')
			r++;
		if(s[i]=='G')
			g++;
		if(s[i]=='B')
			b++;
	}
	ans=r*g*b;
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n,2*j-i<n;j++)
		{
			if(s[i]!=s[j]&&s[j]!=s[2*j-i]&&s[i]!=s[2*j-i])
				ans--;
		}
	cout<<ans; 
return 0;
}


Measured memory_bytes: 3624
d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}}

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

const int nax = 405;
const ll INF = 1e18L + 5; // 10^18+5
ll dp[nax][nax];
// dp[i][j] - the minimum total cost of combining interval [i,j] into one vertex

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for(int& x : a) {
        scanf("%d", &x);
    }
    for(int L = n - 1; L >= 0; --L) {
        for(int R = L; R < n; ++R) {
            if(L == R) {
                dp[L][R] = 0;
            }
            else {
                dp[L][R] = INF;
                ll s=0;
              for(int i=L;i<=R;i++)
                s=s+a[i];
                for(int i = L; i <= R - 1; ++i) {
                    dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R]+s);
                }
            }
        }
    }
    
    printf("%lld\n", dp[0][n-1]);
}

Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;



int main(void){
    int n;
    cin>>n;
    map<string,int>m;
    set<string>st;
    for(int i=0;i<n;i++){
        string t;
        cin>>t;
        m[t]++;
    }
    int ans = 0;
    for(auto itr =m.begin();itr!=m.end();++itr){
        ans = max(ans,itr->second);
    }
    for(auto itr =m.begin();itr!=m.end();++itr){
        if(ans == itr->second){
            st.insert(itr->first);
        }
    }
    for(auto itr = st.begin();itr!=st.end();++itr){
        cout<<(*itr)<<endl;
    }
	return 0; 
}

Measured memory_bytes: 34560
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000ll
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
#include <boost/integer/common_factor_rt.hpp> // gcd, lcm


// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，出現位置，DP
// 余事象，包除
// データ構造
// 問題の特徴量
// 存在判定：構成方法，入力の特徴
// 例外を十分に含む一般化．想像力の限界
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int N, K;cin >> N >> K;
VI A(N); 
rep(i, 0, N) {
    cin >> A[i];
    if (A[i] == K) {cout << "POSSIBLE\n"; return 0;}
}

if (*max_element(ALL(A)) < K){cout << "IMPOSSIBLE\n"; return 0;}

int64_t G = A[0];
rep(i, 1, N) G = boost::integer::gcd(G, A[i]);

if (K % G) cout << "IMPOSSIBLE\n";
else cout << "POSSIBLE\n";

}

// 境界，出力文字列 チェック



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

// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

     vector<pair<long, long>> A(N);

     REP(i,N) {
         cin >> A[i].second >> A[i].first;
     }
// first 締切　second 仕事時間
    sort(all(A));
    int sum = 0;
    bool flag = true;
    REP(i,N){
        sum += A[i].second;
        if(A[i].first < sum) {
            flag = false;
            break;
        }

    }


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

Measured memory_bytes: 3328
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9 for _ in range(N)]
    dp[0] = 0
    for i in range(N):
        for j in range(1, K+1):
            if i+j < N:
                dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
    print(dp[-1])


if __name__ == "__main__":
    main()


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

int main()
{
    string s;
    cin>>s;
    int sum=0;
    for(int i=0;i<s.size();i++)
    {
        sum+=s[i]-'0';
    }
    if(sum%9==0)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;

     //cout<<sum;
    return 0;
}


Measured memory_bytes: 3692
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
//エイリアス
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

//定数
const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll mod = 1e9 + 7;
const double pi = M_PI;

string toString(int code) {
  if (code == 1) return "a";
  if (code == 2) return "b";
  if (code == 3) return "c";
  if (code == 4) return "d";
  if (code == 5) return "e";
  if (code == 6) return "f";
  if (code == 7) return "g";
  if (code == 8) return "h";
  if (code == 9) return "i";
  if (code == 10) return "j";
  if (code == 11) return "k";
  if (code == 12) return "l";
  if (code == 13) return "m";
  if (code == 14) return "n";
  if (code == 15) return "o";
  if (code == 16) return "p";
  if (code == 17) return "q";
  if (code == 18) return "r";
  if (code == 19) return "s";
  if (code == 20) return "t";
  if (code == 21) return "u";
  if (code == 22) return "v";
  if (code == 23) return "w";
  if (code == 24) return "x";
  if (code == 25) return "y";
  if (code == 0) return "z";
}

int main()
{
  ll n;
  cin >> n;
  string name = "";
  while(n > 0) {
    int rest = n % 26;
    n /= 26;
    if(rest == 0) n--;
    name += toString(rest);
  }
  reverse(name.begin(), name.end());
  cout << name << endl;
}


Measured memory_bytes: 3592
fn read<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect()
}

fn main() {
    let v: Vec<usize> = read();
    let n = v[0];
    let a = v[1] as i64;
    let x: Vec<i64> = read();

    let sum = x.iter().fold(0, |s, &t| s + t) as usize;
    let mut dp = vec![vec![0_usize; sum * 2 + 1]; n + 1];
    dp[0][sum] = 1;
    for i in 1..(n + 1) {
        for j in 0..(sum * 2 + 1) {
            dp[i][j] = dp[i - 1][j];
            let tmp = j as i64 - (a - x[i - 1]);
            if tmp >= 0 && tmp <= (sum * 2) as i64 {
                dp[i][j] += dp[i - 1][tmp as usize];
            }
        }
    }
    println!("{}", dp[n][sum] - 1);
}


Measured memory_bytes: 6396
import math
def combination(n,r):
      return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())
A = list(map(int,input().split()))
ls = [0 for i in range(N)]
for i in range(N):
  ls[A[i]-1] += 1
summation = 0
for i in range(N):
  if ls[i] >= 2:
    summation += combination(ls[i],2)
for i in range(N):
  if ls[A[i]-1] >= 2:
    print(summation - (ls[A[i]-1] -1))
  else:
    print(summation)

Measured memory_bytes: 32716
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<double >    vecd;
typedef vector<vector<int> >  vec2int;
typedef vector<vector<double> >  vec2d;
typedef vector<ll >     vecll;
typedef vector<string > vecstr;
typedef vector<bool > vecbool;
typedef vector<vector< bool > > vec2bool;
typedef vector<bool > vecbool;
////////////////////////////////////////////////
int n;
vector<vector< pair<int, int>>> u; // u[i].first = node from u[i], u[i].second = cost
//output
vecbool seen;
vecbool ans;
////////////////////////////////////////////////
void dfs(int pos, int color)
{
  seen[pos] = true;
  ans[pos] = color;
  REPvec(itr, u[pos]){
    if(seen[itr->first])continue;
    dfs(itr->first, (color + (itr->second))%2);
  }
}
////////////////////////////////////////////////
int main()
{
  cin >> n;
  u.resize(n);
  seen.resize(n);
  ans.resize(n);
  ll a, b, c;
  REP(i,n - 1){
    cin >> a >> b >> c;
    a --; b --;
    u[a].push_back(make_pair(b, c));
    u[b].push_back(make_pair(a, c));
  }
  REP(i,n){
    seen[i] = false;
    ans[i] = -1;
  }
  dfs(0,0);
  REP(i,n){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    ll ans = n;
    for(ll i=0;i<=n;i++){
        ll cur=0,num=i;
        while(num)cur+=num%6,num/=6;
        num = n-i;
        while(num)cur+=num%9,num/=9;
        ans=min(ans , cur);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

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

struct RHS {
	int n;
	string s;
	vector<ull> hs; //???????????\????´???????
	vector<ull> bp; //b????´?????????????????¨??????????(??????????????????????????????)
	const ull b = 1e9 + 7;
	//?????????
	RHS(string s) : n(s.size()), s(s), hs(n+1) , bp(n+1){
		bp[0] = 1;
		rep(i, n) {
			bp[i + 1] = bp[i] * b;
			hs[i + 1] = hs[i] * b + s[i];
		}
	}
	//s[l,r]??????????????\????????????
	ull subhash(int l, int r) {
		return hs[r+1] - hs[l] * bp[r+1 - l];
	}
};

signed main() {
	int n, m;
	cin >> n >> m;
	string s;
	cin >> s;
	RHS hs(s);
	int l = 0, r = 0;
	set<int> se;
	rep(i, m) {
		string t;
		cin >> t;
		if (t == "R++") {
			r++;
		}
		if (t == "L++") {
			l++;
		}
		if (t == "R--") {
			r--;
		}
		if (t == "L--") {
			l--;
		}
		se.insert(hs.subhash(l, r));
	}
	cout << se.size() << endl;

	return 0;
}

Measured memory_bytes: 21796
#include<stdio.h>
#include<limits.h>

struct Matrix{
	int r;
	int c;
};
#define MATRIX_SIZE 100
struct Matrix A[MATRIX_SIZE+1];
int C[MATRIX_SIZE+1][MATRIX_SIZE+1];

void init(void)
{
	int i, j;
	for(i = 1; i <= MATRIX_SIZE; i++){
		for(j = 1; j <= MATRIX_SIZE; j++){
			if(i == j){
				C[i][j] = 0;
			}else{
				C[i][j] = INT_MAX;
			}
		}
	}
}

void scanMatrix(int size)
{
	int i;
	for(i = 1; i <= size; i++){
		scanf("%d %d", &A[i].r, &A[i].c);
	}
	return;
}

void order(int size)
{
	int i, j, k, o;
	for(i = 1; i <= (size - 1); i++){
		for(j = 1; j <= (size - i); j++){
			for(k = j + 1; k <= (i + j); k++){
				o = C[j][k-1] + C[k][i+j] + (A[j].r * A[k].r * A[i+j].c);
				if(o < C[j][i+j]){
					C[j][i+j] = o;
				}
			}
		}
	}

	return;
}

int main(int argc, char* argv[])
{
	int n;
	
	init();
	scanf("%d", &n);
	scanMatrix(n);
	order(n);
	printf("%d\n", C[1][n]);

	return(0);
}

Measured memory_bytes: 636
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 100001
#define ll long long
using namespace std;

int main(){
    string s;
    int k;
    cin>>s>>k;
    
    vector<string> data;
    for (int i=1; i<=k; i++){
        for (int j=0; j<s.size()-i+1; j++){
            string l;
            l=s[j];
            for (int p=1; p<i; p++){
                l+=s[j+p];
            }
            data.push_back(l);
        }
    }
    
    set<string> st;
    
    for (int i=0; i<data.size(); i++){
        st.insert(data[i]);
    }
    
    vector<string> ans;
    for (auto x:st){
        string p=x;
        ans.push_back(p);
    }
    
    cout<<ans[k-1]<<endl;
}

Measured memory_bytes: 2556
import java.util.Scanner;

/**
 * Created by khrom on 2017/06/11.
 */
public class Main {
    public static void main(String[] args) {
        int time = new Scanner(System.in).nextInt();
        int hour = time / (60 * 60);
        int minute = (time - hour * 60 * 60) / 60;
        int second = (time - hour * 60 * 60 - minute * 60);
        System.out.println(hour + ":" + minute + ":" + second);
    }
}

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

int main()
{
    int n;
    cin>>n;
    vector<int>v;
    for(int i=1; i<=n; i++)
    {
        int a;
        cin>>a;
        if(a%2){
            if(i%2){
                v.push_back(a);
            }
        }
    }
    cout<<v.size()<<endl;
}


Measured memory_bytes: 3616
let N = stdin.ReadLine() |> float

let result = Array.zeroCreate<int> (int N + 1)

let f i j k = i * i + j * j + k * k + i * j + j * k + k * i

let rec solver i j k =
    if i = int (sqrt N) then ()
    elif j = int (sqrt N) then solver (i + 1) 1 1
    elif k = int (sqrt N) then solver i (j + 1) 1
    else
        let v = f i j k
        if v <= (int N) then result.[v] <- result.[v] + 1
        solver i j (k + 1)

solver 1 1 1

result
|> Array.skip 1
|> Array.iter stdout.WriteLine


Measured memory_bytes: 28256
#include <iostream>

using namespace std;

int main(){
    int n, x;
    cin >> n >> x;
    int a[n];
    int sum = 0;
    int cnt = 1;
    

    
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        sum += a[i];
        
        if (sum > x){
            cout << cnt << endl;
            return 0;
        } else if (sum == x){
            cout << cnt + 1 << endl;
            return 0;
        }
        cnt +=1;
        
    }
    cout << cnt << endl;
    
}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI 3.141592653589793
#define vi vector<int>
#define p pair<int,int>
const int MOD = 1000000007;
inline double degcos(double ang) {return cos(ang*PI/180);}
inline double degsin(double ang) {return sin(ang*PI/180);}
#define for(i,j,k,in) for (int i = j; i < k; i += in)


/*---END OF TEMPLATE---*/




int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //ifstream fin("data.in");
    //ofstream fout("data.out");
    string s,k;
    cin >> s;
    k = s;
    reverse(k.begin(),k.end());
    bool flag = false;
    if (s != k) flag = true;
    string t="",u;
    for (i,0,(s.size()-1)/2,1) {
        t += s[i];
    }
    u = t;
    reverse(u.begin(),u.end());
    if (t != u) flag = true;
    string v = "",w;
    for (i,(s.size()+3)/2-1,s.size(),1) {
        v += s[i];
    }
    w = v;
    reverse(v.begin(),v.end());
    if (v != w) flag = true;
    if (flag) cout << "No";
    else cout << "Yes";


}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;

const int MAX_N = 2000;
int N, Z, W;
int a[MAX_N+1];
int dp[2][MAX_N+1];

int main() {
  cin >> N >> Z >> W;
  for (int i = 1; i <= N; ++i) cin >> a[i];

  for (int i = N-1; i > 0; --i) {
    int mi = INFINT, ma = -1;
    for (int j = i+1; j < N; ++j) {
      mi = min(mi, dp[1][j]);
    }
    mi = min(mi, abs(a[i]-a[N]));

    for (int j = i+1; j < N; ++j) {
      ma = max(ma, dp[0][j]);
    }
    ma = max(ma, abs(a[i]-a[N]));

    dp[0][i] = mi; dp[1][i] = ma;
  }

  int ans = 0;
  for (int i = 1; i < N; ++i) {
    ans = max(ans, dp[0][i]);
  }
  ans = max(ans, abs(W-a[N]));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	
		public static void main(String[] args) {
			int a=scan.nextInt()*100+scan.nextInt()*10+scan.nextInt();
			System.out.println(a%4==0?"YES":"NO");
		}
}


Measured memory_bytes: 23124
N = int(input())
v = list(map(int, input().split()))

# 昇順にソートすると、最大値を与えるのは以下の操作を行ったとき：
# v_1 = (v_0 + v_1)/2 (v_0は消滅）
# v_2 = (v_1 + V_2)/2 (v_1は消滅)
# v_(N-1) = (v_(N_1) + v_(N-2))/2 (v_(N-2)は消滅)
# 結局、(N-1)番目の素材が残り、その価値はv_(N-1)

v = sorted(v)
for i in range(N-1):
  v[i+1] = (v[i+1]+v[i])/2
  
print(v[N-1])

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

using namespace std;
using ll = long long;

int main() {
    string S, T;
    cin >> S >> T;
    ll s = S.size();
    ll t = T.size();

    ll ans = 1e15;
    if(s < t) {
        cout << 0 << endl;
        return 0;
    }

    for(ll i = 0; i <= s - t; i++) {
        ll temp = 0;
        string temps = S.substr(i, t);
        for(ll j = 0; j < t; j++) {
            if(temps.at(j) != T.at(j)) {
                temp++;
            }
        }
        ans = min(ans, temp);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
vll d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  ll n, k;
  cin >> n >> k;
  if (k % 2 == 0) {
    ll ans1 = 0, ans2 = 0;
    for (ll i = 1; i <= n; i++) {
      if (i % k == 0) ans1++;
      else if (i % k == k / 2) ans2++;
    }
    cout << (ll)(pow(ans1, 3) + pow(ans2, 3)) << endl;
  }
  else {
    ll ans = 0;
    for (ll i = 1; i <= n; i++) {
      if (i % k == 0) ans++;
    }
    cout << (ll)pow(ans, 3) << endl;
  }
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int N; vi A; map<int,int> M;
void input()
{
    cin>>N;
    rep(i,N){
        int a; cin>>a; A.emplace_back(a);
    }
    return;
}

void solve()
{
    string ans="YES";
    rep(i,N){
        if(M[A[i]]==0) ++M[A[i]];
        else {ans="NO";break;}
    }
    cout<<ans<<endl;
    return;
}

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

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    ll d, t, s; cin >> d >> t >> s;
    puts(s * t >= d ? "Yes" : "No");
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

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

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> H(N);

    for(int i = 0; i < N; i++){
	cin >> H.at(i);
    }

    int sum = 0;
    int prev = 0;

    for(int i = 0; i < N; i++){
	if(H.at(i) >= prev){
	    sum++;
	    prev = H.at(i);
	}else{
	    
	}
    }

    cout << sum << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;


int main(){
	//ios_base::sync_with_stdio(0);
	ll A, B, C, ans=0;

	cin >> A >> B >> C;
	rep(i,10000005){
		if( A%2 || B%2 || C%2 ) break;
		ll _A = A;
		ll _B = B;
		ll _C = C;
		A = _B/2 + _C/2;
		B = _A/2 + _C/2;
		C = _A/2 + _B/2;
		ans++;
	}

	if( ans > 10000000 ) ans = -1;
	cout << ans << endl;

	return 0;
}


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

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <vector>
//#define LOCAL
using namespace std;
typedef long long ll;
vector<ll>number;

int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll q;
cin>>q;
for(ll i=1;i<=q;i++){
    int t;
    cin>>t;
    if(0==t){
        ll value;
        cin>>value;
        number.push_back(value);
    }else if(1==t){
        ll sub;
        cin>>sub;
        cout<<number[sub]<<endl;
    }else if(2==t){
        number.pop_back();
    }

}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 4976
#include <bits/stdc++.h>
#define maxn 65
#define MOD 998244353
#define INF 10000000000

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

ll n, k;
ll x[maxn], y[maxn], c[maxn];
const double er = 0.00000001;

bool check(double t){
    for(ll i = 0; i  < n; i++){
        for(ll j = i; j < n; j++){
            if(i == j){
                ll cnt = 0;
                for(ll l = 0; l < n; l++){
                    double r = t/c[l];
                    double dis = (x[l]-x[i])*(x[l]-x[i]) + (y[l]-y[i])*(y[l]-y[i]);
                    if(dis <= r*r + er) cnt++;
                }
                if(cnt >= k) return true;

            }
            else{
                // calculate intersection
                // https://poporix.hatenablog.com/
                double xd = x[j]-x[i], yd = y[j]-y[i];
                double d = sqrt(xd*xd + yd*yd);
                double r1 = t/c[i], r2 = t/c[j];
                double costheta = (r1*r1 + d*d - r2*r2)/ (2*r1*d);
                double rc = r1 * costheta;
                double rs = sqrt(r1*r1 - rc*rc);

                double x1 = x[i] + (xd/d)*rc - (yd/d)*rs, y1 = y[i] + (yd/d)*rc + (xd/d)*rs;
                double x2 = x[i] + (xd/d)*rc + (yd/d)*rs, y2 = y[i] + (yd/d)*rc - (xd/d)*rs;

                ll cnt1 = 0, cnt2 = 0;
                for(ll l = 0; l < n; l++){
                    double r = t/c[l], dis = (x1-x[l])*(x1-x[l]) + (y1-y[l])*(y1-y[l]);
                    if(dis <= r*r + er) cnt1++;

                    dis = (x2-x[l])*(x2-x[l]) + (y2-y[l])*(y2-y[l]);
                    if(dis <= r*r + er) cnt2++;
                }
                if(cnt1 >= k || cnt2 >= k) return true;

            }
        }
    }

    return false;
}

void solve(){
    cin >> n >> k;
    for(ll i = 0; i < n; i++){
        cin >> x[i] >> y[i] >> c[i];
    }
    cout << setprecision(10);

    double mn = 0.0, mx = 100000000.0;
    while(mx - mn > er){
        double md = mn + (mx - mn)/2; //cout << md << " ";
        if(check(md)){
            mx = md;
        }
        else mn = md;
    }
    cout << mn;
}

int main()
{
    fast();
    int t= 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
/*

いくつかの文字列が与えられる。
右から読んでも左から読んでも同じ（左右対称な）文字列の数を出力せよ。

やり方：
	・-----whileループここから-----
	・文字列入力。
	・長さ取得。
	・文字列の頭と最後から照合していって、”違うものがあったら”（＝左右対称でなければ）、cntを増やす。
	・照合が終わった時、cntが”0”であれば（＝右から読んでも左から読んでも同じであれば）、countを1増やす。
	・-----whileループここまで-----
	・count（左右対称な文字列の数）を出力。

結果：Accepted。


*何か、別の方法があるような気がする。

*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main()
{
	int i=0,count=0,cnt=0;
	int length;
	int ret;
	char root[101];
	while(1){
		ret=scanf("%s",root);
		if(ret==EOF){
			break;
		}
		length=strlen(root);
		for(i=0; i<length; i++){
			if(root[i]!=root[length-1-i]){
				cnt++;
				break;
			}
		}
		if(cnt==0){
			count++;
		}
		cnt=0;
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 536
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		System.out.println(Math.max(A * B, C * D));
	}
}


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

int main(){
    int n;
    cin >> n;
    int b[n+1];
    float interval;
    float offset;
    int repeat = 0;
    offset = float(n+1)/2.0;
    if (n%2==0){
        interval = 0.5;
    }else{
        interval = 0.0;
        repeat = 1;
    }
    for (int i=0;i<n;i++){
        if(repeat == 0){
            cin >> b[int(offset+interval)];
        }else{
            cin >> b[int(offset-interval)];
        }
        repeat++;
        if(repeat==2){
            repeat = 0;
            interval += 1.0;
        }
    }
    for (int i=1;i<n;i++){
        cout << b[i] << ' ';
    }
    cout << b[n] << endl;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;

template <class T> using Vec = vector<T>;

/* 定数 */
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define ALL(v) v.begin(), v.end()

#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 R;
    cin >> R;
    cout << PI * 2.0 * R << endl;

}


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

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" <<endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{

    int n;

    cin >> n;
    cout << n*n << endl;    

    return 0;
}


Measured memory_bytes: 256
/*
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

typedef vector<int> vi;

struct Node {
  int key;
  struct Node *l, *r;
  Node(): l(NULL), r(NULL) {}
  Node(int _k): key(_k), l(NULL), r(NULL) {}
};

/* global variables */

/* subroutines */

void insert(Node *(&root), Node *z) {
  Node *y = NULL, *x = root;

  while (x != NULL) {
    y = x;
    if (z->key < x->key) x = x->l;
    else x = x->r;
  }

  if (y == NULL) root = z;
  else if (z->key < y->key) y->l = z;
  else y->r = z;
}

void inorder(Node *nd, vi &v) {
  if (nd != NULL) {
    inorder(nd->l, v);
    v.push_back(nd->key);
    inorder(nd->r, v);
  }
}

void preorder(Node *nd, vi &v) {
  if (nd != NULL) {
    v.push_back(nd->key);
    preorder(nd->l, v);
    preorder(nd->r, v);
  }
}

void print_vec(vi &v) {
  for (int i = 0; i < v.size(); i++) printf(" %d", v[i]);
  putchar('\n');
}

/* main */

int main() {
  Node *root = NULL;

  int m;
  cin >> m;

  while (m--) {
    string op;
    cin >> op;

    if (op[0] == 'i') {
      int key;
      cin >> key;
      insert(root, new Node(key));
    }
    else {
      vi v;

      v.clear();
      inorder(root, v);
      print_vec(v);

      v.clear();
      preorder(root, v);
      print_vec(v);
    }
  }
  return 0;
}

Measured memory_bytes: 18764