akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    vector<int> *vec = new vector<int>();
    int loop,tmp;
    cin >>  loop;
    for(int i=0;i<loop;i++) {
        cin >> tmp;
        vec->push_back(tmp);
    }
    int max = 0;
    for(int i=0;i<vec->size()-1;i++) {
        if(vec->at(i) > vec->at(i+1))
            max=i;
        else
            max=i+1;
    }
    
    int lp=1;
    int flag=0;
    while(1) {
        flag=1;
        for(int i=0;i<vec->size();i++) {
            if( vec->at(max) * lp  % vec->at(i) != 0) {
                flag=0;break;
            }
        }
        if(flag){
            cout << vec->at(max)*lp <<endl;
            break;
        }
        ++lp;
    }
    
    delete vec;
    
    return 0;
}

Measured memory_bytes: 1216
import sys
import math
import numpy
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
       
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
   
if __name__ == "__main__":
    main()

Measured memory_bytes: 91408
#include<bits/stdc++.h>
using namespace std;
const string tmp = "aiueo";

int N;
string S[50];
bool check(int length)
{
  vector< string > d(N);
  for(int i = 0; i < N; i++) {
    d[i] = S[i].substr(0, min(length, (int)S[i].size()));
  }
  sort(d.begin(), d.end());
  d.erase(unique(d.begin(), d.end()), d.end());
  return(d.size() == N);
}
int main()
{  
  while(cin >> N, N) {
    for(int i = 0; i < N; i++) {
      string T;
      cin >> T;
      S[i] = string(1, T[0]);
      for(int j = 0; j < T.size() - 1; j++) {
        if(tmp.find(T[j]) != string::npos) S[i] += T[j + 1];
      }
    }
    int ok = 51, ng = 0;
    while(ok - ng > 1) {
      int mid = (ok + ng) / 2;
      if(check(mid)) ok = mid;
      else           ng = mid;
    }
    if(ok == 51) cout << -1 << endl;
    else         cout << ok << endl;
  } 
}

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

namespace Algorithm
{
    class Program
    {
        const int Mod = 1000000007;
        static void Main(string[] args)
        {
            var NM = Console.ReadLine().Split().Select(long.Parse).ToArray();
            if (Math.Abs(NM[0]-NM[1]) >= 2)
            {
                Console.WriteLine(0);
                return;
            }

            var ans = Factorial(NM[0]) * Factorial(NM[1]) % Mod;
            if (NM[0] == NM[1])
                Console.WriteLine(2 * ans % Mod);
            else
                Console.WriteLine(ans);
        }

        static long Factorial(long n)
        {
            var j = 1L;
            for (var i = 1; i <= n; i++)
            {
                j *= i;
                j %= Mod;
            }
            return j;
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

#define PRINT_VECTOR_MAX 100
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)min(v.size(),PRINT_VECTOR_MAX); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)min(v.size(),PRINT_VECTOR_MAX); i++) {for (ll j = 0; j < (ll)min(v[i].size(),PRINT_VECTOR_MAX); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

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

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

void Main(){
	int s; cin >> s;
	if(s < 3){
		cout << 0 << endl;
		return;
	}
	vector<mint> dp(s+1, mint(0));
	dp[0] = mint(1);
	dp[3] = mint(1);
	for(int i = 4; i <= s; i++){
		for(int fi = 3; fi <= i; fi++){
			dp[i] += dp[i-fi];
		}
	}
	cout << dp[s] << endl;
}	

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pi 3.1415
	 
int main()
{
	fastio;
	int r;
	cin>>r;
	float ans=(2.0)*pi*r;
	printf("%f\n",ans);
	
	return 0;
	
	
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main(){
    //vector<vector<int>> c(3,vector<int> (3));
    int c[3][3];
    bool key=true;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>c[i][j];
        }
    }
    int a[3],b[3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            a[j]=c[i][j]-c[(i+1)%3][j];
            b[j]=c[j][i]-c[j][(i+1)%3];
        }
        if(a[0]!=a[1] || a[1]!=a[2] || a[2]!=a[0]){
            key=false;
        }
        if(b[0]!=b[1] || b[1]!=b[2] || b[2]!=b[0]){
            key=false;
        }
    }
    if(key) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)

cs_plus = np.cumsum((a > 0) * a)
cs_plus = [0] + list(cs_plus)
plus = [v2 - v1 for v1, v2 in zip(cs_plus[:-k], cs_plus[k:])]

cs_minus = np.cumsum((a < 0) * a)
cs_minus = [0] + list(cs_minus)
minus = [v2 - v1 for v1, v2 in zip(cs_minus[:-k], cs_minus[k:])]

print(cs_plus[-1] - min(min(plus), -max(minus)))


Measured memory_bytes: 31020
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000009
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	nums := nextInt()
	// appendは遅いらしいので予め必要な容量を確保する
	dn := make([]int, nums)
	for i := 0; i < nums; i++ {
		dn[i] = nextInt()
	}
	dnuniq := intUniq(dn)
	fmt.Println(len(dnuniq))
}

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

func intUniq(list []int) []int {
	m := make(map[int]struct{})
	newList := make([]int, 0)

	for _, element := range list {
		// mapでは、第二引数にその値が入っているかどうかの真偽値が入っている
		if _, ok := m[element]; ok == false {
			m[element] = struct{}{}
			newList = append(newList, element)
		}
	}
	return newList
}


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

using namespace std;

int N, M;
int C[17], x[20001];
int dp[256][20001];

int rec(int now, int cnt) {
  if ( cnt == N ) return 0;
  if ( dp[now][cnt] != -1 ) return dp[now][cnt];

  int ret = 1e8;
  for ( int i = 0; i < M; i++ ) {
    int tmp = max(0, min(255, now + C[i]));
    ret = min(ret, rec(tmp, cnt + 1) + (x[cnt] - tmp) * (x[cnt] - tmp));
  }

  return dp[now][cnt] = ret;
}

int main()
{
  while ( cin >> N >> M, N | M ) {
    for ( int i = 0; i < M; i++ ) cin >> C[i];
    for ( int i = 0; i < N; i++ ) cin >> x[i];
    
    fill_n(*dp, 256 * 20001, -1);
    
    cout << rec(128, 0) << endl;
  }
}

Measured memory_bytes: 25008
/*
 * Problem Description: Linear Search
 * Category:
 * Author: Khan
 * Date: 13th October, 2017
 */

#include <stdio.h>

int Search(int A[], int n, int key)
{
    int i =0;
    A[n] = key;
    while(A[i] != key)
        i++;
    return i != n;
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int i, n, A[10000 + 1], q, key, sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", &A[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; ++i)
    {
        scanf("%d", &key);
        if(Search(A, n, key))
            sum++;
    }
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 1832
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
//これは、頭が悪く競プロが世界で一番できないHIR180が
//IOI2014日本代表になるまでのN日間の記録である。
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
#define SIZE (1<<17)
ll out[100005],got[100005];
struct segtree
{
	ll seg[SIZE*2];
	ll lazy[SIZE*2];
	void lazy_evaluate(int k)
	{
		seg[k*2+1]+=lazy[k];
		seg[k*2+2]+=lazy[k];
		lazy[k*2+1]+=lazy[k];
		lazy[k*2+2]+=lazy[k];
		lazy[k]=0;
	}
	ll update(int a,int b,int k,int l,int r,ll num)
	{
		if(lazy[k] && l!=r) lazy_evaluate(k);
		if(b<l || r<a) return seg[k];
		if(a<=l && r<=b)
		{
			seg[k]+=num;
			lazy[k]+=num;
			return seg[k];
		}
		return seg[k]=max(update(a,b,k*2+1,l,(l+r)/2,num),update(a,b,k*2+2,(l+r)/2+1,r,num));
	}
	ll query(int a,int b,int k,int l,int r)
	{
		if(lazy[k] && l!=r) lazy_evaluate(k);
		if(b<l || r<a) return -1LL*INF;
		if(a<=l && r<=b)
		{
			return seg[k];
		}
		return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2+1,r));
	}
}seg;
int main()
{
	srand((unsigned int)time(NULL));
	int n; ll maxv; scanf("%d %lld",&n,&maxv);
	for(int i=1;i<n;i++)
	{
		scanf("%lld %lld",&out[i],&got[i]);
	}
	seg.update(0,SIZE-1,0,0,SIZE-1,maxv);
	ll ret=0;
	priority_queue<P>que;
	for(int i=1;i<n;i++)
	{
		ll cur=seg.query(i,i,0,0,SIZE-1);
		que.push(mp(got[i],i));
		while(cur<=out[i]&&!que.empty())
		{
			//cout << ret << " "  << i << " " << cur << endl;
			int id=que.top().s;
			ll gott=que.top().f;
			ll recov,upper;
			recov=(out[i]-cur)/gott+1;
			upper=(maxv-seg.query(id,i,0,0,SIZE-1))/gott;
			if(recov<=upper)
			{
				seg.update(id,SIZE-1,0,0,SIZE-1,recov*gott);
				cur+=recov*gott; ret+=recov;
			}
			else
			{
				seg.update(id,SIZE-1,0,0,SIZE-1,upper*gott);
				que.pop();
				if(maxv-seg.query(id,i,0,0,SIZE-1)>0) que.push(mp(maxv-seg.query(id,i,0,0,SIZE-1),id));
				ret+=upper; cur+=upper*gott;
			}
		}
		seg.update(i+1,SIZE-1,0,0,SIZE-1,-1LL*out[i]);
	}
	printf("%lld\n",ret);
}

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

int abs(int x){
  if(x>0) return x;
  else return -x;
}
int gcd(int a,int b){
  if(b<a)
    swap(a,b);
  int r = b % a;
  while(r!=0){
  b = a;
  a = r;
  r = b % a;
  }
  return a;
}
int main(){
  int N,X,a1;
  cin >> N >> X >> a1;
  int c = abs(a1-X);
  for(int i=1;i<N;i++){
    int a;
    cin >> a;
    a = abs(a-X);
    c = gcd(c,a);
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#0009
a = []
l = [2]
while True:
    try:
        a.append(int(input()))
    except:
        break

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
    
z = primes(max(a))


for k in a:
    y = len([x for x in z if x <= k])
    print(y)


Measured memory_bytes: 16416
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,s = 0;cin >> n;
  int a[n];
  for(int i = 0;i<n;i++)
    cin >> a[i];
  for(int i = 0;i<n-1;i++)
    for(int j = i+1;j<n;j++)
      s+=a[i]*a[j];
  cout << s;
  return 0;
}

Measured memory_bytes: 256
from math import ceil #切り上げ
import numpy as np
 
def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #リストをstrで

a = input()

if a == "ABC":
  print("ARC")
else:
  print("ABC")

Measured memory_bytes: 26960
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n,m,l;
vi in,dp;
ll mm[2010][2010];
ll f(ll a,ll b){
	if(mm[a][b]+1)return mm[a][b];
	if(b==n-1)return mm[a][b]=(dp[in[n-1]]-dp[in[a]-1])/l;
	return mm[a][b]=min(f(a,b+1)+(dp[in[b+1]]-dp[in[b]-1])/l,f(b,b+1)+(dp[in[b+1]]-dp[in[a]-1])/l);
}
int main(){
	cin>>n>>m>>l;
	rep(i,2010)rep(j,2010)mm[i][j]=-1;
	in=vi(n);
	dp=vi(m+1);
	rep(i,n)cin>>in[i];
	rep(i,m)cin>>dp[i+1];
	rep(i,m)dp[i+1]+=dp[i];
	sort(all(in));
	cout<<f(0,0)<<endl;
}

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

const int N = 100, W = 10000;
struct Item {int cost, weight;} items[N];
int c[W + 1];

void knapsack(int n, int w)
{
    memset(c, 0, sizeof(c));

    for (int i = 0; i < n; ++i)
    {
        int weight = items[i].weight;
        int cost = items[i].cost;
        int num = w / weight;
        for (int k = 1; num > 0; k *= 2)
        {
            //if (k > num) k = num;
            num -= k;
            //cout << "      " << k << endl;
            for (int j = w; j >= weight * k; --j){
                c[j] = max(c[j], c[j - weight * k] + cost * k);
                //cout << c[j] << endl;
                }

        }
        //cout << endl;

    }
    cout << c[w]<< endl;
}

int main(){

    int n, c, time = 0;
    cin >> n >> c;
    while(time < n){
        cin >> items[time].cost >> items[time].weight;
        time++;
    }
    knapsack(n,c);
   return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int n;cin>>n;
    int a[n];
    map<int,int> mp;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
        mp[a[i]+1]++;
        mp[a[i]-1]++;
    }
    int res=0;
    for(auto x:mp){
        res = max(res,x.second);
    }
    cout<<res<<endl;
}

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

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

    while(a != b){
      if(a > b){
        a = a % b;
        if(a == 0){ break; }
      }
      else if(a < b){
        b = b % a;
        if(b == 0){ break; }
      }
    }
    cout << max(a, b) << endl;
}


Measured memory_bytes: 3096
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int res = 0;
        bool lastIsMax = true;
        while (a.Any(x => x > 0))
        {
            lastIsMax = true;
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] > 0)
                {
                    if (lastIsMax) res++;
                    a[i]--;
                    lastIsMax = false;
                }
                else
                {
                    lastIsMax = true;
                }
            }
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 13524
n = int(raw_input())
a = map(int, raw_input().split())
if n % 2 == 0:
    bpos = range(n - 1, 0, -2) + range(0, n, 2)
else:
    bpos = range(n - 1, -1, -2) + range(1, n, 2)
for p in bpos:
    print a[p],
print


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    int N, K;
    cin >> N >> K;

    vll h(N);
    rep(i, N) cin >> h[i];

    vll dp(N, INF);
    dp[0] = 0;

    repl(i, 1, N)
    {
        for (int j = i - 1; j >= max(0, i - K); j--)
        {
            chmin(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }

    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

internal static class CR
{
    public static string GetText() { return Console.ReadLine(); }
    public static List<string> GetTexts() { return Console.ReadLine().Split(' ').ToList(); }
    public static long GetLong() { return long.Parse(Console.ReadLine()); }
    public static List<long> GetLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }
}

namespace AtCoder.B
{
    public class Program
    {
        public static long[,] A { get; private set; }
        public static bool[,] Bingo { get; private set; }
        public static long N { get; private set; }
        public static List<long> Bs { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            A = new long[3, 3];
            Bingo = new bool[3, 3];
            for (int i = 0; i < 3; i++)
            {
                var inputs = CR.GetLongs();
                A[i, 0] = inputs[0];
                A[i, 1] = inputs[1];
                A[i, 2] = inputs[2];
            }

            N = CR.GetLong();
            Bs = new List<long>();
            for (int i = 0; i < N; i++)
            {
                Bs.Add(CR.GetLong());
            }

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (Bs.Any(x => A[i, j] == x))
                    {
                        Bingo[i, j] = true;
                    }
                }
            }

            for (int i = 0; i < 3; i++)
            {
                // 縦
                if (Bingo[i, 0] && Bingo[i, 1] && Bingo[i, 2]) return "Yes";
                // 横
                if (Bingo[0, i] && Bingo[1, i] && Bingo[2, i]) return "Yes";
            }
            if (Bingo[0, 0] && Bingo[1, 1] && Bingo[2, 2]) return "Yes";
            if (Bingo[2, 0] && Bingo[1, 1] && Bingo[0, 2]) return "Yes";

            return "No";
        }
    }
}


Measured memory_bytes: 13396
n = int(input())
sol = 0
niz = []
d1, d2 = 0, 0
for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        sol += a
    elif a < b:
        sol += a
        d1 += b - a
    else:
        d2 += a - b
        niz.append(b)
if d1 + d2 == 0:
    print(0)
else:
    assert d1 == d2
    print(sol + d1 + sum(niz) - min(niz))


Measured memory_bytes: 3444
n = gets.to_i
a, b = gets.split
  .each_with_object(Hash.new(0)) { |a, h| h[a.to_i] += 1 }
  .select { |_, v| v >= 2 }
  .sort_by { |k, v| [-k] }
  .take(2)

if [a, b].all?(&:nil?)
  puts 0
else
  puts a[1] >= 4 ? a[0] ** 2 : a[0] * b[0]
end


Measured memory_bytes: 17536
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(R int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 200011;
const ll INF = 5e16;

namespace IO {

    inline char gc() {
        static char buf[100000], *p1 = buf, *p2 = buf;
        return (p1 == p2) && (p2 = (p1 = buf) +
            fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
    }

    #define dd ch = getchar()
    inline ll read() {
        R ll x = 0; R int f = 0; R char dd;
        for (; !isdigit(ch); dd) f ^= (ch == '-');
        for (; isdigit(ch); dd)  x = x * 10 + (ch ^ 48);
        return f? -x: x;
    }
    #undef dd

    inline void write ( ll x ) {
        if (x < 0) x = -x, putchar('-');
        if (x > 9) write(x / 10); putchar(x % 10 | 48);
    }

    inline void wrn ( ll x ) { write(x), putchar(' '); }

    inline void wln ( ll x ) { write(x), putchar('\n'); }

    inline void wlnn ( ll x, ll y ) { wrn(x), wln(y); }

}

using IO::wln;
using IO::read;

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	int a; 
	string s;
	a = read();
	cin >> s;
	if (a < 3200) puts("red");
	else cout << s;
    return 0;
}

/*

*/







Measured memory_bytes: 256
a, b, h, m = gets.split.map(&:to_i)

aa = (h * 60 + m).to_f / 720 * 360 * Math::PI / 180
bb = (m * 360).to_f / 60 * Math::PI / 180

ax = a * Math.cos(aa)
ay = a * Math.sin(aa)
bx = b * Math.cos(bb)
by = b * Math.sin(bb)

puts Math.sqrt((ax - bx) ** 2 + (ay - by) ** 2)


Measured memory_bytes: 14796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (n); ++i)
#define NIL -1
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

P f(int x)
{
    int a = x % 10;
    int b = 0;
    while (x)
    {
        b = x;
        x /= 10;
    }
    return P(a, b);
}

int main()
{
    int n;
    cin >> n;
    map<P, int> freq;

    rep(x, n)
    {
        P p = f(x);
        ++freq[p];
    }
    ll ans = 0;

    rep(x, n)
    {
        P p = f(x);
        P q = P(p.second, p.first);
        ans += freq[q];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>

double standardDeviation(std::vector<double> &nums) {
  double average = std::accumulate(nums.begin(), nums.end(), 0.0) / nums.size();
  double sum =
      std::accumulate(nums.begin(), nums.end(), 0.0,
                      [&average](const double &init, const double &elm) {
                        return init + pow(elm - average, 2.0);
                      });
  double variance = sum / nums.size();
  return sqrt(variance);
}

int main() {
  int n;
  while (std::cin >> n) {
    if (n == 0) return 0;

    std::vector<double> nums;
    while (n-- != 0) {
      double buf;
      std::cin >> buf;
      nums.push_back(buf);
    }
    std::cout << std::fixed << std::setprecision(5) << standardDeviation(nums)
              << std::endl;
  }
}



Measured memory_bytes: 3288
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np
import queue
import itertools
import functools 

# define
TBMod = int(1e+9 + 7)

# nCr(int, int, devider)
def nCr(n, r, mod):
	f = lambda x, y : x * y % mod
	x, y = functools.reduce(f, range(n - r + 1, n + 1)), \
		functools.reduce(f, range(1, r + 1))
	return x * pow(y, mod - 2, mod) % mod

n,a,b = map(int, input().split())
print((pow(2, n, TBMod) - (nCr(n, a, TBMod) + nCr(n, b, TBMod)) - 1) % TBMod)


Measured memory_bytes: 20016
#include <bits/stdc++.h>
 
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))
 
typedef long long ll;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string t;
  cin>>t;
  
  string ans="Yes";
  if(t=="AAA" or t=="BBB"){
    ans="No";
  }
  cout<<ans;
  
  return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010
#define MAX_M 1010
#define MAX_PAT 5010

ll N, M;
vector<int> A, B, C;

ll g_pat;
ll dp[MAX_M][MAX_PAT];

ll dfs(int i, int pat) {
    if(pat == g_pat) { return 0; }
    if(i >= M) { return LLINF; }

    ll& ret = dp[i][pat];
    if(~ret) { return ret; }

    // この鍵を使う場合
    ret = dfs(i + 1, pat | C[i]) + A[i];
    // 使わない場合
    ret = min(ret, dfs(i + 1, pat));

    return ret;
}

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

    cin >> N >> M;
    A.resize(M);
    B.resize(M);
    C.assign(M, 0);
    REP(i, M) {
        cin >> A[i] >> B[i];
        REP(j, B[i]) {
            int c;
            cin >> c;
            c--;
            C[i] |= (1 << c);
        }
    }

    g_pat = (1 << N) - 1;
    MINUS(dp);
    ll ans = dfs(0, 0);
    if(ans >= LLINF) { ans = -1; }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 39808
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int D;
int p[10];
int c[10];
int G;

int minSolve(int mask) {
    priority_queue<int> scores;
    int totalScore = 0;
    int solved = 0;
    for (int i = 0; i < D; i++) {
        if (mask & (1 << i)) {
            totalScore += (i + 1) * p[i] + c[i];
            solved += p[i];
        } else {
            for (int j = 0; j < p[i]; j++)
                scores.push(i + 1);
        }
    }
    while (totalScore < G) {
        if (scores.empty()) return INT_MAX;
        totalScore += scores.top();
        scores.pop();
        solved++;
    }
    return solved;
}

void solve() {
    cin >> D >> G;
    G /= 100;
    for (int i = 0; i < D; i++) {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }
    int ans = INT_MAX;
    for (int mask = 0; mask < (1 << D); mask++) {
        //cout << mask << " " << minSolve(mask) << endl;
        ans = min(ans, minSolve(mask));
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

#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(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int a, b, c, k_val;
  cin >> a >> b >> c >> k_val;
  bool flag = false;
  REP(i, k_val+1){
    REP(j, k_val+1){
      REP(k, k_val+1){
        if (i+j+k > k_val) continue;
        int ta, tb, tc;
        ta = a * pow(2, i);
        tb = b * pow(2, j);
        tc = c * pow(2, k);
        if (ta < tb and tb < tc){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 4088
from bisect import bisect_left, bisect_right
N = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    a = bisect_left(A, b)
    c = bisect_right(C, b)
    ans += a * (N-c)
print(ans)


Measured memory_bytes: 29556
#include <stdio.h>
int main (void){
  int a, b, n;
  scanf("%d %d", &a, &b);
  n = a - b;
   if(n < 0){
    puts("a < b");
  }
  else if(n > 0){
    puts("a > b");
  }
  else{
    puts("a == b");
  }
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <random>
#include <functional>

#include <fstream>
#include <vector>
#include <algorithm>

#define ll long long int

using namespace std;

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

int main(void)
{

    
    ll n,ac,wa,tle,re;
    string tmp;
    ac = 0;
    wa = 0;
    tle = 0;
    re = 0;
    
    cin >> n;
    for(ll i = 0; i < n; i++)
    {
        cin >> tmp;
        if(tmp == "AC")
        {
            ac++;
        }
        else if(tmp == "WA")
        {
            wa++;
        }
        else if(tmp == "TLE")
        {
            tle++;
        }
        else if(tmp == "RE")
        {
            re++;
        }
    }
    
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  int n;
  cin >> n;
  int a[n];
  REP(i, n) cin >> a[i];

  int ans = 0;

  int j[n];
  REP(i, n) j[i] = 0;

  int i = 0, p = 0;

  while(i < n){
    j[p] = 1;
    if(i == n - 1) break;
    while(a[i + 1] == a[i]){
      j[p]++;
      i++;
    }
    p++;
    i++;
  }

  REP(i, n){
    if(j[i] % 2 == 0) ans += j[i] / 2;
    else ans += (j[i] - 1) / 2;
  }
  cout << ans << endl;
}


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

#define MAX 200000000

int size = 0;
int A[MAX + 1];

void insert(int A[], int k) {
    ++size;

    A[size] = k;
    int i = size;
    while (i/2 > 0 && A[i] > A[i/2]) {
        std::swap(A[i], A[i/2]);
        i = i / 2;
    }
}

void maxHeapfy(int A[], int root) {
    int left = root * 2;
    int right = root * 2 + 1;

    int max = root;
    if (left <= size && A[max] < A[left]) {
        max = left;
    }
    if (right <= size && A[max] < A[right]) {
        max = right;
    }

    if (max != root) {
        std::swap(A[root], A[max]);
        maxHeapfy(A, max);
    }
}

int extractMax(int A[]) {
    int max = A[1];
    A[1] = A[size];
    --size;
    maxHeapfy(A, 1);
    return max;
}

int main() {
    while (true){
        char c[100];
        scanf("%s", c);
        if (c[0] == 'i') {
            int k;
            scanf("%d", &k);
            insert(A, k);
        }
        else if (c[0] == 'e') {
            if (c[1] == 'x') {
                int max = extractMax(A);
                printf("%d\n", max);
            }
            else {
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 6584
#include <stdio.h>

int Check(int A, int B){
  int C;
  for(C = 1;C <= 3;C++) if(A * B * C % 2 == 1) return 1;
  return 0;
}

int main(void){
  int A, B;
  scanf("%d %d", &A, &B);
  if(Check(A, B) == 1) printf("Yes\n");
  else printf("No\n");
  return 0;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[1005];
ll B[1005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B, B + N);
    ll index = -1;
    REP(i, N) {
        if (A[i] == B[i])
            continue;
        if (index < 0 || A[index] > A[i])
            index = i;
    }

    ll ans = 0;
    if (index >= 0) {
        while (true) {
            ll cnt = 0;
            while (A[index] != B[index]) {
                REP(i, N) {
                    if (B[index] == A[i]) {
                        ans += A[i];
                        cnt++;
                        swap(A[index], A[i]);
                        index = i;
                        break;
                    }
                }
            }

            ans += std::min(A[index] * cnt, B[0] * cnt + 2 * (B[0] + A[index]));

            index = -1;
            REP(i, N) {
                if (A[i] == B[i])
                    continue;
                if (index < 0 || A[index] > A[i])
                    index = i;
            }
            if (index < 0)
                break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3180
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S1 = sc.next();
		
		int s1Len = S1.length();
		
		if(s1Len == 2){
			System.out.println(S1);
		}else{
			
			String a = S1.substring(0,1);
			String b = S1.substring(1,2);
			String c = S1.substring(2,3);
			
			S1 = c + b + a;//ひどい有様
			
			System.out.println(S1);
		}
	}
}


Measured memory_bytes: 21588
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)*/

#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <bitset>  // std::bitset<N>
#include <sstream> //stringstream
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
//ここから書き始める

int main(){
	stack<int> num;
	stack<char> ope;
	string s;
	while(cin >> s){
		if(s == "+"){
			int n1, n2;
			n1 = num.top();
			num.pop();
			n2 = num.top();
			num.pop();
			num.push(n1+n2);
		}
		else if(s=="-"){
			int n1 , n2 ;
			n1 = num.top();
			num.pop();
			n2 = num.top();
			num.pop();
			num.push(n2-n1);
		}
		else if(s=="*"){
			int n1 , n2 ;
			n1 = num.top();
			num.pop();
			n2 = num.top();
			num.pop();
			num.push(n1 *n2);
		}
		else{//文字じゃなくて数字だったとき
			num.push(stoi(s));
		}
	}
	cout<< num.top()<<endl;
		
}





Measured memory_bytes: 3176
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	h := stdin.ReadInt()
	w := stdin.ReadInt()
	a := []string{}
	for i := 0; i < h; i++ {
		a = append(a, stdin.Read())
	}

	b := [][]bool{}
	q := NewDeque()
	for i := 0; i < h; i++ {
		b = append(b, []bool{})
		for j := 0; j < w; j++ {
			b[i] = append(b[i], false)
		}
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if a[i][j] == '#' {
				q.AppendLast(&Tuple{x: i, y: j, count: 0})
				b[i][j] = true
			}
		}
	}

	ans := 0
	diffs := []Tuple{
		Tuple{x: 0, y: 1},
		Tuple{x: 0, y: -1},
		Tuple{x: 1, y: 0},
		Tuple{x: -1, y: 0},
	}
	for !q.IsEmpty() {
		cur, _ := q.PopFirst().(*Tuple)
		ans = Max(ans, cur.count)
		for _, diff := range diffs {
			nx := cur.x + diff.x
			ny := cur.y + diff.y
			if 0 <= nx && nx < h && 0 <= ny && ny < w && !b[nx][ny] {
				b[nx][ny] = true
				q.AppendLast(&Tuple{x: nx, y: ny, count: cur.count + 1})
			}
		}
	}

	stdout.Println(ans)
}

type Tuple struct {
	x     int
	y     int
	count int
}

func main() {
	stdout := NewStdout()
	exec(NewStdin(bufio.ScanWords), stdout)
	stdout.Flush()
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

type Deque struct {
	deque []interface{}
}

func NewDeque() *Deque {
	return &Deque{deque: []interface{}{}}
}

func (d *Deque) AppendFirst(v interface{}) {
	e := make([]interface{}, len(d.deque)+1)
	copy(e[1:], d.deque)
	d.deque = e
}

func (d *Deque) AppendLast(v interface{}) {
	d.deque = append(d.deque, v)
}

func (d *Deque) PopLast() interface{} {
	n := len(d.deque)
	v := d.deque[n-1]
	d.deque = d.deque[0 : n-1]
	return v
}

func (d *Deque) PopFirst() interface{} {
	v := d.deque[0]
	d.deque = d.deque[1:]
	return v
}

func (d *Deque) IsEmpty() bool {
	return len(d.deque) == 0
}

func Max(a ...int) int {
	v := a[0]
	for i := 1; i < len(a); i++ {
		if v < a[i] {
			v = a[i]
		}
	}
	return v
}


Measured memory_bytes: 83328
import java.util.*;
public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		
		double d = (1.0*a+b)/2;
		
		System.out.println((int)(d+0.5));
	}

}


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

int main(){
    string s;
    cin>>s;
    int len=s.length();
    long long ans=0;
    for(int bit=0;bit<(1<<(len-1));bit++){
        long long num=s[0]-'0';
        for(int i=0;i<len-1;i++){
            if(bit&(1<<i)){
                ans+=num;
                num=0;
            }
            num=num*10+s[i+1]-'0';
        }
        ans+=num;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    String alpbt = scan.next();
    String[] list = {"a","b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
    		"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
    int  i = 0;
    String result = null;
    while(!(list[i].equals(alpbt))){
    	i++;
    };
   	if(list[i].equals(alpbt)) {
   		result = list[i+1];
   	}
    System.out.println(result);
  }
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
int n,ans;
set<int> a;
void dfs(string s){
	int x=0;
	stringstream ss;
	ss<<s;
	ss>>x;
	if(x>n) return ;
	set<int> b;
	while(x>0){
		b.insert(x%10);
		x/=10;
	}
	if(b==a) ans++;
	dfs(s+"3"); 
	dfs(s+"5"); 
	dfs(s+"7"); 
}
int main(){
	a.insert(3);
	a.insert(5);
	a.insert(7);
	int i,j;
	cin>>n;
	dfs("");
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<int> v(86400 * 2, 0);
    int n; cin >> n;
    int cur = 0;
    for (int i = 0; i < n; i++) {
        int a, b; cin >> a >> b;
        v[(cur+a)%86400]++;
        cur = (cur + a + b) % 86400;
    }
    for (int i = 0; i < 86400; i++) {
        v[86400+i] = v[i];
    }
    cur = 0; int ans = 0;
    for (int i = 0; i < 86400 * 2; i++) {
        cur += v[i];
        if (i > 10800) cur -= v[i-10801];
        ans = max(cur, ans);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  long long N;
  cin>>N;
  vector <long long> A(N+2,0);
  vector <long long> L(N+2,0);
  vector <long long> R(N+2,0);
  for(long long i=0;i<N;i++){
    cin>>A[i];
  }
  L[0]=0;
  for(long long i=1;i<=N;i++){
    L[i]=gcd(L[i-1],A[i-1]);
  }
   R[N+1]=0;
  for(long long i=N;i>=0;i--){
    R[i]=gcd(R[i+1],A[i]);
  }  
    long long maxgcd=0;
  long long temp=0;
  for(long long i=0;i<N;i++){
    temp=gcd(L[i],R[i+1]);
    maxgcd=max(maxgcd,temp);
    //cout<<i<<" "<<L[i]<<" "<<R[i]<<" "<<temp<<endl;
  }
  cout<<maxgcd<<endl;
  
  return 0;
}

       

Measured memory_bytes: 5556
N = int(input())
A, B, C = [], [], []
A = list(map(int, input().split()))
B = list(map(int, input().split()))  
C = list(map(int, input().split()))

point = 0
point = sum(B)

for i in range(len(A)-1):
    if A[i+1] - A[i] == 1:
        point += C[A[i]-1]

print(point)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int n, a;
int x[60] = {};
ll dp[60][60][3000] = {};
int ma = 0;

int main()
{
    cin >> n >> a;

    for (int i = 1; i <= n; i++)
    {
        cin >> x[i];
        ma = max(ma, x[i]);
    }
    dp[0][0][0] = 1;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= (n * ma); k++)
            {
                if (i == 0 && j == 0 && k == 0)
                {
                    dp[0][0][0] = 1;
                }
                else if (i > 0 && k < x[i])
                {
                    dp[i][j][k] = dp[i - 1][j][k];
                }
                else if (i > 0 && j > 0 && k >= x[i])
                {
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]];
                }
                else
                {
                    dp[i][j][k] = 0;
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        ans += dp[n][i][i * a];
    }
    cout << ans << endl;
}

Measured memory_bytes: 71680
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void resolve() {
    int a,b,c;
    cin >> a >> b >> c;
    if (a == b) cout << c << endl;
    else if (a == c) cout << b << endl;
    else cout << a << endl;
}

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

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

int main(){
	int i;
	char c;
	char array[5]={'a','e','i','o','u'};

	cin >>c;
	for(i=0;i<5;i++)if(c==array[i])break;
	if(i==5)cout<<"consonant"<<endl;
	else cout<<"vowel"<<endl;
	return 0;

}

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

#define ll long long

using namespace std;

ll n, k;

ll p3(ll x)
{
    return x*x*x;
}

int main()
{
    cin >> n >> k;
    ll ans = 0;
    if(!(k & 1LL) && k / 2 <= n)
        ans += p3((n - k / 2) / k + 1);
    ans += p3(n / k);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<cstring>
#include<iostream>
#include<cstdio>
#define ull unsigned long long
#define ll long long
const int maxn=100000;
using namespace std;
priority_queue<int,vector<int>,greater<int>>q;
struct A{
 string s;
 int a,b;
 bool operator < (A p)
 {
     if(s==p.s)return a>p.a
;
     return s<p.s;
 }
}z[103];
int main()
{
int n;
cin>>n;
 for(int i=1;i<=n;i++)
    cin>>z[i].s>>z[i].a,z[i].b=i;
 sort(z+1,z+1+n);
 for(int i=1;i<=n;i++)
 cout<<z[i].b<<endl;

}


Measured memory_bytes: 256