akhauriyash/Code-Regression huggingface dataset:
import java.io.*
import java.util.*

fun solve(N: Long){
    // dp[j] = j円作るのに必要な最小な操作数 = i
    // dp[j] = MIN(dp[j-yen]) yen <= j
    val n = N.toInt()
    val dp = LongArray(100001)
    val yens = listOf(1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049 ).sorted()
    for ( i in 1..n ){
        dp[i] = yens.filter{ it <= i }.map{ dp[i-it] + 1}.min()!!
        // println(dp[i])
    }
    println(dp[n])
    return
}

fun Int.pow(x: Double): Double = Math.pow(this.toDouble(), x)
fun Long.pow(x: Double): Double = Math.pow(this.toDouble(), x)


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    solve(N)
}



Measured memory_bytes: 43072
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

typedef long long int64;

const int MAX_N = 10000;
const int MAX_K = 10000;
const int MAX_V = MAX_K + 2;
const int INF = 1<<29;
const int INF2 = 10000;

int M, N, K;
int ws[MAX_N];
vector<int> as;
vector<int> ts[MAX_N];

typedef pair<int, int> P;
struct edge{ int to, cap, cost, rev; };
int V;
vector<edge> G[MAX_V];
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];

void add_edge(int from, int to, int cap, int cost){
	G[from].push_back((edge){to,cap,cost,G[to].size()});
	G[to].push_back((edge){from,0,-cost,(int)G[from].size()-1});
}

int min_cost_flow(int s, int t, int f){
	int res = 0;
	fill(h, h+V, 0);
	while(f > 0){
		priority_queue<P, vector<P>, greater<P> > que;
		fill(dist, dist+V, INF);
		dist[s] = 0;
		que.push(P(0,s));
		while(!que.empty()){
			P p = que.top(); que.pop();
			int v = p.second;
			if(dist[v] < p.first) continue;
			for(int i=0; i<G[v].size(); i++){
				edge &e = G[v][i];
				if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
					dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
					prevv[e.to] = v;
					preve[e.to] = i;
					que.push(P(dist[e.to],e.to));
				}
			}
		}
		if(dist[t] == INF){
			return -1;
		}
		for(int v = 0; v<V; v++) h[v] += dist[v];

		int d = f;
		for(int v=t; v != s; v = prevv[v]){
			d = min(d, G[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += d*h[t];
		for(int v=t; v!=s; v=prevv[v]){
			edge &e = G[prevv[v]][preve[v]];
			e.cap -= d;
			G[v][e.rev].cap += d;
		}
	}
	return res;
}

int solve(){
	int tot = 0, cnt = 0, sub = 0;

	for(int i=0; i<K; i++){
		ts[as[i]].push_back(i);
	}

	V = K;

	for(int i=0; i+1<K; i++){
		add_edge(i, i+1, INF, INF2);
	}

	for(int i=0; i<N; i++){
		tot += ws[i] * ts[i].size();
		for(int j=0; j+1 < (int)ts[i].size(); j++){
			add_edge(ts[i][j]+1, ts[i][j+1], 1, INF2 * (ts[i][j+1] - (ts[i][j] + 1)) - ws[i]);
		}
	}

	return tot + ( min_cost_flow(0, K-1, M-1) -  (M - 1) * (K - 1) * INF2 );
}

int main(){
	scanf("%d%d%d",&M,&N,&K);
	for(int i=0; i<N; i++){
		scanf("%d", ws+i);
	}
	for(int i=0; i<K; i++){
		int x;
		scanf("%d", &x);
		as.push_back(x - 1);
	}

	as.erase(unique(as.begin(), as.end()), as.end());
	K = as.size();

	printf("%d\n", solve());

	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            char[] s = sc.chararr;

            int n = s.Length;
            int tmin = n;

            for (int k = 0; k < s.Length - 1; k++)
            {
                if (s[k] != s[k + 1])
                {
                    int t = Math.Max(k + 1, n - k - 1);
                    if (tmin > t) tmin = t;
                }
            }

            Console.WriteLine(tmin);
        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


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

int main()
{
    long long H;
    cin>>H;
    int count=0;
    long long sum=0;
    while(H>=1)
    {
        H=H/2;
        count++;
        sum += pow(2,count-1);
    }
    
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	ans := 0
	if a >= 13 {
		ans = b
	} else if a >= 6 {
		ans = b / 2
	} else {
		ans = 0
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import Data.Maybe
import qualified Data.IntSet as S

calc :: Integer -> Maybe Integer
calc x = if isJust y then Just (fromJust y * sign) else Nothing
  where
  y = calc' 0 x'
  x' = abs x
  sign = if x > 0 then 1 else -1
  calc' l r
    | l > r = Nothing
    | mm < x' = calc' (m + 1) r
    | mm > x' = calc' l (m - 1)
    | otherwise = Just m
    where
    m = (l + r) `div` 2
    mm = m ^ 5

main :: IO ()
main = do
  x <- read <$> getLine :: IO Integer
  let b = head $ filter (\b -> isJust $ calc $ x + b ^ 5) $ concat $ map (\(a, b) -> [a, b]) $ zip [0 ..] $ map (* (-1)) [0 ..]
      a = fromJust $ calc $ x + b ^ 5
  putStrLn $ show a ++ " " ++ show b


Measured memory_bytes: 4980
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>
#include <cassert>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

vector<pii> primefactor(int n){
    vector<pii> ret;
    for(int i = 2; i*i <= n; i++)if(n % i == 0){
        int cnt = 0;
        while(n%i == 0)n /= i, cnt++;
        ret.push_back(pii(i,cnt));
    }
    if(n != 1)ret.push_back(pii(n,1));

    return ret;
}


signed main(void) {
    int k;
    cin >> k;
    if(k%2 == 0 || k%5 == 0){
        cout << -1 << endl;
        return 0;
    }
    int t = 0;
    rep(i,10000000){
        t *= 10;
        t += 7;
        if(t % k == 0){
            cout << i+1 << endl;
            return 0;
        }
        t %= k;
    }
}


Measured memory_bytes: 3624
#include<stdio.h>
int main() {
	int i,x[10000],c=0;
	for (i = 0; i < 10000; i++) {
		scanf("%d", &x[i]);
		if (x[i] == 0)break;
		c++;
	}
	for (i = 0; i < c; i++) {
		printf("Case %d: %d\n",i+1,x[i]);
	}
	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
  int n, k;
  string s;
  while(cin>>s>>k){
    n=s.length();
    set<string> st;
    for(int i=0; i<26; ++i){
      if(st.size()>=k)
        break;
      for(int j=0; j<n; ++j){
        if(s[j]-'a'==i){
          for(int l=j; l<n&&l<j+5; ++l){
            string s1(s.begin()+j,s.begin()+l+1);
            st.insert(s1);
          }
        }
      }
    }
    int cnt=1;
    for(auto i:st){
      if(cnt==k){
        cout<<i<<endl;
        break;
      }
      ++cnt;
    }
  }
  return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

ll n,c,x[100005],v[100005],dp[2][1000005],ans=0;

int main()
{ios_base::sync_with_stdio(false);
cin>>n>>c;

rep(i,1,n)
{
	cin>>x[i]>>v[i];
}

ll s=0;
rep(i,1,n)
{
	s+=v[i];
	ans=max(ans,s-x[i]);
	dp[0][i]=max(dp[0][i-1],s-2*x[i]);
}

s=0;

ren(i,n,1)
{
	s+=v[i];
	ans=max(ans,s-(c-x[i]));
	ans=max(ans,dp[0][i-1]+s-(c-x[i]));
	dp[1][i]=max(dp[1][i+1],s-2*(c-x[i]));
}
s=0;
rep(i,1,n)
{
	s+=v[i];
	ans=max(ans,dp[1][i+1]+s-x[i]);
}
ol(ans);
return 0;
}



Measured memory_bytes: 8064
K,N = map(int , input().split())
A = list(map(int , input().split()))

A.append(A[0] + K)

max_distance = A[1] - A[0]
for i in range(N):
    if A[i + 1] - A[i] > max_distance:
        max_distance = A[i + 1] - A[i]
print(K - max_distance)

Measured memory_bytes: 26444
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{
  string s;
 int x,y,sum=0;
  cin>>s;
x=s.find("A");
y=s.rfind("Z");
for(int i=x;i<=y;i++)
{
	sum++;
}
cout<<sum;
 return 0;
}

Measured memory_bytes: 640
n,x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = [0] * (n+1)
for i in range(n):
    s[i+1] = s[i] + a[i]

ans = 0
for i in range(n):
    if x >= s[i+1]:
        ans = i+1
if x > s[n]:
    ans -= 1
print(ans)

Measured memory_bytes: 3064
import std;
import core.bitop;

// dfmt off
ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
void aryWrite(T = long)(T[] ary){ ary.map!(x => x.text()).join(' ').writeln(); }
alias Pair = Tuple!(long, "X", long, "Y");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto n = lread();
    auto p = new Pair[](n);
    foreach (i; iota(n))
    {
        long x, y;
        scan(x, y);
        p[i] = Pair(x, y);
    }
    auto skip = new Pair[][](n, 0);
    bool[Pair] pq;
    foreach (i; iota(n))
    {
        foreach (j; iota(n))
        {
            if (i != j)
            {
                skip[i] ~= Pair(p[j].X - p[i].X, p[j].Y - p[i].Y);
                pq[Pair(p[j].X - p[i].X, p[j].Y - p[i].Y)] = true;
            }
        }
    }

    long ans = n;
    foreach (key; pq.byKey)
    {
        long cnt;
        foreach (i; iota(n))
        {
            if (skip[i].canFind(key))
            {
                cnt++;
            }
        }
        ans = min(n - cnt, ans);
    }
    ans.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pull pair<ull, ull>
#define m_p make_pair

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	double l;
	cin >> l;
	
	double a = l / 3;
	
	cout << fixed << setprecision(17) <<  a*a*a;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
maxi = 10**18
def main():
    if 0 in A:
        print(0)
        return
    mult = 1
    for a in A:
        mult *= a
        if mult > maxi:
            print(-1)
            return 
    print(mult)

main()

Measured memory_bytes: 21564
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

ll dist[1010][210], d1[210][210], d2[210][210];

int solve_testcase() {
    int N, M; scanf(" %d %d", &N, &M);
    if(N == 0 and M == 0) return 1;

    fill(d1[0], d1[N], LONGINF);
    fill(d2[0], d2[N], LONGINF);
    for(int i=0; i<N; i++) d1[i][i] = d2[i][i] = 0;
    for(int i=0; i<M; i++) {
        ll u, v, c; char tp; cin >> u >> v >> c >> tp;
        u--; v--;
        if(tp == 'L') {
            chmin(d1[u][v], c);
            chmin(d1[v][u], c);
        }
        if(tp == 'S') {
            chmin(d2[u][v], c);
            chmin(d2[v][u], c);
        }
    }

    for(int k=0; k<N; k++) {
        for(int i=0; i<N; i++) {
            for(int j=0; j<N; j++) {
                chmin(d1[i][j], d1[i][k] + d1[k][j]);
                chmin(d2[i][j], d2[i][k] + d2[k][j]);
            }
        }
    }

    int R; scanf("%d", &R);
    vector<int> z(R);
    for(int i=0; i<R; i++) scanf("%d", &z[i]), z[i]--;

    fill(dist[0], dist[R], LONGINF);
    dist[0][ z[0] ] = 0;
    for(int i=0; i+1<R; i++) {
        int u = z[i], v = z[i+1];
        for(int j=0; j<N; j++) {
            if(dist[i][j] == LONGINF) continue;
            // land only
            {
                ll cost = d1[u][v];
                chmin(dist[i+1][j], dist[i][j] + cost);
            }

            // land -> sea -> land
            for(int k=0; k<N; k++) {
                ll cost = d1[u][j] + d2[j][k] + d1[k][v];
                chmin(dist[i+1][k], dist[i][j] + cost);
            }
        }
    }

    ll ans = *min_element(dist[R-1], dist[R-1] + N);
    printf("%lld\n", ans);
    return 0;
}

int main() {
    while(!solve_testcase());
    return 0;
}



Measured memory_bytes: 5516
dat = input().split()
x = dat[0]
y = dat[1]
 
while (True):
    if (int(x)==0 and int(y)==0):
        break
    if (int(y) >= int(x)):
        print(x, end=" ")
        print(y)
    else:
        print(y, end=" ")
        print(x)

    try:
      dat = input().split()
      x = dat[0]
      y = dat[1]
    except EOFError:
      pass


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

int main() {
  int n;
  cin >> n;
  bool result = true;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    if (num % 2 == 0) {
      if (num % 3 == 0 || num % 5 == 0) {
        // no-op
      } else {
        result = false;
      }
    }
  }
  string out = result ? "APPROVED" : "DENIED";
  cout << out << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

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

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N, M, K;
	vector<int> A, B;
	vector<int> sum;
	int ans = 0;
	
	cin>>N>>M>>K;
	
	A.resize(N);
	B.resize(M);
	sum.resize(M+1);
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
	}
	
	for(int i = 0; i < M; i++){
		cin>>B[i];
		
		sum[i+1] = sum[i] + B[i];
		
		if(sum[i+1] <= K) {
			ans = max(ans, i+1);
		}
		// cout<<sum[i+1]<<endl;
	}
	
	sort(sum.begin(), sum.end());
	
	for(int i = 0, s = 0; i < N; i++){
		s += A[i];
		
		if(s > K) break;
		
		int it = upper_bound(sum.begin(), sum.end(), K - s) - sum.begin();
		
		ans = max(ans, i + 1 + it - 1);
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 7932
#include <bits/stdc++.h>
#define pi 3.14159
#define MOD 1000000007
using namespace std;
int main()
{
	long long int i,n,m;
	cin>>n>>m;
	int a[m];
	for(i=0;i<m;i++)
		cin>>a[i];
	vector<int>ans(n+1,-1);
	
		
			ans[0]=1;
			ans[1]=1;
			ans[2]=2;
			for(i=0;i<m;i++)
				ans[a[i]]=0;
			for(i=2;i<=n;i++)
				{
					if(ans[i]!=0)
						ans[i]=(ans[i-1]+ans[i-2])%MOD;
				}
		
	cout<<ans[n]<<endl;	
}

Measured memory_bytes: 3888
#include<iostream>
#include<string>
using namespace std;
int main(){
  int i;
  int ans=0;
  string s;
  cin>>s;
  for(i=0;i<s.size()/2;++i){
    if(s.at(i)!=s.at(s.size()-i-1))
      ++ans;
  }
  cout<<ans<<endl;
}

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

#define PB push_back
#define MP make_pair
#define SZ size()
#define Fr first
#define Sc second
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%I64d", &a)
#define sd(a) scanf("%lf", &a)
#define ss(a) scanf("%s", a)
#define debug(x) cout << #x << ": " << x << endl
#define Fast_IO ios_base::sync_with_stdio(0);cin.tie(0)

typedef long long Long;
typedef pair <int, int> Pii;
///<-------------------------------------------------END OF TEMPLATE-------------------------------------------------->

#define MAX 100005
int N, M, A[MAX];
vector <Pii> vec;

inline int path(int a, int b) {
   if(a <= b) return b-a;
   return M - a + b;
}

int main() {
   si(N); si(M);
   for(int i = 0; i < N; i++) {
      si(A[i]);
   }

   Long sum = 0;
   int kombe = 0;
   for(int i = 1; i < N; i++) {
      if(A[i-1] > 1 && A[i] >= 1 && A[i-1] > A[i]) {
         sum += (1 + path(1, A[i]));
         kombe++;
      } else sum += path(A[i-1], A[i]);
      vec.PB(MP(A[i-1]+1, -(i-1)));
      vec.PB(MP(A[i]+1, i));
      //debug(sum);
   }
   sort(vec.begin(), vec.end());

   Long cur = sum;
   int p = 0;
   //printf("move at 1: %lld\n", sum);
   for(int k = 2; k <= M; k++) {
      cur -= kombe;
      while(p < vec.SZ && vec[p].Fr == k) {
         int id = abs(vec[p].Sc);
         if(vec[p].Sc <= 0) {
            cur -= path(A[id], A[id+1]);
            cur += (1 + path(k, A[id+1]));
            kombe++;
         } else {
            cur += path(A[id-1], A[id]);
            kombe--;
         }
         p++;
      }
      sum = min(sum, cur);
      //printf("move at %d: %lld\n", k, cur);
   }
   printf("%lld\n", sum);
}


Measured memory_bytes: 2804
#!/usr/bin/env python3

from typing import Iterable


def main() -> None:
    s = r()
    if s == 'ABC':
        w('ARC')
    else:
        w('ABC')


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(input())


def rmi(delim: str = ' ') -> int:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(data: Iterable) -> None:
    print(' '.join(data))


if __name__ == '__main__':
    main()


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	ll k;
	cin >> k;
	// mod k 
	ll fir = 7;
	fir %= k;
	int ans = 1;
	while(1){
		if(fir == 0){
			cout << ans << endl;
			return 0;
		} else {
			fir *= 10;
			fir += 7;
			fir %= k;
			ans++;
		}
		if(ans > 1e8){
			cout << -1 << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3636
x, y = map(int, input().split())

ans = 0

for i in range(0, x + 1):
  # i is the number of the crane
  rest = y - (2 * i)
  if rest / 4 == x - i:
    print('Yes')
    ans = 1
    break

if ans == 0:
  print('No')


Measured memory_bytes: 9104
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
/*
int stoi(string sstoi){//string->int
  ll int stois=0;
  rep(stoii,0,sstoi.length()){
    stois+=ctoi(sstoi[stoii])*jo(10,sstoi.length()-stoii-1);
  }
  return stois;
}*/
  
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
    string a;
  cin>>a;
  int max=0;
  int count=0;
  rep(i,0,a.length()){
    if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G'){
      count++;
    }else{
      if(max<count) max=count;
      count=0;
    }
  }
      if(max<count) max=count;
  cout<<max;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    static final long MOD=1000000007;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long[] nums=new long[2];
        for(int i=0;i<2;i++){
            nums[i]=sc.nextInt();
        }
        Arrays.sort(nums);
        if(nums[1]-nums[0]>1){
            System.out.println(0);
        }else if(nums[1]-nums[0]==1){
            System.out.println((long)(kaijo(nums[1])*kaijo(nums[0]))%MOD);
        }else{
            System.out.println((kaijo(nums[0])*kaijo(nums[1])*2)%MOD);
        }
    }
    static long kaijo(long input){
        long output=1;
        for(int i=1;i<=input;i++){
            output*=i;
            output%=MOD;
        }
        return output;
    }
}


Measured memory_bytes: 25172
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    string s;
    cin>>s;
    bool flag = true;
    rep(i,0,s.size()-1){
        rep(j,i+1,s.size()-1){
            if(s[i]==s[j]){
                flag = false;
                break;
            }
        }
    }
    if(flag) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
    return 0;
}

Measured memory_bytes: 256
// ＡＢＣのＡ過去問を解くだけだよ

// フォント:Electroharmonix
// x:小文字(ｘ)    X:大文字(Ｘ)
// +:プラス(＋)    &:アンド(＆)

#include <bits/stdc++.h>

using namespace std;

void Main()
{
    int N, K;
    cin >> N >> K;

    if (N % K == 0)
        cout << 0;
    else
        cout << 1;
}

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

    //std::cout << std::fixed << std::setprecision(10);

#ifdef DEBUG_BUILD
    while (true)
    {
        Main();
        cout << std::endl;
    }
#endif

    Main();
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			int b,c,d;
			scanf("%d%d%d",&b,&c,&d);
			if(b==100||c==100||d==100||b+c>=180||b+c+d>=240)printf("A\n");
			else if(b+c+d>=210||(b+c+d>=150&&(b>=80||c>=80)))printf("B\n");
			else printf("C\n");
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll kai(vector<ll> A, ll key) {
	ll an = 0;
	rep(i, A.size()) {
		an += (A.at(i) - 1) / key;
	}
	return an;
}
// index が条件を満たすかどうか
bool isOK(int index,vector<ll> A, int K) {
	if (kai(A,index) <= K) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(ll MA,vector<ll> A,ll K) {
	int left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = MA; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, A,K)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}
ll HP[4];
int main() {
	ll H, W, A, B,an=0;
	cin >> H >> W >> A >> B;
	prenCkModp(H + W);
	for (ll i = 1; i <= H - A; i++) {
		an += (nCk(i + B-2, i-1) * nCk(H - i + W - B-1, W - B-1)) % mod;
	}
	cout << an % mod << endl;
}


Measured memory_bytes: 7996
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	ll a, b;
	cin >> a >> b;
	cout << max({a + b, a - b, a * b});
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args)
	{
		// TODO 自動生成されたメソッド・スタブ
		try
		{
			while(true)
			{
				String str[] = input(1);
				int sum = 0;
				for(int i = 0; i < str[0].length(); i++)
				{
					sum += Integer.parseInt(str[0].toCharArray()[i] + "");
				}
				if(sum != 0) System.out.println(sum);
				else break;
			}
		}
		catch(IOException e)
		{
		}
	}

	/*
	public static int Calc(int[] a, int f, int e)
	{
		ArrayList<Integer> list[] = new ArrayList[2];
		return e;
	}
	//*/

	public static String[] input(int Num) throws IOException
	{
		String str[] = new String[Num];
		String str2 = br.readLine();
		int j = 0;
		for(int i = 0; i < Num; i++)
		{
			if(i < Num - 1)
			{
				str[i] = str2.substring(j, str2.indexOf(" ", j));
				j = str2.indexOf(" ", j) + 1;
			}
			else
			{
				str[i] = str2.substring(j);
			}
		}
		return str;
	}

}



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

using namespace std;


void solve(){
    int n,k; cin>>n>>k;
    vector<int> v(n);
    for(auto& i: v) cin>>i;
    sort(v.begin(), v.end());
    int ans =0;
    for(int i=0; i<k; ++i) ans+=v[i];
    cout<<ans;
}


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

    // int T; cin>>T; while(T--)
        solve();
}

Measured memory_bytes: 3636
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,k = LI()
    aa = [LS() for _ in range(n)]
    a = [[int(_[0]) + (k if _[2] == 'W' else 0), int(_[1])] for _ in aa]
    k2 = k*2
    aa = [[0] * k2 for _ in range(k2)]
    dr = [0, -2, -1, 0, 1, 2, 1, 0, -1, 2, 2, -2, -2]
    dc = [0, 0, 1, 2, 1, 0, -1, -2, -1, 2, -2, 2, -2]

    for x,y in a:
        x %= k2
        y %= k2
        for i in range(13):
            cx = x + dr[i] * k
            cy = y + dc[i] * k
            if cx >= k2 or cy >= k2 or cx <= -k or cy <= -k:
                continue
            mx = max(cx, 0)
            my = max(cy, 0)
            aa[mx][my] += 1
            if cx < k:
                aa[cx+k][my] -= 1
                if cy < k:
                    aa[cx+k][cy+k] += 1
            if cy < k:
                aa[mx][cy+k] -= 1

    for i in range(k2):
        for j in range(1,k2):
            aa[i][j] += aa[i][j-1]
    for i in range(k2):
        for j in range(1,k2):
            aa[j][i] += aa[j-1][i]
    return max(max(c) for c in aa)


print(main())




Measured memory_bytes: 138712
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC152C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N,min,a;
            a = 0;
            N = int.Parse(Console.ReadLine());
            min = N+1;
            int[] P = new int[N];
            var word = Console.ReadLine().Split(' ');
            for(int i=0;i<=N-1;i++)
            {
                P[i] = int.Parse(word[i]);
                if(P[i]<min)
                {
                    min = P[i];
                    a++;
                }
            }
            Console.WriteLine(a);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 33116
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop, core.thread;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


int M, N;
string S, T;

void main() {
  try {
    for (; ; ) {
      S = readToken();
      T = readToken();
      M = cast(int)(S.length);
      N = cast(int)(T.length);
      auto dp = new int[][](M + 1, N + 1);
      auto prev = new int[][](M + 1, N + 1);
      foreach (x; 0 .. M + 1) foreach (y; 0 .. N + 1) {
        dp[x][y] = -1;
      }
      dp[0][0] = 0;
      foreach (x; 0 .. M + 1) foreach (y; 0 .. N + 1) {
        if (x < M) {
          if (dp[x + 1][y] < dp[x][y]) {
            dp[x + 1][y] = dp[x][y];
            prev[x + 1][y] = 0;
          }
        }
        if (y < N) {
          if (dp[x][y + 1] < dp[x][y]) {
            dp[x][y + 1] = dp[x][y];
            prev[x][y + 1] = 1;
          }
        }
        if (x < M && y < N && S[x] == T[y]) {
          if (dp[x + 1][y + 1] < dp[x][y] + 1) {
            dp[x + 1][y + 1] = dp[x][y] + 1;
            prev[x + 1][y + 1] = 2;
          }
        }
      }
      debug {
        writeln(dp[M][N]);
      }
      char[] ans;
      for (int x = M, y = N; !(x == 0 && y == 0); ) {
        switch (prev[x][y]) {
          case 0: {
            --x;
          } break;
          case 1: {
            --y;
          } break;
          case 2: {
            --x;
            --y;
            assert(S[x] == T[y]);
            ans ~= S[x];
          } break;
          default: assert(false);
        }
      }
      ans.reverse();
      writeln(ans.to!string);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 74236
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
long long GCD(long long a,long long b){
    if(b==0)return a;
    return GCD(b,a%b);
}
long long LCM(long long a,long long b){
    return a*b/GCD(a,b);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    cout<<min(n%k,k-n%k)<<endl;
}


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

int T[ 110 ];

int main( int argc, char *argv[] )
{
int i;
int N;
int M;
int P;
int X;
int iSum;

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

	cin >> N;

	iSum = 0;
	for( i = 1; i <= N; i++ )
	{
		cin >> T[ i ];
		iSum += T[ i ];
	}

	cin >> M;
	for( i = 1; i <= M; i++ )
	{
		cin >> P;
		cin >> X;
		cout << iSum - T[ P ] + X << endl;
	}

	return 0;
}



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

int  D;
vector<int> c(26);
vector<int> t(365);
vector<int> last(26,0);
vector<vector<int>> s(365,vector<int>(26));

int f()
{
   int ans =0;
   rep(i,26) last[i] = 0;
   rep(i,D)
   {
      int type = t[i] -1;
      ans += s[i][type];
      last[type] = i+1;
      rep(j,26) ans -= c[j] * (i+1 - last[j]);

   }
   return ans;
}

int main()
{
   ll m;
   cin >> D;

   rep(i,26) cin >> c[i];
   rep(i,D) rep(j,26) cin >> s[i][j];
   rep(i,D) cin >> t[i];
   cin >> m;
   vector<int> d(m), q(m);
   rep(i,m) cin >> d[i] >> q[i];

   rep(i,m)
   {
      int day = d[i] -1;
      t[day] = q[i];
      cout << f() << endl;
   }

   //rep(i,D) cout << anslist[i] <<endl;

   return 0;
}


Measured memory_bytes: 4040
n = int(input())
list_r = [list(map(int, input().split())) for _ in range(n)]
list_b = [list(map(int, input().split())) for _ in range(n)]
list_b.sort(key=lambda x:(x[0], x[1]))

count = 0
for one_b in list_b:
  idx = -1
  max_y = -1
  for i, one_r in enumerate(list_r):
    if one_r[0] < one_b[0] and max_y < one_r[1] < one_b[1]:
      max_y = one_r[1]
      idx = i
  if idx != -1:
    count += 1
    list_r.pop(idx)
print(count)

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

auto printvec = [](vector<int>& vi){
    cout << "--- Printing vector ---\n";
    for(int& v:vi){
        cout << v << '\n';
    }
};


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
   
    
    int x, y;
    cin >> x >> y;
    

    if(y&1){
        cout << "No" << endl;
        return 0;
    } else {
        if( y>=2*x && y<= 4*x){
            cout << "Yes" << endl;
            return 0;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vec x(n),y(n);
  for(ll i=0;i<n;i++) cin >> x[i] >> y[i];
  for(ll i=0;i<n;i++) {
    vector<double> d;
    for(ll j=0;j<n;j++) {
      if(i==j) continue;
      d.push_back(atan2(y[j]-y[i],x[j]-x[i]));
    }
    sort(d.begin(),d.end());
    double r=0;
    ll k=d.size();
    for(ll j=0;j<k;j++) {
      d.push_back(d[j]+2*M_PI);
    }
    for(ll j=0;j<k;j++) {
      r=max(r,M_PI-d[j+k]+d[j+1]);
    }
    cout << fixed << setprecision(10) << r/(2*M_PI) << endl;
  }
}

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

int main(void)
{
	int n;
	string s;
	cin >> n;
	cin >> s;

	char* character = new char[s.size() + 1];

	for (int i = 0; i < s.size(); i++)
	{
		character[i] = s[i];

		for (int j = 0; j < n; j++)
		{
			character[i] += 0x01;
		}

		if (character[i] > 'Z')
			character[i] -= 0x1a;
	}

	character[s.size()] = '\0';

	cout << character << endl;

	delete[] character;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 100000
using namespace std;

int main(){
  int H, W; cin >> H >> W;
  string S[50];
  int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
  int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
  rep(i, 0, H){
    cin >> S[i];
  }
  rep(i, 0, H){
    rep(j, 0, W){
      if(S[i][j] == '#') continue;

      int num = 0;
      rep(h, 0, 8){
        int nh = i + dy[h];
        int nw = j + dx[h];

        if(nh < 0 || H <= nh) continue;
        if(nw < 0 || W <= nw) continue;
        if(S[nh][nw] == '#')  num++;

      }
      S[i][j] = char(num + '0');
    }
  }
  rep(i, 0, H)  cout << S[i] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
long long digitsum(long long a,long long p){
    long long t = 0;
    while(a>0){
        t+=(a%p);
        a/=p;
    }
    return t;
}
int main(){
    long long n,s;
    cin >> n >> s;
    long long n1 = long(sqrt(n))+10;
    for(int i = 2;i<=n1;i++){
        if(digitsum(n,i)==s){
            cout << i << endl;
            return 0;
        }
    }
    long long n2 = (n/n1)+10;
    // n/?==i...amari
    for(int i = n2;i>=1;i--){
        long long amari = s-i;
        if(n-amari > 0 && amari>=0 && (n-amari)%i==0 && amari<(n-amari)/i && (n-amari)/i>=2){
            cout << (n-amari)/i << endl;
            return 0;
        }
    }
    if(n==s){
        cout << n+1 << endl;
        return 0;
    }
    cout << -1 << endl;
}

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

int n, q, c;
string s;
set<int> id[150];
int main()
{
	int i, t1, t2, t3;
	char t4;
	set<int>::iterator l, r;
	cin >> n >> s >> q;
	s = ' ' + s;
	for (i = 1; i <= n; i++) {
		id[s[i]].insert(i);
	}
	while (q--) {
		scanf("%d", &t1);
		if (t1 == 1) {
			scanf("%d %s", &t2, &t4);
			id[s[t2]].erase(t2);
			s[t2] = t4;
			id[t4].insert(t2);
		} else {
			scanf("%d %d", &t2, &t3);
			c = 0;
			for (i = 'a'; i <= 'z'; i++) {
				l = id[i].lower_bound(t2);
				r = id[i].upper_bound(t3);
				if (l != r) c++;
			}
			printf("%d\n", c);
		}
	}
    return 0;
}

Measured memory_bytes: 24216
import java.util.Scanner;
import java.util.Arrays;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int sc1 = Integer.parseInt(scanner.nextLine());
        String array[] = (scanner.nextLine().split(" ")); 
        double sum = 0;
        for( int i=0; i<sc1; i++ ) {
                sum += Integer.parseInt(array[i]);
        }
        double ave = Math.round(sum/sc1);
        double sum2 = 0;
        for( int i=0; i<sc1; i++ ) {
                sum2 += Math.pow(Integer.parseInt(array[i]) - ave,2);
        }
        System.out.println((int)sum2);
    }
}

Measured memory_bytes: 21844
n = int(input())
s = input()
l = {}
for c in s:
    if c in l:
        l[c] += 1
    else:
        l[c] = 1
ans = 1
for i in l.values():
    ans *= i+1
    ans %= (10**9+7)
print((ans-1)%(10**9+7))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
char a[100001],b,s[10000001];
int i=0;
int main()
{
    cin>>a;
    for(int j=0;j<strlen(a);j++)
    {
        s[i]=a[j];
        i+=2;
    }
    i=1;
    a[0]='\0';
    cin>>a;
    for(int j=0;j<strlen(a);j++)
    {
        s[i]=a[j];
        i+=2;
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())

keta = len(str(N))
if keta == 1:
    ans = N
elif keta == 2:
    ans = 9
elif keta == 3:
    ans = N-90
elif keta == 4:
    ans = 909
elif keta == 5:
    ans = N-90-9000
else:
    ans = 90909

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;
  std::vector<int> t(3);
  t[0] = a;
  t[1] = b;
  t[2] = c;
  std::sort(t.begin(), t.end());
  std::cout << t.at(0) << " " << t.at(1) << " " << t.at(2) << std::endl;
  return 0;
}


Measured memory_bytes: 3140
S = input()
a = [0 for i in range(len(S)+1)]
for i, x in enumerate(S):
    if x == '<':
        a[i+1] = max(a[i+1], a[i]+1)
for i in range(len(S)):
    if S[-i-1] == '>':
        a[-i-2] = max(a[-i-2], a[-i-1]+1)
print(sum(a)) 


Measured memory_bytes: 24024
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cerr << "\n\n" << "Time elapsed: " << \
					  (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
					  return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'



int main()
{
	fastio;
	#ifdef APNA_IO
		start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    
    ll n;cin>>n;
    string s;
    cin>>s;
    ll r=0,b=0;
    for(ll i=0;i<n;i++)
    	if(s[i]=='R')
    		r++;
    	else
    		b++;

    if(r>b) cout<<"Yes";
    else cout<<"No";

	#ifdef APNA_IO
		end_routine();
    #endif
}

Measured memory_bytes: 256