akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll Q, H, S, D, n; cin >> Q >> H >> S >> D >> n;

    ll minone, mintwo;
    minone = min({Q*4,H*2,S});
    mintwo = min(minone*2,D);

    ll ans = 0;
    if(n%2==0) {
        ans = n/2*mintwo;
    }
    else {
        ans = n/2*mintwo+minone;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

#define pll pair<ll,ll>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl
#define sz(a) int((a).size())
#define endl '\n' // remove for interactive

const int INF = 1e9;
const ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}



void solve()
{
    ll x, k, d; cin>>x>>k>>d;
    x = abs(x);
    ll val = x % d;
    ll steps = x/d;
    if(steps <= k) {
        k -= steps;
        ll alt = abs(val-d);
        if(k%2 == 0) cout<<val;
        else cout<<alt;
    }
    else {
        ll cut = abs(x) - k*abs(d);
        cout<<cut;
    }
    
}

int main()
{
    // clock_t start, end;
    // start = clock();
    ios_base::sync_with_stdio(0); //cant use scanf, printf
    cin.tie(0);cout.tie(0); // no longer auto flush cout before each cin, remove for interactive
    int t = 1;
    // cin>>t;
    REP(i, 1, t)
    {
        solve();
        
    }
    // end = clock();
    // double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    // watch(time_taken);
    ll x = INF; x++;
    return 0;
    
}



/*before sub
TEST: 0, 1, equal, -ve, bounds(random and ez)
ERR/WA: loop vars, out of bounds, endl, finish taking inputs, large doubles, larger INF, corr mod, t
RE: double dec, integer overflow(ll or 1LL mult)
*/





Measured memory_bytes: 3648
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

int main(){
	ll N,M;cin>>N>>M;
	set<ll>set;
	vector<ll>wa(N+1,0);
	rep(i,M){
		ll p;
		string s;
		cin>>p>>s;
		if(s=="AC")set.insert(p);
		if(set.find(p)==set.end()&&s=="WA")wa[p]++;
	}
	ll ans=0;
	for(auto&&i:set)ans+=wa[i];
	cout<<set.size()<<" "<<ans<<endl;
}


Measured memory_bytes: 5760
n = gets.chomp.to_i
tree = Array.new(n)
n.times { |i| tree[i] = [] }
(n - 1).times do
  a, b = gets.chomp.split(' ').map { |x| x.to_i - 1 }
  tree[a] << b
  tree[b] << a
end

visited = Hash.new(false)
distances = Array.new(n, 0)
distance = 0
queue = [0]
until queue.empty?
  size = queue.length
  size.times do
    q = queue.shift
    next if visited[q]
    distances[q] = distance
    visited[q] = true
    tree[q].each do |i|
      next if visited[i]
      queue << i
    end
  end
  distance += 1
end

queue = [n - 1]
route = []
until queue.empty?
  q = queue.shift
  route.unshift(q)
  tree[q].each do |i|
    if distances[q] - distances[i] == 1
      queue << i
      break
    end
  end
end
visited = Hash.new(false)
start_index = route.length % 2 == 0 ? route.length / 2 - 1 : route.length / 2
queue = [route[start_index]]
count = 0
until queue.empty?
  q = queue.pop
  next if visited[q]
  visited[q] = true
  count += 1
  tree[q].each do |i|
    next if i == route[start_index + 1]
    next if visited[i]
    queue << i
  end
end

puts count > n - count ? 'Fennec' : 'Snuke'

Measured memory_bytes: 24040
# -*- coding: utf-8 -*-
"""
C - Attack Survival
https://atcoder.jp/contests/abc141/tasks/abc141_c

"""
import sys


def solve(N, K, Q):
    scores = {n: K for n in range(1, N+1)}
    for _ in range(Q):
        a = int(input())
        scores[a] += 1
    ans = ['Yes' if scores[i] - Q > 0 else 'No' for i in range(1, N+1)]
    return ans


def main(args):
    N, K, Q = map(int, input().split())
    ans = solve(N, K, Q)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 15084
from collections import Counter
n = int(input())
lst = list(map(int, input().split()))
counter = Counter(lst)

if len(counter.values()) == 1:
    print(n // 2)
    exit()

num_cnt = list(counter.items())
num_cnt.sort(key=lambda x: x[1], reverse=True)
max_num = num_cnt[0][0]
second_max_num = num_cnt[1][0]
tmp_ans = 0
for i in range(n):
    if i % 2 == 0 and max_num == lst[i] or \
            i % 2 == 1 and second_max_num == lst[i]:
        continue
    tmp_ans += 1
ans = 0
for i in range(n):
    if i % 2 == 1 and max_num == lst[i] or \
            i % 2 == 0 and second_max_num == lst[i]:
        continue
    ans += 1
print(min(ans, tmp_ans))

Measured memory_bytes: 26616
#pragma GCC optimize("Ofast", "unroll-loops")

// #define TEST

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int R; cin >> R;
	cout << setprecision(15) << (2 * R * M_PI) << endl;
	return 0;
}

Measured memory_bytes: 3788
from collections import Counter

N = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


c1 = Counter(prime_factorize(N))
count = 0

for key in c1.keys():
    v = c1[key]
    for i in range(1, v + 1):
        if c1[key] < i:
            break
        c1[key] -= i
        count += 1

print(count)


Measured memory_bytes: 9464
#include <bits/stdc++.h>
using namespace std;
 
/*てんぷれぞーん！*/
//static const int INF = 2147483647;
static const int INF = 1000000000;
static const long long llINF = 9223372000000000000;
static const int NIL = -1;
static const int MOD = 1000000007;
typedef long long ll;
typedef pair<int,int> P;
struct edge {int to,cost;};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
/* t y p o っ て 知 っ て る ゥ ！ ？ */
#define itn int
#define scnaf scanf
#define reutnr return
/*必要に応じて使ってね*/
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll
//#define INF llINF
/*てんぷれぞーんしゅーりょー！*/

multiset<int> pro;
bool rullonz=false;

void nantoka(){
    int score;
    scanf("%d",&score);
    multiset<int>::iterator it = pro.find(score);
    if(it == pro.end()){
        rullonz = true;
        return;
    } else {
        pro.erase(it);
        return;
    }
}

/*void debug(){
    for(multiset<int>::iterator it=pro.begin();it!=pro.end();it++){
        printf("%d ",*it);
    }
}*/
 
signed main(){
    int n,m;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int score;
        scanf("%d",&score);
        pro.insert(score);
    }
    scanf("%d",&m);
    if(m>n){
        puts("NO\n");
        return 0;
    }
    for(int i=0;i<m;i++){
        //debug();
        //cout << endl;
        nantoka();
        if(rullonz){
            puts("NO\n");
            return 0;
        }
    }

    puts("YES\n");
}

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

int main() {
	int n;
	int co = 0;
	while (cin>>n&&n!=0) {
		while (n > 4) {
			n /= 5;
			co += n;
		}
		cout << co << endl;
		co = 0;
	}
	return 0;
}

Measured memory_bytes: 2984
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
using namespace std;
char s[100][100];
int H, W;
void dfs(int x, int y, char f) {
  if (x < 0 || y < 0 || x >= W || y >= H)
    return;
  if (s[y][x] == f) {
    s[y][x] = 'x';
  } else
    return;
  dfs(x + 1, y, f);
  dfs(x - 1, y, f);
  dfs(x, y + 1, f);
  dfs(x, y - 1, f);
}
int main() {
  while (cin >> H >> W) {
    if (H == 0 && W == 0)
      break;
    int ans = 0;
    rep(i, H) rep(j, W) cin >> s[i][j];
    rep(i, H) rep(j, W) {
      if (s[i][j] == 'x') {
      } else {
        ans++;
        dfs(j, i, s[i][j]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3308
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  string s;
  cin >> s;
  cout << s.substr(0, 4) << " " << s.substr(4) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

using namespace std;

typedef long long ll;

ll len[51];
ll cnt[51];

ll go(int n, ll k) {
	ll cur = 0;
	
	assert(0 < k && k <= len[n]);
	if (n == 0) return 1;
	
	if (k <= 1) return 0;
	k -= 1;
	
	if (k <= len[n - 1]) return go(n - 1, k) + cur;
	k -= len[n - 1], cur += cnt[n - 1];
	
	if (k <= 1) return 1 + cur;
	k -= 1, cur++;
	
	if (k <= len[n - 1]) return go(n - 1, k) + cur;
	k -= len[n - 1], cur += cnt[n - 1];
	
	return cur;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n; ll x;
	cin >> n >> x;
	
	len[0] = 1;
	for (int i = 1; i <= n; i++) len[i] = 2 * len[i - 1] + 3;
	
	cnt[0] = 1;
	for (int i = 1; i <= n; i++) cnt[i] = 2 * cnt[i - 1] + 1;
		
	cout << go(n, x) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int x; cin >> x;
    if(x==3 | x==5 | x==7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3564
/**
    BISMILLAH
    @Author : Arham
*/
#include <bits/stdc++.h>

using namespace std;

void solve() {
    string s;
    cin >> s;
    int fin = s.size() - 1;
    if(s[fin] == 's') {
        cout << s << "es" << endl;
    }
    else
        cout << s << "s" << endl;

    return;
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--)
        solve();

    return 0;
}


Measured memory_bytes: 3624
N = int(input())
s = [int(input()) for _ in range(N)]
s = sorted(s)
if sum(s) % 10 != 0:
  print(sum(s))
  exit()
else:
  for i in range(N):
    if (sum(s) - s[i]) % 10 != 0:
      print((sum(s) - s[i]))
      exit()

print(0)

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

int main() {
    int n;
    cin >> n;
    map<string, int> c;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        c[s]++;
    }

    map<int, vector<string>, greater<>> d;
    for (auto& e : c) {
        d[e.second].push_back(e.first);
    }

    sort(begin(begin(d)->second), end(begin(d)->second));
    for (auto& e : begin(d)->second) {
        cout << e << endl;
    }
}


Measured memory_bytes: 26868
fun main(args: Array<String>) {
    readLine()
    val hs = readLine()!!.split(' ').map { it.toInt() }

    var x = 0
    var y = 0
    for (i in (0 until hs.size)) {
        y += Math.max(0, hs[i] - x)
        x = hs[i]
    }

    println(y)
}


Measured memory_bytes: 37920
#include <iostream>
using namespace std;
int main(void){
    int n,m,p,x,sum;
    int t[100]={};
    cin>>n;
    for(int z=0;z<n;z++){
        cin>>t[z];
    }
    cin>>m;
    for(int z=0;z<m;z++){
        cin>>p>>x;
        for(int y=0;y<n;y++){
            if(y==p-1){
                sum+=x;
                //cout<<"d0";
            }else{
                sum+=t[y];
            }
            //cout<<p<<" x  ";
            //cout<<t[y]<<" ty  ";
        }
        cout<<sum<<endl;
        sum=0;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string sa;
	int a,b,n;
	int i,j,k;
	int m;
	cin>>n>>a>>b;
	cin>>sa;
	j=0;
	k=0;
	for(i=0;i<n;i++){
		if(sa[i]=='a' && k<a+b){
			m=0;
		}else if(sa[i]=='b' && k<a+b && j<b){
			j++;
			m=0;
		}else{
			m=1;
		}
		if(m==0){
			k++;
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 896
import math
N,K = map(int, input().split())
if K == 1:
    print(1)
else:
    P = max(0,(N-(K-1))/N)
    t = 0
    for i in range(1,min(N+1,K)):
        foo = math.log2(K/i)
        x=math.ceil(foo)
        t+=(1/2)**x
    P+=t*(1/N)
    print(P)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define forf(i,a,b) for(li i=a;i<b;i++)
#define li long int
using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int arr[n];
	forf(i,0,n)
		cin>>arr[i];
	li count=0;
	if(n==k)
	{	cout<<1;
		return 0;
	}
	while(n>=k)
	{	count+=n/k;
		n=n/k + n%k;
	}
	if(n!=1)
		count++;
	cout<<count;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int N, M, Q;
    
    scanf("%d%d%d", &N, &M, &Q);
    
    int station[505][505];
    
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N; j++){
            station[i][j] = 0;
        }
    }
    
    for(int i = 0; i < M; i++){
        int s,g;
        scanf("%d%d", &s, &g);
        station[s][g]++;
    }
    int nums[505][505];
    
    int count = 0;
    
    for(int j = 1; j <= N; j++){
        count = 0;
        for(int k = j; k <= N; k++){
            count += station[j][k];
            nums[j][k] = count;
        }
    }
    
    for(int i = 0; i < Q; i++){
        int s,g;
        scanf("%d%d", &s, &g);
        int count = 0;
        for(int j = s; j <= g; j++){
            /*
            for(int k = j; k <= g; k++){
                count += station[j][k];
            }*/
            count += nums[j][g];
            
        }
        printf("%d\n", count);
    }
    return 0;
    
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;

    while(scanf("%d %d %d",&a,&b,&c)==3)
    {
        if(b*c>=a)
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }












return 0;
}


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

	int a[100009];
	int c = 0;
	int vis[100009] = {0};
int dfs( int n )
{
	if( vis[n] == 0 ){
	vis[n] = 1;
	if( n == 2 ){
		return c;
	}
	c++;
	return dfs(a[n]);
}
	else
	return -1;
}

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

Measured memory_bytes: 1024
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        Map<Integer, List<Integer>> graph = new HashMap<>();
        for(int i = 0; i < n; i++){
            graph.put(i, new ArrayList<>());
        }
        for(int i = 0; i < m; i++){
            int s = Integer.parseInt(sc.next());
            int t = Integer.parseInt(sc.next());
            graph.get(s).add(t);
            graph.get(t).add(s);
        }
        
        ArrayDeque<Integer> stack = new ArrayDeque<>();
        int[] color = new int[n];
        int c = 0;
        for(int i = 0; i < n; i++){
            if(color[i] == 0){
                color[i] = ++c;
                stack.push(i);
            }
            while(!stack.isEmpty()){
                int s = stack.pop();
                for(Integer t : graph.get(s)){
                    if(color[t] == 0){
                        color[t] = c;
                        stack.push(t);
                    }
                }
            }
        }
        
        int q = Integer.parseInt(sc.next());
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < q; i++){
            int s = Integer.parseInt(sc.next());
            int t = Integer.parseInt(sc.next());
            if(color[s] == color[t]){
                sb.append("yes").append(System.lineSeparator());
            }else{
                sb.append("no").append(System.lineSeparator());
            }
        }
        
        System.out.print(sb);
    }
}


Measured memory_bytes: 90448
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
  unsigned ll x, m = 100;
  scanf("%llud", &x);
  int d = 0;
  while(m < x) {
    m += m / 100;
    d++;
  }
  printf("%d\n", d);
}

Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		long[] s=sc.La;
		long[] h=sc.La;
		long[] dp=new long[s[0]];
		int q=0;
		List<long> li=new List<long>((int)s[0]);
		li.Add(0);
		for(int i = 1;i<s[0];i++) {
			dp[i]=long.MaxValue;
			while(q<li.Count-1&&dp[li[q]]+h[i]*h[i]+h[li[q]]*h[li[q]]-2*h[i]*h[li[q]]>=dp[li[q+1]]+h[i]*h[i]+h[li[q+1]]*h[li[q+1]]-2*h[i]*h[li[q+1]]){q++;}
			dp[i]=dp[li[q]]+(h[li[q]]-h[i])*(h[li[q]]-h[i])+s[1];
			li.Add(i);
			int c=li.Count-1;
			while(c>=2&&1.0*(dp[li[c]]+h[li[c]]*h[li[c]]-dp[li[c-2]]-h[li[c-2]]*h[li[c-2]])/(2*(h[li[c]]-h[li[c-2]]))>1.0*(dp[li[c]]+h[li[c]]*h[li[c]]-dp[li[c-1]]-h[li[c-1]]*h[li[c-1]])/(2*(h[li[c]]-h[li[c-1]]))){
				li.RemoveAt(c-1);
				c--;
			}
		}
		Console.WriteLine(dp[s[0]-1]);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 35812
n,y = map(int,input().split())
flag = True
if(y <= n *10000):
    for i10 in range(n+1):
        for i5 in range(n+1-i10):
            i1 = n-i5-i10
            if(i10*10000+i5*5000+i1*1000==y):
                print(i10,i5,i1)
                flag = False
                break
        else:
            continue
        break
if(flag):
    print(-1,-1,-1)

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

const long long mod = 1e9+7 ;
const long long maxn = 5e3+10 ;
long long a[maxn][maxn] ;

int main(){

    ios::sync_with_stdio(0) ;
    fill(a[0],a[0]+maxn, 1) ;
    for(long long i = 1; i < maxn; i++){
        for(long long j = 1; j < maxn; j++){
            a[j][i] = a[j-1][i-1] + a[j][i-1] ;
            a[j][i] %= mod ;
        }
    }
    long long n, k ;
    cin >> n >> k ;
    for(long long i = 1; i <= k; i++){
        cout << a[i][n-k+1] * a[i-1][k-1] % mod << '\n'  ;

    }

}


Measured memory_bytes: 196352
l,r=map(int,input().split())
m=l//2019
l-=m*2019
r-=m*2019
ans=2018
if r>=2019:exit(print(0))
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min(ans,i*j%2019)
print(ans)

Measured memory_bytes: 3060
from collections import deque
import itertools

h, w = map(int, input().split())
g = [input() for _ in range(h)]


# x,yはスタートの座標
def bfs(x, y):
    # 最初は全て未訪問なので-1で初期化
    d = [[-1] * w for _ in range(h)]
    # スタート地点への距離は0
    d[x][y] = 0
    q = deque([(x, y)])
    while q:
        tx, ty = q.popleft()
        # 右、上、左、下
        for dx, dy in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
            nx, ny = tx + dx, ty + dy
            # グリッドの範囲内で、通路で、未訪問の場合
            if 0 <= nx < h and 0 <= ny < w and g[nx][ny] == '.' and d[nx][ny] < 0:
                d[nx][ny] = d[tx][ty] + 1
                q.append((nx, ny))
    # 最終的なdを平坦化して最大値を返す
    return max(list(itertools.chain.from_iterable(d)))

# 全てのマスについて
max_count = 0
for x in range(h):
    for y in range(w):
        if g[x][y] == ".":
            max_count = max(max_count, bfs(x, y))

print(max_count)


Measured memory_bytes: 9404
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Main me = new Main();
		long a,b,gcd;
		while(in.hasNext()){
			a = in.nextInt();
			b = in.nextInt();
			gcd = me.GCD(a,b);
			System.out.printf("%d %d\n",gcd,a*b/gcd);
			
		}
	}
	private long GCD(long a,long b){
		if(b == 0)
			return a;
		else
			return GCD(b,a%b);
	}
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

typedef struct edge_def {
  int from;
  int to;
  int cost;

  edge_def(int _from, int _to, int _cost) {
    from = _from;
    to   = _to;
    cost = _cost;
  }
} edge;

const int INF = INT_MAX;
const int N = 100000;
const int M = 100000;
int n, m, q;
vector<edge> es[N];
int d[N];

void dijkstra(int s) {
  int i;
  priority_queue<PII, vector<PII>, greater<PII > > q;
  q.push(PII(d[s], s));

  while (q.size()) {
    PII p = q.top();
    q.pop();
    int v = p.second;

    for (i=0; i<(int)es[v].size(); i++) {
      edge e = es[v][i];
      if (d[e.to]==-1) {
        d[e.to] = d[v];
        q.push(PII(d[e.to], e.to));
      }
    }
  }
}

int main() {
  int i;
  for (i=0; i<N; i++) es[i].clear();
  memset(d, 0xff, sizeof(d));

  scanf("%d%d ", &n, &m);
  for (i=0; i<m; i++) {
    int u, v;
    scanf("%d%d ", &u, &v);
    es[u].psb(edge(u, v, 0));
    es[v].psb(edge(v, u, 0));
  }

  int c = 0;
  for (i=0; i<n; i++)
    if (d[i]==-1)  {
      d[i] = c++; 
      dijkstra(i);
    }

  scanf("%d ", &q);
  for (i=0; i<q; i++) {
    int l, r;
    scanf("%d%d ", &l, &r);
    if (d[l]==d[r])
      printf("yes\n");
    else
      printf("no\n");
  }

	return 0;
}

Measured memory_bytes: 8108
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        n = ni();

        int m = ni();

        for (int i = 0; i < n; i++) {
            G.add(new ArrayList<>());
        }

        for (int i = 0; i < m; i++) {
            int a = ni() - 1;
            int b = ni() - 1;

            G.get(a).add(b);
            G.get(b).add(a);
        }

        dfs(0, 1);
        out.println(ans);
    }

    ArrayList<ArrayList<Integer>> G = new ArrayList<>();
    int ans = 0;
    int n;

    void dfs(int x, int state) {
        state |= 1 << x;

        if ((1 << n) - 1 == state) {
            ans++;
            return;
        }

        for (int i = 0; i < n; i++) {
            if (G.get(x).contains(i) && (state & 1 << i) == 0) {
                dfs(i, state | 1 << i);
            }
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF INT_MIN 
#define INF INT_MAX 
#define MP make_pair
#define int ll int

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef map<int,int>MII;
typedef vector<int> VI;
const int MAX = 1e4 + 5;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 
//int root(int x){return x==f[x]?x:f[x]=root(f[x]);}


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    int h;
    cin>>h;int ans=0;int r=1;
    while(h>1)
    {
        h/=2;ans+=r;r*=2;
    }
    ans+=r;
    cout<<ans<<endl;
}


return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a[n],b[n];
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	int c[m],d[m];
	for(int i=0;i<m;i++){
		cin>>c[i]>>d[i];
	}
	int l=1000000000;
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			int ll=abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(ll<l){
				l=ll;
				ans=(j+1);			
			}
		}
		cout<<ans<<endl;
		l=1000000000;
	}
}

Measured memory_bytes: 256
import java.io.*;
class Main {

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

		BufferedReader reader =
			new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		while ((line = reader.readLine()) != null) {
			String[] values = line.split(" ");

			if (values.length != 8) break;

			double x1 = Double.parseDouble(values[0]);
			double y1 = Double.parseDouble(values[1]);
			double x2 = Double.parseDouble(values[2]);
			double y2 = Double.parseDouble(values[3]);
			double x3 = Double.parseDouble(values[4]);
			double y3 = Double.parseDouble(values[5]);
			double xp = Double.parseDouble(values[6]);
			double yp = Double.parseDouble(values[7]);

			double area12 = area(xp, yp, x1, y1, x2, y2);
			double area23 = area(xp, yp, x2, y2, x3, y3);
			double area31 = area(xp, yp, x3, y3, x1, y1);
			double area123 = area(x1, y1, x2, y2, x3, y3);

			String result = area12 + area23 + area31 - area123 < 0.0001 ? "YES" : "NO";
			System.out.println(result);
		}

	}

	static double area(double x1, double y1, double x2, double y2, double x3, double y3) {
		return 0.5 * Math.abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
	}

}

Measured memory_bytes: 9724
#include <bits/stdc++.h>
using namespace std;
 
#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main() {
    int N;
    VI X;
    cin >> N;
    REP(i, N) {
        int tmp;
        cin >> tmp;
        X.PB(tmp);
    }

    int ans = INF;
    REP1(i, 101) {
        int ans2 = 0;
        REP(j, N) {
            ans2 += (X[j] - i) * (X[j] - i);
        }
        ans = min(ans, ans2);
    }

    cout << ans << endl;
}


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

using namespace std;

int main() {
  int a, b, c, d;
  cin>>a>>b>>c>>d;
  if(abs(a-c) <= d ||
     (abs(a-b) <= d && abs(b-c) <= d)) {
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
open Batteries
open Printf
module Mmap = Map.Make(Char)
let () =
  let s = Scanf.scanf "%s " (fun a -> a) in
  let c_l = String.to_list s in

  let mmap = Mmap.empty in
  let mmap = List.fold_left (fun accum x -> Mmap.modify_opt x (fun v_opt -> match v_opt with
        Some v -> Some (v + 1)
      | None -> Some 1
    ) accum) mmap c_l
  in

  let mmap = Mmap.filterv (fun x -> x mod 2 <> 0) mmap in

  Printf.printf "%s\n" @@
  if Mmap.is_empty mmap then "Yes" else "No"
  


Measured memory_bytes: 1152
// By Mohit Gupta
#include <bits/stdc++.h>
using namespace std;
//DEBUG 
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define all(v) (v).begin(), (v).end()
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define pb push_back
#define fi first
#define int long long
#define se second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 1e3+5, MOD = 998244353;
int t,n,m,k,x,y;
 
 
int32_t main()
{
    IOS;
    cin>>x;
    forn(a,LIM){
      forn(b,LIM){
        int a5=pow(a,5);
        int b5=pow(b,5);
        if(a5-b5 == x) {
          cout<<a<<" "<<b<<ln;
          return 0;
        }
        if(a5+b5 == x){
          cout<<a<<" "<<-1*b<<ln;
          return 0;
        }
      }
    }
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll 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);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  (s == u ? a-- : b--);
  cout << a << " " << b << endl;

  return 0;
}

Measured memory_bytes: 256
import sys
import itertools as it
input = sys.stdin.readline


def main():
    N = int(input())
    p = tuple(int(c) for c in input().split())
    q = tuple(int(c) for c in input().split())

    a = -1
    b = -1
    for i, t in enumerate(it.permutations(range(1,N+1)),1):
        if a != -1 and b != -1:
            break
        if t == p: a = i
        if t == q: b = i

    print(abs(a - b))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int MOD = (1e+9) + 7,MAX_N = (2e+5)+10;
vec nCm(MAX_N+1,0);
vec fact(MAX_N+1,0),fact_inv(MAX_N+1,0);

ll fastpow(ll a, ll pw) {
	ll res = 1;
	while (pw) {
		if (pw & 1) res = res * a % MOD;
		a = a * a % MOD;
		pw >>= 1;
	}
	return res;
}
void makefact(ll n){//MODは素数かつnより大きい
    ll ans = 1;
    fact.at(0) = ans;
    fact_inv.at(0) = ans;
    reps(i,1,n+1){
        (ans *= i)%=MOD;
        fact.at(i) = ans;
        fact_inv.at(i) = fastpow(ans,MOD-2);
    }
    return;
}
void makenCm(ll n){
    rep(i,n+1){
        ll ans = fact.at(n);
        (((ans*=fact_inv.at(n-i))%=MOD)*=fact_inv.at(i))%=MOD;
        nCm.at(i) = ans;
    }
    return;
}

int main() {
    cin>>N>>M>>K;
    makefact(N*M-2);
    makenCm(N*M-2);
    ll ans = 0;
    ll M2 = (M*M) % MOD, N2 = (N*N) % MOD;
    reps(d,1,N){
        ll temp = nCm.at(K-2);
        (temp*=N-d)%=MOD;
        (temp*=M2)%=MOD;
        (temp*=d)%=MOD;
        (ans += temp)%=MOD;
    }
    //cout<<ans<<endl;
    reps(d,1,M){
        ll temp = nCm.at(K-2);
        (temp*=M-d)%=MOD;
        (temp*=N2)%=MOD;
        (temp*=d)%=MOD;
        (ans += temp)%=MOD;
    }
   /*rep(i,11){
        cout<<i<<"fact"<<fact.at(i)<<endl;
        cout<<i<<"fact_inv"<<fact_inv.at(i)<<endl;
    }*/
    cout<<ans<<endl;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include<stdlib.h>




typedef struct node{
  double e;
  int kazu;
  int *edges;
} Node;


void insert(Node *list[],int from,int to){
  Node *ntmp = list[from-1];
  
  ntmp->edges[ntmp->kazu]=to;
  ntmp->kazu++;
}

int main(){
  int n,m;
  scanf("%d %d\n",&n,&m);

  //list of nodes
  Node *list[n];
  for(int i=0;i<n;i++){
    list[i] = malloc(sizeof(Node));
    list[i]->kazu = 0;
    list[i]->edges = malloc(sizeof(int)*n);}
  //printf("nm:%d %d\n",m,n);

  //insert nodes
  for(int i=0;i<m;i++){
    int from,to;
    scanf("%d%d",&from,&to);
    //printf("input:%d %d\n",from,to);
    insert(list,from,to);}
  //printf("insert finished\n");


  double min=m;

  //calculate
  list[n-1]->e=0;
  for(int l=0;l<n-1;l++){
    for(int i=n-1;i>0;i--){
      double max=0;
      int j=i-1;
      Node *ntmp=list[j];
      ntmp->e = 0;
      for (int k=0;k<ntmp->kazu;k++){
	double num=list[ntmp->edges[k]-1]->e;
	ntmp->e += num+1;
	if(max < num){
	  max= num;}}
      if(l==j && ntmp->kazu >1){
	ntmp->e = 1.0* (ntmp->e-max-1)/(ntmp->kazu-1);}
      else{
	ntmp->e = 1.0* ntmp->e/ntmp->kazu;}}
    if(min > list[0]->e){
      min=list[0]->e;}}
  //printf("calc finished\n");

       /* 
  //calulate 1
  if(list[0]->kazu > 1){
    double max=0;
    Edge *tmp=list[0]->to;
    list[0]->e=0;
    while(tmp!=NULL){
      list[0]->e += list[tmp->name-1]->e+1;
      if(max < list[tmp->name-1]->e){
	max= list[tmp->name-1]->e;}
      tmp=tmp->next;}
    //printf("%f\n",max);
    list[0]->e = 1.0*(list[0]->e - (max+1))/(list[0]->kazu-1);}
    //printf("calc1 finished\n");*/

  /*
  for(int i=n-1;i>=0;i--){
    printf("%f\n",list[i]->e);}*/
  printf("%f\n",min);

  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){

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

    for(int i=0;i<=N;i++){
        for(int j=0;j<=M;j++){
            int cnt=i*M+j*N;
            cnt-=i*j*2;
            if(cnt==K){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a);i>(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int m; cin >> m;
  cout << 48 - m << endl;
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int a[100005];
inline int read()
{
	char ch=getchar(); int ans=0;
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch<='9'&&ch>='0') ans=ans*10+ch-48,ch=getchar();
	return ans;
}
int main()
{
	int n=read(),mx=0,ansx=1e9+5,ans=0;
	for (int i=1; i<=n; i++) a[i]=read(),mx=max(mx,a[i]);
	for (int i=1; i<=n; i++) 
		if (abs(mx/2-a[i])<ansx&&a[i]!=mx) ansx=abs(mx/2-a[i]),ans=a[i];
	printf("%d %d\n",mx,ans);
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#include <climits>
#include <memory>
#include <numeric>
#include <utility>


#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
#define PI 3.14159265358979323846264338327950L;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
const ll LINF = 1e18;
using namespace std;
using Graph = vector<vector<int>>;



int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int D;
ll G;
vector<ll> P, C;

//aのp乗を求めるアルゴリズム
long modpow(long a, int p) {
	if (p == 0)return 1;
	if (p % 2 == 0) {
		//pが偶数のとき
		int halfP = p / 2;
		long half = modpow(a, halfP);
		return half * half % mod;
	}
	else {
		//pが奇数の時は、
		//pを偶数にするために1減らす
		return a * modpow(a, p - 1) % mod;
	}

}


//(10*9*8)/(3*2*1);
//10*9*8 -> ansMul
//3*2*1 -> ansDiv;
long calcComb(int a, int b) {
	if (b > a - b) return calcComb(a, a - b);
	long ansMul = 1;
	long ansDiv = 1;
	rep(i, 0, b) {
		ansMul *= (a - i);
		ansDiv *= (i + 1);
		ansMul %= mod;
		ansDiv %= mod;
	}
	//ansMul /ansDivをやりたい
	//ansDivの逆元を使って求めよう。

	long ans = ansMul * modpow(ansDiv, mod - 2) % mod;
	return ans;

}


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

	int n, m;
	cin >> n >> m;

	long ans = 1;
	int MNokori = m;
	for (int i = 2; i * i <= MNokori; i++) {
		if (MNokori % i == 0) {
			int cnt = 0;
			while (MNokori % i == 0) {
				cnt++;
				MNokori /= i;
			}
			//cntが2^Xとか3^XのXの部分
			ans *= calcComb(n + cnt - 1, n-1);//n-1はcntと同じ。
			ans %= mod;
		}
	}
	if (MNokori != 1) {
		//最後に素数が残ってる部分を処理する
		ans *= calcComb(n + 1 - 1, n - 1);//N-1はcntと同じ
		ans %= mod;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 234567;
int a[maxn], v[maxn];
int main(){
	int n; cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	vector<int> good;
	for(int i = n; i >= 1; i--){
		int sum = 0;
		for(int j = i + i; j <= n; j += i) sum ^= v[j];
		v[i] = sum ^ a[i];
		if(v[i]) good.push_back(i);
	}
	cout << good.size() << endl;
	for(int v : good) cout << v << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 3064