akhauriyash/Code-Regression huggingface dataset:
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n,k,mod;

int c[333][333],dp[333][333];
int main()
{
	get3(n,k,mod);
	for(int i=0;i<333;i++)
	{
		c[i][0]=1;
		for(int j=1;j<=i;j++)
		{
			c[i][j]=c[i-1][j]+c[i-1][j-1];
			if(c[i][j]>=mod)c[i][j]-=mod;
		}
	}
	for(int i=0;i<=k;i++)dp[1][i]=1;
	for(int i=2;i<=n+1;i++)
	{
		for(int j=1;j<i;j++)
		{
			int sum=0;
			for(int tk=k;tk>=0;tk--)
			{
				dp[i][tk]=(dp[i][tk]+1ll*sum*c[i-2][j-1]%mod*dp[i-j][tk])%mod;
				sum=(sum+dp[j][tk])%mod;
			}
		}
	}
	printf("%d\n",dp[n+1][0]);
	return 0;
}

Measured memory_bytes: 1024
S = list(input())
# min(全部０１０１０、全部１０１０１)
cnt0 = 0
cnt1 = 0
for e in S[::2]:
    if e == '1':
        cnt0 += 1
for e in S[1::2]:
    if e == '0':
        cnt0 += 1
for e in S[::2]:
    if e == '0':
        cnt1 += 1
for e in S[1::2]:
    if e == '1':
        cnt1 += 1
print(min(cnt0, cnt1))


Measured memory_bytes: 4268
#include <cmath>
#include <iostream>
#include <string>

using namespace std;

int main() {
	int x1, y1, x2, y2, x3, y3;
	cin >> x1 >> y1 >> x2 >> y2;
	int dx, dy;
	dx = abs(x2 - x1);
	dy = abs(y2 - y1);
	if (x1 < x2 && y1 < y2) {
		cout << x2 - dy << " " << y2 + dx << " " << x2 - dy - dx << " " << y2 + dx - dy << endl;
	}
	else if (x1 < x2 && y2 < y1) {
		cout << x2 + dy << " " << y2 + dx << " " << x2 + dy - dx << " " << y2 + dx + dy << endl;
	}
	else if (x2 < x1 && y1 < y2) {
		cout << x2 - dy << " " << y2 - dx << " " << x2 - dy + dx << " " << y2 - dx - dy << endl;
	}
	else if (x2 < x1 && y2 < y1) {
		cout << x2 + dy << " " << y2 - dx << " " << x2 + dy + dx << " " << y2 - dx + dy << endl;
	}
	else if (x1 == x2 && y1 < y2) {
		cout << x1 - dy << " " << y2 << " " << x1 - dy << " " << y1 << endl;
	}
	else if (x1 == x2 && y2 < y1) {
		cout << x1 + dy << " " << y2 << " " << x1 + dy << " " << y1 << endl;
	}
	else if (x1 < x2 && y1 == y2) {
		cout << x2 << " " << y1 + dx << " " << x1 << " " << y1 + dx << endl;
	}
	else if (x2 < x1 && y1 == y2) {
		cout << x2 << " " << y1 - dx << " " << x1 << " " << y1 - dx << endl;
	}
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(mut n: usize) -> usize {
    if n == 10 || n == 100 || n == 1000 || n == 10000 || n == 100000 {
        return 10
    }

    let mut ans = 0;
    while n > 0 {
        ans += n % 10;
        n = n / 10
    }

    ans
}

fn main() {
    let n = parse_line!(usize);

    println!("{}", solve(n));
}

#[test]
fn solve_test() {
    assert_eq!(solve(15), 6);

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define px(str) cout<<(str)<<endl,exit(0);
#define pe(str) return cout<<(str)<<endl,0;
#define IF(a,b,c) ((a)?(b):(c))
#define re(i,n) for(int i=0;i<(n);i++)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;


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

int main(int argc,char** argv){
	int a,b;
	cin>>a>>b;
	cout<<a+b+1-gcd(a,b)<<endl;
	return 0;
}



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

int main() {
    string s;
    cin >> s;
    int cnt_a = 0;
    int cnt_b = 0;
    int cnt_c = 0;
    for (char x: s) {
        
        if (x == 'a') {
            cnt_a++;
        }else if (x == 'b'){
            cnt_b++;
        }else if (x == 'c') {
            cnt_c++;
        }
    }
    if (cnt_a == 1 && cnt_b == 1 && cnt_c == 1) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

n,k=map(int,input().split())
G=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1; b-=1
    G[a].append(b)
    G[b].append(a)

class InverseTable:
    __slots__ = ['In', 'fac', 'Ifac']

    def __init__(self, mod, maxnum):
        self.In = [0, 1]; self.fac = [1, 1]; self.Ifac = [1, 1]
        for i in range( 2, maxnum + 1 ):
            self.In.append( ( -self.In[mod % i] * (mod//i) ) % mod )
            self.fac.append( ( self.fac[-1] * i ) % mod )
            self.Ifac.append( (self.Ifac[-1] * self.In[-1]) % mod )
        
    def cmb(self, n, r):
        if ( r<0 or r>n ): return 0
        r = min(r, n-r)
        return self.fac[n] * self.Ifac[r] * self.Ifac[n-r] % mod

invt = InverseTable(mod, 2*10**5)
# maxnum=10**6だとテーブル生成に200ms程かかるので
# 最大生成領域は問題ごとに要検討

def dfs(s,node,parent):
    if len(G[node])>=k: return 0
    elif len(G[node])-s==0: return 1
    else: result=(invt.fac[k-1-s]*invt.Ifac[k-1-s-(len(G[node])-s)])%mod
    for i ,di in enumerate(G[node]):
        if di == parent: continue
        result*=dfs(1,di,node); result%=mod
    # print(node,result)
    return result

print((k*dfs(0,0,-1))%mod)


    



Measured memory_bytes: 121784
N,M = map(int,input().split())

# まずsを使い切る
# sが余るならもう無理
# sがなしでcが余るならc4つをscc

if M < 2*N:
  answer = M//2
else:
  answer = N
  answer += (M-N*2)//4
print(answer)

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

using namespace std;

unsigned long long clp(unsigned long long x)
{
    x -= 1;
    x = x | (x >>  1);
    x = x | (x >>  2);
    x = x | (x >>  4);
    x = x | (x >>  8);
    x = x | (x >> 16);
    x = x | (x >> 32);
    return x + 1;
}

// a[0], a[1], ... , a[n - 1] is a given array of length n.
// T is the type of elements of array a.
// ZERO is a element such that for any element x, f(x, ZERO) == x.
// e.g. f(x, y) = sum(x, y), ZERO = 0.
// e.g. f(x, y) = min(x, y), ZERO = INFINITY.
template <class T>
class segment_tree
{
    private:
        const size_t n;
        const T ZERO;
        function<T(T, T)> f;
        T *a;
    public:
        segment_tree(size_t size, T ZERO, function<T(T, T)> f) : n(clp(size)), ZERO(ZERO), f(f)
        {
            a = new T[2 * n - 1];
            fill(a, a + 2 * n - 1, ZERO);
        }
        ~segment_tree() {
            delete [] a;
        }
        void update(size_t i, T x)
        {
            i += n - 1;
            a[i] += x;
            while (i) {
                i = (i - 1) / 2;
                a[i] = f(a[2 * i + 1], a[2 * i + 2]);
            }
        }
        T query(size_t query_first, size_t query_last, size_t k = 0, size_t node_first = 0, size_t node_last = 0)
        {
            if (k == 0) {
                node_last = n;
            }
            if (node_last <= query_first || query_last <= node_first) {
                return ZERO;
            }
            if (query_first <= node_first && node_last <= query_last) {
                return a[k];
            } else {
                size_t node_mid = (node_first + node_last) / 2;
                T vl = query(query_first, query_last, k * 2 + 1, node_first, node_mid);
                T vr = query(query_first, query_last, k * 2 + 2, node_mid, node_last);
                return f(vl, vr);
            }
        }
};

int main(void)
{
    int n, q;
    cin >> n >> q;
    segment_tree<int> t(n, 0, [](int x, int y) {return x + y;});
    while (q--) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            t.update(x - 1, y);
        } else if (com == 1) {
            cout << t.query(x - 1, y) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
using System;

class Program
{

    static bool IsMM(int m, int n)
    {
        return m == 0 && n != 0 || m == 1 && n >= 0 && n <= 2;
    }

    static void Main(string[] args)
    {
        string s = Console.ReadLine();

        int y1 = int.Parse(s.Substring(0, 1));
        int y2 = int.Parse(s.Substring(1, 1));
        int m1 = int.Parse(s.Substring(2, 1));
        int m2 = int.Parse(s.Substring(3, 1));

        if (IsMM(y1, y2) && IsMM(m1, m2))
        {
            Console.WriteLine("AMBIGUOUS");
        }
        else if (IsMM(y1, y2) && !IsMM(m1, m2))
        {
            Console.WriteLine("MMYY");
        }
        else if (!IsMM(y1, y2) && IsMM(m1, m2))
        {
            Console.WriteLine("YYMM");
        }
        else Console.WriteLine("NA");
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
bool comp(const pair<string,ll> &a,const pair<string, ll> &b)
{
   return a.second>b.second;
}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, r;
    cin>>n>>r;
    if(n>=10)
        cout<<r;
    else
        cout<<r+100*(10-n);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll i = 1;
    ll ans = 1;
    while (i*i <= n){
        if (n%i == 0){
            ans = i;
        }
        i++;
    }
    cout << ans + n/ans - 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        #define ll long long
        #define f(i, a, b) for(ll i=a; i<b; i++)
        #define pb push_back
        #define mp make_pair
        #define F first
        #define S second
        using namespace std;
        ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
        {
            unordered_map<ll, ll> prevSum;
            ll res = 0;
            ll currsum = 0;
            for (ll i = 0; i < n; i++)
            {
                currsum += arr[i];
                if (currsum == sum) res++;
                if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
                prevSum[currsum]++;
            }
            return res; 
        } 
        ll gcd(ll a, ll b) 
        { 
            if (a == 0) 
                return b; 
            return gcd(b % a, a); 
        } 
          
        ll findGCD(ll arr[], ll n) 
        { 
            ll result = arr[0]; 
            for (ll i = 1; i < n; i++)
                result = gcd(arr[i], result); 
          
            return result; 
        } 
        ll powmp(ll x, ll y, ll p) 
        { 
            ll res = 1;     x = x % p;   
            while (y > 0) 
            {  
                if (y & 1)  res = (res*x) % p; 
                y = y>>1; 
                x = (x*x) % p;   
            } 
            return res; 
        } 
         
        int main()
        {
            ios_base::sync_with_stdio(false); 
            cin.tie(NULL);
           ll n,ans=0; cin>>n;
          string s; cin>>s;
          f(i,0,n)
          {
          ans++;
            while(s[i]==s[i+1] && i<n-1) i++;
          }
          cout<<ans;
        }

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
int n,m,a[N],ans,v,p;
LL sum[N];
bool ck(int x){
	if(n-x+1<=p)return true;
	if(x+p-1>=v){
		int pos=a[n-p+1];
		return (a[x]+m>=pos);
	}
	int lft=v-(x+p-1);
	LL mid=0,num=0;
	for(int i=x+1;i<=n-p+1;i++){
		if(a[i]>a[x]+m)return false;
		mid+=a[i];num++;
	}
	mid+=1ll*m*lft;
	LL tmp=(mid+num-1)/num;
	//cout<<x<<" "<<lft<<" "<<a[x]+m<<" "<<tmp<<endl;
	return a[x]+m>=tmp;
}
int main(){
	scanf("%d%d%d%d",&n,&m,&v,&p);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)sum[i]=sum[i-1]+a[i];
	int L=1,R=n;
	while(L<=R){
		int mid=(L+R)>>1;
		if(ck(mid))ans=mid,R=mid-1;
		else L=mid+1;
	}
	printf("%d\n",(n-ans+1));
}
	

Measured memory_bytes: 1408
package main

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

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

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

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)

	s := readString()
	switch s {
	case "Sunny":
		fmt.Println("Cloudy")
	case "Cloudy":
		fmt.Println("Rainy")
	case "Rainy":
		fmt.Println("Sunny")
	default:
		panic("err")
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <limits>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
ull T[2<<17],mod,ans,cnt[2<<17];
inline void solve(void){
  string S;
  in(S);
  ull N=S.size();
  T[N-1]=1;
  for(ull i=N-1;i--;)T[i]=T[i+1]*10%2019;
  cnt[0]=1;
  for(ull i=0;i<N;i++){
    mod=(mod+(S[i]-'0')*T[i])%2019;
    ans+=cnt[mod]++;
  }
  out(ans);
}
int main(void){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 5328
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    int n = readln().chomp().to!int;
    for(int i=0;i<n;i++){
	int[] s = split(readln()).to!(int[]);
	int res = s[0] * s[2] + s[1] * s[3];
	if(s[2] >= 5 && s[3] >= 2)  res = to!int(to!real(res*0.8));
	else if(s[2] >= 5) res = min(res, to!int(0.8*(s[0]*s[2]+s[1]*2)));
	else if(s[3] >= 2) res = min(res, to!int(0.8*(s[0]*5+s[1]*s[3])));
	else res = min(res, to!int(0.8*(s[0]*5 + s[1]*2)));
	writeln(res);
    }

}

Measured memory_bytes: 2492
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] s = new int[n];
        for (int i = 0; i < n; i++)
        {
            s[i] = sc.NextInt();
        }

        List<int> ten = new List<int>();
        List<int> notTen = new List<int>();

        foreach (var num in s)
        {
            if (num % 10 == 0)
            {
                ten.Add(num);
            }
            else
            {
                notTen.Add(num);
            }
        }

        int answer = s.Sum();

        if (notTen.Count == 0)
        {
            answer = 0;
        }

        if (answer % 10 == 0 && notTen.Count() > 0)
        {
            answer = s.Sum() - notTen.Min();
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13268
H,W=map(int,input().split())
S = [ input() for _ in range(H) ]
for h in range(H):
  L = ''
  for w in range(W):
    if S[h][w] == '#':
      L += '#'
    else:
      x = 0
      for dh in [ -1, 0, 1]:
        for dw in [-1, 0, 1]:
          if 0 <= h + dh < H and 0 <= w + dw < W and S[h+dh][w+dw] == '#':
            x += 1
      L += str(x)
  print(L)


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

using namespace std;
typedef long long ll;

void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int main()
{

	FAST();
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

  //ll d,s,t,ans;
  string s,t; cin>>s>>t;
ll hash=0; ll interm=0;
for(int i=0;i<t.length();i++)
	hash+=(int(t[i]))-96;

vector<ll> v;

ll count;
ll a=s.size();
ll b=t.size();
//scerr<<a<<" "<<b;

for(int i=0;i<=(a-b);i++){
 count=0;
 
 for(int j=0;j<b;j++){
 	//cerr<<"checking "<<s[i+j]<<"  "<<t[j]<<endl;
     if(s[i+j]==t[j])
        {count++; }    
 }
 if(count>0)
 {v.push_back(count);
   }
 
}

if(v.size()==0)
	cout<<b;
else{
sort(v.begin(),v.end());
cout<<abs(b-v[v.size()-1]);
}
//cerr<<"size= "<<v.size()<<endl;
//cerr<<endl;
/*for(auto i:v)
	 cerr<<i<<" ";
*/
	return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<vector>
#include<string>

int main(){
	std::string s, t;
	std::cin>>s>>t;

	std::vector<std::vector<int>> alpIdx(26);
	std::vector<std::vector<int>> numUsed(t.size());

	for(int i=0; i<t.size(); i++)
		numUsed[i].resize(26, 0);

	for(int i=0; i<s.size(); i++)
		alpIdx[s[i]-'a'].push_back(i);

	int tableNo= 0;
	int curIdx= 0;
	long long ans= 0;
	bool isExist= true;

	for(int i=0; i<t.size(); i++){
		int alpNo= t[i]-'a';
		int numIdx= alpIdx[alpNo].size();

		if(numIdx<=0){
			isExist= false;
			break;
		}

		bool isSatisfied= false;
		while(!isSatisfied){			
			if(numUsed[tableNo][alpNo]>= numIdx){
				tableNo++;
				curIdx= 0;
			}

			if(alpIdx[alpNo][numUsed[tableNo][alpNo]] >= curIdx){				
				curIdx= alpIdx[alpNo][numUsed[tableNo][alpNo]];
				isSatisfied= true;
			}

			numUsed[tableNo][alpNo]++;
		}
	}

	if(isExist)
		std::cout<< s.size() * tableNo + curIdx+1<<std::endl;
	else
		std::cout<<-1<<std::endl;

	return 0;
}

Measured memory_bytes: 14336
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    rep(i,n) cin >> x[i] >> y[i];
    double ans = 0;
    vector<int> v(n);
    rep(i,n) v[i] = i;
    do{
        double sum = 0;
        rep(i,n-1){
            sum += sqrt((x[v[i]]-x[v[i+1]])*(x[v[i]]-x[v[i+1]]) + (y[v[i]]-y[v[i+1]])*(y[v[i]]-y[v[i+1]]));
        }
        ans += sum;
    }while(next_permutation(v.begin(), v.end()));
    double div = 1;
    rep(i,n) div *= (i+1);
    ans /= div;
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,s;
	s=0;
	cin>>n>>k;
	vector<int> d(n);
	for(int i=0;n>i;i++){
		cin>>d.at(i);
	}
	for(int i=0;n>((k-1)*i)+1;i++){
		s++;
	}
	cout<<s<<endl;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cctype>
using namespace std;
int main(){
    char ch;
    scanf("%c", &ch);
    while(ch!='\n'){
        if (islower(ch)){
            printf("%c", toupper(ch));
        }
        else if (isupper(ch)){
            printf("%c", tolower(ch));
        }
        else{
            printf("%c", ch);
        }
        scanf("%c", &ch);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2692
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, Q = mapint()
Cs = list(mapint())
LR = []
for i in range(Q):
    l, r = mapint()
    k = r*(10**12)+l*(10**6)+i
    LR.append(k)
LR.sort()
A = [0]*N

def add(A,a,w):#リストに値を追加する関数
    x = a
    while x <= N:
        A[x-1] += w
        x += x&(-x)

def sums(A,a):#k番目までの和
    x = a
    S = 0
    while x != 0:
        S += A[x-1]
        x -= x&(-x)
    return S

ans = [0]*Q
i = 0
last_appeared = [-1]*(N+1)
for k in LR:
    ans_idx = k%(10**6)
    l = k//(10**6)%(10**6)
    r = k//(10**12)
    while i<r:
        c = Cs[i]
        if last_appeared[c]==-1:
            last_appeared[c] = i+1
            add(A, i+1, 1)
        else:
            past = last_appeared[c]
            last_appeared[c] = i+1
            add(A, past, -1)
            add(A, i+1, 1)
        i += 1
    ans[ans_idx] = sums(A, r)-sums(A, l-1)
for a in ans:
    print(a)

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

class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int S=Integer.parseInt(br.readLine());

    int h=S/3600;
    int m=(S%3600)/60;
    int s=((S%3600)%60);

    System.out.println(h+":"+m+":"+s);
  }
}


Measured memory_bytes: 24416
#include <iostream>
#include <cmath>
using namespace std;
const long long MAXN = 2e5+5;
const long long F = (2e5) * (1e9);
int main()
{
	long long n,relsum = 0;
	cin >> n;
	long long sl[MAXN];
	for (int i = 0; i < n; i++)
	{
		cin >> sl[i];
		relsum += sl[i];
	}
	long long sumx[n] = {0};
	for (int i = 1; i <= n - 1;i++)
	{
		sumx[i] += sumx[i - 1] + sl[i - 1];
	}
	long long cha[n - 1] = {0};
	long long minn = F; 
	for (int i = 1; i <= n - 1;i++)
	{
		if (abs(relsum - 2 * sumx[i]) < minn)
			minn = abs(relsum - 2 * sumx[i]);
	}
	cout << minn << endl;
} 

Measured memory_bytes: 4992
#include <stdio.h>
int main(void){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  if(a>b){
    printf("a > b");
    printf("\n");
  }
  if(a<b){
    printf("a < b");
    printf("\n");
  }
  if(a==b){
    printf("a == b");
    printf("\n");
  }

  return 0;

}

Measured memory_bytes: 1752
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;

string N;
int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    int count=0;
    REP(i,4){
        if(N[i] == '2') count++;
    }

    cout << count << endl;

    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;


typedef long long LL;
typedef pair<LL,LL> PLL;
const LL mod = 100000007;
const int SIZE = 2001;
LL R, C, X1, Y1, X2, Y2;
const LL dr[9] = { 0, 1, 1, -1, -1, 0, 0, 1, -1 };
const LL dc[9] = { 0, 1, -1, 1, -1, 1, -1, 0, 0 };

LL NCR[SIZE+1][SIZE+1];

void init() {
    fill( (LL*)NCR, (LL*)NCR+(SIZE+1)*(SIZE+1), 0 );
    NCR[0][0] = 1;
    for ( int i = 1; i <= SIZE; ++ i ) {
        NCR[i][0] = 1;
        for ( int j = 1; j <= i; ++ j ) {
            NCR[i][j] = ( NCR[i-1][j] + NCR[i-1][j-1] ) % mod;
        }
    }
}

bool input() {
    return cin >> R >> C >> Y1 >> X1 >> Y2 >> X2;
}

LL ncr( int n, int r ) {
    return NCR[n][r];
}

LL get_manhattan_dist( int x1, int y1, int x2, int y2 ) {
    return ( abs( x1 - x2 ) + abs( y1 - y2 ) ) % mod;
}

LL get_minimum_manhattan_dist( int x1, int y1, int x2, int y2 ) {
    LL res = get_manhattan_dist( x1, y1, x2, y2 );
    for ( int i = 0; i < 9; ++ i ) {
        int nx = X1 + C * dc[i];
        int ny = Y1 + R * dr[i];
        LL dist = get_manhattan_dist( nx, ny, x2, y2 );
        res = min( res, dist );
    }
    return res;
}

LL calc( PLL p ) {
    return ncr( p.first+p.second, p.first );
}

LL solve() {
    if ( X1 == X2 && Y1 == Y2 ) return 0;
    LL res = 0;
    LL min_dist = get_minimum_manhattan_dist( X1, Y1, X2, Y2 );
    for ( int i = 0; i < 9; ++ i ) {
        int nx = X1 + C * dr[i];
        int ny = Y1 + R * dc[i];
        PLL diff( abs( nx - X2 ), abs( ny - Y2 ) );
        LL dist = get_manhattan_dist( nx, ny, X2, Y2 );
        if ( dist == min_dist ) {
            res = ( res + calc( diff ) ) % mod;
        }
    }
    return res % mod;
}

int main() {
    while ( init(), input() ) cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 32472
#include <stdio.h>
#include <stdlib.h>
 
int compare(const void *a,const void *b){
  return *(int *)a - *(int *)b;
}
 
int main(){
  int n;
  scanf("%d",&n);
  int d[100000];
  for(int i=0;i<n;i++){
    scanf("%d",d+i);
  }
  qsort(d,n,sizeof(int),compare);
  printf("%d\n",d[n/2]-d[n/2 -1]);
  return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int GCD(int x,int y){return y==0? x:GCD(y,x%y);}
int main(void){
	int n,i,ans;
	scanf("%d",&n);
	int A,B;
	scanf("%d",&ans);
	for(i=1;i<n;i++){
		scanf("%d",&B);
		ans = GCD(ans,B);
		A = B;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
//package atcoder.beginnner_176;

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "123456789";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); char[] N = nca();
        long n=0;
        for (int i=0; i<N.length; ++i) n+=(N[i]-'0');
        bw.write((n%9==0?"Yes":"No") + "\n");
        bw.flush();
    }

    static BufferedReader br; static BufferedWriter bw; static StringTokenizer st;
    static void rl() throws Exception{ st = new StringTokenizer(br.readLine()); }
    static long nlo(){ return Long.parseLong(st.nextToken()); }
    static int nin(){ return Integer.parseInt(st.nextToken()); }
    /*private static void te(){}*/
    static double ndo(){ return Double.parseDouble(st.nextToken()); }
    static char[] nca(){ return st.nextToken().toCharArray(); }
}


Measured memory_bytes: 39788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h+2, vector<char>(w+2,'.'));
    rep(i,h){
        rep(j,w){
            cin >> s[i+1][j+1];
        }
    }
    int mvx[4] = {0, 1, 0, -1};
    int mvy[4] = {1, 0, -1, 0};
    rep(i,h){
        rep(j,w){
            if(s[i+1][j+1] == '#'){
                bool flag = false;
                rep(nx,4){
                    if(s[i+1+mvx[nx]][j+1+mvy[nx]] == '#'){
                        flag = true;
                    }
                }
                if(!flag){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		solve(s);
		s.close();
	}

	public static void solve(Scanner s) {
		String w = s.next();
		int[] array = new int[26];

		for (char c : w.toCharArray()) {
			array[c - 97]++;
		}

		for (int i : array) {
			if (i % 2 != 0) {
				System.out.println("No");
				return;
			}
		}

		System.out.println("Yes");
	}
}

Measured memory_bytes: 9424
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main() {
  string S;
  cin >> S;
  int sz = S.size();
  vector<int> vec(sz,0);
  vector<int> sum(sz,0);
  ll acc=0;
  for(int i=0;i<sz;i++){
    if(S[i]=='B') vec[i]=1;
    else vec[i]=0;
  }
  for(int i=sz-1;i>=0;i--){
    if(vec[i]==0) acc++;
    else sum[i]=acc;
  }
  ll ans=0;
  for(int i=0;i<sz;i++){
    ans+=sum[i];
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 2180
#include<stdio.h>

int main(){
  long long int sum, Q, H, S, D, N;
  scanf("%lld%lld%lld%lld", &Q, &H, &S, &D);
  long long int a[4] = {Q*8, 4*H, S*2, D};
  scanf("%lld", &N);
  if(H > 2*Q){H = 2*Q;}
  if(S > 2*H){S = 2*H;}
  if(D > 2*S){D = 2*S;}
  if(N%2==1){
    sum = (N/2)* D + S;}
  else
    {sum = D  * (N / 2);}
  printf("%lld", sum);
  return 0;  
}

Measured memory_bytes: 128
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        System.out.printf("%d ", c);
        System.out.printf("%d ", a);
        System.out.print(b);
        
    }
}

Measured memory_bytes: 21716
type Coord = (Int, Int)

rotateClockWise :: Coord -> Coord
rotateClockWise (x, y) = (y, -x)

plus :: Coord -> Coord -> Coord
plus (x1, y1) (x2, y2) = (x1 + x2, y1 + y2)

minus :: Coord -> Coord -> Coord
minus (x1, y1) (x2, y2) = (x1 - x2, y1 - y2)

pairToList :: (a, a) -> [a]
pairToList (x, y) = [x, y]

main = do
    [x1, y1, x2, y2] <- map read . words <$> getLine
    let v1 = (x1, y1)
    let v2 = (x2, y2)
    let v3 = v2 `plus` rotateClockWise (v1 `minus` v2)
    let v4 = v3 `plus` rotateClockWise (v2 `minus` v3)
    putStrLn $ unwords $ fmap show ([v3, v4] >>= pairToList)


Measured memory_bytes: 508
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B
  * Structured Program II - How many ways?
  */
object Main {
  def main(args: Array[String]): Unit = {
    val dataSets = Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).map(_.split(" ").map(_.toInt))
      .map { case Array(n, x) => (n, x) }
      .takeWhile(_ != (0, 0))
      .toList
    val results = dataSets.map { case (n, x) =>
      (for (a <- 1 to n; b <- 1 to n if a < b; c <- 1 to n if a < c && b < c && (a + b + c) == x)
        yield 1).length
    }
    results.foreach(println)
  }

}

Measured memory_bytes: 86708
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    string S;
    cin >> S;
    bool all9 = true;
    repe(i,1,S.size()){
        if (S[i] != '9') all9 = false;
    }
    if(all9){
        cout << (S[0] - '0' + 9 * (S.size() - 1)) << endl;
    }
    else{
        cout << (S[0] - '1' + 9 * (S.size() - 1)) << endl;
    }
}

Measured memory_bytes: 256
import collections
import math

N = int(input())
S = list(input())

if 'R' in S and 'G'in S and 'B' in S:
    count = collections.Counter(S)
    c_value = list(count.values())
    con = c_value[0]*c_value[1]*c_value[2]
else:
    con = 0

for i in range(N):
    for j in range(i+1, int(math.ceil((N+i)/2))):
        if S[i] != S[j]:
            if S[i] != S[j + (j - i)] and S[j] != S[j + (j - i)]:
                con -= 1

print(con)


Measured memory_bytes: 9468
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n;
	ll ans[200002]={};

	cin>>n;
	rep(i,n-1){
		ll a;
		cin>>a;
		ans[a]++;
	}
	rep(i,n){
		cout<<ans[i+1]<<endl;
	}

	return 0;
}


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

int numofbits5(long bits) {
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> K(M+1), P(M+1);
  vector<int> S(M+1, 0);
  for (int i = 1; i < M+1; i++) {
    cin >> K[i];
    for (int j = 1; j < K[i]+1; j++) {
      int s_tmp;
      cin >> s_tmp;
      S[i] += 1 << (s_tmp-1);
    }
  }
  for (int i = 1; i < M+1; i++) {
    cin >> P[i];
  }

  int count = 0;
  for (int i = 0; i < (1 << N); i++) {
    for (int j = 1; j < M+1; j++) {
      if (numofbits5(S[j] & i) % 2 != P[j]) {
        break;
      }
      if (j == M) {
        count++;
      }
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 256
#D
import math
a,b,x = map(int,input().split())

if x >= a*a*b/2:
    d = math.degrees(math.atan(2*b/a - 2*x/(a**3)))
else:
    d = math.degrees(math.atan(a*b*b/(2*x)))
    
print(d)
        
        


Measured memory_bytes: 2940
package main

import (
	"fmt"
	"sort"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	v := make([]int, n)
	for i:=0; i<n; i++ {
		fmt.Scan(&v[i])
	}
	sort.Sort(sort.IntSlice(v))
	ans := 0.0
	for i:=0; i<n; i++ {
		if i<2 {
			ans += float64(v[i])
		} else {
			ans += float64(v[i])*math.Pow(2,float64(i-1))
		}
	}
	fmt.Println(ans/math.Pow(2,float64(n-1)))
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdint>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;
using std::lower_bound;
using std::upper_bound;
using std::find_if;
using std::copy;
using std::copy_if;

const double PI=3.141592653589793;

int N;
int M;

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

    if(std::abs(N-M)>1){
        cout << "0" << endl;
        return 0;
    }

    long ans=(M==N)?2:1;
    long K=1000000007;

    while(N>1){
        ans*=N;
        ans%=K;
        N--;
    }

    while(M>1){
        ans*=M;
        ans%=K;
        M--;
    }

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



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int count;
int n,s;

void find_dps(int sum, int now, int add_count) {
  //printf("%d %d : %d %d\n",sum,s,add_count,n);
  if (now > 10 || add_count > n || sum > s) {
    return;
  }
  if (sum == s && add_count == n) {
    //printf("now=%d\n", now);
    count++;
    return;
  }
  find_dps(sum+now, now+1, add_count+1);
  find_dps(sum, now+1, add_count);
}

int main (int argc, char const* argv[]) {
  while (true) {
    cin>>n>>s;
    if (n==0 && s==0) break;
    count = 0;
    find_dps(0,0,0);
    cout<<count<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
//F
#include <bits/stdc++.h>
#define write(x) printf("%d\n", x)
using namespace std;
typedef long long ll;
template <typename T>
void read(T &x)
{
	x = 0;
	char c;
	while (!isdigit(c = getchar()));
	do
	{
		x = (x << 1) + (x << 3) + (c ^ 48);
	}while (isdigit(c = getchar()));
}
int n;
ll D, A;
struct Monster
{
	ll x;
	ll h;
}M[200005];
bool operator <(Monster A, Monster B)
{
	return A.x < B.x;
}
struct SegmentTree
{
	int l, r;
	ll dat, add;
}t[800050];
ll X[200005];
ll H[200005];
void build(int p, int l, int r)
{
	t[p].l = l;t[p].r = r;
	if (l == r)
	{
		t[p].dat = H[l];
		return ;
	}
	int mid = (l + r) >> 1;
	build((p << 1), l, mid);
	build((p << 1) + 1, mid + 1, r);
	t[p].dat = t[(p << 1)].dat + t[(p << 1) + 1].dat;
}
void spread(int p)
{
	if (t[p].add)
	{
		t[(p << 1)].dat += t[p].add * (t[(p << 1)].r - t[(p << 1)].l + 1);
		t[(p << 1) + 1].dat += t[p].add * (t[(p << 1) + 1].r - t[(p << 1) + 1].l + 1);
		t[(p << 1)].add += t[p].add;
		t[(p << 1) + 1].add += t[p].add;
		t[p].add = 0;
	}
}
void change(int p, int v, int l, int r)
{
	if (l <= t[p].l && t[p].r <= r)
	{
		t[p].add += (ll)v;
		t[p].dat += (ll)v * (t[p].r - t[p].l + 1);
		return ;
	}
	spread(p);
	int mid = (t[p].l + t[p].r) >> 1;
	if (l <= mid) change(p << 1, v, l, r);
	if (r > mid) change((p << 1) + 1, v, l, r);
	t[p].dat = t[(p << 1)].dat + t[(p << 1) + 1].dat;
}
ll ask(int p, int l, int r)
{
	if (l <= t[p].l && t[p].r <= r)
		return t[p].dat;
	spread(p);
	int mid = (t[p].l + t[p].r) >> 1;
	ll val = 0;
	if (l <= mid) val += ask(p << 1, l, r);
	if (r > mid) val += ask((p << 1) + 1, l, r);
	return val;
}
ll cnt;
int main()
{
	read(n);read(D);read(A);
	for (int i = 0;i < n;++i)
		read(M[i].x), read(M[i].h), M[i].h = (M[i].h + A - 1) / A;
	sort(M, M + n);
	for (int i = 0;i < n;++i)
	{
		X[i] = M[i].x;
		H[i] = M[i].h;
	}
	build(1, 0, n - 1);
	for (int i = 0;i < n;++i)
	{
		ll temp = ask(1, i, i);
		if (temp > 0)
		{
			int j = upper_bound(X, X + n, X[i] + 2 * D) - X - 1;
			cnt += temp;
			change(1, -temp, i, j);
		}
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 21120
#include <stdio.h>
#define MAX 100

int main(){

	int n,i,j,tyoten,zisu,tonari,u;
	int A[MAX][MAX];

	scanf("%d",&n);

	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			A[i][j] = 0;
		}
	}/* 初期化 */

	for(i=0;i<n;i++){
		scanf("%d %d",&tyoten,&zisu);
		
		for(j=0;j<zisu;j++){
			scanf("%d",&tonari);
			A[i][tonari-1] = 1;
		}
	}
	for(i=0;i<n;i++){
    	for(j=0;j<n-1;j++){
 		printf("%d ",A[i][j]);
 		if(j==n-2) printf("%d\n",A[i][j+1]);
    }
    }
    return 0;
}


Measured memory_bytes: 2048
#include <cassert>
#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define rep(i,n) for(int i=0;i<int(n);i++)

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	for(auto i=a.begin();i!=a.end();++i) os<<(i!=a.begin()?" ":"")<<*i;
	return os<<']';
}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& a){
	os<<'[';
	for(auto i=a.begin();i!=a.end();++i) os<<(i!=a.begin()?" ":"")<<*i;
	return os<<']';
}

string concat(const vector<string>& ss,char sep)
{
	string res;
	rep(i,ss.size()){
		res+=ss[i];
		if(i<ss.size()-1) res+=sep;
	}
	return res;
}

string parse(const map<string,set<string>>& files,const string& path)
{
	vector<string> dirs(1,"");
	string basename;
	for(int i=0,j=1;i<path.size();i=j++)
		for(;;j++) if(j==path.size() || path[j]=='/'){
			basename=path.substr(i+1,j-(i+1));
			if(j==path.size()){
				if(basename=="" || basename=="." || basename==".."){
					if(basename==".."){
						dirs.pop_back();
						if(dirs.empty())
							throw "not found";
					}
					basename="index.html";
					if(!files.at(concat(dirs,'/')).count(basename))
						throw "not found";
					dirs.push_back(basename);
					if(files.count(concat(dirs,'/')))
						throw "not found";
					return concat(dirs,'/');
				}
				else{
					if(!files.at(concat(dirs,'/')).count(basename))
						throw "not found";
					dirs.push_back(basename);
					if(!files.count(concat(dirs,'/')))
						return concat(dirs,'/');
					else{
						if(!files.at(concat(dirs,'/')).count("index.html"))
							throw "not found";
						dirs.push_back("index.html");
						if(files.count(concat(dirs,'/')))
							throw "not found";
						return concat(dirs,'/');
					}
				}
			}
			else{
				if(basename==".")
					;
				else if(basename==".."){
					dirs.pop_back();
					if(dirs.empty())
						throw "not found";
				}
				else{
					dirs.push_back(basename);
					if(!files.count(concat(dirs,'/')))
						throw "not found";
				}
			}
			break;
		}
	assert(0);
}

int main()
{
	for(int n,m;cin>>n>>m,n|m;){
		map<string,set<string>> files;
		rep(_,n){
			string path; cin>>path;
			for(int i=0,j=1;i<path.size();i=j++)
				for(;;j++) if(j==path.size() || path[j]=='/'){
					string dirname=path.substr(0,i);
					string basename=path.substr(i+1,j-(i+1));
					files[dirname].insert(basename);
					break;
				}
		}
		
		for(int i=0;i<m;i++){
			string path1,path2; cin>>path1>>path2;
			try{
				path1=parse(files,path1);
				path2=parse(files,path2);
				cout<<(path1==path2?"yes":"no")<<endl;
			}
			catch(const char* message){
				cout<<message<<endl;
			}
		}
	}
}

Measured memory_bytes: 1304