akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-5,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  string s;

  cin >> s ;
  int N = s.size();
  string x = "ACGT";
  ll ans = 0;
  rep(i,N) REP(j,i,N){
    string a = "";
    bool ok = true;
    REP(k,i,j+1){
      ok &=(s[k]=='A'||s[k]=='C'||s[k]=='G'||s[k]=='T'); 
      if(!ok) break;
      a += s[k];
    }
    if(!ok) continue;
    chmax(ans,ll(a.size()));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
class Dice:
    def __init__(self, top, front, right, left, back, bottom):
        self.TOP = top
        self.BOTTOM = bottom
        self.FRONT = front
        self.BACK = back
        self.LEFT = left
        self.RIGHT = right
    
    def move(self, direction):
        if direction == "N":
            self.move_N()
        elif direction == "E":
            self.move_E()
        elif direction == "S":
            self.move_S()
        elif direction == "W":
            self.move_W()
        elif direction == "SIDE":
            self.move_SIDE()
        else:
            raise Exception
    
    def move_N(self):
        tmp = self.TOP
        self.TOP = self.FRONT
        self.FRONT = self.BOTTOM
        self.BOTTOM = self.BACK
        self.BACK = tmp

    def move_S(self):
        tmp = self.TOP
        self.TOP = self.BACK
        self.BACK = self.BOTTOM
        self.BOTTOM = self.FRONT
        self.FRONT = tmp
        
    def move_W(self):
        tmp = self.TOP
        self.TOP = self.RIGHT
        self.RIGHT = self.BOTTOM
        self.BOTTOM = self.LEFT
        self.LEFT = tmp

    def move_E(self):
        tmp = self.TOP
        self.TOP = self.LEFT
        self.LEFT = self.BOTTOM
        self.BOTTOM = self.RIGHT
        self.RIGHT = tmp
    
    def move_SIDE(self):
        tmp = self.FRONT
        self.FRONT = self.RIGHT
        self.RIGHT = self.BACK
        self.BACK = self.LEFT
        self.LEFT = tmp

def is_same(dice, dice2):
    for _ in range(4):
        dice.move("SIDE")
        for _ in range(4):
            dice.move("N")
            if dice.TOP == dice2.TOP and dice.FRONT == dice2.FRONT \
                and dice.RIGHT == dice2.RIGHT and dice.LEFT == dice2.LEFT \
                and dice.BACK == dice2.BACK and dice.BOTTOM == dice2.BOTTOM:
                return True
        for _ in range(4):
            dice.move("E")
            if dice.TOP == dice2.TOP and dice.FRONT == dice2.FRONT \
                and dice.RIGHT == dice2.RIGHT and dice.LEFT == dice2.LEFT \
                and dice.BACK == dice2.BACK and dice.BOTTOM == dice2.BOTTOM:
                return True
    return False
    
dices = []
n = int(input())
is_OK = True
for _ in range(n):
    top, front, right, left, back, bottom = map(int,input().split())
    new_dice = Dice(top, front, right, left, back, bottom)
    for d in dices:
        if is_same(new_dice, d):
            is_OK = False
            break
    if is_OK == False:
        break
    dices.append(new_dice)
    
if is_OK:
    print("Yes")
else:
    print("No")


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

    int main() {
        long long int X;
        cin >> X;
        long long int happy;
        happy = (X/500)*1000;
        X -= (X/500)*500;
        happy += (X/5)*5;
        cout << happy << endl;
        return 0;
    }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;


signed main(){
	string s,t;cin>>s>>t;
	int a,b;cin>>a>>b;
	string u;cin>>u;
	if(u==s)cout<<a-1<<" "<<b<<endl;
	else cout<<a<<" "<<b-1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
//ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

int main(){
     ios::sync_with_stdio(false);cin.tie(0);
    
    ll n;cin>>n;
    ll t,a;cin>>t>>a;
    t*=1000;a*=1000;
    ll h[n];rep(i,0,n-1)cin>>h[i];
    ll mind=abs(a-(t-h[0]*6));
    int ans=0;
    rep(i,1,n-1){
        if(mind>abs(a-(t-h[i]*6))){
            mind=abs(a-(t-h[i]*6));
                     ans=i;
        }
                    
    }
    cout<<ans+1<<endl;
    
    return 0;
}
//ios::sync_with_stdio(false);cin.tie(0);



Measured memory_bytes: 256
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
I=h*w
d=[I]*I
a=~w+a*w+b
d[a]=1
q=[a]
for s in q:
 for y,x in(1,0),(-1,0),(0,1),(0,-1):
  for z in range(k):
   i,j=s//w+y*~z,s%w+x*~z;t=i*w+j
   if(h>i>-1<j<w)-1or'.'<m[i][j]or d[t]<=d[s]:break
   if d[t]==I:q+=t,;d[t]=d[s]+1
print(d[~w+f*w+g]%I-1)


Measured memory_bytes: 131764
N,X = list(map(int,input().split()))

#[total,パティ数]
burger = [[1]*2 for i in range(51)]

ans = 0
for i in range(1,51):
    burger[i][0] = burger[i-1][0]*2+3
    burger[i][1] = burger[i-1][1]*2+1

    if X <= burger[i][0]:
        if i < N:
            X -= N-i
        while 0<X:
            X -= 1 #一番下のBを食う
            if X==0:
                break
            
            #中間まで食べられるかどうか
            if burger[i-1][0]<=X:
                X -= burger[i-1][0]
                ans += burger[i-1][1]

                if 0<X: #中間のPを食う
                    X -= 1
                    ans += 1
                else:
                    break
            
            #中間まで食べた後はL-1バーガー+B...Bが残る
            #中間まで食べられない場合はL-1バーガーのみ残ると考えて良い
            i -= 1
            if i == 0:
                if 0<X:
                    ans += 1
                #残りはパンだけor最初からなかったのと同じ
                break
        print(ans)
        break


        

Measured memory_bytes: 3064
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N = int(input())
A = factorization(N)
n = len(A)
sum = 0
if N ==1:
    print(0)
else:
    for i in range(n):
        d =A[i][1]
        for j in range(100):
            if j*(j+1) <= 2*d < (j+1)*(j+2):
                sum = sum + j
                break
    print(sum)

Measured memory_bytes: 9504
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////


int main() {
	int A, B; cin >> A >> B;
	if (A != 1 && B != 1)cout << 1 << endl;
	else if (A != 2 && B != 2)cout << 2 << endl;
	else cout << 3 << endl;
	return 0;
}

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

#define mx 200005
#define ll long long

int ar[mx],br[mx];
char ch[mx];
ll pre1[mx],pre[mx];

int n,m,k,ii;

bool func(int tar)
{
    bool f=false;
    int i=min(n,tar);
    int j=tar-i;
   // cout<<i+j<<" "<<tar<<endl;
    while(i>=0 && j<=m && i+j==tar)
    {
        if(pre1[j]+pre[i]<=1LL*k)
        {
           // cout<<tar<<" "<<pre[i]<<" "<<pre1[j]<<endl;
            f=true;
            break;
        }
        else i--,j++;
    }
    return f;
}

void solve()
{
   scanf("%d%d%d",&n,&m,&k);
   for(int i=0;i<n;i++)
   {
       scanf("%d",&ar[i]);
       pre[i+1]=pre[i]+ar[i];
   }
   for(int i=0;i<m;i++)
   {
       scanf("%d",&br[i]);
       pre1[i+1]=pre1[i]+br[i];
   }
   int lo=1,hi=n+m;
   int re=0;
   while(lo<=hi)
   {
       int mid=(lo+hi)/2;
       if(func(mid))
       {
           re=mid;
           lo=mid+1;
       }
       else hi=mid-1;

   }
   printf("%d\n",re);
}

int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int t=1;
  // scanf("%d",&t);
   while(t--)solve();
   return 0;
}


Measured memory_bytes: 8384
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }

int main() {
	int n, q, t, ans = 0;
	vector<int> v;
	cin >> n;
	v.resize(n);
	REP(i, n)
		cin >> v[i];
	cin >> q;
	while (q--) {
		cin >> t;
		if (find(all(v), t) != v.end())
			ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3120
#include<iostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main() {
    long N, M,em=0;
    static long a[2000000] = { 0 };
    cin >> N;
    cin >> M;
    for (int x = 0; x < M; x++) {
        cin >> a[x];
        em += a[x];
    }
    if (em <= N)cout << N-em << endl;
    else cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define rALL(x) x.rbegin(), x.rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<vector<char>> g;
int main(){
    ll n;   cin >> n;
    char key[5] = {'M', 'A', 'R', 'C', 'H'};
    vector<ll> cnt(5);
    rep(i, n){
        string s;   cin >> s;
        rep(i, 5) if(s[0]==key[i]) cnt[i] += 1;
    }
    ll res=0;
    rep(i, 5){
        FOR(j, i+1, 5){
            FOR(k, j+1, 5) res += cnt[i]*cnt[j]*cnt[k];
        }
    }
    cout << res << endl;
    
}


Measured memory_bytes: 3612
package main

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

var sc = bufio.NewScanner((os.Stdin))

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

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

// Point ...
type Point struct {
	x int
	y int
}

func main() {
	sc.Split(bufio.ScanWords)
	H, W, s := nextInt(), nextInt(), []string{}
	for i := 0; i < H; i++ {
		s = append(s, nextLine())
	}

	fmt.Printf("%d\n", ABC088D(H, W, s))
}

// ABC088D ...
func ABC088D(H, W int, s []string) (res int) {
	maze, whitecnt := make([][]byte, H), 0
	for i := 0; i < H; i++ {
		maze[i] = make([]byte, W)
		for j, char := range s[i] {
			maze[i][j] = byte(char)
			if char == '.' {
				whitecnt++
			}
		}
	}

	dist := make([][]int, H)
	for i := 0; i < H; i++ {
		dist[i] = make([]int, W)
		for j := 0; j < W; j++ {
			dist[i][j] = 1000000
		}
	}

	start, goal := Point{0, 0}, Point{W - 1, H - 1}
	queue := []Point{start}
	dist[start.y][start.x] = 0

	moves := []Point{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}
	for len(queue) != 0 {
		current := queue[0]
		queue = queue[1:]

		if current.y == goal.y && current.x == goal.x {
			continue
		}

		for _, mv := range moves {
			next := Point{current.x + mv.x, current.y + mv.y}
			if next.x < 0 || next.y < 0 || W <= next.x || H <= next.y {
				continue
			}

			if maze[next.y][next.x] == '#' {
				continue
			} else {
				nextdist := dist[current.y][current.x] + 1
				if nextdist < dist[next.y][next.x] {
					dist[next.y][next.x] = nextdist
					queue = append(queue, next)
				}
			}
		}
	}

	if dist[goal.y][goal.x] >= 1000000 {
		return -1
	}

	return whitecnt - (dist[goal.y][goal.x] + 1)
}


Measured memory_bytes: 1928
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>
#include <stack>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
using P = std::pair<int,int>;
const int INF = 1e17;
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<P> a,b;
	int sum=0;
	rep(i,n) {
		std::string s;
		std::cin >> s;
		int A=0;
		int D=0;
		for(auto c:s) {
			A += (c=='(')?1:-1;
			D=std::min(D,A);
		}
		if(A>=0) a.emplace_back(D,A);
		else b.emplace_back(D-A,-A);
		sum+=A;
	}
	std::sort(a.rbegin(),a.rend());
	std::sort(b.rbegin(),b.rend());
	int ok=true;
	int curr=0;
	for(auto p:a) {
		if(curr+p.first<0) ok=false;
		curr+=p.second;
	}
	curr=0;
	for(auto p:b) {
		if(curr+p.first<0) ok=false;
		curr+=p.second;
	}
	if(sum==0 && ok) print("Yes");
	else print("No");
	return 0;
}


Measured memory_bytes: 19012
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << ", ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main()
{
	ll n;
	cin >> n;
	if(n%2) cout << 0 << endl;
	else{
		ll ans=0;
		n/=2;
		while(n!=0){
			ans+=n/5;
			n/=5;
		}
		cout << ans << endl;
	}
    return 0;
}


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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {

	return;
}

void solve() {
	lli l, r;
	cin >> l >> r;
	
	lli ans = 2019;
	
	for (lli i = l; i < min(l+2019, r); ++i) {
		for (lli j = i+1; j <= min(l+2019, r); ++j) {
			ans = min(ans, i * j % 2019);
		}
	}
	
	cout << ans << '\n';
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
vector<int> adj[2000005];
int n,m;
int d[2000005];
bool visited[2000005];
int main()
{
	ll n;
	cin>>n;
	ll t[n];
	for(int i=0;i<n;i++)cin>>t[i];
	ll lcm=t[0];
	for(int i=1;i<n;i++)
	{
		lcm=(t[i])/__gcd(t[i],lcm)*lcm;
	}
	cout<<lcm;
}
	

Measured memory_bytes: 48640
N = gets.chop.to_i
V = gets.chop.split.map(&:to_i).unshift(nil)
C = gets.chop.split.map(&:to_i).unshift(nil)

result = (1..N).to_a.map do |i|
  V[i] - C[i]
end.inject(0) do |sum, i|
  sum = i > 0 ? sum + i : sum
end

p result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }


ll next_combination(ll sub) {
    ll x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}

int main(){
    ll K;
    cin >> K;
    ll gu = K/2;
    ll ki = K/2;
    if (K%2==1) ki++;
    cout << gu * ki << "\n";
}


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

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


int main()
{
    int N, M;
    cin >> N >> M;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];
    vector<pair<long long,long long>> op(M);
    REP(i, M) cin >> op[i].second >> op[i].first;

    sort(A.begin(), A.end());
    sort(op.begin(), op.end(), greater<pair<long long,long long>>());

    long long ans = 0;
    int idx = 0;  // idx-1 まで置き換え終了
    REP(i, M){
        long long B = op[i].second; 
        long long C = op[i].first; 
        int itr = lower_bound(next(A.begin(), idx), A.end(), C) - A.begin();
        if(itr == 0) break;
        if(itr-idx >= B){
            ans += C*B;
            idx += B;
        }else{
            ans += C*(itr-idx);
            idx += itr-idx;
        }
    }
    FOR(i, idx, N) ans += A[i];
    cout << ans << endl;

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<ll> count(5,0);
    vector<ll> checked;
    rep(i, N) {
        string S;
        cin >> S;
        if (S[0] == 'M') {count[0]++;}
        else if (S[0] == 'A') {count[1]++;}
        else if (S[0] == 'R') {count[2]++;}
        else if (S[0] == 'C') {count[3]++;}
        else if (S[0] == 'H') {count[4]++;}
    }
    rep(i, 5) {
        if (count[i] != 0) {
            checked.push_back(count[i]);
        }
    }
    if (checked.size() < 3) {
        cout << 0 << endl;
        return 0;
    }
    if (checked.size() == 3) {
        ll ans = 1;
        rep(i, 3) {
            ans *= checked[i];
        }
        cout << ans << endl;
    }
    else if (checked.size() == 4) {
        ll ans = 0;
        rep(i, 4) { //i番目は使わないやつ
            ll preans = 1;
            rep(j, 4) {
                if (j != i)
                preans *= checked[j];
            }
            ans += preans;
        }
        cout << ans << endl;
    }
    else if (checked.size() == 5) {
        ll ans = 0;
        rep(i, 4) {
            rep2(j, i+1, 5) { //i,j番目は使わない
                ll preans = 1;
                rep(k, 5) {
                    if (k != i && k != j) {
                        preans *= checked[k];
                    }
                }
                ans += preans;
            }
        }
        cout << ans << endl;
    }
}

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

using namespace std;

int main(){
    int n; cin >> n;
    
    vector<int> a(n);
    for(int i = 0 ; i < n ; i ++) cin >> a[i];
    
    sort(a.begin() , a.end(),greater<int>());
    
    int al = 0; int bo = 0;
    for(int i = 0 ; i < n ; i ++){
        if(i % 2 == 0) al += a[i];
        else bo += a[i];
    }
    
    cout << al - bo << endl;
}


Measured memory_bytes: 256
def solve(X:list, N:int):
    cnt = 0
    for i in range(N):
        for j in range(i):
            dist = 0
            for a, b in zip(X[i], X[j]):
                dist += (a-b)**2
            if dist**.5%1 == 0:
                cnt += 1
    print(cnt)

def main():
    N, D = map(int, input().split(" "))
    X = [list(map(int, input().split(" "))) for i in range(N)]
    solve(X, N)

if __name__ == "__main__":
    main()



Measured memory_bytes: 3188
def main():
    s=list(input())
    t=list(input())
    n=len(s)
    l=len(t)
    
    judge=False
    for i in range(n-l,-1,-1):
        flag=True
        for j,st in enumerate(s[i:i+l]):
            if st!='?' and st!=t[j]:
                flag=False
                break
        if flag:
            s[i:i+l]=t
            judge=True
            break
    
    if judge:
        for i in range(n):
            if s[i]=='?':
                s[i]='a'
        print(''.join(s))
    else:
      print('UNRESTORABLE')
        
if __name__=='__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    int max = 0;
    int ans = 0;
    if (N == 1) {
        std::cout << 1 << std::endl;
    } else {
        for (int i = 1; i <= N; i++) {
            int temp = i;
            int count = 0;
            while (temp % 2 == 0) {
                temp /= 2;
                count++;
            }
            if (max < count) {
                max = count;
                ans = i;
            }
        }

        std::cout << ans << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	Scanner sc = new Scanner(System.in);
	public void run(){
		while(true){
			int h = sc.nextInt();
			if(h == 0) break;
			calc(h);
		}
	}
	public void calc(int h){
		int[][] board = new int[h][5];
		for(int i = h-1; i >= 0; i--){
			for(int j = 0; j < 5; j++){
				board[i][j] = sc.nextInt();
			}
		}
		int ans = 0;
		while(true){
			int sum = 0;
			for(int i = 0; i < h; i++){
				int count = 0;
				int start = -1;
				int before = 0;
				for(int j = 0; j < 5; j++){
					if(board[i][j] == 0){
						count = 0;
						start = -1;
						before = 0;
					}
					else if(board[i][j] == before){
						count += 1;
						if(j == 4 && count >= 3){
							sum += before*count;
							for(int k = start; k < start+count; k++){
								board[i][k] = 0;
							}
						}
					}
					else {
						if(count >= 3){
							sum += before*count;
							for(int k = start; k < start+count; k++){
								board[i][k] = 0;
							}
						}
						count = 1;
						start = j;
						before = board[i][j];
					}
					
				}
			}
			
			if(sum == 0) break;
			else ans += sum;
			
			for(int j = 0; j < 5; j++){
				int counter = 0;
				for(int i = 0; i < h; i++){
					if(board[i][j] == 0){
						counter++;
					}
					else if(counter > 0){
						board[i-counter][j] = board[i][j];
						board[i][j] = 0;
					}
				}
			}
		}
		System.out.println(ans);
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
}

Measured memory_bytes: 55584
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> a(n), L(n), M(n), R(n);
    rep(i, n) cin >> a[i];
    L[0] = a[0] % 2;
    int sum = a[0];
    Rep(i, 1, n)
    {
        sum += a[i];
        int cost = a[i] % 2;
        if (a[i] == 0)
            cost = 2;
        L[i] = min(L[i - 1] + cost, sum);
    }
    sum = a[n - 1];
    M[n - 1] = 0;
    R[n - 1] = a[n - 1] % 2;
    for (int i = n - 2; i >= 0; i--)
    {
        sum += a[i];
        int cost1 = a[i] % 2, cost2 = (a[i] + 1) % 2;
        if (a[i] == 0)
            cost1 = 2;
        R[i] = min(R[i + 1] + cost1, sum);
        M[i] = min(M[i + 1] + cost2, R[i]);
    }
    int ans = min(L[n - 1], M[0]);
    Rep(i, 1, n) ans = min(ans, L[i - 1] + M[i]);
    cout << ans << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i<(int)n; ++i)
#define forr(i, t, n) for (int i = t; i<n; ++i)
#define rmod(x, y) (((x%y)+y)%y)
#define pb push_back
#define emp emplace_back
#define ppb pop_back
#define len(v) int(v.size())
#define all(v) (v).begin(),(v).end()
#define ri(x) scanf("%d",&(x))
#define rii(x,y) scanf("%d %d",&(x),&(y))
#define riii(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rl(x) scanf("%lld",&(x))
#define rll(x,y) scanf("%lld %lld",&(x),&(y))
#define rlll(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
void fastio(){ios_base::sync_with_stdio(false); cin.tie(0);}

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;
const int maxn = 3e5;

int n;
ll a[maxn];

int main() {
	ri(n);
	forn(i, n) rl(a[i]);
	ll ans = 0;
	forn(exp, 61){
		ll z = 0, o = 0;
		forn(i, n){
			if ((a[i]>>ll(exp))&1) o++;
			else z++;
		}
		ans = ans%MOD + (((o*z)%MOD)*((1ll<<ll(exp))%MOD))%MOD;
		ans%=MOD;
	}
	printf("%lld", ans%MOD);

	
	
	return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <set>

int main()
{
	std::set<int> set;
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		int a;
		scanf("%d", &a);
		if (set.count(a))
		{
			puts("NO");
			return 0;
		}
		set.insert(a);
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 9600
#line 1 "test/aoj/GRL_2_A.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A"
#line 1 "test/aoj/../../graph/mst-kruskal.cpp"
#include <algorithm>
#include <iostream>
#include <vector>
#line 1 "test/aoj/../../graph/template.cpp"
#include <vector>

using namespace std;

template< typename T >
struct Edge {
  int from, to;
  T cost;
  Edge() {}
  Edge(int f, int t) : from(f), to(t), cost(1) {}
  Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
  friend bool operator < (const Edge& lhs, const Edge& rhs) { return lhs.cost < rhs.cost; };
  friend bool operator > (const Edge& lhs, const Edge& rhs) { return rhs < lhs; };
  friend bool operator <= (const Edge& lhs, const Edge& rhs) { return !(lhs > rhs); };
  friend bool operator >= (const Edge& lhs, const Edge& rhs) { return !(lhs < rhs); };
};

template< typename T >
using Edges = vector< Edge< T > >;
template< typename T >
using Graph = vector< Edges< T > >;
#line 1 "test/aoj/../../graph/../datastructure/union-find-tree.cpp"
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

class UnionFind {
public:
  vector<int> data; // sizeとparを同時に管理する
  UnionFind(int size) : data(size, -1) {}

  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }

  void unite(int x, int y) {
    int px = find(x);
    int py = find(y);
    if (px != py) {
      if (data[py] < data[px]) swap(px, py);
      data[px] += data[py]; data[py] = px;
    }
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  int size(int x) {
    return -data[find(x)];
  }
};
#line 6 "test/aoj/../../graph/mst-kruskal.cpp"

template< typename T >
T kruscal(int V, Edges< T > &edges) {
  // 最小全域木の重みを返す
  UnionFind uf(V);
  T weight = 0;
  sort(edges.begin(), edges.end());
  for (auto e : edges) {
    if (uf.same(e.from, e.to)) continue;
    uf.unite(e.from, e.to);
    weight += e.cost;
  }
  return weight;
}
#line 3 "test/aoj/GRL_2_A.test.cpp"

using edge = Edge<int>;
int main() {
  vector<edge> edges;
  int V, E;
  cin >> V >> E;
  for (int i = 0; i < E; ++i) {
    int x, y, w;
    cin >> x >> y >> w;
    edges.emplace_back(x, y, w);
  }
  int ans = kruscal(V, edges);
  cout << ans << endl;
}



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

double arr[3010];
double dp[3010][3010];

int main()
{
    int n; cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];}


    for(int i=0;i<=n;i++)
        for(int j=0;j<=n;j++)
            dp[i][j]=0;


    dp[1][0]=1.0-arr[1];
    dp[1][1]=arr[1];

    for(int i=2;i<=n;i++)
    {
        for(int k=0;k<=i-1;k++)
            {
                dp[i][k+1]+=dp[i-1][k]*arr[i];
                dp[i][k]+=dp[i-1][k]*(1.0-arr[i]);
            }

    }



    double ans=0.0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[n][i];

    cout<<setprecision(9)<<fixed<<ans;

    return 0;
}


Measured memory_bytes: 70784
import java.util.Random;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int R = sc.nextInt();
		int[] r = new int[R];
		for (int i = 0; i < R; ++i)
			r[i] = sc.nextInt() - 1;
		int[][] mat = new int[N][N];

		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				if (i != j)
					mat[i][j] = Integer.MAX_VALUE / 10;
			}
		}
		for (int i = 0; i < M; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			--a;
			--b;
			mat[a][b] = c;
			mat[b][a] = c;
		}

		for (int m = 0; m < N; ++m) {
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					mat[i][j] = Math.min(mat[i][j], mat[i][m] + mat[m][j]);
				}
			}
		}

		int[][] dp = new int[R][1 << R];
		for (int i = 0; i < R; ++i) {
			for (int j = 0; j < (1 << R); ++j) {
				dp[i][j] = Integer.MAX_VALUE / 10;
			}
		}

		for (int i = 0; i < R; ++i) {
			dp[i][1 << i] = 0;
		}

		for (int s = 0; s < (1 << R); ++s) {
			for (int cur = 0; cur < R; ++cur) {

				for (int next = 0; next < R; ++next) {

					dp[next][s | 1 << next] = Math.min(dp[next][s | 1 << next], dp[cur][s] + mat[r[cur]][r[next]]);

				}

			}
		}

		int ans = Integer.MAX_VALUE / 10;

		for (int i = 0; i < R; ++i) {
			ans = Math.min(ans, dp[i][(1 << R) - 1]);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 46224
N = gets.chomp.to_i
p_s = []
N.times do |i|
    p_s << gets.chomp.to_i
end

p_s = p_s.sort
sum = 0
p_s.each_with_index do |p, i|
    if i == p_s.length-1
        sum = sum + p/2
    else
        sum = sum + p
    end
end

puts sum


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  string input;
  cin >> H>>W;
  string s;
  for(int i =0; i <W+2; i++){
    s += "#";
  }
  cout << s << endl;
  
  // 
  for (int i = 0; i < H; i++) {
    cin >> input;
    cout <<"#"+input+ "#"<< endl;
  }
  
  cout << s << endl;
  
}

Measured memory_bytes: 3596
'use strict';

function Main(INPUT) {
    const input = INPUT.split("\n")[0].split(" ");
    if (input[0] == input[1]) {
        console.log("=");
    } else {
        console.log(input[0] > input[1] ? ">" : "<");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
A, B = map(int, input().split())
st = A if (A % 2 == 0) else A + 1

delta = B - st + 1

if (st == A):
    if (delta % 4 == 2):
        print(1)
    elif (delta % 4 == 0):
        print(0)
    elif (delta % 4 == 1):
        print(B)
    else: #delta % 4 == 3
        print(B ^ 1)
else:
    if (delta % 4 == 2):
        print(1 ^ A)
    elif (delta % 4 == 0):
        print(0 ^ A)
    elif (delta % 4 == 1):
        print(B ^ A)
    else: #delta % 4 == 3
        print(B ^ 1 ^ A)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0) {
			break;
		}
		vector<long long int> code(m);
		for (int i = 0; i < m; i++) {
			cin >> code[i];
		}
		vector<long long int> x(n);
		for (int i = 0; i < n; i++) {
			cin >> x[i];
		}
		vector< vector<long long int> > dp(n, vector<long long int>(256, -1));
		for (int i = 0; i < m; i++) {
			long long int a = 128+code[i];
			if (a < 0) {
				a = 0;
			} else if (a > 255) {
				a = 255;
			}
			dp[0][a] = (x[0]-a)*(x[0]-a);
			//cout << a << ' ' << dp[0][a] << endl;
		}
		for (int i = 0; i < n-1; i++) {
			for (int j = 0; j < 256; j++) {
				for (int k = 0; k < m; k++) {
					long long int a = j+code[k];
					if (a < 0) {
						a = 0;
					} else if (a > 255) {
						a = 255;
					}
					if (dp[i][j] != -1) {
						if (dp[i+1][a] == -1) {
							dp[i+1][a] = dp[i][j]+(x[i+1]-a)*(x[i+1]-a);
						} else {
							dp[i+1][a] = min(dp[i+1][a], dp[i][j]+(x[i+1]-a)*(x[i+1]-a));
						}
					}
				}
			}
			//cout << dp[i][255] << endl;
		}
		long long int MIN = -1;
		for (int i = 0; i < 256; i++) {
			if (MIN == -1) {
				MIN = dp[n-1][i];
			} else if (dp[n-1][i] != -1){
				MIN = min(MIN, dp[n-1][i]);
			}
		}
		cout << MIN << endl;
	}
	return 0;
}

Measured memory_bytes: 41992
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  set<char> atgc = {'A', 'T', 'G', 'C'};
  ll ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (atgc.count(s[i])) {
      int start = i;
      int end = i;
      while (end + 1 < s.size() && atgc.count(s[end + 1])) {
        end++;
      }
      ans = max(ans, (ll)(end - start + 1));
      i = end;
    }
  }
  cout << ans << endl;
  return 0;
}

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

#define PRIME_FLG_SIZE 1000000
#define PRIME_SUM_SIZE 1000000

bool primeFlg[PRIME_FLG_SIZE]; //[i]テ」ツ?古ァツエツ?ヲツ閉ーテ」ツ?凝」ツ?ゥテ」ツ??」ツ?凝」ツ?ョテァツョツ。テァツ青?
int primeSum[PRIME_SUM_SIZE]; //[0, i]テ」ツ?ョテゥツ鳴禿」ツ?ォテ・ツュツ佚・ツ慊ィテ」ツ?凖」ツつ凝ァツエツ?ヲツ閉ーテ」ツ?ョテヲツ閉ーテ」ツ?ョテァツョツ。テァツ青?

//テ」ツつィテ」ツδゥテ」ツδ暗」ツつケテ」ツδ?」ツδ催」ツつケテ」ツ?ョテ」ツ?オテ」ツつ凝」ツ??
void erato(){
  fill(primeFlg, primeFlg + PRIME_FLG_SIZE, true);
  primeFlg[0] = primeFlg[1] = false;

  for(int i = 2; i * i < PRIME_FLG_SIZE; i++){
    if(!primeFlg[i]) continue;
    for(int j = i * i; j < PRIME_FLG_SIZE; j += i){
      primeFlg[j] = false;
    }
  }

  fill(primeSum, primeSum + PRIME_SUM_SIZE, 0);

  for(int i = 1; i < PRIME_SUM_SIZE; i++){
    bool isPrime = primeFlg[i];
    primeSum[i] = primeSum[i - 1] + (isPrime ? 1 : 0);
  }
}

int main(){
  erato();

  int n;

  while(cin >> n){
    cout << primeSum[n] << endl;
  }
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> b(n-1); rep(i,n-1) cin >> b[i];
    
    int ans = 0;
    repm(i,1,n-1){
        ans += min(b[i],b[i-1]);
    }
    ans += b[0];
    ans += b.back();
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
#define INFTY 1000000001
#define MAX 200000
 
void merge(int *, int, int, int);
void mergeSort(int *, int, int);
 
long cnt=0;
 
int main(void)
{
    int i, n, A[MAX];
     
    scanf("%d",&n);
    for (i=0; i<n; i++) {
        scanf("%d",&A[i]);
    }
     
    mergeSort(A, 0, n);
     
    printf("%ld\n",cnt);
     
    return 0;
}
 
void merge(int *A, int left, int mid, int right)
{
    int i, j, n1, n2, k;
    int L[MAX/2 +2], R[MAX/2 +2];
     
    n1 = mid - left;
    n2 = right - mid;
    for (i=0; i<n1; i++) {
        L[i] = A[left + i];
    }
    for (i=0; i<n2; i++) {
        R[i] = A[mid + i];
    }
    L[n1] = INFTY;
    R[n2] = INFTY;
     
    i = 0;
    j = 0;
    for (k=left; k<right; k++) {
        if( L[i] <= R[j] ) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
            cnt += n1 - i;
        }
    }
}
 
void mergeSort(int *A, int left, int right)
{
    int mid;
    if( left + 1 < right ) {
        mid = ( left + right ) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}


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

int main(){
  int N;cin>>N;
  bool ok=true;
  int num=0;
  for(int i=0;i<N;++i){
    string st;cin>>st;
    if(st=="A")num++;
    else num--;
    if(num<0)ok=false;
  }
  if(num!=0)ok=false;
  if(ok){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3132
s = raw_input()
n = len(s)
s = "0"+s

if s[1]=="0":
  print -1
  exit(0)
for i in range(1,n+1):
  if s[i]!=s[n-i]:
    print -1
    exit(0)

ans = [(0,1)]
p = 1
c = 2
for i in range(2,n):
  ans += [(p,c)]
  c += 1
  if s[i]!="0":
    p = c-1

for a in ans:
  print a[0]+1, a[1]+1


Measured memory_bytes: 20084
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=998244353;
inline void add(int &x,int y){(x+=y)>=mod?x-=mod:0;}
inline int pl(int x,int y){return (x+=y)>=mod?x-mod:x;}
inline int kpow(int a,int b)
{
	int s=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1)s=1ll*s*a%mod;
	return s;
}
int n,a[410],b[410],jc[410],jcv[410],Sa,Sb,Sv,ans;
int dp[410][410],A[410];
void init()
{
	jc[0]=1;
	for(int i=1;i<=400;++i)jc[i]=1ll*jc[i-1]*i%mod;
	jcv[400]=kpow(jc[400],mod-2);
	for(int i=400;i;--i)jcv[i-1]=1ll*jcv[i]*i%mod;
}
int main()
{
	scanf("%d",&n);
	init();
	for(int i=1;i<=n;++i)scanf("%d %d",&a[i],&b[i]),Sa+=a[i];
	Sv=kpow(Sa,mod-2);
	dp[0][0]=1;
	for(int i=1;i<=n;++i)
	{
		int tmp=1ll*a[i]*Sv%mod,cur=1;
		for(int j=0;j<b[i];++j)
		{
			A[j]=1ll*(mod-cur)*jcv[j]%mod;
			cur=1ll*cur*tmp%mod;
		}
		for(int j=Sa-1;~j;--j)
			for(int k=Sb;~k;--k)
			{
				for(int l=1;l<b[i];++l)dp[j][k+l]=(dp[j][k+l]+1ll*dp[j][k]*A[l])%mod;
				dp[j][k]=mod-dp[j][k];
				if(j>=a[i])add(dp[j][k],dp[j-a[i]][k]);
			}
		Sb+=b[i]-1;
	}
	for(int i=0;i<Sa;++i)
	{
	//	for(int j=0;j<5;++j)printf("%9d ",dp[i][j]);printf("\n");
		int na=1ll*i*Sv%mod,tmp=kpow(mod+1-na,mod-2),w=tmp;
		for(int j=0;j<=Sb;++j)ans=(ans+1ll*dp[i][j]*w%mod*jc[j])%mod,w=1ll*w*tmp%mod;
	}
	if(ans)ans=mod-ans;
	printf("%d",ans);
	return 0;
}


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

const int pricA = 380;
const int pricB = 550;
const int pricC = 850;
const int discA = (pricA*5)*0.8;
const int discB = (pricB*4)*0.85;
const int discC = (pricC*3)*0.88;
const int INF = 1<<20;

int main()
{
	int w;

	while(cin >> w, w)
	{
		int cmp, ans = INF;
		w /= 100;
		for(int a = 0; a*2 <= w; a++)
		{
			for(int b = 0; a*2+b*3 <= w; b++)
			{
				if((w - (a*2+b*3)) % 5 == 0)
				{
					int c = (w-(a*2+b*3))/5;

					cmp = discA*(a/5)+pricA*(a%5) + discB*(b/4)+pricB*(b%4) + discC*(c/3)+pricC*(c%3);
					//printf("a:%d b:%d c:%d = %d\n", a, b, c, cmp);
					ans = min(ans, cmp);
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
import java.util.*

fun main( argv : Array<String> ) {
    
    val scan = Scanner(System.`in`)
    
    //
    val N = scan.nextInt()
    //
    var c=1 // 1 2 4 8 16
    while(true) {
        if(c*2>N){
            println(c)
            return
        }
        c*=2
    }

}


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

bool prime(int x){
	if(x==0||x==1) return false;
	for(int i=2;i*i<=x;i++){
		if(x%i==0) return false;
	}
	return true;
}

int main(){
	int n,nl,nh;
	while(cin>>n){
		nl=n;
		nh=n;
		while(1){
			nl--;
			if(prime(nl))break;
		}
		while(1){
			nh++;
			if(prime(nh))break;
		}
		cout<<nl<<" "<<nh<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);
    int n;
    int i;
    cin>>n;
    double multi=1,x;
    int a[n];
    for(i=0;i<n;i++){
      cin>>a[i];}
      for(i=0;i<n;i++){
      multi=multi*a[i];
    }
    //x=multi;
    double sum=0;
    for(i=0;i<n;i++){
        sum+=(multi/a[i]);
    }
    cout<<multi/sum<<endl;
    //printf("%0.5\n",multi/sum);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>
#include <algorithm>

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int h[n];
  int minDist[n];
  scanf("%d", &h[0]);
  minDist[0] = 0;
  for (int i = 1; i < n; i++) {
    scanf("%d", &h[i]);
    minDist[i] = INT_MAX;
    for (int j = 1; j <= k && i - j >= 0; j++) {
      minDist[i] = std::min(minDist[i], minDist[i - j] + abs(h[i] - h[i - j]));
    }
  }
  printf("%d\n", minDist[n - 1]);
  return 0;
}


Measured memory_bytes: 896
//abc103_a.cpp
//Sat Jul 21 20:49:29 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INF 100000000
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int a,b,c;
	cin >> a >> b >> c;

	int aa = abs(b-a);
	int bb = abs(c-b);
	int cc = abs(a-c);

	if (aa >= bb && aa >= cc){
		cout << bb+cc << endl;
	}else if (bb >= aa && bb >= cc){
		cout << aa+cc << endl;
	}else{
		cout << aa+bb << endl;
	}

}

Measured memory_bytes: 256
a, b, c, d = (int(i) for i in input().split())  
x = c - a
y = d - b
ans = ""
ans += "R"*x + "U"*y + "L"*x + "D"*y
ans += "D" + "R"*(x+1) + "U"*(y+1) + "L"
ans += "U" + "L"*(x+1) + "D"*(y+1) + "R"
print(ans)

Measured memory_bytes: 3060