akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns #-}

import Data.Int
import Data.Bits
import Data.List
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IntMap
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Control.Applicative
import Data.Maybe
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
-- import Data.Vector.Unboxed ((!))
import Data.Tuple
import Data.Ord (Down(..))
import Data.Coerce


extEuc :: (Integral a) => a -> a -> (a,a,a)
extEuc x0 y0
  = loop (signum x0) 0 (abs x0) 0 (signum y0) (abs y0)
  where
    loop !a !b !x !c !d 0 = (a,b,x)
    loop !a !b !x !c !d !y
      = loop c d y (a - q*c) (b - q*d) z
      where
        (q,z) = x `quotRem` y

invMod :: (Integral a) => a -> a -> Maybe a
invMod x m
  | g == 1 = Just r'
  | otherwise = Nothing
  where
    (_,r,g) = extEuc m x
    r' = r `mod` m

modulus :: Int
modulus = 10^9 + 7

nMax :: Int
nMax = 10^5

plus :: Int -> Int -> Int
plus x y
  | p >= modulus = p - modulus
  | otherwise    = p
  where
    p = x + y

mult :: Int -> Int -> Int
mult x y = (x * y) `mod` modulus

fact :: Int -> Int
fact n = foldl' mult 1 [1..n]

sumInv :: V.Vector Int32
sumInv
  = V.map fromIntegral
    $ V.scanl' plus 0
    $ V.map (fromJust . (`invMod` modulus))
    $ V.enumFromN 1 nMax

coeff :: Int -> Int -> Int
coeff n j = x + y - 1
  where
    x = fromIntegral $ sumInv V.! (j+1)
    y = fromIntegral $ sumInv V.! (n-j)

query :: Int -> V.Vector Int -> Int
query n = V.foldl' plus 0 . V.imap (\j -> mult $ coeff n j `mult` fact n)

main :: IO ()
main = do
  n <- read <$> getLine
  v <- V.unfoldrN n (B.readInt . B.dropWhile (== ' ')) <$> B.getLine
  putStrLn $ show $ query n v


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
//#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 2000000000;
const ll INF64 = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
//std::vector<vector<int>> g;


//std::vector<std::set<int>> g;
int main(){
    int n;
    std::cin >> n;
    VEC(int,a,n);
    sort(all(a));
    int c=0;
    rep(i,n-1){
        if(a[i]==a[i+1])c++;
    }
    std::cout << n-ceil(c,2)*2 << std::endl;
}

Measured memory_bytes: 640
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();

    let n: usize = itr.next().unwrap().parse().unwrap();
    let t: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let m: usize = itr.next().unwrap().parse().unwrap();
    let ans = t.iter().sum::<usize>();
    let mut out = Vec::new();
    for _ in 0..m {
        let p: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1;
        let x: usize = itr.next().unwrap().parse().unwrap();
        writeln!(out, "{}", ans - t[p] + x).ok();
    }
    stdout().write_all(&out).unwrap();
}


Measured memory_bytes: 2164
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int S = int.Parse (str[0]);

            int h = S / 3600;

            S = S % 3600;

            int m = S / 60;

            S = S % 60;

            int s = S;

            Console.WriteLine ("{0}:{1}:{2}", h, m, s);

        }
    }

    class MyLibrary
    {

        // 自作の関数
        public static int MyFunction (int n)
        {
            return 0;
        }
    }
}


Measured memory_bytes: 18024
#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}

vector<int> color;
vector<vector<int>> G;

bool dfs(int v, int c)
{
    color[v] = c;
    rep(i, G[v].size())
    {
        if (color[G[v][i]] == c)
        {
            return false;
        }
        if (color[G[v][i]] == 0 && !dfs(G[v][i], -c))
        {
            return false;
        }
    }

    return true;
}

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

    G = vector<vector<int>>(N);
    color = vector<int>(N, 0);

    rep(i, M)
    {
        int s, t;
        cin >> s >> t;
        G[s - 1].push_back(t - 1);
        G[t - 1].push_back(s - 1);
    }

    bool flag = true;
    rep(i, N)
    {
        if (color[i] == 0)
        {
            flag = dfs(i, 1);
            if (!flag)
            {
                break;
            }
        }
    }

    int B = 0, W = 0;
    ll ans;

    if (flag)
    {
        rep(i, N)
        {
            if (color[i] == 1)
            {
                B++;
            }
            else if (color[i] == -1)
            {
                W++;
            }
        }
        ans = 1LL * B * W - M;
    }
    else
    {
        ans = ((1LL * N * (N - 1)) / 2) - M;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define M 1000000007
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------
vi dx({0,0,-1,1});
vi dy({-1,1,0,0});
void Main(){
  int h,w;
  cin>>h>>w;
  v(string) a(h);
  cin>>a;
  vvi dist(h,vi(w,INF));
  queue<pii> q;
  rep(i,h) rep(j,w) if(a[i][j]=='#'){
    q.push({i,j});
    dist[i][j] = 0;
  }
  while(!q.empty()){
    int ni = q.front().fi;
    int nj = q.front().se; q.pop();
    int d = dist[ni][nj]+1;
    rep(i,4){
      int si = ni+dx[i];
      int sj = nj+dy[i];
      if(si<0 || h<=si || sj<0 || w<=sj ) continue;
      if(dist[si][sj]!=INF) continue;
        q.push({si,sj});
        dist[si][sj] = d;
    }
  }

  int ans =0;
  rep(i,h) rep(j,w){
    maxs(ans,dist[i][j]);
  }
  cout<<ans<<endl;

} int main(int argc,char** argv)
{fastio; myio; Main();}


Measured memory_bytes: 13456
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();

        int[] W = cin.ArrayInt(N);

        int sum = W.Sum();

        float sumHalf = sum / 2.0f;

        float minDiff = float.MaxValue;

        //Array.Sort(W);

        int sumTotal = 0;
        for (int i = 0; i < N; ++i)
        {
            int tmpTotal = sumTotal + W[i];

            float diff = Math.Abs(sumHalf - tmpTotal);

            if (diff > minDiff)
            {
                break;
            }

            minDiff = diff;

            sumTotal = tmpTotal;
        }

        int anotherTotal = sum - sumTotal;

        WriteLine(Math.Abs(anotherTotal - sumTotal));
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int main(){
	string s;
	int n;
	cin >> n;
	cin >> s;
	for(int i=0; i<=(int)(s.length())-1; i++){
		s[i] = ((s[i]-65+n)%26)+65;
	}
	cout << s;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
string c[300];
bool emp[300];
int ans[300][300];
signed main(){
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=0;i<h;i++)
        cin>>c[i];
    for(int i=0;i<h;i++)
        emp[i]=(string(w,'.')==c[i]);
    bool fi=1,fj;
    int cnt=0;
    for(int i=0;i<h;i++){
        fj=1;
        for(int j=0;j<w;j++){
            if(c[i][j]=='#'){
                cnt++;
                int ni,nj;
                for(ni=i+1;ni<h&&emp[ni];ni++);
                for(nj=j+1;nj<w&&c[i][nj]=='.';nj++);
                for(int k=(fi?0:i);k<ni;k++)
                    for(int l=(fj?0:j);l<nj;l++)
                        ans[k][l]=cnt;
                if(fj)
                    fj=0;
            }

        }
                  if(fi&&!emp[i])
                fi=0;
    }
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            cout<<ans[i][j]<<(j+1==w?'\n':' ');
}


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

int main(void)
{
  int n,a;
  cin>>n>>a;

  int l=a;//おいしさ最小値
  int r=a+n-1;//おいしさ最大値

  int eat;
  
  if(r<=0)//おいしさ最大値が0以下の場合
    eat=r;//eatにおいしさ最大値を代入
  else if(l>=0)//おいしさ最小値が0以上の場合
    eat=l;//eatにおいしさ最小値を代入
  else//それ以外なら
    eat=0;//eatに0を代入

  int answer=(r+l)*(r-l+1)/2-eat;

  cout<<answer<<endl;
    
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	int R, G; cin >> R >> G;

	int X = 2 * G - R;
	cout << X << endl;

	return 0;
}

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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (n); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)


int main() {
  string S, T;
  cin >> S >> T;

  int ans = 0;
  rep0(i, 3) {
    if (S[i] == T[i]) ans++;
  }

  cout << ans << BR;
  return 0;
}

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

int main(){
	int n, ans = 0;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ans += a[i] - 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
// vim: ts=2 sw=2 sts=2
#include <bits/stdc++.h>
using namespace std;

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

  int s = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;

    if (x < k - x)
      s += x;
    else
      s += k - x;
  }

  cout << s * 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
int main() {
    int N, K;
    std::cin >> N >> K;
    int ans = 1;
    for (int i = 0; i < N; i++) {
        ans = std::min(ans * 2, ans + K);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 3164
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define inv(i, a, b)        for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl                endl

using namespace std;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int x, unsigned int y) {                                                    //return x^y in order(log(y))
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class CColon {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double kaku = 2 * 3.1415926535897932 * abs(H / 12 + (M / 60) / 12 - M / 60);
    cout << fixed << setprecision(15) << sqrt((A * A) + (B * B) - (2 * A * B * cos(kaku))) << endl;
  }
};


signed main() {
  CColon solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 4232
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<math.h>
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
#define ll long long
using namespace std;
int n;
long long a[200005];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        a[i]+=a[i-1];
    }
    int p1=1,p2=2,p3=3;
    long long ans=9999999999999999LL;
    for(;p2<n-1;p2++)
    {
        long long mn=9999999999999999LL,mx=0;
        for(int i=p1;i<p2;i++)
        {
            if(abs((ll)((ll)a[p2]-a[i])-a[i])<mn)
            {
                mn=abs((ll)((ll)a[p2]-a[i])-a[i]);
                p1=i;
            }
            else break;
        }
        mn=9999999999999999LL;
        p3=max(p3,p2+1);
        for(int i=p3;i<n;i++)
        {
            if(abs((ll)((ll)a[n]-a[i])-((ll)a[i]-a[p2]))<mn)
            {
                mn=abs((ll)((ll)a[n]-a[i])-((ll)a[i]-a[p2]));
                p3=i;
            }
            else break;
        }
        mn=min(a[p1],min((ll)a[p2]-a[p1],min((ll)a[p3]-a[p2],(ll)a[n]-a[p3])));
        mx=max(a[p1],max((ll)a[p2]-a[p1],max((ll)a[p3]-a[p2],(ll)a[n]-a[p3])));
        ans=min(ans,(ll)mx-mn);
    }
    printf("%lld",ans);
}

Measured memory_bytes: 1792
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "tmp.cpp"

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

  string s, t;
  cin >> s >> t;
  t = t.substr(0, t.length() - 1);
  say(t == s, "Yes", "No");
  return 0;
}


Measured memory_bytes: 3652
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		double ans=0;
		Scanner sc=new Scanner(System.in);
		double x1=Double.parseDouble(sc.next());
		double y1=Double.parseDouble(sc.next());
		double x2=Double.parseDouble(sc.next());
		double y2=Double.parseDouble(sc.next());
		ans= Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));
		String strAns=String.valueOf(ans);
		BigDecimal bd=new BigDecimal(strAns);
		BigDecimal A=bd.setScale(8, BigDecimal.ROUND_HALF_UP);
		//System.out.println(A);
		System.out.println(ans);
	}

}



Measured memory_bytes: 26472
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<int> L(N);
  rep(i,N) cin >> L[i];
  sort(L.begin(), L.end());
  ll ans = 0;
  for(int i=0; i<N-2; ++i) {
    for(int j=i+1; j<N-1; ++j) {
      auto it = lower_bound(L.begin()+j+1, L.end(), L[i]+L[j]);
      ans += distance(L.begin()+j+1, it);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Created on Wed Aug  8 22:33:01 2018
ABC045D
@author: maezawa
"""
import collections
h, w, n = list(map(int, input().split()))
areas = []
for i in range(n):
    ai, bi = list(map(int, input().split()))
    ai -= 1
    bi -= 1
    for j in range(3):
        for k in range(3):
            ci = ai + j - 1
            di = bi + k - 1
            if ci>=1 and ci <= h-2 and di>=1 and di <= w-2:
                areas.append(str(ci)+'-'+str(di))
c = collections.Counter(areas)
#print(c.values())
cn = list(c.values())
cn0 = (h-2)*(w-2)-sum([cn.count(i) for i in range(1,10)])
print(cn0)
for i in range(1,10):
    print(cn.count(i))


Measured memory_bytes: 148524
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
int main() {
	string S; cin >> S;
	if (S == "SUN") {
		cout << 7 << endl;
	}
	else if (S == "SAT") {
		cout << 1 << endl;
	}
	else if (S == "FRI") {
		cout << 2 << endl;
	}
	else if (S == "THU") {
		cout << 3 << endl;
	}
	else if (S == "WED") {
		cout << 4 << endl;
	}
	else if (S == "TUE") {
		cout << 5 << endl;
	}
	else cout << 6 << endl;
}


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

min_A = float('inf')
max_A = -1

for i in range(N):
    if A[i] < min_A:
        min_A = A[i]
    if A[i] > max_A:
        max_A = A[i]


print(max_A - min_A)

Measured memory_bytes: 3060
#include<stdio.h>

int main(void)
{
	int a, b;
	int perimeter, area;
	
	a = 0;
	b = 0;
	perimeter = 0;
	area = 0;
	
	// 数値入力
	scanf("%d%d", &a, &b);
	
	// 周の長さ計算
	perimeter = (a * 2) + (b * 2);
	
	// 面積
	area = a * b;
	
	// 計算結果出力
	printf("%d %d\n", area, perimeter);
	
	return 0;
}


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

using namespace std;

template <typename T>
inline T read()
{
	T x = 0;
	char ch = getchar();
	bool f = 0;
	while(ch < '0' || ch > '9')
	{
		f = (ch == '-');
		ch = getchar();
	}
	while(ch <= '9' && ch >= '0')
	{
		x = ((x + (x << 2)) << 1) + (ch - '0');
		ch = getchar();
	}
	return  f? -x : x;
}

template <typename T>
void put(T x)
{
	if(x < 0)
	{
		x = -x;
		putchar('-');
	}
	if(x < 10) {
		putchar(x + 48);
		return;
	}
	put(x / 10);
	putchar(x % 10 + 48);
	return ;
}

#define reg register
#define rd read <int>
#define pt(i) put <int> (i), putchar(' ')

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned long long ull;
typedef unsigned int ui;

const int Maxn = 2e5 + 111;

ll n, sum, nr, nb, ng;
struct N
{
	char c;
	int id;
	bool operator < (const N &x) const
	{
		return c == x.c ? id > x.id : c < x.c;
	}
}a[Maxn];
char c[Maxn];
int main()
{
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#endif
	cin >> n >> c + 1;
	if(n == 1 || n == 2)
	{
		puts("0");
		return 0;
	}
	for(int i = 1; i <= n; ++i)
	{
		if(c[i] == 'R') nr++;
		else if(c[i] == 'B') nb++;
		else if(c[i] == 'G') ng++;
		a[i].id = i;
		a[i].c = c[i];
	}
	sort(a + 1, a + n + 1);
	sum = nb * ng * nr;
	for(int i = 1; i <= nb; ++i)
	{
		for(int j = nb + 1; j <= ng + nb; ++j)
		{
			// 枚举两个
			if(((a[i].id + a[j].id) % 2) == 0)
			{
				int mid = (a[i].id + a[j].id) >> 1;
				if(c[mid] == 'R') sum--;
			}
			int nxt = 2 * a[j].id - a[i].id;
			if(nxt >= 1 && nxt <= n)
			{
				if(c[nxt] == 'R') sum--;
			}
			nxt = a[i].id * 2 - a[j].id;
			if(nxt >= 1 && nxt <= n)
			{
				if(c[nxt] == 'R') sum--;
			}
		}
	}
	cout << sum;
	return 0;
}

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

#define int long long
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
#define rep(i,a,n) for(int i=a; i<n; i++)
#define endl "\n"
#define E "\n"
#define show(arr) REP(i,arr.size()){cout<<arr[i]<<" ";}
const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const int MAX = 1e18;

#define N 5010

int sum(int x){
    int s=0;
    while(x>0){
        s+=x%10;
        x/=10;
    }
    return s;
}

void solve()
{
    int a,b,c,d,n;
    cin>>a>>b>>c>>d>>n;
    b = min(b,2*a);
    c = min(c,2*b);
    d = min(d,2*c);
    if (2*c<=d){
        cout<<n*c;
    }
    else {
        cout<<((n%2)?(n/2)*d+c:(n/2)*d);
    }
}

signed main()
{
    int t=1;
    //cin>>t;
    WL(t)solve();

    return 0;
}




Measured memory_bytes: 3596
#include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"iomanip"
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
ll pre1[maxn],pre2[maxn],a[maxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;++i)
    {
        cin>>a[i];
        //--a[i];
    }
    memset(pre1,0,sizeof pre1);
    memset(pre2,0,sizeof pre2);
    for(int i=0;i<n-1;++i)
    {
        int s=a[i],t=a[i+1];
        if(s<t)
        {
            pre1[0]+=t-s;
            pre1[s+1]-=t-s;
            pre1[t+1]+=t-s;
            pre1[s+1]+=1+t;
            pre1[t+1]-=1+t;
            pre2[s+1]--;
            pre2[t+1]++;
        }
        else
        {
            pre1[0]+=1+t;
            pre1[t+1]-=1;
            pre1[s+1]+=1;
            pre1[t+1]+=m-s;
            pre1[s+1]+=s;
            pre2[0]-=1;
            pre2[t+1]+=1;
            pre2[s+1]-=1;
        }
    }
        ll ans=2e15;
        for(int i=1;i<=m;++i)
        {
            pre1[i]+=pre1[i-1];
            pre2[i]+=pre2[i-1];
            //cout<<pre1[i]+i*pre2[i]<<" "<<i<<" i\n";
            ans=min(ans,pre1[i]+i*pre2[i]);
        }
        cout<<ans<<'\n';
}












Measured memory_bytes: 2560
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        n: usize,
    }

    let mut bmap: BTreeMap<usize, usize> = BTreeMap::new();
    
    for x in 1..=100 {
        for y in 1..=100 {
            for z in 1..=100 {
                *bmap.entry(x * x + y * y + z * z + x*y + y*z + z*x).or_insert(0) += 1;
            }
        }
    }
    for i in 1..=n {
        println!("{}", bmap.get(&i).unwrap_or(&0))
    }
}


Measured memory_bytes: 3032
<?php
while (fscanf(STDIN, "%d %d %d %d %d", $n, $a, $b, $c, $x)) {
  if(($n | $a | $b | $c | $x) == 0) break;
  
  $y = explode(' ', trim(fgets(STDIN)));

  $ans = -1;
  $idx = 0;
  for ($i = 0; $i < 10001; $i++) {
    if ($x == $y[$idx] && ++$idx == $n) {
      $ans = $i;
      break;
    }
    $x = ($a * $x + $b) % $c;
  }

  print $ans . "\n";
}
  

Measured memory_bytes: 6696
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
# list(map(int, input().split()))
class UnionFind(object):
    def __init__(self, n = 1):
        self.link = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.link[x] == x:
            return x

        # re-connect union find to make the height of tree lower
        # you can use while, but recursion makes it easier to reconnect
        self.link[x] = self.find(self.link[x])
        return self.link[x]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return

        if self.size[x] < self.size[y]:
            x, y = y, x
        self.link[y] = x
        self.size[x] += self.size[y]
    
    def get_size(self, x):
        x = self.find(x)
        return self.size[x]


while True:
    N = int(input())
    if N == 0:
        break
    cells = [0] * N
    for i in range(N):
        x, y, z, r = map(float, input().split())
        cells[i] = (x, y, z, r)
    
    edges = []
    for i in range(N):
        for j in range(i + 1, N):
            x1, y1, z1, r1 = cells[i]
            x2, y2, z2, r2 = cells[j]
            d = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2 + (z1 - z2) ** 2)
            if d <= r1 + r2:
                d = 0
            else:
                d = d - r1 - r2
            edges.append((d, i, j))

    edges = sorted(edges)

    u = UnionFind(N)
    ans = 0
    for e in edges:
        d, a, b = e
        if u.is_same(a, b):
            continue
        u.unite(a, b)
        ans += d
    print('{:.3f}'.format(ans))
            



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, N, C);
  vector D(C, vector(C, 0));
  rep(i, C) rep(j, C) cin >> D[i][j];
  vector c(N, vector(N, 0));
  rep(i, N) rep(j, N) cin >> c[i][j];

  vector cost(3, vector<pair<int, int>>());
  rep(i, 3) {
    V<int> cs;
    rep(j, N) rep(k, N) if (((j + 1) + (k + 1)) % 3 == i) {
      cs.push_back(c[j][k]);
      dbg(i, j, k);
      //  123
      // 1201
      // 2012
      // 3120
    }
    rep(j, C) {
      ll sum = 0;
      for (int csi : cs) sum += D[csi - 1][j];
      cost[i].push_back({sum, j});
      dbg(i, j, sum);
    }
    sort(all(cost[i]));
  }
  ll ans = numeric_limits<ll>::max();
  V<int> idx = {0, 1, 2};
  do {
    set<int> used;
    ll sum = 0;
    rep(i, 3) {
      for (auto& p : cost[idx[i]]) {
        if (used.insert(p.second).second) {
          dbg(idx[i], p.first, p.second);
          sum += p.first;
          break;
        }
      }
    }
    dbg(sum);
    ans = min(ans, sum);
  } while (next_permutation(all(idx)));
  out(ans);
}


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

using ll = long long;

template <typename T>
class fenwick_tree {
public:
    fenwick_tree(int n) : n(n), dat(n, 0) {}

    void add(int i, T value) {
        for(; i<n; i |= i + 1) {
            dat[i] += value;
        }
    }

    T sum(int i) const {
        T res = 0;
        for(; i>=0; i = (i & (i+1)) - 1) {
            res += dat[i];
        }
        return res;
    }
    // [l, r)
    T sum(int l, int r) const {
        return sum(r-1) - sum(l-1);
    }

private:
    const int n;
    vector<T> dat;
};


int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> S(N+1);
    for(int i=1; i<=N; ++i) {
        cin >> S[i];
        S[i] += S[i-1];
    }
    vector<ll> b(N+1);
    vector<ll> bs = {0};
    for(int i=1; i<=N; ++i) {
        b[i] = S[i] - i*K;
        bs.push_back(b[i]);
    }
    sort(bs.begin(), bs.end());
    bs.erase(unique(bs.begin(), bs.end()), bs.end());
    ll res = 0;
    fenwick_tree<ll> bit(N+1);
    for(int i=0; i<=N; ++i) {
        b[i] = lower_bound(bs.begin(), bs.end(), b[i]) - bs.begin();
        res += bit.sum(b[i]);
        bit.add(b[i], 1);
    }
    cout << res << endl;
}


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


using namespace std;


typedef long long int lli;
typedef long double ld;


double getDist(int x1, int y1, int x2, int y2) {
  int dx = x1-x2;
  int dy = y1-y2;
  int d = (dx*dx)+(dy*dy);
  return sqrt(d);
}


int main() {

  
  int n;
  cin >> n;
  vector<int> arx(n); 
  vector<int> ary(n);
  vector<int>  perm;
  for (int i = 0 ; i < n ; i++) {
    cin >> arx[i] >> ary[i];
    perm.push_back(i);
  }

  double sum = 0;
  do {
    for (int i = 1 ; i < n ; i++) {
      sum += getDist(arx[perm[i]], ary[perm[i]], arx[perm[i-1]], ary[perm[i-1]]);
    }
  } while (next_permutation(perm.begin(), perm.end()));


  int fact = 1;
  for (int i = 1 ; i <= n ; i++) {
    fact *= i;
  }


  sum = sum / fact;


  cout << fixed << setprecision(23) << sum << "\n";




  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

int main() {
  int x, a;
  cin >> x >> a;

  int ans = 10;
  if(x < a) {
    ans = 0;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
from math import gcd

K = int(input())


ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        tmp = gcd(i, j)
        if tmp == 1:
            ans += tmp*K
        else:
            for k in range(1, K+1):
                ans += gcd(tmp, k)
            

print(ans)

Measured memory_bytes: 9104
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S;
  int count = 0;
  cin >> S;
  for(int i = 0; i < S.length(); i++){
    for(int j = i + 1; j < S.length(); j++){
      if(S[i] == S[j]){
        count = count + 1;
      }
    }
  }
  if(count == 0){
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n,*t=map(int,open(0).read().split())
*z,=zip(t[::2],t[1::2])
s=set((a+b)%2for a,b in z)
if len(s)>1:
    print(-1)
    exit()
s,*_=s
d=[2**(38-i)for i in range(39)]+[1]*(s<1)
print(len(d))
print(*d)
for a,b in z:
    x=y=0
    for i in d:
        if abs(a-x)>abs(b-y):
            if a-x>0:
                print('R',end='')
                x+=i
            else:
                print('L',end='')
                x-=i
        else:
            if b-y>0:
                print('U',end='')
                y+=i
            else:
                print('D',end='')
                y-=i
    print()

Measured memory_bytes: 4660
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0, ans = 0, x = 0, y = 0, z = 0, n = 0, m = 0, maxy = -999999, mini = 99999999, counter = 0, counter2 = 0, endp = 0, checker = 0;

std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[100001], sec[100001];
long long int iremono2[100001],iremono3[100001], check[100001];
std::vector<long long int>kinds{}, kaku{};
char maze[1000][1000];
int sx, sy;
int gx, gy;

bool relation[1000][1000];
int twod[1001][1001];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
std::string output, output2, input, input2, input3;
char rev[100001];


int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

int N, M;//はんい
int bfs() {
	queue<pair<int, int>> que;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			twod[i][j] = INF;
		}
	}
	que.push(pair<int, int>(sx, sy));
	twod[sx][sy] = 1;
	while (que.size()) {
		pair<int, int> p = que.front();
		que.pop();
		if (p.first == gy && p.second == gx) {
			break;
		}
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i], ny = p.second + dy[i];
			if (1 <= nx && nx <= N && 1 <= ny && ny <= M && maze[nx][ny] != '#'&&twod[nx][ny] == INF) {
				que.push(pair<int, int>(nx, ny));
				twod[nx][ny] = twod[p.first][p.second] + 1;
			}
		}
	}
	return twod[gy][gx];
}
vector <int> g[100100];
int main()
{
	cin >> a;
	rep(i, a) {
		cin >> iremono[i];
		counter += std::abs(iremono[i]);
		if (iremono[i] < 0) {
			b++;
		}
		if (std::abs(mini) > std::abs(iremono[i])) {
			mini = std::abs(iremono[i]);
		}
	}
	if (b % 2 == 0) {
		cout << counter << endl;
	}
	else {
		cout << counter - mini*2 << endl;
	
	}

}


Measured memory_bytes: 7168
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

def calc_taple(x):
    if x % 10 == 0:
        num = 10
    else:
        num = x % 10
    return(num, x)

lst = []
lst.append(calc_taple(a))
lst.append(calc_taple(b))
lst.append(calc_taple(c))
lst.append(calc_taple(d))
lst.append(calc_taple(e))
lst = sorted(lst)
res = 0
for elem1, elem2 in lst[1:]:
    res += elem2 + (10 - elem1)
res += lst[0][1]
print(res)

Measured memory_bytes: 3064
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	double t, a;
	cin >> t >> a;
	vector<double>h(n);
	double ans = 1001001;
	double now = 0;
	int now_2 = 0;
	rep(i, n) {
		cin >> h[i];
		if (t - h[i] * 0.006 - a >= 0) {
			now = t - h[i] * 0.006 - a;
		}
		else {
			now = -(t - h[i] * 0.006 - a);
		}
		if (now < ans) {
			now_2 = i;
		}
		ans = min(now, ans);
		
	}
	cout << now_2+1 << endl;
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    long long sum = 0;
    int length = s.length();
    long long number = stol(s);

    for(int i = 0; i < pow(2, length - 1); ++i){
        int bits = i;
        long long p = number;
        // cout << bitset<10>(bits) << " ";
        for(int j = 0, q = 1; j < length - 1; ++j){            
            q = q * 10;
            if((bits >> j) & 1){
                sum += p % q;
                // cout << p % q << " ";
                p = p / q;
                q = 1;
            }
        }
        sum += p;
        // cout << sum << endl;
    }
    cout << sum << endl;
}

Measured memory_bytes: 4024
import java.util.*;
public class Main {
    public static void main(String[] ano) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        Stack <Integer> stack = new Stack <Integer> ();
        while(scan.hasNext()){
        	int in =scan.nextInt();
        	if(in == 0)System.out.println(stack.pop());
        	else stack.push(in);
        }
    }
}

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

#define    ll     long long int

const int N = 200005;
vector<int> g[N];
int n, m;

int main( )
{
    cin >> n >> m;
    int i, j, k, u, v;
    for (i = 1; i <= m; i++) {
        cin >> j >> k;
        g[j].push_back(k);
        g[k].push_back(j);
    }
    for (i = 0; i < (int) g[1].size(); i++) {
        u = g[1][i];
        for (j = 0; j < (int) g[u].size(); j++) {
            v = g[u][j];
            if (v == n) {
                cout << "POSSIBLE\n";
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE\n";
    return 0;
}


Measured memory_bytes: 12016
import math
def combination_count(n,k):
    if k > n or k < 0:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
  
 
  
p,q = map(int,input().split())
 
m = 10**9 + 7
 
for i in range(1,q+1):
  a =  combination_count(p-q+1,i) * combination_count(q-1,i-1)
  print(a%m)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int edge,to[N],d[N],dis[N],last[N],x,y,Next[N],n,m;
queue <int> q;
void add(int x,int y){
	to[++edge]=y;
	Next[edge]=last[x];
	last[x]=edge;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		d[y]++;
		add(x,y);
	}
	for (int i=1;i<=n;i++) 
		if(!d[i]) q.push(i);
	while (!q.empty()){
		x=q.front();
		q.pop();
		for (int i=last[x];i;i=Next[i]){
			int u=to[i];
			d[u]--;
			dis[u]=max(dis[u],dis[x]+1);
			if (!d[u]) q.push(u);
		}
	} 
	int ans=0;
	for (int i=1;i<=n;i++) ans=max(ans,dis[i]);
	printf("%d\n",ans);
} 

Measured memory_bytes: 2432
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    A = list(map(int, input().split()))

    for i in range(0, N):
        A[i] = A[i] - (i+1)
    
    sorted_A = sorted(A)
    b = sorted_A[N//2]

    ans = 0
    for i in range(0, N):
        ans += abs(A[i] - b)

    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 26180
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

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

	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	reverse(t.begin(),t.end());

	for(int i=1;i<=min(s.length(),t.length());i++)
	{
		if(s[i-1]==t[i-1])
		{
			continue;
		}
		if(s[i-1]>t[i-1])
		{
			cout << "No" << endl;
			return 0;
		}
		if(s[i-1]<t[i-1])
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	if(s.length()<t.length())
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

// 

public class ABC144_B // ←Class名変更！！    Program
{
    public static void Main()
    {
        var n = Ri();
        var result = "No";

        if (81<n)
        {
            WriteLine($"{result}");
            return;
        }


        for (int i = 1; i < 10; i++)
        {
            var a = n % i;
            var v = n / i;
            if (a ==0 && v<=9)
            {
                result = "Yes";
                break;
            }
        }


        WriteLine($"{result}");
        return;

    } // Main

    public static string Rs() { return ReadLine(); }
    public static char Rc() { var c = ReadLine(); return c[0]; }    //最初の1文字だけ返す
    public static int Ri() { return int.Parse(ReadLine()); }
    public static long Rl() { return long.Parse(ReadLine()); }
    public static char[] Rca() { return ReadLine().ToCharArray(); }
    public static int[] Ria() { return Array.ConvertAll(ReadLine().Split(' '), int.Parse); }
    public static long[] Rla() { return Array.ConvertAll(ReadLine().Split(' '), long.Parse); }
} // Class


Measured memory_bytes: 13140
#include <algorithm>
#include <cstdio>
#include <cstring>

#define int long long

const int Maxv = 300010; 

int sum[Maxv], val[Maxv], a[Maxv], b[Maxv], suma, sumb, ans; 

inline char fgc() {
    static char buf[1 << 15], *p1 = buf, *p2 = buf; 
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 15, stdin), p1 == p2) ? EOF : *p1++; 
}

inline int read() {
    static int x, ch; 
    x = 0, ch = fgc(); 
    while (ch < '0' || ch > '9') ch = fgc(); 
    while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = fgc(); 
    return x; 
}

signed main() {
    int n = read(); 
    
    for (int i = 1; i <= n; i++) {
        a[i] = read(); 
        suma += a[i]; 
        b[i] = read();
        sumb += b[i];  
        val[(i << 1) - 1] = a[i]; 
        val[i << 1] = b[i]; 
    }   

    ans = std::min(suma, sumb); 
    std::sort(val + 1, val + (n << 1) + 1); 
    
    for (int i = 1; i <= (n << 1); i++) 
        sum[i] += sum[i - 1] + val[i]; 

    for (int i = 1; i <= n; i++) {
       int idx = n, tmp = 0; 
       if (a[i] <= val[idx - 1]) 
            idx++; 
        else
            tmp += a[i]; 
        if (b[i] <= val[idx - 1])
            idx++; 
        else
            tmp += b[i]; 

        ans = std::min(ans, tmp + sum[idx - 2]); 
    }

    printf("%lld\n", ans); 

    return 0; 
}

Measured memory_bytes: 7552