akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;


void solve(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    int k;
    cin >> k;
    sort(a, a + 3);
    cout << a[0] + a[1] + a[2] * pow(2, k );
}

int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}
// vse dolzhny vyiti v internet po hhtp


Measured memory_bytes: 512
import math
n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
p1, p2, p3, pn = 0, 0, 0, 0
for i in range(n):
    p1 += abs(x[i]-y[i])
    p2 += (x[i]-y[i])**2
    p3 += abs(x[i]-y[i]) ** 3
    if abs(x[i]-y[i]) > pn:
        pn = abs(x[i]-y[i])
p2 = math.sqrt(p2)
p3 = math.pow(p3, 1/3)
print(p1, p2, p3, pn, sep='\n')


Measured memory_bytes: 5724
/*
ID: zhaowei10
TASK:
LANG: C++14
*/
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
#include <debug.h>
#else
#define debug(...) 0
#endif

#define eb emplace_back

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vc = vector<char>;
using vb = vector<bool>;
using vll = vector<ll>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(9);

#ifdef LOCAL
  freopen("test.in", "r", stdin);
  freopen("test.out", "w", stdout);
#else
#endif

  int a, b;
  cin >> a >> b;
  cout << a * b;
}


Measured memory_bytes: 3664
s = raw_input()
N = len(s)

def calc_score(hands):
    score = 0
    for i in range(N):
        if s[i] == 'g' and hands[i] == 'p':
            score += 1
        elif s[i] == 'p' and hands[i] == 'g':
            score -= 1
    return score

hands = 'gp' * (N/2) + 'g' * (N%2)
score = calc_score(hands)
print score


Measured memory_bytes: 5892
//package  com.company;


import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        StringBuilder ans=new StringBuilder();
        long n=sc.nextLong();
        while(n>0){
            n--;
            ans.append((char) ((n % 26) + 'a'));
            n/=26;
        }
        System.out.println(ans.reverse().toString());

    }
}

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


static class P
{
    static void Main()
    {
        Console.WriteLine(Console.ReadLine().Distinct().Count() == 3 ? "Yes" : "No");
    }
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    ll K;
    cin >> N >> K;
    vector<vector<vector<ll>>> dp(61, vector<vector<ll>>(N, vector<ll>(N)));
    int mod = 1e9 + 7;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> dp[0][i][j];
        }
    }

    for(int b = 0; b < 60; b++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                ll sum = 0;
                for (int k = 0; k < N; k++) {
                    sum += dp[b][i][k] * dp[b][k][j];
                    sum %= mod;
                }
                dp[b + 1][i][j] = sum;
            }
        }
    }
    vector<vector<ll>> dp2(61, vector<ll>(N));

    int first = 1;
    for(int b = 0; b < 60; b++) {
        if ((K >> b & 1) && first) {
            first = 0;
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    dp2[b + 1][j] += dp[b][i][j];
                    dp2[b + 1][j] %= mod;
                }
            }
        } else if (K >> b & 1) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    dp2[b + 1][j] += dp2[b][i] * dp[b][i][j];
                    dp2[b + 1][j] %= mod;
                }
            }
        } else {
            for (int i = 0; i < N; i++) {
                dp2[b + 1][i] = dp2[b][i];
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ans += dp2[60][i];
        ans %= mod;
    }
    cout << ans << endl;
    

}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);++i)
#define chmax(x,y) x=max(x,y)
const ll INF = 1e18;
ll dp[200001][3]; // [N][skip]

int main() {
  int N; cin>>N;
  vector<int> A(N);
  rep(i, N) cin>>A[i];

  rep(i, N+1) dp[i][0] = dp[i][1] =  dp[i][2] =-INF;
  dp[0][0] = 0;

  rep(i, N){
		rep(k, N%2+1+1){
			chmax(dp[i+1][k], dp[i][k] + ((i+k)%2? 0:A[i]));
			if(k >= 2) break;
			chmax(dp[i+1][k+1], dp[i][k]);
		}
  }

  cout << dp[N][N%2+1] << endl;

	// // print =====================
	// puts("---");//
	// rep(i,N)cout<<A[i]<<" ";//
	// puts("");//
	// puts("===");//
	// cout<<"i: ";
	// rep(i,N+1) printf("%5d ",i);//
	// puts("");//
	// rep(j,N%2+1+1){
	// 	cout<<j<<": ";
	// 	rep(i,N+1){
	// 		if(dp[i][j] == -INF) cout<<"----- ";
	// 		else printf("%5lld ",dp[i][j]);
	// 	}
	// 	puts("");
	// }
	// puts("===");//
	// rep(i,N+1){
	// 	cout<<i<<": ";
	// 	rep(j,N%2+1+1){
	// 		if(dp[i][j] == -INF) cout<<"----- ";
	// 		else printf("%5lld ",dp[i][j]);
	// 	}
	// 	puts("");
	// }
	// // ===========================

}


Measured memory_bytes: 8800
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public struct Pair<T> { public T x, y; public Pair(T x, T y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        List<Tuple<int, int>> ab = Enumerable.Range(0, N).Select(v => new Tuple<int, int>(NextInt(), NextInt())).OrderBy(x => x.Item1).ThenBy(x => x.Item2).ToList();
        List<Tuple<int, int>> cd = Enumerable.Range(0, N).Select(v => new Tuple<int, int>(NextInt(), NextInt())).OrderBy(x => x.Item1).ThenBy(x => x.Item2).ToList();
        //xを満たすものでyが大きいの使っていくとうまあじなきがする
        int ans = 0;
        bool[] done = Enumerable.Repeat(false, N).ToArray();
        for (int i = 0; i < N; i++)
        {
            int p = -1;
            int y = -1;
            for (int j = 0; j < N; j++)
                if (!done[j] && ab[j].Item1 < cd[i].Item1 && ab[j].Item2 < cd[i].Item2)
                    if (ab[j].Item2 > y) { y = ab[j].Item2; p = j; }
            if (p != -1)
            {
                done[p] = true;
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


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

#define endl "\n"
#define int long long

const int MOD = 1e9 + 7;
const int INF = 2e15;

void debug(vector <int> &dp, int l, int r) {
	for (int i = 1; i <= r; i++) {
		if (dp[i] == INF) cout << "inf ";
		else cout << dp[i] << " ";
	}
	cout << endl;
}

signed main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n, k;
	cin >> n;
	k = 2;

	vector <int> heights(n + 1, 0);
	for (int i = 1; i <= n; i++) cin >> heights[i];

	vector <int> dp(n + 1, INF);
	dp[0] = 0;
	dp[1] = 0;

	for (int i = 2; i <= n; i++) {
		for (int j = max(i - k, 1LL); j < i; j++) {
			dp[i] = min(dp[i], dp[j] + abs(heights[i] - heights[j]));
		}
	}

	//debug(dp, 0, n);
	cout << dp[n] << endl;
}

Measured memory_bytes: 4756
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
		 string s,t;
		 cin>>s>>t;
		 ll m = INT_MAX;
		 ll d=s.length()-t.length();
		 for(ll i=0;i<=d;i++){
		 	ll c=0;
		 	for(ll j=i;j<i+t.length();j++){
		 		if(s[j]==t[j-i]){
		 			c++;
				}
		    }
		    if(t.length()-c<m){
		    	m = t.length()-c;
			}
		 }
		 cout<<m<<endl;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

typedef long long ll;

/* global variables */

ll as[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) cin >> as[i];
  sort(as, as + n, greater<ll>());

  ll maxsum0 = 0, maxsum1 = 0;
  ll sumi, sumj;
  int i;
  
  for (i = 0; i < n - 5; i++)
    if (as[i] < as[i + 1] + as[i + 2]) {
      sumi = as[i] + as[i + 1] + as[i + 2];
      //printf("%d:%lld+%lld+%lld=%lld\n",i,as[i],as[i+1],as[i+2],sumi);
      break;
    }

  for (int j = i + 3; j < n - 2; j++)
    if (as[j] < as[j + 1] + as[j + 2]) {
      sumj = as[j] + as[j + 1] + as[j + 2];
      maxsum0 = sumi + sumj;
      //printf("%d:%lld+%lld+%lld=%lld\n",j,as[j],as[j+1],as[j+2],sumj);
      break;
    }

  ll sum = as[0] + as[1] + as[2] + as[3] + as[4];
  for (i = 0; i < n - 5; i++) {
    sum += as[i + 5];
    if ((as[i] < as[i + 1] + as[i + 2] && as[i + 3] < as[i + 4] + as[i + 5]) ||
	(as[i] < as[i + 1] + as[i + 3] && as[i + 2] < as[i + 4] + as[i + 5]) ||
	(as[i] < as[i + 1] + as[i + 4] && as[i + 2] < as[i + 3] + as[i + 5]) ||
	(as[i] < as[i + 1] + as[i + 5] && as[i + 2] < as[i + 3] + as[i + 4]) ||
	(as[i] < as[i + 2] + as[i + 3] && as[i + 1] < as[i + 4] + as[i + 5]) ||
	(as[i] < as[i + 2] + as[i + 4] && as[i + 1] < as[i + 3] + as[i + 5]) ||
	(as[i] < as[i + 2] + as[i + 5] && as[i + 1] < as[i + 3] + as[i + 4]) ||
	(as[i] < as[i + 3] + as[i + 4] && as[i + 1] < as[i + 2] + as[i + 5]) ||
	(as[i] < as[i + 3] + as[i + 5] && as[i + 1] < as[i + 2] + as[i + 4]) ||
	(as[i] < as[i + 4] + as[i + 5] && as[i + 1] < as[i + 2] + as[i + 3])) {
      maxsum1 = sum;
      break;
    }
    sum -= as[i];
  }
  
  cout << max(maxsum0, maxsum1) << endl;
  
  return 0;
}

Measured memory_bytes: 1964
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Numerics;
using System.IO;
using System.Runtime.InteropServices;
using static System.Math;
using static io;
public class CompetitiveProgramming
{
  public void Solve()
  {
    var o = Ints;
    var n = o[0];
    var q = o[1];
    var nt = new string[n][];
    var qq = new Queue<Tuple<string, int, int>>();
    for (int i = 0; i < n; ++i)
    {
      nt[i] = Strs;
      qq.Enqueue(new Tuple<string, int, int>(nt[i][0], int.Parse(nt[i][1]), i));
    }
    int time = 0;
    while (qq.Any())
    {
      var x = qq.Dequeue();
      if (x.Item2 > q)
      {
        qq.Enqueue(new Tuple<string, int, int>(x.Item1, x.Item2 - q, x.Item3));
        time += q;
      }

      else
      {
        time += x.Item2;
        Write(nt[x.Item3][0] + " " + time);
      }
    }

  }
}



class Program
{
  static void Main(string[] args)
  {
    var CompetitiveProgramming = new CompetitiveProgramming();
    CompetitiveProgramming.Solve();
  }
}
public static class io
{
  public static string Str => Console.ReadLine();
  public static string[] Strs => Str.Split(' ');
  public static long[] Longs => Strs.Select(long.Parse).ToArray();
  public static int[] Ints => Strs.Select(int.Parse).ToArray();
  public static char[] Chars => Str.ToArray();
  public static double[] Doubles => Strs.Select(double.Parse).ToArray();
  public static long Long1 => Longs[0];
  public static int Int1 => Ints[0];
  public static char Char1 => Chars[0];
  public static double Double1 => Doubles[0];
  public static long[] VerticalRead(int N) { long[] A = new long[N]; for (int i = 0; i < N; ++i) A[i] = Long1; return A; }
  public static void Write(string a) => Console.WriteLine(a);
  public static void Write(params object[] i) => Write(string.Join(" ", i));
  public static void Write<T>(IEnumerable<T> a) => Write(string.Join(" ", a));
  public static void Verticalwrite<T>(IEnumerable<T> a) { foreach (var z in a) Write(z); }
  public static void YN(bool i) { if (i) Write("Yes"); else Write("No"); }
}



Measured memory_bytes: 29744
#include <iostream>
#include <vector>
#include <algorithm>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;

ll level_all[100];
ll level_pat[100];

ll calc(ll level, ll under) {
	//cout << level << "," << under << "," << endl;
	if(level==0) {
		return (under>=1)?1:0;
	}
	ll all_layer = level_all[level];
	ll half_layer = (all_layer-1)/2;
	ll ans = 0;
	if(under>=half_layer) {
		ans += (level_pat[level]-1)/2;
		under -= half_layer;
		//cout << " " << under << "," << half_layer << endl;
		if(under>0) {
			ans++;
			under--;
		}
		if(under>0) {
			ans += calc(level-1,under);
		}
	}else {
		ans = calc(level-1,under-1);
	}
	//cout << level << "," << under << "," << ans << endl;
	return ans;
}

int main() {
	ll n,x;
	cin >> n >> x;
	level_all[0] = 1;
	level_pat[0] = 1;
	for(ll i = 1; i <= 50; i++) {
		level_all[i] = level_all[i-1]*2+3;
		level_pat[i] = level_pat[i-1]*2+1;
	}

	ll ans = calc(n,x);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 100000
#define Name 10

struct process{
	char n[Name];
	int p;
};

int tail,head,n,t,total=0;
struct process S[N],f[N];

void init(){
	tail = head = 0;
}

void enque(struct process x){
	S[tail] = x;
	++tail;
	tail = tail % N;
}

struct process deque(){
	struct process x;
	x = S[head];
	head++;
	head = head % N;
	return x;
}

int isEmpty(){
	if(tail == head) return 1;
	return 0;
}

int calc(){
	struct process l;
	int count=0;
	l = deque();

	while(count != n){
		if(l.p - t > 0) {
			l.p -= t;
			enque(l);
			total += t;
		}
		else {
			strcpy(f[count].n,l.n);
			total += l.p;
			f[count++].p = total;
		}
		l = deque();
	}
	return 1;

}

int main(){
	scanf("%d%d",&n,&t);
	int i;
	struct process s[N];
	for(i=0;i<n;i++){
		scanf("%s",s[i].n);
		scanf("%d",&s[i].p);
		enque(s[i]);
	}
	calc();
	for(i=0;i<n;i++){
		printf("%s %d\n",f[i].n,f[i].p);
	}
	return 0;
}

Measured memory_bytes: 5704
import sys


class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x


N = int(input())
Px = []
Py = []
for k, s in enumerate(sys.stdin.readlines()):
    x, y = map(int, s.split())
    Px.append((x, k))
    Py.append((y, k))

edge = []

Px.sort()
Py.sort()
for i in range(N - 1):
    x0, k0 = Px[i]
    x1, k1 = Px[i + 1]
    d = abs(x0 - x1)
    edge.append((d, k0, k1))

    y0, k0 = Py[i]
    y1, k1 = Py[i + 1]
    d = abs(y0 - y1)
    edge.append((d, k0, k1))

edge.sort()
uf = UnionFind(N)
cnt = 0
for d, k0, k1 in edge:
    if uf.find(k0) != uf.find(k1):
        uf.union(k0, k1)
        cnt += d
    
    if uf.parents[uf.find(0)] == -N:
        break

print(cnt)


Measured memory_bytes: 144464
#!/usr/bin/env python3 ## -*- python -*-

t = input().split()
a = int(t[0])
b = int(t[1])
c = int(t[2])

ans = "No"
z = c-a-b
if z > 0 and 4 * a * b < z*z:
    ans = "Yes"
print(ans)

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

int main(){
	int n;
	cin >> n;
	
	vector<string> v;
	
	bool yes = true;
	
	for(int i = 0; i < n; i++){
		string tmp;
		cin >> tmp;
		bool flag = true;
		for(int j = 0; j < (int)v.size(); j++){
			//被り
			if(v[j] == tmp) flag = false;
			//しりとりでない
			int v_size = v.size() - 1;
			int last = v[v_size].size() - 1;
			if(v[v_size][last] != tmp[0]) flag = false;
		}
		
		if(flag)v.push_back(tmp);
		else yes = false;
	}
	
	if(yes) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

int main(){
  int x;
  cin >> x;
  
  if(x >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 3632
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::str::FromStr;

// stone-monument.rs --- Stone Monument
// author: Seong Yong-ju <sei40kr@gmail.com>

#[allow(unused_macros)]
macro_rules! get {
  ($t:ty) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.trim().parse::<$t>().unwrap()
    }
  };
  ($($t:ty),*) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      let mut iter = line.split_whitespace();
      (
        $(iter.next().unwrap().parse::<$t>().unwrap(),)*
      )
    }
  };
  ($t:ty; $n:expr) => {
    (0..$n).map(|_|
                get!($t)
    ).collect::<Vec<_>>()
  };
  ($($t:ty),*; $n:expr) => {
    (0..$n).map(|_|
                get!($($t),*)
    ).collect::<Vec<_>>()
  };
  ($t:ty ;;) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.split_whitespace()
        .map(|t| t.parse::<$t>().unwrap())
        .collect::<Vec<_>>()
    }
  };
  ($t:ty ;; $n:expr) => {
    (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
  };
}

#[allow(unused_macros)]
macro_rules! debug {
  ($($a:expr),*) => {
    println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
  }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("Failed to parse token")
}

#[allow(dead_code)]
fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer);
}

fn main() {
    let (a, b) = get!(u32, u32);
    assert!(1 <= a);
    assert!(a < b);
    assert!(b < 499500);
    // Assume that they're (n-1)th and n-th trees
    let n = b - a;
    let ans = (1 + n) * n / 2 - b;

    with_bufwriter(|mut out| writeln!(out, "{}", ans).unwrap());
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

bool isPrime(ll n){
    if(n == 2)return true;
    if(n == 1 || n == 0)return false;
    ll sq = sqrt(n) + 1;
    ll tmp = n; 
    for(int i = 2; i <= sq; i++){
        sq = sqrt(tmp) + 1;
        while(tmp%i == 0)tmp/=i;
    }
    if(tmp == n)return  true;
    return false;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i*i <= n; ++i){
    if(n%i == 0){ 
      if(isPrime(i))ret.push_back(i);
      if(i*i != n && isPrime(n/i))ret.push_back(n/i);
    }
  }
  sort(ALL(ret));
  return (ret);
}
int main(){
    ll a, b;
    cin >> a >> b;
    if(a > b)swap(a, b);
    vector<ll> p = divisor(a);
    ll ans = 1;

    rep(i, p.size())if(b%p[i]==0)ans++;
    cout << ans;

}

Measured memory_bytes: 256
import math
import itertools
a=[]
ans=0
n=int(input())
m=1
for i in range(1,n+1):
  m*=i
for i in range(n):
    x,y=map(int,input().split())
    a.append([x,y])
for t in itertools.permutations(range(n),n):
  for i in range(n-1):
    ans+=math.sqrt((a[t[i]][0]-a[t[i+1]][0])**2+(a[t[i]][1]-a[t[i+1]][1])**2)
ans=ans/m
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

ll n;

int main() {
    scanf("%lld",&n);
    ll x=n/11*2;
    ll rem=n%11;
    if (rem>6) x+=2;
    else if (rem>0) x++;
    printf("%lld\n",x);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100001],dp[100001][3],b[100001],c[100001];
int main(){
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i]>>b[i]>>c[i];
 dp[1][0]=a[1];
 dp[1][1]=b[1];
 dp[1][2]=c[1];
 for(int i=2;i<=n;i++){
dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
dp[i][2]=max(dp[i-1][1]+c[i],dp[i-1][0]+c[i]);
 }
cout<<max(max(dp[n][0],dp[n][1]),dp[n][2]);
return 0;
}


Measured memory_bytes: 2560
N = int(input())
A = [int(i) for i in input().split()]
B = [0]+A[:]+[0]
s = 0
for i in range(N+1):
    s += abs(B[i]-B[i+1])

for i in range(N):
    if B[i] < B[i+1] and B[i+1] <B[i+2]:
        print(s)
    else:
        t = abs(B[i+1]-B[i])+abs(B[i+2]-B[i+1])-abs(B[i+2]-B[i])
        print(s-t)

Measured memory_bytes: 14172
#include <bits/stdc++.h>
using namespace std;
inline int read()
{
    int x=0;char ch=getchar();
    while(ch>'9'||ch<'0')ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-'0',ch=getchar();
    return x;
}
int n,a[200010],t;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();	
	}	
	sort(a+1,a+n+1,greater<int>());
	for(;a[t]>=t;t++);
	t--;
	if((a[t]-t)%2==0)
	{
		int j=0;
		for(;a[t+j]>=t;j++);
		if(j%2)
		{
			cout<<"Second"<<endl;
			return 0;
		}
	}
	cout<<"First"<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

int main()
{
    int A, B;
    std::cin >> A >> B;

    if (A <= 5) {
        B = 0;
    }
    else if (A >= 6 && A <= 12) {
        B /= 2;
    }

    std::cout << B << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
try (Scanner sc = new Scanner(System.in)) {
String line = sc.nextLine();
String answer = "";
int length = line.length();
for (int i = 0; i < length; i++) {
char ch = line.charAt(i);
if(Character.isUpperCase(ch)==true){
	answer+=Character.toLowerCase(ch);
}
else if(Character.isLowerCase(ch)==true){
	answer+=Character.toUpperCase(ch);
}
else answer+=ch;
}
System.out.println(answer);
}
}
}


Measured memory_bytes: 31208
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
using namespace std;
typedef long long ll;
#define N  100005
//week_10_A
//我看网上代码看了很久也没反应过来，然后战略性放弃
//别想了，我就是代码的搬运工（我终于搞懂这道题这么写了）
//这道题大概是这样的, 记f为这个string中有的好串个数
//则f(c+X+c+Y) = 2*f(X+Y) + 1
//f(c+X+Y+c) = f(X+Y) + 1;
deque<int> L, R;
int num;
void sove_A( ll n)
{
    if(!n) return;
    //n是奇数时
    else if(n & 1)
    {
        sove_A(n>>1);
        L.push_front(++num);
        R.push_front(num);
    }
    else
    {
        sove_A(n-1);
        L.push_front(++num);
        R.push_back(num);
    }
}
void week_10_A()
{
    ll n;
    cin >> n;
    sove_A(n);
    cout << L.size()+R.size() << endl;
    cout << L.front();
    L.pop_front();
    while(!L.empty())
    {
        cout << ' ' << L.front();
        L.pop_front();
    }
    while(!R.empty())
    {
        cout << ' ' << R.front();
        R.pop_front();
    }
}
int main(int argc, const char * argv[])
{
    ios::sync_with_stdio();
    cin.tie(0);
    week_10_A();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//????????????
void lntrim(char *str) {  
  char *p;  
  p = strchr(str, '\n');  
  if(p != NULL) {  
    *p = '\0';  
  }  
}  
int main(void) {
	char words[102]={};
	char ring[204]={};
	//????????°??????????????\???
	fgets(words, sizeof(words), stdin);	
	lntrim(words);
	//????????????2????????????
	strcpy(ring,words);
	strcat(ring,words);
	
	char search[101]={};
	//????´¢??????????????\???
	fgets(search, sizeof(search), stdin);
	lntrim(search);
	//????´¢
	printf(strstr(ring,search)!=NULL ? "Yes\n" : "No\n");
	
	return 0;
}

Measured memory_bytes: 528
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

ll A[3],ans;

int main(void){
    rep(i,3)cin >> A[i];
    sort(A,A+3);
    ans +=A[2]-A[1];
    A[0] +=A[2]-A[1];
    if((A[2]-A[0])%2)ans +=(A[2]-A[0])/2 + 2;
    else ans +=(A[2]-A[0])/2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    // 入力
    ll N,K;
    cin >> N >> K;
    ll out = 0;
    cout << N*K << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, k;
    cin >> n >> k;
    int d[k];
    rep(i, k) cin >> d[i];

    for (int i = n;; i++)
    {
        bool isok = true;
        string s = to_string(i);
        rep(j, s.size())
        {
            rep(a, k)
            {
                if (s[j] - '0' == d[a])
                {
                    isok = false;
                    goto loopend;
                }
            }
        }
    loopend:
        if (isok)
        {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ld long double
#define pa pair<int,int>
#define pii pair<ll,ll>
#define st first
#define nd second
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

int main()
{
  BOOST;
 string s;
 cin>>s;
 for (int i=0;i<s.length();i++)
 {
   cout<<'x';
 }
  return 0;
}


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

long long p[200001],b[200001],mx;
int n,k;

int main(){
	cin>>n>>k;
	for (int i=0;i<n;i++) cin>>p[i];
	for (int i=0;i<n;i++) b[i+1]=b[i]+p[i];
	for (int i=0;i<n-k+1;i++)
		mx=max(mx,b[i+k]-b[i]);
	printf("%.12lf\n",(mx+k)/2.0);
	//cout<<(mx+k)/2.0<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  using StA = tuple<string, ll, ll>;
  vector<StA> v;
  for (ll i = 1; i <= N; i++) {
    string s;
    ll p;
    cin >> s >> p;
    v.emplace_back(s, -p, i);
  }
  sort(v.begin(), v.end());
  for (auto [s, p, i] : v) {
    cout << i << "\n";
  }

  return 0;
}



Measured memory_bytes: 3668
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    int sn = 0;
    int i = 1;
    cin >> n;
    while(n/i != 0){
        sn += n/i - n/i/10*10;
        i *= 10;
    }
    if(n%sn == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
  int W,H,x,y,r;
  cin >> W >> H >> x >> y >> r;

  if(x-r>=0 && y-r>=0 && x+r<=W && y+r<=H){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3104
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <complex>
#define ld long double
#define cp complex<ld>
#define ll long long
#define N 200005
#define P 200003
using std::complex;
int n, ln[N], g=2;
cp f[N<<2];
ll tot, ans, a[N<<2];
namespace FFFT{
	int rev[N<<2], lim;
	cp wn[N<<2], inv[N<<2];
	ld Pi;
	inline int proc(int n)
	{
		while(n) ++lim, n>>=1;
		++lim;
		n=1<<lim;
		Pi=acos(-1.0);
		for(int i=0; i<=n; ++i) rev[i]=(rev[i>>1]>>1|((i&1)<<(lim-1)));
		for(int i=0; i<=n; ++i) wn[i]=cp(cos(2*Pi*i/n), sin(2*Pi*i/n)), inv[i]=conj(wn[i]);
		return n;
	}
	inline void FFT(cp *f, int n, int mod)
	{
		for(int i=0; i<n; ++i) if(i<rev[i]) std::swap(f[i], f[rev[i]]);
		for(int l=2; l<=n; l<<=1)
		{
			int mid=l>>1;
			for(int j=0; j<n; j+=l) for(int k=j, c=0; c<mid; ++k, ++c)
			{
				cp x=f[k]+f[k+mid]*(mod?wn[n/l*c]:inv[n/l*c]), y=f[k]-f[k+mid]*(mod?wn[n/l*c]:inv[n/l*c]);
				f[k]=x, f[k+mid]=y;
			}
		}
	}
}
using namespace FFFT;
int main()
{
	scanf("%d", &n);
	for(int i=1, x; i<=n; ++i) scanf("%d", &x), ++a[x], ans-=1ll*x*x%P;
	a[0]=0;
	for(int i=0, c=1; i<=P; ++i, c=1ll*c*g%P) ln[c]=i;
	for(int i=0; i<P; ++i) f[ln[i]]=cp(a[i], 0);
	int l=proc(P);
	FFT(f, l, 0);
	for(int i=0; i<l; ++i) f[i]*=f[i];
	FFT(f, l, 1);
	for(int i=0; i<P; ++i) a[i]=0;
	for(int i=0; i<l; ++i) a[i]+=(ll)(f[i].real()/l+0.5);
	for(int i=0, c=1; i<l; ++i, c=1ll*c*g%P) ans+=1ll*c*a[i];
	printf("%lld\n", ans/2);
	return 0;
}

Measured memory_bytes: 59600
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n;
	int b, r, v, f;
	int a[4][3][10] = {0};

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		a[b - 1][f - 1][r - 1] += v;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				cout << " " << a[i][j][k];
			}
			cout << endl;
		}
		if (i != 3) cout << "####################" << endl;
	}

	return (0);
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

vector<int> E[110000];
int cnt[110000] = {};
vector<int> c4;
int p1, p2;

int func(int pos, int pre){
	if(pos == p2){
		return 1;
	}
	if(pos == p1 && pre != -1){
		return 0;
	}
	int ret = 0;
	for(int i = 0; i < E[pos].size(); i++){
		if(E[pos][i] != pre){
			ret += func(E[pos][i], pos);
		}
	}
	return ret;
}

int main(){
	int N, M;
	cin >> N >> M;
	for(int i = 0; i < M; i++){
		int a, b;
		cin >> a >> b;
		cnt[a] += 1;
		cnt[b] += 1;
		E[b].push_back(a);
		E[a].push_back(b);
	}
	bool flag = false;
	for(int i = 1; i <= N; i++){
		if(cnt[i] % 2){
			cout << "No" << endl;
			return 0;
		}
		if(cnt[i] >= 6){
			flag = true;
		}
		if(cnt[i] == 4){
			c4.push_back(i);
		}
	}
	if(flag || c4.size() >= 3){
		cout << "Yes" << endl;
		return 0;
	}
	if(c4.size() <= 1){
		cout << "No" << endl;
		return 0;
	}
	p1 = c4[0];
	p2 = c4[1];
	if(func(p1, -1) == 2){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int mod=998244353;
int a[1000010];
int main()
{
	int n;
	cin >>n;
	int sum=0;
	int a=0,b=0;
	int cot=0;
	while(n--)
	{
		string s;
		cin >>s;
		int len=s.size();
		if(s[0]=='B'&&s[len-1]=='A') cot++;
		else
		{
			if(s[0]=='B') b++;
			else if(s[len-1]=='A') a++;
		}
		
		for(int i=1;i<len;i++)
		{
			if(s[i]=='B'&&s[i-1]=='A') sum++;
		}
	} 
	if(cot>0)
	{
		if(b==0) sum+=cot-1,b++;
		else sum+=cot;
	 } 
	sum+=min (a,b);
	cout <<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int GCD(long long a ,long long b){
  if (b==0) return a;
  else return GCD (b,a%b);
}

int main(){
  long int K,A,B,F,G;
  cin >> K >> A >> B;
  F = B % K;
  G = B-F;
  if (G >= A)
    cout << "OK" <<endl;
  else
    cout << "NG" <<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

const double INF = 1e20, EPS = 1e-8;

double W, H, w, h, x, y;
double lx, hx, ly, hy;

// x = vx (y1 <= y <= y2)の部分とy = axが交わるか
bool intersect_x(double a, double vx, double y1, double y2, double &px, double &py) {
  double vy = a * vx;
  if (!(y1 - EPS < vy && vy < y2 + EPS)) return false;
  px = vx;
  py = vy;
  return true;
}

// y = vy (x1 <= x <= x2)の部分とy = axが交わるか
bool intersect_y(double a, double vy, double x1, double x2, double &px, double &py) {
  if (abs(a) < EPS) return false;
  double vx = vy / a;
  if (!(EPS + x1 < vx && vx < x2 + EPS)) return false;
  px = vx;
  py = vy;
  return true;
}

bool ok(double a) {
  double x[4], y[4], b[4];
  b[0] = intersect_x(a, lx, ly, hy, x[0], y[0]);
  b[1] = intersect_y(a, hy, lx, hx, x[1], y[1]);
  b[2] = intersect_x(a, hx, ly, hy, x[2], y[2]);
  b[3] = intersect_y(a, ly, lx, hx, x[3], y[3]);

  ll cnt = 0;
  REP(i, 0, 4) if (b[i]) cnt++;

  double s;
  if (cnt == 3 || cnt == 4) {
    return true;
  } else if (b[0] && b[1]) {
    s = (hy - y[0]) * (x[1] - lx) / 2;
  } else if (b[1] && b[2]) {
    s = (hx - x[1]) * (hy - y[2]) / 2;
  } else if (b[2] && b[3]) {
    s = (hx - lx) * (hy - ly) - (y[2] - ly) * (hx - x[3]) / 2;
  } else if (b[3] && b[0]) {
    s = (hx - lx) * (hy - ly) - (x[3] - lx) * (y[0] - ly) / 2;
  } else if (b[0] && b[2]) {
    s = ((hy - y[0]) + (hy - y[2])) * (hx - lx) / 2;
  } else if (b[1] && b[3]) {
    s = ((x[1] - lx) + (x[3] - lx)) * (hy - ly) / 2;
  } else {
    return ly > a * lx;
  }

  return s > (hx - lx) * (hy - ly) / 2 - EPS;
}

int main(void) {
  cin >> W >> H >> w >> h >> x >> y;

  lx = max(-W / 2, x - w / 2);
  hx = min(+W / 2, x + w / 2);
  ly = max(-H / 2, y - h / 2);
  hy = min(+H / 2, y + h / 2);

  double l = -INF, h = INF;
  REP(i, 0, 250) {
    double m = (l + h) / 2;
    if (ok(m)) l = m;
    else h = m;
  }
  printf("%.15lf\n", h);
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> x(m, vector<int>());
    int y;
    REP(i, n) {
        cin >> y; 
        x[y % m].push_back(y);
    }

    int c = 0;
    // mod m == 0
    c += x[0].size() / 2;
    // mod m == just m/2
    if (m % 2 == 0) {
        c += x[m / 2].size() / 2;
    }

    FOR(i, 1, m / 2 + 1) {
        if (m % 2 == 0 && i == m / 2) {
            continue;
        }
        if (x[i].size() == x[m - i].size()) {
            c += x[i].size();
            continue;
        }
        vector<int> large;
        vector<int> small;
        if (x[i].size() < x[m - i].size()) {
            large = x[m - i];
            small = x[i];
        } else {
            small = x[m - i];
            large = x[i];
        }
        c += small.size();
        sort(ALL(large));
        int d = 0;
        int l = (large.size() - small.size()) / 2;
        int prev = -1;
        for (const int z : large) {
            if (prev == z) {
                d++;
                prev = -1;
            } else {
                prev = z;
            }
            if (l == d) {
                break;
            }
        }
        c += d;
    }

    cout << c << endl;
}


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

const int N = 1e6 + 1;

int n;
int a[N];
map<int, bool> used;

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    int x = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (used[a[i]] == true) x = 1;
        used[a[i]] = true;
    }
    if (x == 1) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}

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

#define N 100001
#define ALPHA_N 10

using namespace std;

double solve(double *expect){
  double possible[ALPHA_N];
  double npossible[ALPHA_N];

  expect[0] = 0;
  expect[1] = 1;
  expect[2] = 1.5;

  possible[0]=1;
  for(int i = 1; i < ALPHA_N; ++i){
    double pos = 1.0/((double)(1<<i));
    possible[i] = pos * possible[i-1];
    npossible[i] = (1-pos)*possible[i-1];
  }

  for(int n = 3; n < N; ++n){
    expect[n] = 0;
    for(int j = 1; j < ALPHA_N && n-j-1 >= 0; ++j){
      expect[n] += npossible[j] * ( j + expect[n-j-1] );
    }
    if( n-1 < ALPHA_N )
      expect[n] += n * possible[n-1];
  }
}

int main(){
  double ans[N];
  solve( ans );
  while(true){
    int n;
    scanf("%d", &n);
    if(n==0)break;
    printf("%.3lf\n", ans[n]);
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<math.h>
#define MAX 1000
using namespace std;

int main()
{
	int n,i=0,j=0;
	int S[MAX]={0};
	double a=0.0,m=0.0,temp=0.0;

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

		for(j=0;j<n;j++)
		{
			cin >> S[i] ;
			m = m + S[i] ;
			i++;
		}

	m = m / n ;

	for(i=0;i<n;i++)
	{
		temp = temp + (S[i] - m)*(S[i] - m) ;
	}

	a = temp / n ;

	a = sqrt(a);

	cout << a << endl;

	a = 0.0;
	m = 0.0;
	temp = 0.0;
	i=0;

	}

	return 0;
}

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

const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    int n;
    string s,t;
    cin >> n >> s >> t;
    int ans = n * 2,same = 0;
    for(int i = 0; i < n; i++){
        if(s.substr(i,n-i) == t.substr(0,n-i)){
            ans -= n-i;
            break;
        }
    }
    cout << ans-same << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int h; scanf("%d", &h);
	std::vector<std::string> s(h);
	for(int i = 0; i < h; i++) {
		cin >> s[i];

		s[i] += s[i];
	}
	for(int i = 0; i < h; i++) s.push_back(s[i]);
	
	int ans = 0;
	for(int q = 0; q < h; q++) {
		int p = 0;

		bool f = true;
		for(int i = 0; i < h; i++) {
			for(int j = 0; j < h; j++) {
				if(s[p + i][q + j] == s[p + j][q + i]) continue;
				f = false;
				break;
			}
		}
		
		ans += f * h;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 768
def run(A, B, K):
    for i in range(K):
        if i % 2 == 0:
            if A % 2 == 1:
                A -= 1
            A /= 2
            B += A
        else:
            if B % 2 == 1:
                B -= 1
            B /= 2
            A += B
    return '{} {}'.format(int(A), int(B))


def main():
    A, B, K = map(int, input().split())
    print(run(A, B, K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

int main()
{
	long N,K;
	cin >> N >> K;

	long num = N / K;

	long longCount = num*num*num;

	if (K % 2 == 1)
	{
		cout << longCount << endl;

		return 0;
	}
	else
	{
		long num2 = 0;

		for (int i = 0; i <= N; i++)
		{
			if (i % K == K / 2)
			{
				num2++;
			}
		}

		longCount= longCount+ num2 * num2 * num2;
		cout << longCount << endl;

		return 0;

	}





	cout << " "<< endl;

	return 0;


}



Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

using namespace std;



int _gcd(int a,int b)
{
	return (b==0?a:_gcd(b,a%b));
}
bool cmp(int a,int b)
{
	return a>b;
}

int main()
{
	fast;
	#ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
				string s;
				cin>>s;
				int n=s.length();
				if(s[n-1]!='s')
				{
					s.push_back('s');
					cout<<s<<endl;
					return 0;
				}
				else if(s[n-1]=='s')
				{
					s.push_back('e');
					s.push_back('s');
					cout<<s<<endl;
					return 0;
				}

	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;

int main(){

    int N;
    int ans;
    int max_cand = 0;

    cin >> N;
    int A[2][N];

    for(int i = 0; i < N; ++i) cin >> A[0][i];
    for(int i = 0; i < N; ++i) cin >> A[1][i];

    for(int i = 0; i < N; ++i){
        ans = 0;
        for(int step = 0; step < N; ++step){
            if(step <= i) ans += A[0][step];
            if(step == i) ans += A[1][step];
            if(step > i) ans += A[1][step];
        }
        max_cand = max(max_cand, ans);
    }
    cout << max_cand << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
#define mx 100000
int main(){

 string s;
 cin>>s;
 for(int i=0;i<s.size();i++)s[i]='x';
 cout<<s<<endl;
    return 0;
}

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

typedef long long int lli;

const lli maxn = lli(2e5)+5;

pair<lli, lli> A[maxn];

int main(void)
{
	lli n, res1 = 0, res2 = 0, res3 = 0, alleq = 0;
	scanf("%lld", &n);
	for(lli i = 0;i < n;i++)
	{
		scanf("%lld%lld", &A[i].first, &A[i].second);
		alleq = max(alleq, lli(A[i].first != A[i].second));
	}

	if(!alleq)
	{
		printf("0\n");
		return 0;
	}

	for(lli i = 0;i < n;i++)
	{
		if(A[i].first <= A[i].second) res1 += A[i].first;
	}

	for(lli i = 0;i < n;i++)
	{
		if(A[i].first > A[i].second) res2 += A[i].first;
	}

	for(lli i = 0;i < n;i++)
	{
		if(A[i].first > A[i].second) res3 = max(res3, res2-A[i].second);
	}
	printf("%lld\n", res1+res3);
}


Measured memory_bytes: 512
import math
A,B,H,M = map(int,input().split())
cos_theta = math.cos(math.radians(abs(30*H+0.5*M-6*M)))
#print(cos_theta)
ans = math.sqrt(A**2+B**2-2*A*B*cos_theta)
print('{:.20f}'.format(ans))

Measured memory_bytes: 9432
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')
from collections import deque
def solve():
    n, q = MI()
    e = [[] for _ in range(n)]
    for _ in range(n - 1):
        a, b = MI1()
        e[a].append(b)
        e[b].append(a)

    point = [0] * n
    for _ in range(q):
        p, x = MI()
        p -= 1
        point[p] += x

    d = deque([(0, point[0])])
    used = [False] * n
    used[0] = True

    while len(d) > 0:
        v, p = d.popleft()
        for nv in e[v]:
            if used[nv]: continue
            used[nv] = True
            point[nv] += p
            d.append((nv, point[nv]))

    printlist(point, " ")

if __name__ == '__main__':
    solve()


Measured memory_bytes: 124280