akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	static int[] arr = new int[110];
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			arr[i] = sc.nextInt();
		}
		print(n);
		insertSort(n);
	}
	
	public static void insertSort(int n){
		int v,j;
		for(int i=1;i<n;i++){
			v = arr[i];
			j = i - 1;
			while(j>-1&&arr[j]>v){
				arr[j+1] = arr[j--];
			}
			arr[j+1] = v;
			print(n);
		}
	}
	public static void print(int n){
		for(int i=0;i<n;i++){
			if(i!=n-1) System.out.print(arr[i]+" ");
			else System.out.print(arr[i]);
		}
		System.out.println();
	}
}


Measured memory_bytes: 32204
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int n,min;
	vector<long long> v;
	long long s[100001]={};
	long long tmp;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(v.begin(),v.end());
	s[0] = v[0];
	for(int i=1;i<n;i++){
		s[i] = s[i-1]+v[i];
	}
	min=0;
	for(int i=1;i<n;i++){
		if(2*s[i-1]<v[i])min = i;
	}
	cout << n-min << endl;
	return 0;
}

Measured memory_bytes: 2168
#include <stdio.h>

int min(int n,int m){
	if(n > m){
		return m;
	}else{
		return n;
	}
}

int main(void)
{
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	int count = 0;
	
	while(b >= 0){
		b = b - a;
		if(b >= 0){
			count = count + 1;
		}
	}
	
	printf("%d\n",min(count,c));
	
	return 0;
	
}
	
	

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],arr1[1000000];
int main()
{
	long long mn,n,i,j,k,a,x,y,ans;
	ans=0;
	cin>>n;
	mn=1e9;
	for (i=0;i<n;i++)
	{
		cin>>arr[i];
		mn=min(mn,arr[i]);
		arr1[i]=mn;
	}
	for (i=0;i<n;i++)
	{
		if (arr[i]==arr1[i])
		
		{
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5888
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	count := 0
	flag := true
	for flag {
		for i := range a {
			if a[i]%2 == 0 {
				a[i] /= 2
				continue
			}
			flag = false
		}
		if flag {
			count++
		}
	}
	fmt.Println(count)
}


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

int main() {
	long long j,t,l,n,m,c,b,s=0;
	cin>>n>>m;
	long long int a[n];
	for(int i=0;i<n;i++){
	cin>>a[i];
		s+=a[i];
	}
	sort(a,a+n);
	vector<pair<int,int>> v;
	for(int i=0;i<m;i++){
		cin>>b>>c;
		v.push_back(make_pair(c,b));
	}
	sort(v.begin(),v.end());
	j=0;
	for(int i=v.size()-1;i>=0;i--){
		t=v[i].first;
		l=v[i].second;
		while(j!=n&&l!=0){
			if(a[j]>=t)
			break;
			s+=(t-a[j]);
			a[j]=t;
			l--;
			j++;
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 2168
n, q = map(int,input().split())
cnt = [0] * (n+1)
tree = [[] for _ in range(n+1)]
seen = [0] * (n+1)
todo = [1]
for i in range(n-1):
    a, b = map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)
for _ in range(q):
    p,x = map(int,input().split())
    cnt[p] += x

while todo != []:
    i = todo.pop()
    seen[i] = 1
    for j in tree[i]:
        if seen[j] == 0:
            todo.append(j)
            cnt[j] += cnt[i]
print(*cnt[1:])

Measured memory_bytes: 55828
#include<bits/stdc++.h>
using namespace std;
int inf=0x3f3f3f3f;
int d[210][210];
int p[10];
int main()
{
    int n,m,r,i,j,k,a,b,c;
    int res,ans;
    cin>>n>>m>>r;
    for(i=1;i<=r;i++)
        scanf("%d",&p[i]);
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
        {
            if (i==j) d[i][j]=0;
            else d[i][j]=inf;
        }
    for(i=1;i<=m;i++)
    {
        scanf("%d%d%d",&a,&b,&c);
        d[a][b]=d[b][a]=c;
    }
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
            for(k=1;k<=n;k++)
                d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
    ans=inf;
    sort(p+1,p+1+r);
    do
    {
        res=0;
        for(i=1;i<=r-1;i++)
            res+=d[p[i]][p[i+1]];
        ans=min(res,ans);
    }while(next_permutation(p+1,p+1+r));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] x = sc.next().toCharArray();
		int check = 0;



		for (int i = 0; i < x.length; i++) {
			if (x[i] == 'C' && check==0) {
				check = 1;
			}

			if (x[i] == 'F' && check==1){
				check = 2;
				break;
			}
		}


		if (check == 2) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		sc.close();
	}

}


Measured memory_bytes: 10064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int X;cin >> X;
    int ans = 0,cnt = 0;
    REP(i,X+100){
        if(X <= cnt){
            cout << i -1 << endl;
            return 0;
        }
        else{
            cnt += i;
        }
    }
}

Measured memory_bytes: 256
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=100000+10;
const int mod=1e9+7;
int qpow(int a,int b) { int c=1;
	for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) c=1ll*c*a%mod;
	return c;
}

int n,a[N],vis[N];
int fac[N],ifac[N];
int C(int n,int m) {
	if (n<m) return 0;
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

int main() {
	n=read(); int l,r;
	for (int i=1;i<=n+1;++i) a[i]=read();
	for (int i=1;i<=n+1;++i) {
		if (!vis[a[i]]) vis[a[i]]=i;
		else { l=vis[a[i]],r=i; break; }
	}
	fac[0]=1;
	for (int i=1;i<=n+1;++i) fac[i]=1ll*fac[i-1]*i%mod;
	ifac[n+1]=qpow(fac[n+1],mod-2);
	for (int i=n+1;i;--i) ifac[i-1]=1ll*ifac[i]*i%mod;
	for (int i=1;i<=n+1;++i)
		printf("%d\n",(C(n+1,i)-C(n+l-r,i-1)+mod)%mod);
	return 0;
}

Measured memory_bytes: 5228
package main

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

var n, m, q int
var a, b, c, d []int

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n, m, q = io.NextInt(), io.NextInt(), io.NextInt()
	a, b, c, d = make([]int, q), make([]int, q), make([]int, q), make([]int, q)
	for i := 0; i < q; i++ {
		a[i], b[i], c[i], d[i] = io.NextInt(), io.NextInt(), io.NextInt(), io.NextInt()
	}
	ans := solve()
	io.Println(ans)
}

func solve() (ans int) {
	return search([]int{1})
}

func search(choice []int) (max int) {
	if len(choice) == n+1 {
		return scoring(choice)
	}
	for i := choice[len(choice)-1]; i <= m; i++ {
		score := search(append(choice, i))
		if score > max {
			max = score
		}
	}
	return max
}

func scoring(choice []int) int {
	score := 0
	for i := range a {
		if choice[b[i]]-choice[a[i]] == c[i] {
			score += d[i]
		}
	}
	return score
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 5036
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BinaryHeap;
use std::cmp;


struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn d(g: &HashMap<usize, Vec<(usize, (usize, usize))>>, ck: usize, s: usize, n: usize) -> Vec<usize> {
    let mut pq = BinaryHeap::new();
    let mut dist: Vec<usize> = (0..(n+1)).map(|_| usize::max_value()).collect();
    dist[s] = 0;
    pq.push((usize::max_value(), s));
    while let Some((c, u)) = pq.pop() {
        // println!("{}", pq.len());
        if dist[u] > usize::max_value() - c { continue; }
        for &(v, cost) in &g[&u] {
            let alt = dist[u] + if ck == 0 {cost.0} else {cost.1};
            if dist[v] > alt {
                pq.push((usize::max_value()-alt, v));
                dist[v] = alt;
            }
        }
    }

    dist
}

fn main(){
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);  // スキャナの定義

    let n:usize = sc.read();
    let m:usize = sc.read();
    let s:usize = sc.read();
    let t:usize = sc.read();

    let mut g:HashMap<usize, Vec<(usize, (usize, usize))>> = HashMap::new();

    for i in 1..(n+1){
        g.insert(i, Vec::new());
    }
    for _ in 0..m{    
        let u:usize = sc.read();
        let v:usize = sc.read();
        let a:usize = sc.read();
        let b:usize = sc.read();
        // println!("{:?}",g);  
        // (*g.get_mut(&u).unwrap_or(&mut Vec::new())).push((v, (a, b)));
        // (*g.get_mut(&v).unwrap_or(&mut Vec::new())).push((u, (a, b)));
        (*g.get_mut(&u).unwrap()).push((v, (a, b)));
        (*g.get_mut(&v).unwrap()).push((u, (a, b)));
    }

    let dist0 = d(&g, 0, s, n);
    let dist1 = d(&g, 1, t, n);
    let mut ans: Vec<usize> = (0..(n+1)).map(|_| usize::max_value()).collect();
    for i in (0..(n)).rev(){
        ans[i] = cmp::min(ans[i+1], dist1[i+1] + dist0[i+1]);
    }
    for i in 0..n{
        println!("{}", 1e+15 as usize - ans[i]);
    }
    
}


Measured memory_bytes: 24332
#include<bits/stdc++.h> 
using namespace std;
int arr[1005][1005];

int main(){
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	for(int i=1;i<=b;i++){
		for(int j=1;j<=a;j++){
			arr[i][j]=1;
		}
	}
	for(int i=b+1;i<=h;i++){
		for(int j=a+1;j<=w;j++){
			arr[i][j]=1;
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			printf("%d",arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 5120
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 100000000

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}
 
void solve(void){
    string w;
    cin >> w;
    int map['z'+1];
    rep(i,'a','z'+1){
        map[i] = 0;
    }
    rep(i,0,w.size()){
        map[w[i]]++;
    }
    bool flag = false;
    rep(i,'a','z'+1){
        if(map[i]%2!=0){
            flag = true;
            break;
        }
    }
    if(!flag) ys();
    else ns();

}

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

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

using namespace std;

/* * * *   * * *   	* * * */
#define ll long long
#define ld long double
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<pair<int, int>>
#define VLL vector<pair<ll, ll>>
#define PB push_back()
#define B begin()
#define E end()
#define F first
#define S second
#define SZ size()
#define P complex <ll> 
#define X real()
#define Y imag()
const int oo = 1e9;
const ll mod = 1e7;
/* * * *   * * *   	* * * */

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s, t; cin>>s>>t;
	VI a(26, 0), b(26, 0);
	for (int i=0; i<(int)s.SZ; ++i){
		a[s[i]-97]++;
		b[t[i]-97]++;
	}
	sort(a.B, a.E);
	sort(b.B, b.E);
	for (int i=0; i<26; ++i) if (a[i] != b[i]){cout<<"No\n"; return 0;}
	cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 916
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_2 100000
#define d9_7 1000000007
int main(void){
  ll a,b,q;
  cin >> a>>b>>q;
  ll tmps,tmpt,x;
  set<ll> s;
  set<ll> t;
  rep(i,a){
    cin>>tmps;
    s.insert(tmps);
  }
  rep(i,b){
    cin>>tmpt;
    t.insert(tmpt);
  }
  s.insert(300000000000);
  s.insert(-300000000000);
  t.insert(300000000000);
  t.insert(-300000000000);
  rep(i,q){
    cin>>x;
    auto itrs=s.lower_bound(x);//その一つ右のやつ
    auto itrt=t.lower_bound(x);
    if(*itrt-x<0||*itrs-x<0){
      cout<<"ERROR";
    }
    ll x1=max(*itrs-x,*itrt-x);
    --itrs;--itrt;
    ll x2=max(x-*itrt,x-*itrs);
    ++itrs;++itrt;
    --itrt;
    ll x3 = (*itrs-x)*2 -*itrt+x;
    ll x5 = (*itrs-x)+2*( -*itrt+x);
    ++itrt;--itrs;
    ll x4 = (*itrt-x)*2 -*itrs+x;
    ll x6 = (*itrt-x)+2*( -*itrs+x);
    //cout<<"a"<<*itrt-x<<" "<<-*itrs+x<<endl;
    ++itrs;
    ll result=min(x1,x2);
    result=min(result,x3);
    result=min(result,x4);
    result=min(result,x5);
    result=min(result,x6);
    //cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<endl;
    cout<<result<<endl;
  }
  return 0;
}

Measured memory_bytes: 10752
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  int n;
  cin >> n;
  vi v(n);
  rep(i, n * (n - 1) / 2) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    if (c == d) {
      v[a]++;
      v[b]++;
      continue;
    }
    v[c > d ? a : b] += 3;
  }
  rep(i, n) {
    int r = 1;
    rep(j, n) r += v[i] < v[j];
    cout << r << endl;
  }
}

Measured memory_bytes: 3088
#include<stdio.h>

int A[1000000],n;

int binarySearch(int key){
	int left = 0;
	int right = n;
	int mid;
	while(left < right){
		mid = (left + right) / 2;
		if(key == A[mid]) return 1;
		if(key > A[mid]) left = mid + 1;
		else if(key < A[mid]) right = mid;
	}
	return 0;
}

int main(void){
	int i, q, k, sum = 0;
	
	scanf("%d",&n);
	for(i = 0; i < n; i++){
		scanf("%d",&A[i]);
	}
	
	scanf("%d",&q);
	for(i = 0;i < q; i++){
		scanf("%d",&k);
		if(binarySearch(k))sum++;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 976
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

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

    int m = sqrt(M);
    vector<int> a;
    for(int i=1; i<=m; ++i){
        if(M%i==0){
            a.push_back(i);
            a.push_back(M/i);
        }
    }
    sort(a.begin(), a.end());
    for(int i=a.size()-1; i>=0; --i){
        if(M/a[i] >= N){
            cout<<a[i]<<endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
//
// Created on 2019-01-25.
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }

#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

#define PB push_back
#define INF 1e9
#define MOD 1e9+7
#define EPS 1e-9

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

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


    int N, x, y;
    cin >> N;
    vector<pair<pii,bool>> red(N), blue(N);
    REP(i,N){
        cin >> x >> y;
        red[i] = {{x, y},true};
    }
    REP(i,N){
        cin >> x >> y;
        blue[i] = {{x, y},true};
    }

    sort(ALL(red), [](const pair<pii,bool> &l, const pair<pii,bool> &r) {return l.first.second > r.first.second;});
    sort(ALL(blue),[](const pair<pii,bool> &l, const pair<pii,bool> &r) {return l.first.first < r.first.first;});

//    REP(i,N) cout << red[i].first.first << " " << red[i].first.second << endl;
//    cout << "---------" << endl;
//    REP(i,N) cout << blue[i].first.first << " " << blue[i].first.second << endl;
//
//    return 0;
    int ans = 0;
    REP(b,N)REP(r,N){
        //赤い点と青い点は，赤い点のx座標が青い点のx座標より小さく， また赤い点のy座標も青い点のy座標より小さいとき，仲良しペアになれます
        //if red_x < blue_x and red_y < blue_y then be frend
        //bp.first > rp.second and bp.second > rp.first
        if (red[r].first.first < blue[b].first.first and red[r].first.second < blue[b].first.second and red[r].second){
            ans++;
            red[r].second = false;
            break;
        }
    }

    cout << ans << endl;

    return 0;

}

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

using namespace std; 

int64_t a[90];

int main(){ 
  int n;
  cin>>n;
  a[0]=2;
  a[1]=1;
  for(int i=0;i<=n;i++){
    if(i>1){
      a[i]=a[i-1]+a[i-2];
    }
  }
  cout<<a[n];
}
 

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

#define Max 2000000
#define Infty (1<<30)

int h, a[Max + 1];

void maxHeapify(int i){
  int l, r, largest, n;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= h && a[l] > a[i]) largest = l;
  else largest = i;

  if(r <= h && a[r] > a[largest]) largest = r;

  if(largest != i){
    n = a[i];
    a[i] = a[largest];
    a[largest] = n;

    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(h < 1) return -Infty;
  maxv = a[1];
  a[1] = a[h--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  int n;

  if(key < a[i]) return;
  a[i] = key;
  while(i > 1 && a[i / 2] < a[i]){
    n = a[i];
    a[i] = a[i / 2];
    a[i / 2] = n;
    i = i / 2;
  }
}

void insert(int key){
  h++;
  a[h] = -Infty;
  increaseKey(h, key);
}


int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s", com);
    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }
    else{
      printf("%d\n", extract());
    }
  }

  return 0;
}


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

signed main(){

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

    int n; cin >> n;
    vector<int> x(n), y(n);
    rep(i,n) cin >> x[i] >> y[i]; 
    
    auto dist = [&](int i, int j){
        int dx = x[i] - x[j];
        int dy = y[i] - y[j];
        return sqrt(dx * dx + dy * dy);
    };
    double len = 0;
    rep(i,n) rep(j,i) len += dist(i,j); 
    
    cout << fixed << setprecision(8);
    cout << 2 * len / n << endl;
    return 0;
}

Measured memory_bytes: 256
res_list = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]]

n = int(input())

for i in range(n):
    io_rec = list(map(int, input().split(" ")))
    bld_num = io_rec[0] - 1
    floor_num = io_rec[1] - 1
    room_num = io_rec[2] - 1
    io_headcnt = io_rec[3]
    res_list[bld_num][floor_num][room_num] += io_headcnt


for i in range(4):
    if i:
        print("#" * 20)
    bld = res_list[i]
    for j in bld:
        floor_str = map(str, j)
        print(" " + " ".join(floor_str))


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

using namespace std;

const long long INF = LONG_LONG_MAX;
const int maxsum = (int) (1e5 + 1);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, weight;
    cin >> n >> weight;
    vector<int> c(n), w(n);
    vector<vector<long long> > dp(n + 1);
    for (int i = 0; i <= n; i++) {
        dp[i].resize(maxsum);
    }
    for (int i = 0; i < n; ++i) {
        cin >> w[i] >> c[i];
    }
    for (int i = 0; i < maxsum; ++i) {
        dp[0][i] = weight+1;
    }
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j < maxsum; ++j) {
            dp[i][j] = dp[i - 1][j];
            if (j >= c[i - 1]) dp[i][j] = min(dp[i][j], dp[i - 1][j - c[i - 1]] + w[i - 1]);
        }
    }
    int ans = -1;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j < maxsum; ++j) {
            if (dp[i][j] <= weight) ans = max(ans, j);
        }
    }
    cout << ans << "\n";
    return 0;
}

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

    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;

    int flag = 1;
    int cnt_dot = 0;
    int cnt_sharp = 0;
    rep(i, n){
        if(s[i] == '#' && i > a-1 && i < max(c, d)){    //壁2個以上
            cnt_sharp++;
            if(cnt_sharp == 2){
                flag -= 10;
            }
        }
        else{
            cnt_sharp = 0;
        }

        if(s[i] == '.' && i >= b-2 && i <= d-1){
            cnt_dot++;          // .3個連続なら抜かせる
            if(cnt_dot == 3){
                flag += 5;
            }
        }
        else{
            cnt_dot = 0;
        }
    }

    for(int i=a-1; i<c; i++){
        if(s[i+1] == '#' && i+2 == d-1){
            flag -= 3;
        }
    }

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

    return 0;
}

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

using namespace std;


int n;

int main()
{
	
    #ifdef patil
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif


   cin>>n;
   
   int a[n];
   for(int i=0;i<n;i++)cin>>a[i];

  int min=a[0];
  long long int ans =0;
    for(int i=1;i<n;i++)
    {
        if(a[i]<min)ans+=(min-a[i]);
        else min=a[i];
    }
    cout<<ans;

    return 0;
    

}

Measured memory_bytes: 4296
#include <stdio.h>

int main(void)
{
	long long n, l[90] = {2, 1}, i;

	for (i = 2; i <= 86; i++)
		l[i] = l[i - 1] + l[i - 2];

	scanf("%lld", &n);
	printf("%lld\n", l[n]);

	return 0;
}

Measured memory_bytes: 128
// D - Walk and Teleport
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll n,a,b; cin>>n>>a>>b;
	ll nxt,cur = 0;
	ll xi,xj; cin>>xj;
	while(--n){
		xi = xj; cin>>xj;
		cur = nxt = cur + min(b, (xj-xi)*a);
	}
	cout<< cur <<endl;
}

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

using namespace std;

int main() {
    int N = 0, M = 0;
    map<int, int> A;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int a = 0, b = 0;
        cin >> a >> b;
        A[a]++;
        A[b]++;
    }
    for (int i = 1; i <= N ; i++){
        cout << A[i] << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool flg=false;
    if(s[2]==s[3]&&s[4]==s[5])flg=true;
    if(flg)puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
x,k,d=map(int,input().split())
x=abs(x)
if x>=k*d:
  print(x-k*d)
else:
  if x%d==0:
    t=0
  else:
    t=x%d
  c=k-(x-t)//d
  if c%2==0:
    print(x%d)
  else:
    print(d-x%d)


Measured memory_bytes: 61884
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<double, double> P;

llint n;
double x[105], y[105];

void intersection(vector<P> &vec, vector<P> &vec2)
{
	vector<P> ret;
	for(int i = 0; i < vec.size(); i++){
		for(int j = 0; j < vec2.size(); j++){
			double l = vec[i].first, r = vec[i].second;
			l = max(l, vec2[j].first), r = min(r, vec2[j].second);
			if(l <= r) ret.push_back(P(l, r));
		}
	}
	vec = ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> x[i] >> y[i];
	
	for(int i = 1; i <= n; i++){
		vector<P> vec;
		vec.push_back(P(-M_PI, M_PI));
		for(int j = 1; j <= n; j++){
			if(i == j) continue;
			double dx = x[j]-x[i], dy = y[j]-y[i];
			double ang = atan2(dy, dx);
			double l = ang - M_PI*1.5, r = ang - M_PI*0.5;
			while(r < -M_PI) l += M_PI*2, r += M_PI*2;
			
			//cout << l << " " << r << endl;
			
			vector<P> tmp;
			if(l < -M_PI){
				tmp.push_back(P(l+M_PI*2,  M_PI));
				tmp.push_back(P(-M_PI, r));
			}
			else tmp.push_back(P(l, r));
			
			intersection(vec, tmp);
		}
		double ans = 0;
		for(int i = 0; i < vec.size(); i++){
			ans += vec[i].second - vec[i].first;
		}
		printf("%.11f\n", ans / (M_PI*2));
	}
	
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
long long n,h,w,ans;
int main()
{
	cin>>n>>h>>w;
	while(n--)
	{
		int a,b;
		cin>>a>>b;
		if(a>=h&&b>=w)
		{
			ans++;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<map>
#include<functional>
using namespace std;
typedef long long int llint;
typedef bool izryt;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int big = 1e9;
template <class T, class U>void mineq(T& a, U b) { if (a > b) { a = b; } }
template <class T, class U>void maxeq(T& a, U b) { if (a < b) { a = b; } }
template <typename T>
class seg_tree {
public:
	T treemax, treemin, lazyplus;
	int seghi, segmg;
	seg_tree *left;
	seg_tree *right;
	seg_tree(int hi, int mg) {
		treemax = 0; treemin = 0; lazyplus = 0;
		seghi = hi; segmg = mg;
		left = NULL; right = NULL;
		int tyu = (hi + mg) / 2;
		if (hi + 1 < mg) { make_left(hi, tyu); make_right(tyu, mg); }
	}
	~seg_tree() { delete left; delete right; }
	void make_left(int hi, int mg) { if (this->left != NULL) { cout << "ばぐ" << endl; throw(1); }this->left = new seg_tree(hi, mg); }
	void make_right(int hi, int mg) { if (this->right != NULL) { cout << "ばぐ" << endl; throw(1); }this->right = new seg_tree(hi, mg); }
	void seg_plus(int hi, int mg, T val) {//区間加算クエリ
	//timecount++;//計算量
		if (hi <= seghi && segmg <= mg) { lazyplus += val; return; }
		if (mg <= seghi || segmg <= hi) { return; }
		left->seg_plus(hi, mg, val);
		right->seg_plus(hi, mg, val);
		treemin = min(left->treemin + left->lazyplus, right->treemin + right->lazyplus);
		treemax = max(left->treemax + left->lazyplus, right->treemax + right->lazyplus);
		return;
	}
	T ask_min(int hi,int mg){//区間(hi,mg]について,最小を返す
		//timecount++;//計算量
		if(hi<=seghi&&segmg<=mg){return treemin+lazyplus;}
		if(mg<=seghi||segmg<=hi){return big;}
		T leret,riret;
		if(right!=NULL&&left!=NULL&&lazyplus!=0){
			right->lazyplus+=this->lazyplus;
			left->lazyplus+=this->lazyplus;
			treemax+=lazyplus;
			treemin+=lazyplus;
			lazyplus=0;
		}
		leret=left->ask_min(hi,mg);
		riret=right->ask_min(hi,mg);
		return min(leret,riret);
	}
};
const int mod = 1e9 + 7;
int main(void) {
	llint N, D, A = 0;
	cin >> N >> D >> A;
	vector<pair<llint, llint>> XH(N);
	llint i, t, k;
	for (i = 0; i < N; i++) {
		cin >> t >> k;
		XH[i] = mp(t, k);
	}
	sort(XH.begin(), XH.end());
	seg_tree<llint>isu(0, N + 2);

	for (i = 0; i < N; i++) { isu.seg_plus(i, i + 1, XH[i].sec);}

	llint ans = 0;
	k = 0;
	for (i = 0; i < N; i++) {
		if (isu.ask_min(i, i + 1) <= 0) {
			continue;
		}
		t = XH[i].fir;
		for (; k < N; k++) {
			if (XH[k].fir > t + D * 2) {
				k -= 1;
				break;
			}
		}
		t = isu.ask_min(i, i + 1);
        if (t < 0) {
        	t = 0;
        }
		llint n = ceil(double(t) / A);
		ans += n;
		isu.seg_plus(i, k + 1, -n * A);
	}

	cout << ans << endl;
}


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

int n,m,x;
int a[101];


int main(void){
    // Your code here!
    cin >> n >> m >> x;
    REP(i,0,m) {
        int temp;
        cin >> temp;
        a[temp] = 1;
    }
    
    // cout << n - x << endl;
    
    int toN = 0;
    int toS = 0;
    
    REP(i,x,n) {
        if (a[i] == 1) toN += 1;
    }
    
    for(int i = x; i >= 0; i--) {
        if (a[i] == 1) toS += 1;
    }
    // cout << toN << " " << toS << endl;
    
    cout << min(toN,toS) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <fstream>

using namespace std;

bool iskakko(char c)	{
	if (c == '[' || c == ']' || c == '(' || c == ')')	return true;
	else	return false;
}

int main()	{
	char c[110];
	char temp;
	std::vector<int> v;
	bool legal;
	// bool miss;
	
	/*
	char tehon[5];
	FILE* fp;
	FILE* fp2;
	fp = fopen("out1.txt", "r");
	fp2 = fopen("misslist.txt", "w");
	*/
	
	while (true)	{
		fgets(c, 110, stdin);
		if (c[0] == '.')	break;
		
		v.clear();
		legal = true;
		// miss = false;
		
		for (int i = 0; c[i] != '\n'; i++)	{
			
			if (c[i] == '(')	{
				//printf("'('found\n");
				v.push_back('(');
				
			} else if (c[i] == '[')	{
				//printf("'['found\n");
				v.push_back('[');
				
			} else if (c[i] == ')')	{
				//printf("')'found\n");
				if (v.empty() || v.back() != '(')	{
					legal = false;
					break;
				} else	{
					v.pop_back();
				}
				
			} else if (c[i] == ']')	{
				//printf("']'found\n");
				if (v.empty() || v.back() != '[')	{
					legal = false;
					break;
				} else	{
					v.pop_back();
				}
			}
		}
		
		// fgets(tehon, 5, fp);

		if (!v.empty())	{
			legal = false;
		}
		
		if (legal)	{
			printf("yes\n");
			/*
			if (tehon[0] != 'y')	{
				miss = true;
			}
			*/
		} else	{
			printf("no\n");
			/*
			if (tehon[0] != 'n')	{
				miss = true;
			}
			*/
		}
		/*
		
		miss = false;
		
		if (miss)	{
			ofstream outputfile("misslist.txt");
			outputfile << c;
			outputfile.close();
		}
		*/
	}
	
	return 0;
}


Measured memory_bytes: 2520
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s =scan.next();
		String week[]= {"SAT","FRI","THU","WED","TUE","MON","SUN"};

		for(int i=0;i<week.length;i++) {
			if(week[i].equals(s)) {
				System.out.println((i+1));
				break;
			}
		}
	}

}

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

using namespace std;

using int64 = long long;

constexpr int64 P = 1000000007;

// Verified: ABC133E, ABC132D, ABC130E
struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 input_x) : x(input_x) {}
  FiniteField() : x(0) {}
  int64 Value() { return x; }
  inline FiniteField operator+(FiniteField o) {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

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

  string input;
  cin >> input;
  reverse(input.begin(), input.end());
  int n = input.length();

  vector<FiniteField> dp1(n + 1);
  vector<FiniteField> dp2(n + 1);
  dp1[0] = 1;
  dp2[0] = 1;

  for (int i = 1; i <= n; i++) {
    dp2[i] = dp2[i - 1] * 3;
    if (input[i - 1] == '1') {
      dp1[i] = dp1[i - 1] * 2 + dp2[i - 1];
    } else {
      dp1[i] = dp1[i - 1];
    }
  }
  cout << dp1[n].Value() << endl;
}


Measured memory_bytes: 2000
N, K = map(int, input().split())
M=10**9+7
As = list(map(int, input().split()))
dp = [[0]*(K+1)for _ in range(N+1)]
dp2 = [[1]*(K+1)for _ in range(N+1)]
dp[0][0] = 1

for i in range(1, N+1):
    for j in range(K+1):
#        print(i,j, dp[i][j-1] - dp2[i][j-1] + dp[i-1][j], j-As[i-1])
        dp[i][j] = 1 if j==0 else (dp[i][j-1] - dp2[i][j-1] + dp[i-1][j])%M
        dp2[i][j] = 0 if j-As[i-1] <0 else dp[i-1][j-As[i-1]]%M
#        dp[i][j] = sum(dp[i-1][max(0, j-As[i])...j])
#        sum(dp[i][0...j]) = sum(dp[i-1][max(0,j-As[i])...j])
#        dp[i][j] = dp[i-1][j] + dp[i-1][j-1] + ... dp[i-1][max(0, j-As[i])]
#print(dp,dp2)
print(dp[N][K])


Measured memory_bytes: 193304
s = list(map(str, input().rstrip()))


def solve(s, d):
    arr = [0] * len(s)

    if d == "L":
        s = s[::-1]

    cnt = 0
    for i in range(len(s)):
        if s[i] == d:
            cnt += 1
        elif cnt > 0:
            arr[i - 1] = (cnt + 1) // 2
            arr[i] = cnt // 2
            cnt = 0

    if d == "L":
        arr = arr[::-1]

    return arr


ans = [x + y for x, y in zip(solve(s, "R"), solve(s, "L"))]

print(*ans)

Measured memory_bytes: 7072
n,x=map(int,input().split())
def eat(n,x):
    if x==0:
        return 0
    if n==0 and x==1:
        return 1
    
    if n>=1:
        if x<=2**(n+1)-2:
            return eat(n-1,x-1)
        elif x==2**(n+1)-1:
            return eat(n-1,2**(n+1)-3)+1
        elif 2**(n+2)-3>x>=2**(n+1):
            return eat(n-1,2**(n+1)-3)+1+eat(n-1,x+1-2**(n+1))
        elif x==2**(n+2)-3:
            return 2*eat(n-1,2**(n+1)-3)+1
print(eat(n,x))

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    S=list(input())
    ans=0
    tmp=0
    for s in S:
        if s=='A' or s=='T' or s=='G' or s=='C':
            tmp+=1
        else:
            ans=max(ans,tmp)
            tmp=0
    ans=max(ans,tmp)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 39856
#include <iostream>

using namespace std;

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

if(i == "Sunny") {
   cout << "Cloudy" ;
}
else if ( i == "Cloudy"){
    cout << "Rainy";
    
}
else if ( i == "Rainy") {
    
    cout << "Sunny";
}
 
}

Measured memory_bytes: 256
#include<stdio.h>
typedef long long ll;
typedef double du;
const du inf=9223372036854775807.;
du S(ll n){
	du s=0;
	while(n){
		s+=n%10;
		n/=10;
	}
	return s;
}
ll f(ll n){
	ll d,t,f;
	du mn,s;
	f=n;
	mn=n/S(n);
	for(d=1;d<=n;d*=10){
		t=n/d*d+d*10-1;
		s=t/S(t);
		if(s<mn){
			mn=s;
			f=t;
		}
	}
	return f;
}
int main(){
	int k;
	ll n;
	scanf("%d",&k);
	for(n=1;k--;n=f(n+1))printf("%lld\n",n);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

int main()
{
	cin >> N;
	ll curr = 100;
	int index = 0;
	while(curr < N){
		curr *= 1.01;
		index++;
	}
	cout << index;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int a,b;
    int c;
    while(cin>>a>>b>>c&& a && b && c){
        int ans=0;
        rep(i,1,c){
            rep(j,1,c){
                int x=i*(100+a)/100;
                int y=j*(100+a)/100;
                if(x+y==c){
                    ans=max(ans,i*(100+b)/100+j*(100+b)/100);
                }
            }
        }
        cout<<ans<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IFOR(v,it) for(VI::iterator it=(v).begin();it!=(v).end();++it)

int solve(int N, int six, int nine) {
  if (N == 0)
    return 0;
  while (six > N)
    six /= 6;
  while (nine > N)
    nine /= 9;
  return min(1 + solve(N - six, six, nine), 1 + solve(N - nine, six, nine));
}

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

  int six = 6, nine = 9;
  while (six < N)
    six *= 6;

  while (nine < N)
    nine *= 9;

  cout << solve(N, six, nine) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n",num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

int main(){
	double L;
	cin >> L;
	double l =  L/3;
	printf("%lf", l*l*l);
}

Measured memory_bytes: 256
object Main extends App {
  val in = Iterator.continually(io.StdIn.readLine.toInt)
    .take(4).toArray

  val ans =  for {
    i <- 0 to in(0)
    j <- 0 to in(1)
    k <- 0 to in(2)
    if 500*i + 100*j + 50*k == in(3)
    } yield  true

  println(ans.size)
}

Measured memory_bytes: 27984
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int Main(string[] args) {
        List<string> list = new List<string>();

        int taro = 0;
        int hanako = 0;

        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++) {
            string[] s = Console.ReadLine().Split(' ');

            if (s[0].CompareTo(s[1]) > 0) { taro += 3; }
            else if (s[0].CompareTo(s[1]) < 0) { hanako += 3; }
            else { taro++; hanako++; }
        }

        Console.WriteLine("{0} {1}", taro, hanako);

        return 0;
    }
}



Measured memory_bytes: 18824
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r,d;
    cin >> l >> r>> d;
    int ans=0;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};


int main() {

    int n, m;
    cin >> n >> m;
    vector<vector<mint>> dp(n + 1, vector<mint>(m + 1));
    vector<vector<mint>> sum(n + 1, vector<mint>(m + 1, 0));

    vector<ll> s(n), t(m);
    rep(i, n) cin >> s[i];
    rep(i, m) cin >> t[i];

    rep(i, n + 1) sum[i][0] = 1;
    rep(i, m + 1) sum[0][i] = 1;
    mint ans = 1;
    rep(x, n) rep(y, m) {
            if (s[x] == t[y]) {
                dp[x + 1][y + 1] = sum[x][y];
                ans += dp[x + 1][y + 1];
            }
            sum[x + 1][y + 1] = sum[x][y + 1] + sum[x + 1][y] - sum[x][y] + dp[x + 1][y + 1];
        }
    cout << ans << endl;
}

Measured memory_bytes: 62976
// https://atcoder.jp/contests/abc173/tasks/abc173_d

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

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 2*1e5;
const int A_I_MAX = 1e9;

int N;
vector<int> A;

int main() {
  cin >> N;
  A = vector<int>(N);
  REP(i, N) cin >> A[i];

  sort(A.begin(), A.end(), greater<int>());

  ll ans = 0;
  FOR(i, 1, N - 1) {
    ans += A[i / 2];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4024
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[][] grid = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				grid[i][j] = sc.nextInt();
			}
		}
		int[] x12 = new int[3];
		int[] x13 = new int[3];
		int[] x23 = new int[3];
		int[] y12 = new int[3];
		int[] y13 = new int[3];
		int[] y23 = new int[3];
		
		for (int i = 0; i < 3; i++) {
			x12[i] = grid[i][0] - grid[i][1];
			x13[i] = grid[i][0] - grid[i][2];
			x23[i] = grid[i][1] - grid[i][2];
			y12[i] = grid[0][i] - grid[1][i];
			y13[i] = grid[0][i] - grid[2][i];
			y23[i] = grid[1][i] - grid[2][i];
		}
		boolean flag = true;
		for (int i = 0; i < 2; i++) {
			for (int j = i + 1; j < 3; j++) {
				if (x12[i] != x12[j]) {
					flag = false;
					break;
				}
				if (x13[i] != x13[j]) {
					flag = false;
					break;
				}
				if (x23[i] != x23[j]) {
					flag = false;
					break;
				}
				if (y12[i] != y12[j]) {
					flag = false;
					break;
				}
				if (y13[i] != y13[j]) {
					flag = false;
					break;
				}
				if (y23[i] != y23[j]) {
					flag = false;
					break;
				}
			}
			if (!flag) {
				break;
			}
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define LL long long
using namespace std;
inline int read(){
    int x = 0; char c = getchar();
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
    return x;
}
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
LL n;
map<LL,LL>mp;
LL solve(LL n){
	if (n==1) return 1;
	if (mp.count(n)) return mp[n];
	return 1 + 2*solve(n/2);
}
int main(){
	read(n); mp.clear();
	cout << solve(n) << endl;
    return 0;
}

Measured memory_bytes: 256