akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define debd(x) pf("%s = %d\n", #x, x)
#define debs(x) pf("%s = %s\n", #x, s)
#define debll(x) pf("%s = %lld\n", #x, x)
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return pos;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};


int main() {
//    freopen("input.in", "r", stdin);
	string a, b;
	cin>>a>>b;
	if(a.size() != b.size()) {
		if(sz(a) < sz(b)) puts("LESS");
		else puts("GREATER");
	}
	else puts(a == b ? "EQUAL" : a < b ? "LESS" : "GREATER");
	return 0;
}

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

int N;
int Y;

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

    Y /= 1000;

    for (int ten = 0; ten <= N; ten++)
    {
        int remain = N - ten;
        for (int five = 0; five <= remain; five++)
        {
            int one = N - ten - five;

            if(one + five * 5 + ten * 10 == Y)
            {
                cout << ten << " " << five << " " << one << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
class abc_168:
    
    def __init__(self):
        pass
    
    def A(self):
       N=int(input())
       hon=[2,4,5,7,9]
       pon=[0,1,6,8]
       bon=[3]
       
       ans=N%100
       ans=ans%10
       
       if ans in hon:print("hon")
       elif ans in pon:print("pon")
       else :print("bon")
    
    def B(self):
        K=int(input())
        S=input()
        
        if len(S)<=K:print(S)
        else:
            ans=S[0:K]+"..."
            print(ans)
        
    def C(self):
       pass
            
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_168()
    obj.B()

Measured memory_bytes: 61928
import math

a,b,h,m = map(int, input().split())

ax = a*math.sin((h+m/60)/6*math.pi)
ay = a*math.cos((h+m/60)/6*math.pi)
bx = b*math.sin(m/30*math.pi)
by = b*math.cos(m/30*math.pi)

print(math.sqrt((ax-bx)**2+(ay-by)**2))

Measured memory_bytes: 9464
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    int ans = 0;
    for (int i = 1; i < n-1; ++i) {
        if (p[i-1] < p[i] && p[i] < p[i+1]) ans++;
        else if (p[i-1] > p[i] && p[i] > p[i+1]) ans++;
    }

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

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int N;
  int a, b;
  scanf("%d", &N);
  
  a = N / 10;
  b = N % 10;
  
  if(a == 9){
    printf("Yes\n");
  }else{
    if(b == 9){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  
  return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

//typedef long long ll;
#define ll __int128_t
const int IINF = INT_MAX;
//const ll LLINF = LLONG_MAX;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++) {
    if ('0' <= s[i] && s[i] <= '9') {
      ret = 10 * ret + s[i] - '0';
    }
  }
  if( s[0] == '-' ) ret *= -1;
  return ret;
}

std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}


inline bool check(ll coef, ll T, ll A, ll a, ll b) {
  return coef * T >= a && coef * A >= b;
}

ll bin(ll T, ll A, ll a,ll b) {
  ll L = 0, R = 1;
  rep(_,100) R <<= 1;
  ll two = 2;
  while( L + 1LL < R ){
    ll coef = ( L + R ) / two;
    if( check(coef,T,A,a,b) ) R = coef;
    else                      L = coef;
  }
  if( check(L,T,A,a,b) ) return L;
  else if( check((L+R)/2LL,T,A,a,b) ) return (L+R)/2LL;
  else return R;
}

int n;
ll T[1010], A[1010];
int main() {
  cin >> n;
  ll a = 1, b = 1;
  rep(i,n) {
    string s,t;
    cin >> s >> t;
    T[i] = parse(s);
    A[i] = parse(t);
    //cin >> T[i] >> A[i];
    ll coef = 0;
    //while( !( coef * T[i] >= a && coef * A[i] >= b ) ) ++coef;
    //assert( bin(T[i],A[i],a,b) == coef );
    //coef = bin(T[i],A[i],a,b);
    /*
    ll v = a / T[i];
    if( a % T[i] ) ++v;
    ll w = b / A[i];
    if( b % A[i] ) ++ w;
    coef = max(v,w);
    */

    //cout << coef << " == " << bin(T[i],A[i],a,b) << endl;
    //assert( coef == bin(T[i],A[i],a,b) );
    coef = bin(T[i],A[i],a,b);
    a = coef * T[i];
    b = coef * A[i];
  }
  cout << a+b << endl;
  compute();
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll A,B,C,D; cin >> A >> B >> C >> D;
    cout << min(A,B) + min(C,D) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;

const int mod = 1000000007;
class mint {
public:
    long long x;
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { return mint(-x);}
    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(long long t) const {
        if(t == 0) 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;}
};
//istream& operator>>(istream& is, mint& a) { return is >> a.x;}
//ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1) {
        fact[0] = 1;
        for(int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if(k < 0 || n < k) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int main() {
    int n;
    cin >> n;
    if(n == 1) {
        cout << 0 << endl;
        return 0;
    }
    mint a = 10, b = 9, c = 8;
    mint ans = a.pow(n) - b.pow(n) * 2 + c.pow(n);
    cout << ans.x << endl;

    return 0;
}


Measured memory_bytes: 3612
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Tue Jan  8 23:49:30 2019
//
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	ans := 0
	for i := 0; i < N; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		ans += r - l + 1
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
	static final long MOD = 1000000007L;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int N = sc.ni();
		long[] nums = new long[N];
		for (int i = 0; i < N; i++)
			nums[i] = sc.nl();
		
		long money = 1000;
		long stock = 0;
		for (int i = 0; i < N-1; i++) {
			if (nums[i+1]>nums[i]) {
				long buy = money/nums[i];
				money -= buy*nums[i];
				stock += buy;
				//sell
				money += stock*nums[i+1];
				stock = 0;
				
			}
		}
		pw.println(money);
		
		pw.close();
	}
	
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        }
        
        int ni() { 
            return Integer.parseInt(next()); 
        }
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() {
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 32940
using System;
using System.Collections.Generic;
using System.Text;

namespace AOJ
{
    class Program
    {
        static bool substringStargs(ref char[] text, int itextStarts, ref char[] substring)
        {
            if (text.Length < itextStarts + substring.Length)
            {
                return false;
            }
            for (int isub = 0; isub < substring.Length; ++isub)
            {
                if (text[itextStarts + isub] != substring[isub])
                {
                    return false;
                }
            }
            return true;
        }

        static void Main(string[] args)
        {
            var inputLine0 = Console.In.ReadLine();
            var inputLine1 = Console.In.ReadLine();

            var s = (inputLine0 + inputLine0).ToCharArray();
            var p = inputLine1.ToCharArray();

            var hasPattern = "No";

            for (int iis = 0; iis < s.Length - p.Length; ++iis)
            {
                if (substringStargs(ref s, iis, ref p))
                {
                    hasPattern = "Yes";
                }
            }

            Console.Out.WriteLine(hasPattern);
        }
    }
}



Measured memory_bytes: 17936
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int H = sc.nextInt();
			final int N = sc.nextInt();
			
			int[] as = new int[N];
			int[] bs = new int[N];
			for(int i = 0; i < N; i++) {
				as[i] = sc.nextInt();
				bs[i] = sc.nextInt();
			}
			
			final int MAX = 100000;
			long[] DP = new long[MAX + 1];
			Arrays.fill(DP, Integer.MAX_VALUE);
			DP[0] = 0;
			
			for(int i = 0; i < N; i++) {
				final int a = as[i];
				final int b = bs[i];
				
				for(int j = 0; j + a < DP.length; j++) {
					DP[j + a] = Math.min(DP[j + a], DP[j] + b);
				}
			}
			//System.out.println(Arrays.toString(DP));
			
			long answer = Long.MAX_VALUE;
			for(int i = H; i <= MAX; i++) {
				answer = Math.min(answer, DP[i]);
			}
			
			System.out.println(answer);
		
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 22228
using System;


class Program
{
    static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        for (int i = 1; i <= a; i++)

        {
            if ( i % 3 == 0)
            {
                Console.Write(" " + i);
            }
            else
            {
                string y=""+i+""; for (int k = 0; k < y.Length; k++) { if (y.Substring(k, 1) == "3") { Console.Write(" "+i);break; } } }
        }
        Console.WriteLine();
        Console.ReadLine();
    }
}

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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

using namespace atcoder;

int main() {
    string s = "ACL";

    li k;
    cin>>k;
    rep(i,k){
        cout<<s;
    }
    cout<<endl;

    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);

	int n, w;
	cin >> n >> w;

	int c = 1e5;
	ll dp[c+1];
	memset(dp, INF, sizeof dp);
	dp[0] = 0;
	For(i,n) {
		int we, v;
		cin >> we >> v;
		for (int j=c; j-v>=0; j--) {
			dp[j] = min(dp[j], dp[j-v] + we);
		}
	}

	ll ans = 0;
	For(i,c+1) {
		if (dp[i] <= w) ans = i;
	}
	cout << ans << nl;

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int prime[100000];
int main()
{
  prime[0] = prime[1] = 2;
  for(int i = 2; i < 100000; i++)
  {
    if(prime[i])
      continue;
    for(int j = i + i; j < 100000; j += i)
      prime[j] = 2;
  }
  int n;
  while(cin >> n)
  {
    int i;
    for(i = n - 1; prime[i] == 2; i--);
    cout << i << " ";
    for(i = n + 1; prime[i] == 2; i++);
    cout << i << endl;
  }
}

Measured memory_bytes: 1548
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>

using namespace std;

int m,n;
int k[31];
int like[31]={};
int main(){
    cin >> n >> m;
    for(int i=0;i<n;i++){
        int k;
        cin >> k;
        int like_num;
        for(int j=0;j<k;j++){
            cin >> like_num;
            like[like_num-1]++;
        }
    }

    int all_like = 0;
    for(int i=0;i<m;i++){
        if(like[i]==n){
            all_like++;
        }
    }

    cout << all_like << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
	float l,r;
	int lx[4],rx[4],i;
	for(i=0;i<4;i++){
		lx[i]=0; rx[i]=0;
	}
	while(scanf("%f",&l)!=EOF){
		scanf("%f",&r);
		if(l>=1.1) lx[0]++;
		else if(l>=0.6) lx[1]++;
		else if(l>=0.2) lx[2]++;
		else lx[3]++;
		if(r>=1.1) rx[0]++;
		else if(r>=0.6) rx[1]++;
		else if(r>=0.2) rx[2]++;
		else rx[3]++;
	}
	for(i=0;i<4;i++) cout<<lx[i]<<' '<<rx[i]<<endl;
	return 0;
}

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

int main() {
  string A, B;
  cin >> A >> B;
  if (A.size() != B.size()) {
      cout << (A.size() < B.size() ? "LESS" : "GREATER") << endl;
      return 0;
  }
  for (int i = 0; i < A.size(); i++) {
    if (A[i] == B[i]) continue;
    else {
      cout << (A[i] < B[i] ? "LESS" : "GREATER") << endl;
      return 0;
    }
  }
  cout << "EQUAL" << endl;
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


int N;
ll C;
ll X[101000];
ll V[101000];

pll normal_round[100010];
pll rev_round[100010];


class RMQ{
public:
    int n;
    vector<ll> dat;
    // 初期化
    void init(int n_){
        n=1;
        while(n<n_)n*=2;
        dat.resize(n * 2 - 1, LONG_LONG_MIN / 100);
    }
    // k番目の値(0-indexed)をaに変更
    void update(int k,ll a){
        // 葉の節点
        k+=n-1;
        dat[k]=a;
        // のぼりながら更新
        while(k>0){
            k=(k-1)/2;
            dat[k]=max(dat[k*2+1],dat[k*2+2]);
        }
    }
    // [a,b)の最大値を求める
    // kは節点の番号、l,rはその節点が[l,r)に対応づいていることを表す
    // したがって、外からはquery(a,b,0,0,n)として呼ぶ
    ll _query(int a,int b,int k,int l,int r){
        if(r<=a||b<=l)return LONG_LONG_MIN / 100;
        else if(a<=l&&r<=b)return dat[k];
        ll vl=_query(a,b,k*2+1,l,(l+r)/2);
        ll vr=_query(a,b,k*2+2,(l+r)/2,r);
        return max(vl,vr);
    }
    ll query(int a,int b){
        return _query(a,b,0,0,n);	
    }
};

RMQ rmq[2];

int main(){

    cin >> N >> C;
    for(int i = 0; i < N; i++) cin >> X[i] >> V[i];
    rmq[0].init(N);
    rmq[1].init(N);

    ll normal_opt = 0;
    ll rev_opt = 0;
    
    for(int i = 0; i < N; i++){
        if(i == 0){
            normal_round[i].first =  X[i];
            normal_round[i].second = V[i];
        }
        else{
            normal_round[i].first =  X[i];
            normal_round[i].second = V[i] + normal_round[i-1].second;
        }
        rmq[0].update(i, -normal_round[i].first + normal_round[i].second);
        normal_opt = max(normal_opt, -normal_round[i].first + normal_round[i].second);
    }
    for(int i = N - 1; i >= 0; i--){
        if(i == N - 1){
            rev_round[i].first =  C - X[i];
            rev_round[i].second = V[i];
        }
        else{
            rev_round[i].first =  C - X[i];
            rev_round[i].second = V[i] + rev_round[i+1].second;
        }
        rmq[1].update(i, -rev_round[i].first + rev_round[i].second);
        rev_opt = max(rev_opt, -rev_round[i].first + rev_round[i].second);
    }
    
    ll opt = max(normal_opt, rev_opt);

    for(int i = 0; i < N; i++){
        ll val = rmq[0].query(i, i + 1) - X[i] + rmq[1].query(i + 1, N);
        opt = max(opt, val);
    }
    for(int i = N - 1; i >= 0; i--){
        ll val = rmq[1].query(i, i + 1) - (C - X[i]) + rmq[0].query(0, i);
        opt = max(opt, val);
    }

    cout << opt << endl;

}


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

int main(){

    int n, flag=1, count=0, sentou=0;
    cin >> n;
    int A[n];
    for( int i=0 ; i<n ; i++){
        cin >> A[i];
    }

    while(flag){
        flag = 0;

        for( int j=n-1 ; j>=sentou+1 ; j-- ){
            if(A[j]<A[j-1]){
                int a;
                a = A[j];
                A[j] = A[j-1];
                A[j-1] = a;
                flag = 1;
                count++;
            }
        }

        sentou++;
    }
    for( int k=0 ; k<n-1 ; k++){
        cout << A[k] << " ";
    }
    cout << A[n-1] << endl;
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3096
#include <cstdio>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
#define INF (1<<27)
typedef pair<int,int> P;
int d[3000];
int c[3000][3000];
int N,M,K;
int main() {
	scanf("%d%d%d",&N,&M,&K);
	fill(c[0],c[0]+3000*3000,INF);
	for(int i=0;i<M;i++) {
		int a,b,l;
		scanf("%d%d%d",&a,&b,&l);
		c[a-1][b-1]=c[b-1][a-1]=l;
	}
	fill(d,d+3000,INF);
	for(int i=0;i<K;i++) {
		int s;
		scanf("%d",&s);
		d[s-1]=0;
		priority_queue<P,vector<P>,greater<P> > que;
		que.push(P(0,s-1));
		while(!que.empty()) {
			P p=que.top();que.pop();
			if(d[p.second]<p.first)continue;
			for(int j=0;j<N;j++) {
				if(d[j]>(p.first+c[p.second][j])) {
					d[j]=p.first+c[p.second][j];
					que.push(P(d[j],j));
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<N;i++)for(int j=0;j<N;j++) {
		if(c[i][j]==INF)continue;
		ans=max(ans,(d[i]+d[j]+c[i][j]+1)/2);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 36296
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int [] a = new int [m];
		int right = 0;
		int left = 0;
		for(int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 1; i < x; i++) {
			for(int j = 0; j < m; j++) {
				if(i == a[j]) {
					left++;
				}
			}
		}
		for(int i = x+1; i < n; i++) {
			for(int j = 0; j < m; j++) {
				if(i == a[j]) {
					right++;
				}
			}
		}
		if(left <= right) {
			System.out.println(left);
		}
		else {
			System.out.println(right);
		}
		sc.close();
	}

}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int lcs(string a, string b) {
  int longest_length = 0;
  int m = a.size(), n = b.size();
  int table[m+1][n+1];
  for(int i = 0; i < m+1; i++) table[i][0] = 0; 
  for(int i = 0; i < n+1; i++) table[0][i] = 0; 
  for(int i = 1; i < m+1; i++) {
    for(int j = 1; j < n+1; j++) {
      if(a[i-1] == b[j-1]){
        table[i][j] = table[i-1][j-1] + 1;
      } else {
        table[i][j] = max(table[i-1][j], table[i][j-1]);
      } 
      longest_length = max(longest_length, table[i][j]);
    }
  }
  return longest_length;
}

int main() {
  int n = 0;
  cin >> n;
  string a, b;
  for(int i = 0; i < n; i++) {
    cin >> a >> b;
    int l = lcs(a, b);
    cout << l << endl;
  }
}

Measured memory_bytes: 7092
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(:5.10);
use utf8;

my ($n1, $n2);
{
    my $line = <STDIN>;
    ($n1, $n2) = split(/\s+/, $line);
}

my $gcd = gcd($n1,$n2);
my @divisor = divisor($gcd);
my @uniq;
{
    my %hash;
    $hash{$_}++ for @divisor;
    @uniq = keys %hash;
}
say @uniq+1;

sub divisor {
    my $gcd = shift;
    my $limit = sqrt($gcd);
    for (my $i=2;$i <= $limit;$i++){
        my $remainder = $gcd % $i;
        if ($remainder == 0){
            return $i, divisor($gcd/$i);
        }
    }
    return if $gcd == 1;
    return $gcd;
}
sub gcd {
    my @n = sort {$a <=> $b} @_;
    my $remainder = $n[1] % $n[0];
    return $n[0] if $remainder == 0;
    return gcd($n[0], $remainder);
}

Measured memory_bytes: 768
from math import *
a, b, h, m = map(int, input().split())
s = 30*(h+m/60)
l = 6*m
t = abs(s-l)
pi = acos(-1)
ans = a**2+ b**2 - 2*a*b*cos(t*pi/180)
print(sqrt(ans))

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

priority_queue<double>q;
int n;

int main() {
	int i;
	double x,y;
	scanf("%d",&n);
	for (i=1;i<=n;i++) {
		scanf("%lf",&x);
		q.push(-x);
	}
	for (i=1;i<n;i++) {
		x=q.top(); q.pop();
		y=q.top(); q.pop();
		q.push(1.*(x+y)/2);
	}
	printf("%.6lf\n",-q.top());
	return 0;
}

Measured memory_bytes: 256
//start of jonathanirvings' template v3.0.3 (BETA)

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

typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;

double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

#ifdef TESTING
  #define DEBUG fprintf(stderr,"====TESTING====\n")
  #define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
  #define debug(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DEBUG 
  #define VALUE(x)
  #define debug(...)
#endif

#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)

inline string IntToString(LL a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}

inline LL StringToInt(string a){
  char x[100]; LL res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}

inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

inline string uppercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}

inline string lowercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}

inline void OPEN (string s) {
  #ifndef TESTING
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
  #endif
}

//end of jonathanirvings' template v3.0.3 (BETA)

int n;
int data[100005];
int totL[100005];
int totR[100005];

int main()
{
  scanf("%d",&n);
  REPN(i,n) scanf("%d",&data[i]);
  REPN(i,n)
  {
    totL[i] = totL[i-1] + abs(data[i] - data[i-1]);
  }
  FORD(i,n,1)
  {
    totR[i] = totR[i+1] + abs(data[i+1] - data[i]);
  }
  FORN(i,1,n)
  {
    printf("%d\n",totL[i-1] + totR[i+1] + abs(data[i-1] - data[i+1]));
  }
  return 0;
}











Measured memory_bytes: 2432
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
void solve()
{
	ll n,d,x,y,cn=0;
	cin>>n>>d;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		if((x*x)+(y*y)<=(d*d))
			cn++;
	}
	cout<<cn;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>

int main (){

  int num, nums, i, j, cnt = 0, mini;

  scanf("%d", &num);

  int A[num];

  for(i=0; i<num; i++)
    scanf("%d", &A[i]);

  for(i=0; i<num; i++){

    mini = i;

    for(j=i; j<num; j++){

      if(A[j] < A[mini])
	mini = j;

    }

    if(A[i]>A[mini]){
      nums = A[i];
      A[i] = A[mini];
      A[mini] = nums;
      cnt++;
    }

  }

  for(i=0; i<num; i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");

  printf("%d\n", cnt);

  
  return 0;
  
}

Measured memory_bytes: 604
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄█████████████  █▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const ll INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1000000007;
// const ll MAXN = 3e5;
const ld eps = 1e-6;
const ld eps2 = 1e-9;
const ll MOD2 = 998244353;
const ll dosz = 5e5;
const ll SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("input.txt", "r", stdin);
       // freopen("output.txt", "w", stdout);
#endif
}

void solve(){
    ld r;
    cin >> r;
    cout << 2*r*PI << endl;
}

signed main() {
    fast_io();
    int q = 1;
    cout << fixed << setprecision(6);
    // cin >> q;
    while(q--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3804
#include<stdio.h>

int main()
{
    int a,b,c;
    char op;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
    	if(op == '+'){
        	c = a + b;
    	}else if(op == '-'){
        	c = a - b;
    	}else if(op == '*'){
        	c = a * b;
    	}else if(op == '/'){
    		c = a / b;
    	}else{
			return 0;
    	}
    	printf("%d\n",c);
    }
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

long mod=1e9+7;


int main() {
  int n,y;cin>>n>>y;
  for(int i=0;i<=n;i++){
    if(y>=i*10000){
      int rem=y-i*10000;
      int re=n-i;
      if((rem-re*1000)%4000)continue;
      int p=(rem-re*1000)/4000;
      if(p>=0 && p<=re){
        cout<<i<<' '<<p<<' '<<n-p-i<<endl;
        return 0;
      }
    }
  }
  cout<<-1<<' '<<-1<<" "<<-1<<endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int H, W;
	
	while(1){
		cin >> H >> W;
		if ( H == 0 && W == 0 ) break;
		
		for ( int i = 0; i < H; i++ ){
			for ( int j = 0; j < W; j++ ){
				if ( (i + j) % 2 == 0 ){
					cout << "#";
				}else{
					cout << ".";
				}
			}
			cout << "\n";
		}
		cout << endl;
	}
	
	return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

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

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin >> n >> m;
  priority_queue<double> que;
  rep(i,n){
    double a;
    cin >> a;
    que.push(a);
  }
  rep(i,m){
    double x = que.top();
    que.pop();
    x /= 2.;
    que.push(x);
  }
  ll ans = 0;
  while(que.empty() == false){
    double x = que.top();
    que.pop();
    ans += x;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
#define MOD1 1000000007
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)a - *(ll *)b;}

int main(void){
    char sa[105],sb[105],sc[105];
    ll al,bl,cl,a=0,b=0,c=0;
    scanf("%s%s%s",sa,sb,sc);
    al=strlen(sa);
    bl=strlen(sb);
    cl=strlen(sc);
    ll turn = 1;
    while(1){
        // printf("%lld? ",turn);
        if(turn==1){
            if(a>=al){
                printf("A\n");
                return 0;
            }
            if(sa[a]=='a') turn = 1;
            if(sa[a]=='b') turn = 2;
            if(sa[a]=='c') turn = 3;
            a++;
            continue;
        }
        if(turn==2){
            if(b>=bl){
                printf("B\n");
                return 0;
            }
            if(sb[b]=='a') turn = 1;
            if(sb[b]=='b') turn = 2;
            if(sb[b]=='c') turn = 3;
            b++;
            continue;
        }
        if(turn==3){
            if(c>=cl){
                printf("C\n");
                return 0;
            }
            if(sc[c]=='a') turn = 1;
            if(sc[c]=='b') turn = 2;
            if(sc[c]=='c') turn = 3;
            c++;
            continue;
        }
    }
    // printf("\n");
    // return 0;
}


Measured memory_bytes: 128
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]
    print(II()**3)




if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
void lcs(string s1,string s2,int l,int k)
{
	int dp[l+1][k+1];
	memset(dp,0,sizeof(dp));
	int i,j;
	for(i=1;i<=l;i++)
	{
		for(j=1;j<=k;j++)
		{
			if(s1[i-1]==s2[j-1])
			dp[i][j]=1+dp[i-1][j-1];
			else
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	i=l,j=k;
	string s="";
	while(i>0 && j>0)
	{
		if(s1[i-1]==s2[j-1])
		{
			s+=s1[i-1];
			i--;
			j--;
		}
		else{
			if(dp[i-1][j]>dp[i][j-1])
			i--;
			else
			j--;
		}
	}
	reverse(s.begin(),s.end());
	cout<<s<<"\n";
}
int main() {
	string s1,s2;
	cin>>s1>>s2;
	int l=s1.length();
	int k=s2.length();
	lcs(s1,s2,l,k);
	return 0;
}

Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {

    //バリデーション用メソッド
    static boolean isOK(String checkNum) { return checkNum.matches("[a-z]{1,200}");}
    static boolean notNull(Object o) { return o != null; }

    public static void main(String[] args) {

        //変数宣言
        String compareString="";
        String compareString2="";
        String checkString="";
        int half=0;

        //文字列を入力
        Scanner scanner_s = new Scanner(System.in);
        checkString = scanner_s.nextLine();

     
        //偶文字列確認処理
        while (checkString.length()!=1||checkString.length()%2==0) {
            //文字列の最後一文字を削除
            checkString = checkString.substring(0,checkString.length()-1);

            //使用する変数の作成
            half = (checkString.length() / 2);
            compareString = checkString.substring(0, half);
            compareString2 = checkString.substring(half);

                if (compareString.equals(compareString2)) {
                    System.out.println(checkString.length());
                    break;
                }
                
        }//while文終わり
    }
}











Measured memory_bytes: 23124
import sys


input = sys.stdin.readline

N, Q = map(int, input().split())
S = list(input())
anum = [0]*N
for i in range(1, N):
    if S[i-1] == "A" and S[i] == "C":
        S[i-1] = "a"
        anum[i] += 1
    anum[i] += anum[i-1]
qnum = [map(int, input().split()) for _ in range(Q)]
for l, r in qnum:
    print(anum[r-1]-anum[l-1])

Measured memory_bytes: 54372
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextIntSlice(size int) []int {
	re := make([]int, size)
	for i := 0; i < size; i++ {
		re[i] = nextInt()
	}
	return re
}

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if v > max {
			max = v
		}
	}
	return max
}

func min(a []int) int {
	min := a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
	}
	return min
}

func main() {
	//sc.Split(bufio.ScanWords)
	o, e := nextLine(), nextLine()
	for i := 0; i < len(e); i++ {
		fmt.Print(string(o[i]))
		fmt.Print(string(e[i]))
	}
	if len(o) > len(e) {
		fmt.Println(string(o[len(o)-1]))
	} else {
		fmt.Println()
	}
}


Measured memory_bytes: 640
///
// File:  2738.cpp
// Author: ymiyamoto
//
// Created on Sat Nov 11 00:00:11 2017
//

#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int32_t main()
{
  uint32_t N;
  cin >> N;
  int32_t count = 0;

  vector<string> conv;
  bool has_one_A = false;
  for (uint32_t i = 0; i < N; i++) {
    string str;
    cin >> str;
    conv.push_back(str);
  }

  for (auto c = conv.begin(); c < conv.end(); c++) {
    if (*c == "A") {
      has_one_A = true;
      count++;
    } else {
      count--;
      if (count < 0) {
        break;
      }
    }
  }

  if (has_one_A && count == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 3168
n = int(input())
a = list(map(int,input().split()))
counter = 0
i = 1
while i < n-1:
	if a[i-1] != a[i] and a[i] != a[i+1]:
		i += 2
	elif a[i-1] == a[i] == a[i+1]:
		counter += 1
		i += 2
	elif a[i] == a[i+1]:
		i += 1
	elif a[i-1] == a[i]:
		i += 1
		counter += 1
if i == n-1:
	if a[i] == a[i-1]:
		counter += 1
print(counter)

Measured memory_bytes: 3064
import sys

n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

ans = [0 for i in range(n)]
for i in range(m):
    s = sc[i][0]
    c = sc[i][1]
    if(ans[s-1] != 0 and ans[s-1] != c):
        print('-1')
        sys.exit()
    else:
        if(s == 1 and c == 0 and n != 1):
            print('-1')
            sys.exit()
        else:
            ans[s-1] = c

if(ans[0] == 0 and n != 1):
    ans[0] = 1

an = 0
d = 1
for i in range(n):
    an += ans[n-i-1]*d
    d *= 10
print(an)

Measured memory_bytes: 9244
import sys
MAXINT = 1000000001

n = int(input())
S = list(map(int,input().split()))


def merge(A, l, m, r, cnt):
  n1 = m - l
  n2 = r - m
  L = [A[i] for i in range(l, l+n1)]
  R = [A[i] for i in range(m, m+n2)]
  L.append(MAXINT)
  R.append(MAXINT)
  i = 0
  j = 0
  for k in range(l,r):
    cnt += 1
    if L[i] <= R[j]:
      A[k] = L[i]
      i += 1
    else:
      A[k] = R[j]
      j += 1
  return cnt


def mergesort(A, l, r, cnt):
  if l + 1 < r:
    m = (l + r) // 2
    cnt = mergesort(A, l, m, cnt)
    cnt = mergesort(A, m, r, cnt)
    cnt = merge(A,l,m,r, cnt)
  return cnt

cnt = 0
cnt = mergesort(S, 0, n, cnt)
print(" ".join(map(str,S)))
print(cnt)




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

int main(void) {
	int a, b, c, d, e, k,i=0;
	cin >> a; cin >> b; cin >> c; cin >> d; cin >> e; cin >> k;
	if (0 <= a,b,c,d,e,k <= 123) {
		if (a < b < c < d < e) {
			if ((e - a) <= k){
				cout << "Yay!";
				i = 1;
			}
		}
	}
	if(i == 0) {
		cout << ":(";
	}
	return 0;
}

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

int main(){
    string s;
    cin>>s;
    int ans  =0;
    int mx =0;
    rep(i,s.size()){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            mx++;
            ans=max(mx,ans);
        }else{
            mx=0;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll d=0;
    for(ll i=1;i<=n;i++)
    {
        ll c=i;
        ll sum=0;
        while(c!=0)
        {
            sum++;
            c=c/10;
        }
        if(sum%2==1)
        {
          d++;
        }
    }
    cout<<d<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll com(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cominit();
    ll n,k;
    cin>>n>>k;
    cout << com(n+k-1,n) <<endl;
    return 0;
}



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

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<int> A(1<<N);
    for (int &a: A)
        cin>>a;

    vector<int> B1 = A;
    vector<int> B2(1<<N);
    for (int i=0; i<N; i++)
    for (int b=0; b<1<<N; b++)
    if ((b&1<<i) == 0)
    {
        int T[4] = {B1[b], B2[b], B1[b|1<<i], B2[b|1<<i]};
        sort(T, T+4);
        B1[b|1<<i] = T[3];
        B2[b|1<<i] = T[2];
    }

    int a = 0;
    for (int i=1; i<1<<N; i++)
    {
        a = max(a, B1[i]+B2[i]);
        cout<<a<<endl;
    }
}


Measured memory_bytes: 6144
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		String a = instr(), b = instr(), c = instr();
		String aLast = a.substring(a.length() - 1, a.length());
		String bFirst = b.substring(0, 1);
		String bLast = b.substring(b.length() - 1, b.length());
		String cFirst = c.substring(0, 1);
		out.println(aLast.equals(bFirst) && bLast.equals(cFirst) ? "YES" : "NO");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 21844