akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    ll A, B;
    cin >> A >> B;

    ll n = ceil((double)(A + B) / 2);
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 3584
package main

import "fmt"

func main() {
	var n, d, x int
	fmt.Scan(&n, &d, &x)
	m := make(map[int]int, n)
	var tmp int
	for i := 0; i < n; i++ {
		fmt.Scan(&tmp)
		m[i] = 1 + (d-1)/tmp
	}
	sum := 0
	for _, v := range m {
		sum += v
	}
	fmt.Println(x + sum)
}


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

int main() {
    char n;
    int sumOfDigits = 0;

    while ((n = getchar()) != '\n') {
        sumOfDigits += (n - '0');
    }

    if (sumOfDigits % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

class UnionFind {
public:
    vector <int> par; // 各元の親を表す配列
    vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(int sz_): par(sz_), siz(sz_, 1) {
        for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(int sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    int root(int x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(int x, int y) { // 連結判定
        return root(x) == root(y);
    }

    int size(int x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int N, K, L;
    cin >> N >> K >> L;
    UnionFind uf1(N), uf2(N);

    rep(i,K){
      int a, b;
      cin >> a >> b;
      --a; --b;
      uf1.unite(a,b);
    }
    rep(i,L){
      int a, b;
      cin >> a >> b;
      --a; --b;
      uf2.unite(a,b);
    }
    map<pair<int,int>, int> mp;
    rep(i,N){
      mp[{uf1.root(i), uf2.root(i)}]++;
    }
    rep(i,N){
      cout << mp[{uf1.root(i), uf2.root(i)}] << ' ';
    }
}

Measured memory_bytes: 18048
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }






        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var a = Reads();
            var b = new long[n];

            b[(int)Math.Ceiling(n / 2.0)-1] = a[0];
            //Console.WriteLine((int)Math.Ceiling(n / 2.0) - 1);
            var j =1;
            for (int i = 1; i <= n/2.0; i++)
            {
                if ((int)Math.Ceiling(n / 2.0) - 1 + i < n)
                    b[(int)Math.Ceiling(n / 2.0) - 1 + i] = a[j];
                else break;
                j++;
                if ((int)Math.Ceiling(n / 2.0) - 1 - i >= 0)
                    b[(int)Math.Ceiling(n / 2.0) - 1 - i] = a[j];
                else break;
                j++;
            }
            if (n % 2 != 0)
            {
                for (int i = 0; i < b.Length; i++)
                {
                    Console.Write("{0} ", b[i]);
                }
            }
            else
            {
                for (int i = b.Length-1; i >=0; i--)
                {
                    Console.Write("{0} ", b[i]);
                }
            }
            Console.WriteLine();
         
            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 42028
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////

ll bin(ll n, ll i) {
	if (i == 0) { return n % 2; }
	else { return bin(n / 2, i - 1); }
}

int main() {
	
	ll D, G;
	cin >> D >> G;
	ll p[20], c[20];

	repn(i, D) cin >> p[i] >> c[i];

	ll ans = INF;

	rep(x, pow(2, D)) {
		ll comp[20];
		repn(i, D) comp[i] = bin(x, i - 1);

		ll solve = 0;
		ll score = 0;

		repn(i, D) {
			if (comp[i] == 1) {
				solve += p[i];
				score += 100 * i*p[i] + c[i];
			}
		}

		score = min(score, G);

		for (ll i = D; i > 0; i--) {
			if (comp[i] == 0) {
				if (G - score > 100 * i*p[i]) {
					solve += p[i];
					score += 100 * i*p[i];
				}
				else { solve += (G - score + 100 * i - 1) / (100 * i); break; }
			}
		}

		ans = min(ans, solve);

	}

	cout << ans;
	
	system("PAUSE");
}

Measured memory_bytes: 504
#include <iostream>
using namespace std;
int main(void)
{
  int a,b,c;
  int d;
  cin >> a >> b >> c;
  
  d = a - b;
  if (c > d)
    c = c-d;
  else
    c = 0;
  
  cout << c;
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define M 6700417
#define NIL 0
#define L 14

int getChar(char ch) 
{
	if (ch == 'A') return 1;
	else if (ch == 'C') return 2;
	else if (ch == 'G') return 3;
	else if (ch == 'T') return 4;
	else return 0;
}

long getKey(char str[])
{
	long sum = 0, p = 1;
	for (int i = 0; i < (int)strlen(str); i++) {
		sum += p * (getChar(str[i]));
		p *= 5;
	}
	return sum;
}

int h1(long key) 
{
	return (key % M);
}

int h2(long key) 
{
	return (1 + (key % (M - 1)));
}

int h(long key, int i)
{
	return ((h1(key) + i * h2(key)) % M);
}

int insert(int t[], long key)
{
	int i = 0;
	while (true) {
		int j = h(key, i);
		if (t[j] == NIL) {
			t[j] = key;
			return j;
		}
		else
		{
			i++;
		}
	}
}

int search(int t[], long key)
{
	int i = 0;
	while (true) {
		int j = h(key, i);
		if (t[j] == key) {
			return j;
		}
		else if ((t[j] == NIL) || (i >= M))
		{
			return NIL;
		}
		else
		{
			i++;
		}
	}
}

int main()
{
	int n = 0;
	int h[M] = { 0 };

	cin >> n;

	char com[16], str[16];
	for (int i = 0; i < n; i++) {
		scanf("%s %s", com, str);
		if (com[0] == 'i') {
			if (insert(h, getKey(str)) == NIL) {
				cout << "failInsert" << endl;
			}
		}
		else
		{
			if (search(h, getKey(str)) != NIL) {
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 29420
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	if (n >= 30)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 

#define int long long
#define mod 1000000007
#define pb push_back
#define S second
#define F first
#define INF 1e18
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n" \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define w(x) \
  int x;     \
  cin >> x;  \
  while (x--)

int32_t main() {

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n),b(n);

  for(int &i: a)
    cin >> i;

  for(int &i: b)
    cin >> i;

  reverse(b.begin(),b.end());
  int equal = -1;
  vector<int> pos;
  for(int i = 0; i < n; ++i)
    if(a[i] == b[i])
      pos.pb(i);

  if(!pos.empty()) {
    for(int i = 0; i < n && !pos.empty(); ++i) {
      if(a[i] != b[i] && a[i] != b[pos.back()] && a[pos.back()] != b[i]) {
        swap(b[i],b[pos.back()]);
        pos.pop_back();
      }
    }
    if(!pos.empty()) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  for(int i: b)
    cout << i << " ";
  return 0;
}


Measured memory_bytes: 8348
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

lr = []
for i in range(n):
    l = max(xl[i][0] - xl[i][1], 0)
    r = max(xl[i][0] + xl[i][1], 0)
    lr.append([l, r])

lr.sort(key=lambda x: x[1])
keep = [False] * n


cur = 0
for i in range(n):
    if cur <= lr[i][0]:
        keep[i] = True
        cur = lr[i][1]

ans = sum(keep)
print(ans)


Measured memory_bytes: 42584
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*/
#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
    vector <string> v;
    stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x);
    return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
    cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
    err(++it, args...);
}
 
int ini(){int x; scanf("%d",&x);return x;}
long long inl(){ long long x;scanf("%lld",&x); return x;}
double ind(){double x; scanf("%lf",&x);return x;}
#define Iin ini();
#define Lin inl();
#define Din ind();

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N];

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int t=1,te=0;
  //  cin>>t;
    while(t--){
      string s;
      cin>>s;

      if(s[2]==s[3] and s[4]==s[5]){
        printf("Yes\n");
      }
      else{
        printf("No\n");
      }

        //printf("Case %d: ",++te);
    }
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <list>
#include <string>
#include <map>
#include <numeric>
#include<unordered_map>
#include<queue>
#include <set>
#include<unordered_set>
#include <bitset>
#include <cmath>
#include <functional>
using namespace std;
int main() {
	ifstream fin("input.txt");
	long long h, w, i = 0;
	string s;
	char c;
	cin >> h >> w;
	vector<vector<char>>vec(h + 2, vector<char>(w + 2));
	for (int i = 0; i < h + 2; i++)
		vec[i][0] = '@';
	for (int j = 0; j < w + 2; j++)
		vec[h + 1][j] = '@';
	for (int i = 0; i < h + 2; i++)
		vec[i][w + 1] = '@';
	
	for (int i = 0; i < w + 2; i++)
		vec[0][i] = '@';
	for (int i = 1; i < h + 1; i++)
	{

		for (int j = 1; j < w + 1; j++)
		{
			cin >> c;
			vec[i][j] = c;
		}
	}
	for (int i = 1; i < h + 1; i++)
	{

		for (int j = 1; j < w + 1; j++)
		{
			int sum = 0;
			if (vec[i][j] == '#')
				continue;
			if (vec[i - 1][j] == '#') sum++;
			if (vec[i - 1][j + 1] == '#') sum++;
			if (vec[i - 1][j - 1] == '#') sum++;
			if (vec[i][j - 1] == '#') sum++;
			if (vec[i][j + 1] == '#') sum++;
			if (vec[i + 1][j - 1] == '#') sum++;
			if (vec[i + 1][j] == '#') sum++;
			if (vec[i + 1][j + 1] == '#') sum++;
			vec[i][j] = '0'+sum;
		}
	
	}
	for (int i = 1; i < h + 1; i++)
	{

		for (int j = 1; j < w + 1; j++)
		{
			cout << vec[i][j];
		}
		cout << endl;
	}

	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int N;cin>>N;
    vector<int>V0(N/2);
    vector<int>V1(N/2);
    for(int i=0;i<N;i++){
        if(i%2==0){cin>>V0[i/2];}
        else cin>>V1[i/2];
    }
    sort(V0.begin(),V0.end());
    sort(V1.begin(),V1.end());
    V0.push_back(-1);
    V1.push_back(-1);
    int count=0;
    vector<pair<int,int>>count0;
    for(int i=0;i<N/2;i++){
        count++;
        if(V0[i]!=V0[i+1]){
            count0.push_back(make_pair(count,V0[i]));
            count=0;
        }
    }
    vector<pair<int,int>>count1;
    for(int i=0;i<N/2;i++){
        count++;
        if(V1[i]!=V1[i+1]){
            count1.push_back(make_pair(count,V1[i]));
            count=0;
        }
    }
    sort(count0.begin(),count0.end(),greater<pair<int,int>>());count0.push_back(make_pair(0,0));
    sort(count1.begin(),count1.end(),greater<pair<int,int>>());count1.push_back(make_pair(0,0));
    if(count0[0].second!=count1[0].second)cout<<N-count0[0].first-count1[0].first<<endl;
    else cout<<min(N-count0[0].first-count1[1].first,N-count0[1].first-count1[0].first)<<endl;
}

Measured memory_bytes: 1780
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

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

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

func main() {
	N, K := nextInt(), nextInt()
	An := make([]int, N)
	visitPlace := make([]int, N+1)
	firstPlace := map[int]int{}
	repeatPlace := 0
	for i := 0; i < N; i++ {
		An[i] = nextInt()
	}
	visitPlace[0] = 1
	for i := 1; i < N+1; i++ {
		visitPlace[i] = An[visitPlace[i-1]-1]
		if _, exist := firstPlace[visitPlace[i]]; exist {
			repeatPlace = i
			break
		} else {
			firstPlace[visitPlace[i]] = i
		}
	}
	first := firstPlace[visitPlace[repeatPlace]]
	if K <= first {
		// fmt.Println(K, visitPlace[K])
		fmt.Println(visitPlace[K])
	} else {
		K -= first - 1
		// fmt.Println(K)
		K %= repeatPlace - first
		// fmt.Println(K)
		repeatTowns := visitPlace[first:repeatPlace]
		index := K - 1
		if index < 0 {
			index = len(repeatTowns) - 1
		}
		// fmt.Println(K, repeatTowns[index], repeatTowns)
		fmt.Println(repeatTowns[index])
	}
	// fmt.Println(K, An, visitPlace, repeatPlace, firstPlace, first)
}

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

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


Measured memory_bytes: 18228
#include <iostream>
#include <string>
using namespace std;
void print(string& s) {
    int a, b;
    cin >> a >> b;
    cout << s.substr(a, b-a+1) << endl;
}
void reverse(string& s) {
    int a, b;
    cin >> a >> b;
    string r;
    for(int i = b; i >= a; --i) {
        r.push_back(s[i]);
    }
    s.replace(a, b-a+1, r);
}
void replace(string& s) {
    int a, b; string p;
    cin >> a >> b >> p;
    s.replace(a, b-a+1, p);
}
int main() {
    int q; string str, query;
    cin >> str >> q;
    for(int i = 0; i < q; ++i) {
        cin >> query;
        if(query == "print") print(str);
        else if(query == "reverse") reverse(str);
        else if(query == "replace") replace(str);
    }
    return 0;
}


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

int main() {
	string s,t;
    cin >> s;
    cin >> t;
    string r = "Yes";
    int ssize = s.size();
    int tsize = t.size();
    for(int i=0;i<ssize;i++){
   		if(s.at(i)!=t.at(i)){
          r = "No";
        }
    }
    if(ssize+1 != tsize){
      r = "No";
    }
    cout << r << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll MOD=1e9+7 ;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//-------------------

string s;
int w;
int main(){
    cin >> s >> w;
    FOR(i,0,(s.size()-1)/w){
        cout << s[w*i];
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");

        //コード
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);

    	int K = sc.nextInt();

    	long LCM = lcm(K,360);

    	System.out.println(LCM/K);

    }

    static long lcm (int a, int b) {
    	int temp;
    	long c = a;
    	c *= b;
    	while((temp = a%b)!=0) {
    		a = b;
    		b = temp;
    	}
    	return (int)(c/b);
    }
}

Measured memory_bytes: 27036
i,w;main(c){
  for(;(c=getchar())>10;)w=c==32?0:w*10+c-48;
  for(;i++<w+2;)putchar_unlocked('#');
  putchar_unlocked(10);
  putchar_unlocked('#');
  for(;~(i=getchar_unlocked());){
    if(i==10)putchar_unlocked('#');
    putchar_unlocked(i);
    if(i==10)putchar_unlocked('#');
  }
  for(;i++<w;)putchar_unlocked('#');
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    vector<double> ans;

    while(1){
        int n;
        cin >> n;
        if(n == 0) break;

        vector<int> stu(n);
        int total = 0;
        loop(i, n){
            cin >> stu[i];
            total += stu[i];
        }

        double ave = (double)total/n;

        double dev = 0.0;
        loop(i, n) dev += (stu[i] - ave)*(stu[i] - ave);
        dev = sqrt(dev/n);
        ans.push_back(dev);
    }
    cout << fixed << setprecision(14);
    loop(i, ans.size()) cout << ans[i] << endl;

    return 0;
}



Measured memory_bytes: 3252
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=a[0]
y=a[1]
b.sort()
i=0
k=0
while i ==0:
	t=b[0]
	if y>=t:
		k=k+1
		y=y-t
		del b[0]
	else:
		i=1
	if x==k:
		i=1
if y>0 and x==k:
	k=k-1
print(k)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>

#define inf 1001001001
using namespace std;
int n, c;
size_t s, t, dp[1001][1001];
string a, b;
int main() {
	cin >> a >> b;
	s = a.length(), t = b.length();
	for (size_t i = 1; i <= s; ++i) dp[i][0] = i;
	for (size_t i = 1; i <= t; ++i) dp[0][i] = i;
	for (size_t i = 0; i < s; ++i) {
		for (size_t j = 0; j < t; ++j) {
			if (a[i]==b[j]) c = 0; else c = 1;
			dp[i+1][j+1] = min(dp[i][j+1]+1, dp[i+1][j]+1);
			dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+c);
		}
	}
	printf("%ld\n", dp[s][t]);
}

Measured memory_bytes: 11072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - 754
            string s = Console.ReadLine();
            int min = 753;

            for(int i = 0; i < s.Length - 2; i++)
            {
                int x = int.Parse(s.Substring(i, 3));
                int diff = Math.Abs(753 - x);

                if (diff < min)
                {
                    min = diff;
                }
            }

            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 11092
#pragma target("avx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n,ans=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    if((10<=i and i<100) or (1000<=i and i<10000) or i==100000){
      continue;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  double A,B,H,M;
  double T=0;
  scanf("%lf %lf %lf %lf",&A,&B,&H,&M);
  T=M/30.0*M_PI-(H*60+M)/360.0*M_PI;
  printf("%.10lf\n",sqrt(A*A+B*B-2.0*A*B*cos(T)));
  return 0;
}

Measured memory_bytes: 2660
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

int main() {
  int n; cin >> n;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  int res = 0;
  for (int i = 1; i < n; ++i) if (a[i-1] == a[i]) {
    ++res;
    ++i;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
template<class T> inline bool chmax(T&a , T b){ if(a<b){ a=b; return true; } else{ return false; } }
template<class T> inline bool chmin(T&a , T b){ if(a>b){ a=b; return true; } else{ return false; } } 

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

Measured memory_bytes: 3596
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int minx = 1000000;
    for (int i = 0; i < s.size() - 2; i++) {
        int num = stoi(s.substr(i, 3));
        minx = min(minx, abs(753 - num));
    }
    cout << minx << endl;

    return 0;
}

Measured memory_bytes: 256
let (n,k) = Scanf.sscanf (read_line ()) "%d %d" (fun w h -> (w, h))
;;

let table = Array.make (n+4) 0
;;

let rec get_input () =
  let (a, b) = Scanf.sscanf (read_line ()) "%d %d" (fun a b -> (a,b)) in
  table.(a+1) <- b;
  get_input ()
;;

try get_input ()
with End_of_file -> ()
;;

let is_valid x b m1 p1 p2 =
  if x = m1 then
    not b && x <> p1
  else
    not (x = p1 && x = p2)
;;

let memo = Hashtbl.create 10000
;;

let rec ans index b m1 p1 p2 k' =
  let key = (index, b, m1, p1, p2) in
  let f x = Hashtbl.add memo key x; x in
  if Hashtbl.mem memo key then
    Hashtbl.find memo key
  else
    if table.(index) <> 0 then
      ans (index+1) (m1 = table.(index)) table.(index) p2 table.(index+3) k'
    else if k' = n - k - 1 then
      let aux x =
        if is_valid x b m1 p1 p2 then
          1
        else
          0
      in
      f (aux 1 + aux 2 + aux 3)
    else
      if b then
        if p1 = m1 then
          f (2 * ans (index+2) false p1 table.(index+3) table.(index+4) (k'+1) mod 10000)
        else if p1 <> 0 && p1 = p2 then
          f (ans (index+3) true p2 table.(index+4) table.(index+5) (k'+1))
        else if p1 <> 0 && p2 <> 0 then
          f (2 * ans (index+3) false p2 table.(index+4) table.(index+5) (k'+1) mod 10000)
        else
          let x1 = m1 mod 3 + 1 in
          let aux x = ans (index+1) false x p2 table.(index+3) (k'+1) in
          f ((aux x1 + aux (x1 mod 3 + 1)) mod 10000)
      else
        if m1 = p1 && m1 <> 0 then
          f (2 * ans (index+2) false p1 table.(index+3) table.(index+4) (k'+1) mod 10000)
        else if p1 <> 0 && p1 = p2 then
          f (2 * ans (index+3) true p1 table.(index+4) table.(index+5) (k'+1) mod 10000)
        else if p1 <> 0 && p2 <> 0 then
          f (3 * ans (index+3) false p2 table.(index+4) table.(index+5) (k'+1) mod 10000)
        else
          let aux x = ans (index+1) (x = m1) x p2 table.(index+3) (k'+1) in
          f (((aux 1 + aux 2) mod 10000 + aux 3) mod 10000)
;;

ans 2 false table.(1) table.(3) table.(4) 0 |> string_of_int |> print_string
;;
print_string "\n";;



Measured memory_bytes: 2716
package main

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

const (
	initialBufSize = 64 * 1024
	maxBufSize     = 10000000
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
)

func main() {
	defer writer.Flush()

	scanner.Split(bufio.ScanWords)
	n := scanInt()
	count := make(map[string]int, n)
	for i := 0; i < n; i++ {
		count[scanText()]++
	}

	var ans []string
	most := 0

	for k, v := range count {
		if v >= most {
			if v > most {
				ans = make([]string, 0, n)
			}
			ans = append(ans, k)
			most = v
		}
	}
	sort.Strings(ans)
	for i := 0; i < len(ans); i++ {
		fmt.Println(ans[i])
	}
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

func min(n []int) (min, idx int) {
	min = math.MaxInt64
	for i := 0; i < len(n); i++ {
		if n[i] < min {
			min = n[i]
			idx = i
		}
	}
	return
}

func max(n []int) (max, idx int) {
	max = math.MinInt64
	for i := 0; i < len(n); i++ {
		if n[i] > max {
			max = n[i]
			idx = i
		}
	}
	return
}


Measured memory_bytes: 20608
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
ll add(ll x,ll y)
{
return (x%hell+y%hell)%hell;
}
ll mul(ll x,ll y)
{
return ((x%hell)*(y%hell))%hell;
}
ll sub(ll x,ll y)
{
return (x-y+hell)%hell;
}
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
   //cin>>t;
    for(int ok=1;ok<=t;ok++)
    {
        
      ll n,k;
      cin>>n>>k;
      k++;
      ll a[n+1];
      for(ll i=1;i<=n;i++)
      	cin>>a[i];
      std::vector<ll> v;
      v.pb(1);
      ll x=1;
      for(int i=2;i<=n;i++)
      {
      	   v.pb(a[x]);
           x=a[x];
      }
      map<ll,ll>lol;
      std::vector<ll> c,d;
      ll p=-1,q=-1;
      for(int i=0;i<n;i++)
      {
      	  if(lol.count(v[i]))
      	  {
              p=lol[v[i]];
              q=i-1;
              break;
      	  }
      	  else
      	  {
      	  	  lol[v[i]]=i;
      	  }
      }
      for(int i=0;i<p;i++)
      	c.pb(v[i]);
      for(int i=p;i<=q;i++)
      	d.pb(v[i]);
      ll ol=c.size();
      if(k<=ol)
      {
      	cout<<c[k-1];
      	return 0;
      }
      ll okk=k-ol;
      okk=(okk)%d.size();
      okk=(okk-1+d.size())%d.size();
      cout<<d[okk];

    }
    return 0;
}

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

public class AtCoder
{
  public static void Main()
  {
    var n = int.Parse(Console.ReadLine().Trim());

    var w = n;
    var h = 2;

    var map = new List<int[]>(n);

    for(var i = 0; i < h; i++)
    {
      var input = Console.ReadLine().Trim().Split().Select(e => int.Parse(e)).ToArray();
      map.Add(input);
    }

    var ans = 0;

    for(var i = 0; i < w; i++)
    { 
      var sum = map[0].Take(i+1).Sum();
      sum += map[1].Skip(i).Sum();

      if(sum > ans) ans = sum;
    }

    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13524
//0614 C問題
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {

  int x, n, l, r, i=0, j=0, cl, cr;

  scanf("%d%d", &x, &n);
  if ((x<1)||(100<x)||(n<0)||(100<n)) {
    return -1;
  }
  if (n==0) {
    printf("\n%d\n", x);
    return 0;
  }
  int p[n];

  while (i<n) {
    if (scanf("%d", &p[i])==0) {
      printf("%d\n", x);
      return 0;
    }
    if ((p[i]<1)||(100<p[i])) {
      return -1;
    }
    i++;
  }

  while (1) {
    cl = 0;
    cr = 0;
    l = x-j;
    r = x+j;
    for (i = 0; i < n; i++) {
      if (l==p[i]) {
        cl += 1;
      }
      if (r==p[i]) {
        cr += 1;
      }
    }
    if (cl==0) {
      printf("%d\n", l);
      return 0;
    }
    if (cr==0) {
      printf("%d\n", r);
      return 0;
    }
    j++;
  }

  return 0;
}


Measured memory_bytes: 1708
n,m=map(int,input().split())

oddflag=True
for i in range(1,m+1):
	mid=(1+n)//2
	if oddflag:
		oddflag = False
		print(i//2 + 1 , n - i//2)
	else:
		oddflag = True
		print(mid + i//2, mid - i//2)


Measured memory_bytes: 9248
target = 'ACGT'
S = input()

answer = 0
for start in range(len(S)):
    if S[start] not in target:
        continue
    count = 0
    for end in range(start, len(S)):
        if S[end] not in target:
            break
        count += 1
    
    answer = max(answer, count)

print(answer)

Measured memory_bytes: 9116
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        final int A = Integer.parseInt(sc.next());
        final int B = Integer.parseInt(sc.next());
        final int C = Integer.parseInt(sc.next());
        final int X = Integer.parseInt(sc.next());
        int ans = 0;
        
        for (int i = 0; i <= A; i++)
            for (int j = 0; j <= B; j++)
                for (int k = 0; k <= C; k++)
                    if (500 * i + 100 * j + 50 * k == X) ++ans;
        
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 23764
import sys
from collections import deque

def func(t, MAX, dic, num, coin):
  ans = dic.get(num, -1)
  a,b,c,d = t
  
  if ans != -1:
    return ans
  
  ans = sys.maxsize

  if num == 0:
    dic[0] = 0
    MAX = min(coin,MAX)
    return 0

  if num == 1:
    dic[1] = d
    MAX = min(coin + d, MAX)
    return d

  if coin >= MAX:
    return sys.maxsize

  
  if num % 2 == 0:
    a = min((((num) * d) //2), a)
    ans = min(func(t, MAX, dic, num//2, coin+a)+a, ans)
  else:
    tmp_a = a
    a = min((((num+1) * d) //2), a)
    ans = min(func(t, MAX, dic, (num+1)//2, coin+a+d)+a+d, ans)
    
    a = min((((num-1) * d) //2), tmp_a)
    ans = min(func(t, MAX, dic, (num-1)//2, coin+a+d)+a+d, ans)

  if num % 3 == 0:
    b = min(((num)*2*d)//3, b)
    ans = min(func(t, MAX, dic, num//3, coin+b)+b, ans)
  elif num % 3 == 1:
    b = min(((num-1)*2*d)//3, b)
    ans = min(func(t, MAX, dic, (num-1)//3, coin+b+d)+b+d, ans)
  else:
    b = min(((num+1)*2*d)//3, b)
    ans = min(func(t, MAX, dic, (num+1)//3, coin+b+d)+b+d, ans)

  if num % 5 == 0:
    c = min(((num)*4*d)//5, c)
    ans = min(func(t, MAX, dic, num//5, coin+c)+c, ans)
  elif num % 5 <= 2:
    tmp = num % 5
    c = min(((num-tmp)*4*d)//5, c)
    ans = min(func(t, MAX, dic, (num-tmp)//5, coin+c+d*tmp)+c+d*tmp, ans)
  else:
    tmp = 5 - (num % 5)
    c = min(((num+tmp)*4*d)//5, c)
    ans = min(func(t, MAX, dic, (num+tmp)//5, coin+c+d*tmp)+c+d*tmp, ans)
    
  dic[num] = ans
  MAX = min(coin+ans, MAX)
  return ans

def main():
  t = int(input())

  e = []
  f = []
  g = []
  h = []
  j = []

  for i in range(t):
    n,a,b,c,d = map(int,input().split())
    e.append(n)
    f.append(a)
    g.append(b)
    h.append(c)
    j.append(d)

  for i in range(t):
    n = e[i]
    a = f[i]
    b = g[i]
    c = h[i]
    d = j[i]
    
    t = (a,b,c,d)
    

    print(func(t, sys.maxsize, {}, n, 0))
    
main()

Measured memory_bytes: 89344
#include <bits/stdc++.h>
#define MAXN 105
#define LL long long
using namespace std;

int N,W;
LL w[MAXN], x[MAXN];
LL v[4][MAXN], s[MAXN];
int n0,n1,n2,n3;
LL dp[MAXN][MAXN][MAXN];

int main(){
//	freopen("01.in", "r", stdin);
//	freopen("01.ans", "w", stdout);
	
	scanf("%d%d", &N, &W);
	
	LL m0 = 1e9;
	for(int i=1;i<=N;i++){
		scanf("%lld%lld", &w[i], &x[i]);
		m0 = min(m0, w[i]);
	}
	
	for(int i=1;i<=N;i++){
		if(w[i]==m0) v[0][++n0] = x[i];
		if(w[i]==m0+1) v[1][++n1] = x[i];
		if(w[i]==m0+2) v[2][++n2] = x[i];
		if(w[i]==m0+3) v[3][++n3] = x[i];
	}

	sort(v[0]+1, v[0]+1+n0, greater<int>());
	sort(v[1]+1, v[1]+1+n1, greater<int>());
	sort(v[2]+1, v[2]+1+n2, greater<int>());
	sort(v[3]+1, v[3]+1+n3, greater<int>());
	
	for(int i=1;i<=n3;i++){
		s[i] = s[i-1] + v[3][i];
	}
	
	LL ans = 0;
	for(int i=0;i<=n0;i++){
		for(int j=0;j<=n1;j++){
			for(int k=0;k<=n2;k++){
				if(i*m0 + j*(m0+1) + k*(m0+2) > W) continue;
				if(i) dp[i][j][k] = max(dp[i][j][k], dp[i-1][j][k] + v[0][i]);
				if(j) dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k] + v[1][j]);
				if(k) dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1] + v[2][k]);
				
				ans = max(ans, dp[i][j][k] + s[(W - i*m0 - j*(m0+1) - k*(m0+2))/(m0+3)]);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int INF = 100100100;

char s[20][20];

int bfs(int H, int W, int sx, int sy) {
    vector<vector<int>> d(20, vector<int>(20, INF));
    if(s[sx][sy] == '#') return 0;
    int dst = 0;
    queue<P> que; // 探索可能座標を持つキュー
    que.push(P(sx, sy)); // 始点を push する
    d[sx][sy] = 0;
    // キューが空になるまでループ
    while(!que.empty()) {
        P p = que.front(); que.pop();
        int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
        for(int i = 0; i < 4; ++i) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if(0 <= nx && nx < H && 0 <= ny && ny < W && s[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
                dst = d[nx][ny];
            }
        }
    }
    return dst;
}

int main() {
    int h, w;
    cin >> h >> w;
    rep(i,h)rep(j,w) cin >> s[i][j];
    int ans = 0;
    rep(i,h)rep(j,w) ans = max(ans, bfs(h, w, i, j));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N;
vector<ll> A(200010, 0);
vector<ll> v(200010, 0);

int main(void){
	
	scanf("%d", &N);
    for(int i = 0; i < N; ++i) scanf("%lld", &A[i]);
    
    ll sum = 0;
    for(int i = 0; i < N; ++i) sum += A[i], v[i] = sum;
    
    ll ans = LLONG_MAX;
    for(int i = 0; i < N - 1; ++i){
        ll x = v[i], y = v[N - 1] - v[i];
        ans = min(ans, abs(x - y));
    }
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=1000100;
const int mod=924844033;
const int g[2]={5,554906420};
int n,lim=1,pos[N],cnt[N],siz[N],f[N],r[N],T[N];
vector<int>V[N];
int qpw(int x,int n){
	int ret=1; for(;n;n>>=1,x=1ll*x*x%mod)
	if(n&1) ret=1ll*ret*x%mod; return ret;
}
void ini(int x){
	int l=0; while(lim<x) lim<<=1,++l;
	for(int i=0;i<lim;i++) pos[i]=pos[i>>1]>>1|(i&1)<<l-1;
}
void ntt(int A[],int op){
	for(int i=0;i<lim;i++) if(i<pos[i]) swap(A[i],A[pos[i]]);
	for(int d=1;d<lim;d<<=1) for(int l=d<<1,wn=qpw(g[op],(mod-1)/l),i=0;i<lim;i+=l)
		for(int j=0,w=1;j<d;j++,w=1ll*w*wn%mod){
			int a=A[i+j],b=1ll*w*A[i+j+d]%mod;
			A[i+j]=(a+b)%mod,A[i+j+d]=(a-b)%mod;
		}
	if(op) for(int i=0,k=qpw(lim,mod-2);i<lim;i++) A[i]=1ll*A[i]*k%mod;
}
void dfs(int x,int f){
	siz[x]=1;
	for(int i=0;i<V[x].size();i++){
		int t=V[x][i]; if(t==f) continue; dfs(t,x);
		++cnt[siz[t]], ++cnt[n-siz[t]], siz[x]+=siz[t];
	}
}
int C(int n,int m){return 1ll*f[n]*r[n-m]%mod*r[m]%mod;}
int main(){
	scanf("%d",&n),f[0]=1;
	for(int i=1;i<=n;i++) f[i]=1ll*f[i-1]*i%mod;
	r[n]=qpw(f[n],mod-2); for(int i=n;i>=1;i--) r[i-1]=1ll*r[i]*i%mod;
	for(int i=1,x,y;i<n;i++)scanf("%d%d",&x,&y),V[x].pb(y),V[y].pb(x);
	dfs(1,0); for(int i=0;i<=n;i++) cnt[i]=1ll*cnt[i]*f[i]%mod, T[i]=r[i]; reverse(cnt,cnt+n+1);
	ini(n<<1), ntt(cnt,0), ntt(T,0); for(int i=0;i<lim;i++) cnt[i]=1ll*cnt[i]*T[i]%mod; ntt(cnt,1);
	for(int i=1;i<=n;i++) printf("%lld\n",(mod+(1ll*n*C(n,i)-1ll*r[i]*cnt[n-i])%mod)%mod);
}


Measured memory_bytes: 55076
fun main(arg: Array<String>) {
    val INF = 1000000007
    val (N, M) = listOfInt()
    val G = Array(N) { IntArray(N) { INF } }
    val E = Array(N) { IntArray(N) }
    repeat(N) { n -> G[n][n] = 0 }
    repeat(M) {
        val (a, b, c) = listOfInt(-1, -1, 0)
        G[a][b] = c; G[b][a] = c
        E[a][b] = c; E[b][a] = c
    }
    for (k in 0 until N)
    for (n in 0 until N)
    for (m in 0 until N)
        G[n][m] = Math.min(G[n][m], G[n][k] + G[k][m])
    val A = Array(N) { BooleanArray(N) }
    for (s in 0 until N)
    for (t in 0 until N)
    for (n in 0 until N)
    for (m in 0 until N) {
        if (s == t || n == m) continue
        if (G[s][t] == G[s][n] + E[n][m] + G[m][t]) A[n][m] = true
    }
    var ans = 0
    for (n in 0 until N)
    for (m in 0 until N)
        if (!A[n][m] && E[n][m] != 0) ans += 1
    println(ans / 2)
}

fun next() = readLine()!!
fun nextInt(offset: Int = 0) = Integer.parseInt(next()) + offset
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }
fun listOfLong() = listOfString().map(String::toLong)
fun tripleIntIntLong() = listOfLong().let { Triple(it[0].toInt(), it[1].toInt(), it[2]) }
fun listOfInt(vararg offset: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + offset[index % offset.size] }


Measured memory_bytes: 40984
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] L = new int[M];
		int[] R = new int[M];
		for( int i=0; i<M; i++ ){
			L[i] = sc.nextInt();
			R[i] = sc.nextInt();
		}
		Arrays.sort(L);
		Arrays.sort(R);
		int ans = 0;
		if( R[0]-L[M-1]>=0 ){
			ans = R[0]-L[M-1]+1;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 65032
fun main(args : Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    val nums = mutableMapOf<Int, Long>()

    repeat(n.toInt()) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        nums[a] = (nums[a] ?: 0L) + b
    }

    var cnt = 0L
    nums.entries.sortedBy { it.key }.forEach {
        cnt += it.value
        if (cnt >= k) {
            println(it.key)
            return
        }
    }
}

Measured memory_bytes: 70748
struct Read<R: std::io::BufRead> {
    stdin: R,
    v: Vec<String>,
    i: usize,
}
impl<R:std::io::BufRead> Read<R> {
    pub fn new(stdin: R) -> Self {
        Read{
            stdin: stdin,
            v: Vec::new(),
            i: 0,
        }
    }
    pub fn read_until<T: std::str::FromStr>(&mut self) -> T {
        if self.i == self.v.len() {self.read_line();}
        let elem = &self.v[self.i];
        self.i += 1;
        elem.parse().unwrap_or_else(|_| panic!())
    }
    pub fn read_line(&mut self) {
        self.i = 0; self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        let mut ws = buf.split_whitespace();
        loop {
            let x = ws.next();
            if x.is_none() {break;}
            let x = x.unwrap().to_owned();
            self.v.push(x);
        }
    }
    #[allow(dead_code)]
    pub fn read_i32(&mut self) -> i32 {
        if self.i == self.v.len() {self.read_line();}
        let elem = self.v[self.i].parse().unwrap();
        self.i += 1;
        elem
    }
    #[allow(dead_code)]
    pub fn read_string(&mut self) -> String {
        if self.i == self.v.len() {self.read_line();}
        let elem = &self.v[self.i];
        self.i += 1;
        elem.to_owned()
    }
}
fn main() {
    use std::io;
    let stdin = io::stdin();
    let stdin = io::BufReader::new(stdin.lock());
    let read = Read::new(stdin);
    solve(read);
}

fn solve<R: std::io::BufRead>(mut r: Read<R>) {
    let h:u64 = r.read_until();
    let w:u64 = r.read_until();
    let s = h * w;
    if h!=1 && w!=1 {
        println!("{}",if s%2 == 1 {
            s/2+1
        }else{
            s/2
        });
    } else {
        println!("1");
    }
}

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

int main() {
  int N;
  cin >> N;
  double sum = 0;
  double A; 
  
  for (int i = 0; i < N; i++) {
  cin >> A;
  sum += 1/A;
  }

cout << 1/sum << endl;
  
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a%2 == 0 or b%2 == 0 or c%2 == 0:
    print(0)
else:
    x = max(a,b,c)
    y = min(a,b,c)
    z = a+b+c -(x+y)
    print(y*z)

Measured memory_bytes: 8844
// to Utils -> L47
// to Rlyeh -> L78
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <map>
#include <numeric>
#define class struct
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define elif else if
#define echo std::cout <<
#define read std::cin >>
#define fin << '\n'
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define alles(obj) obj.begin(), obj.end()
#define bash push_back
#define makePair std::make_pair
// type-define
#define String std::string
#define Stack std::stack
#define Queue std::queue
#define pQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
typedef long long llong;
typedef bool boolean;
typedef Pair<int,int> Pii;
typedef Vector<int> Vi;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

class hori {

    static llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) {
                ans = ( ans * x ) % mod;
            }
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }

    static llong power ( llong x, llong n ) {
        return power( x, n, 1000000007 );
    }

    static llong gcd ( llong x, llong y ) {
        return x % y ? gcd( y, x % y ) : y;
    }

    static llong lcm ( llong x, llong y ) {
        return ( x / gcd(x, y) * y );
    }

    static boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
};

namespace Rlyeh {

    llong h[100100];

    signed call_of_Cthulhu( signed datum ) {

        int n, k;
        read n >> k;
        for ( int i = 0; i < n; i++ ) {
            read h[i];
        }

        bogo_sort(h, h+n);

        llong min = LINF;
        for ( int i = k-1; i < n; i++ ) {
            min = std::min ( min, h[i] - h[i-k+1] );
        }

        echo min fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>

int main(void) {
    char str[101][101], temp[101];
    int N, L, i;
    scanf("%d %d ", &N, &L);
    
    for (L = 0; L < N; L++)
        scanf("%s", str[L]);
    for (L = 0; L < N-1; L++) {
        for (i = 0; i < N - 1; i++) {
            if (strcmp(str[i], str[i + 1]) > 0) {
                strcpy(temp, str[i]);
                strcpy(str[i], str[i + 1]);
                strcpy(str[i + 1], temp);
            }
        }
        
    }
    for (i = 0; i < N; i++)
        printf("%s", str[i]);
    return 0;
}

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

int main(){

        int a, b, d, r;
        double f;

        cin >> a >> b;

        d = a / b;
        r = a % b;
        f = (double)a / (double)b;

        cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;

        return 0;

}



Measured memory_bytes: 3180