akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }

i64 ceil(i64 a, i64 b) { return (a+b-1)/b; }
mt19937 rnd(time(NULL));

int d, c[30], s[404][30];
int ans[400];
clock_t start;

int score(int a[400], int l, int r){
	int cnt = 0;
	int last[26] = {};
	fill(last,last+26,l-1);
	
	for(int i = l; i < r; i++){
		cnt += s[i][a[i]];
		last[a[i]] = i;
		for(int j = 0; j < 26; j++){
			cnt -= c[j]*(i-last[j]);
		}
	}
	return cnt;
}

void solve(){
	start = clock();
	
	cin >> d;
	for(int i = 0; i < 26; i++) cin >> c[i];
	for(int i = 0; i < d; i++){
		for(int j = 0; j < 26; j++) cin >> s[i][j];
	}
	
	int ma = 0;
	for(int i = 0; i < d; i++){
		// int v = i%26;
		// ans[i] = v;
		ans[i] = rnd()%26;
	}
	ma = score(ans,0,d);
	
	int cc[30] = {};
	for(int i = 0; i < 26; i++){
		cc[i+1] = c[i] + cc[i];
	}
	
	int value[30] = {};
	int lp = 0;
	while(clock()-start < 1.9*CLOCKS_PER_SEC){
		int res[400] = {};
		int last[26] = {};
		fill(last,last+26,-1);
		for(int i = 0; i < d; i++){
			res[i] = ans[i];
			int r = rnd()%100;
			if(r == 0){
				for(int j = 0; j < 26; j++){
					value[j+1] = value[j];
					value[j+1] += c[i] * pow(i-last[j],2);
					value[j+1] += s[i][j];
				}
				r = rnd()%value[26];
				r = lower_bound(value,value+26, r)-value-1;
				res[i] = r;
			}
			last[res[i]] = i;
		}
		
		if(chmax(ma,score(res,0,d))){
			for(int i = 0; i < d; i++){
				ans[i] = res[i];
			}
		}
		//cout << score(res,0,d) << endl;
		lp++;
	}
	//cout << lp << endl;
	//cout << ma << endl;
	
	for(int i = 0; i < d; i++){
		cout << ans[i]+1 << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3712
//Catchharsh
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    #define see(x) cout<<#x<<" = "<<x<<endl
    const ll MOD = 1e9+7;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (ll x,ll n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    int main()
    {   
         IOS;
         int n,m,i,j,k;
         cin>>n;
         set<int> v;
         string s;
         cin>>s;
         map<int,vector<int> > mp;
         for(i=0;i<n;i++)
         {
           mp[s[i]-'0'].pb(i);
         }
         for(i=0;i<10;i++)
         {
           if(!mp[i].empty()) sort(mp[i].begin(),mp[i].end());
         }

         for(i=0;i<10;i++)
         {
           for(j=0;j<10;j++)
           {
             for(k=0;k<10;k++)
             {
               int num=i*100+j*10+k;
               v.insert(num);
             }
           }
         }
         ll cnt=0;
         vector<int> ::iterator it,it1,it2;
         for(auto it=v.begin();it!=v.end();it++)
         {
             int num=*it;
             int a=(num/100);
             int b=(num/10)%10;
             int c=num%10;
             int ida,idb,idc;
             // cout<<a<<" "<<b<<" "<<c<<endl;
             if(!mp[a].empty())
             {
                ida=mp[a][0];
                if(!mp[b].empty())
                {
                   int id= upper_bound(mp[b].begin(),mp[b].end(),ida)-mp[b].begin();
                   if(id<mp[b].size()&&mp[b][id]>ida)
                   {
                     idb=mp[b][id];
                      if(!mp[c].empty())
                      {
                         int id1=upper_bound(mp[c].begin(),mp[c].end(),idb)-mp[c].begin();
                         if(id1<mp[c].size()&&mp[c][id1]>idb)
                          cnt++;
                      }
                   }
                }
             }


         }
         cout<<cnt; 
         
         cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
    }

Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int cnt = (N + 1) / 2;
    if(cnt >= K) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();
		int[] ans = new int[1000000];


		for(int i = 1; i <= 100; i++) {
			for(int j = 1; j <= 100; j++) {
				for(int k = 1; k <= 100; k++) {
					int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
					ans[tmp]++;
				}
			}
		}

		for(int i = 1; i <= N; i++) {
			System.out.println(ans[i]);
		}
	}
}


Measured memory_bytes: 42684
let rec drop n ls =
    match ls with
    | x :: xs when n > 0 -> drop (n - 1) xs
    | _ -> ls

let add a b =
    if a = max_int || b = max_int then max_int
    else a + b

let update dp w v =
    let rec update_sub dp dp_v =
        match dp, dp_v with
        | x :: dp', x_v :: dp_v' -> min x (add w x_v) :: update_sub dp' dp_v'
        | x :: dp', []         -> min x w :: update_sub dp' []
        | []      , []         -> []
        | _                    -> failwith "failed"
    in update_sub dp (drop v dp)

let find_index p ls =
    let rec find_index_sub n ls =
        match ls with
        | x :: xs ->
            if p x then n
            else find_index_sub (n + 1) xs
        | [] -> failwith "not found"
    in find_index_sub 0 ls

let solve (ws, vs) weight max_v dp =
    let rec solve_sub (ws, vs) dp =
        match (ws, vs) with
        | (w :: ws', v :: vs') -> solve_sub (ws', vs') (update dp w v)
        | _ -> dp
    in max_v - find_index ((>=) weight) (solve_sub (ws, vs) dp)

let () =
    Scanf.scanf "%d %d\n" @@ fun n w ->
        let rec loop n =
            if n = 0 then ([], [])
            else Scanf.scanf "%d %d\n" @@ fun w v ->
                let (ws, vs) = loop (n - 1) in
                (w :: ws, v :: vs)
        in
        let ws, vs = loop n in
        let rec init n =
            if n = 0 then []
            else max_int :: init (n - 1)
        in
        let max_v = List.fold_left (+) 0 vs in
        Printf.printf "%d\n" @@ solve (ws, vs) w max_v (init max_v)


Measured memory_bytes: 20224
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class Main {

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

		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){

			final Integer inputSeconds = Integer.valueOf(br.readLine());

			final LocalTime time = LocalTime.ofSecondOfDay(inputSeconds);
			final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("H:m:s");

			System.out.println(time.format(formatter));
		}

	}

}


Measured memory_bytes: 31664
anntena = [0]*5
for i in range(5):
    anntena[i] = int(input())
k = int(input())
flag = True
for i in range(4):
    for j in range(i, 5):
        if abs(anntena[i]-anntena[j]) > k:
            flag = False
            break
    else:
        continue
    break
if flag:
    print("Yay!")
else:
    print(":(")

Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
	int N, x;
	cin >> N >> x;

	vector<int> a;
	inputVector(a, N);

	sort(all(a));

	int ret = 0;
	rep(i, N) {
		x -= a[i];
		if (i < N - 1 && x >= 0) ret++;
		else if (i == N - 1 && x == 0) ret++;
	}

	cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
n, y = map(int, input().split())
flag = 0
for i in range(min(n, y//10000)+1):
    if flag == 1:
        break
    else:
        for j in range(min(n-i, (y-10000*i)//5000)+1):
            amari = y - (10000*i + 5000*j)
            if amari // 1000 == n-i-j:
                print(i, j, n-i-j)
                flag += 1
                break

if flag == 0:
    print(-1, -1, -1)

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

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

vector<int> A(N);
vector<int> B(N);
vector<int> C(N - 1);

for (int i = 0; i < N; i++) cin >> A.at(i);
for (int i = 0; i < N; i++) cin >> B.at(i);
for (int i = 0; i < N - 1; i++) cin >> C.at(i);

int B_sum = 0;

for (int i = 0; i < N; i++) {
  B_sum += B.at(i);
}

int C_sum = 0;

for (int i = 1; i < N; i++) {
  if (A.at(i) - A.at(i - 1) == 1) {
    int X = A.at(i - 1);
    C_sum += C.at(X - 1);
  }
}

cout << B_sum + C_sum << endl;

}


Measured memory_bytes: 256
import sys


N = input()
    

N_in = int(N)

if N_in>10000 or N_in<0:
    print('error')
    sys.exit()

N = N_in/1000;

N_f = float(N)

N_i = int(N)


if (N_f - N_i) == 0:
    Ans = 0
    print(Ans)

else:
    N_i = N_i + 1
    Ans = N_i*1000 - N_in
    print(Ans)

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


namespace AtCoder
{
    class AtCoderrr
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var result = new Dictionary<string, int>();
            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                char[] s = ReadLine().ToCharArray();
                Array.Sort(s);
                string sorted = string.Join("", s);
                if (result.ContainsKey(sorted))
                {
                    result[sorted]++;
                    ans += result[sorted];
                }
                else result.Add(sorted,0);
            }

            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 29628
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  string ans = "Christmas";
  rep(i, 25 - N) {
    ans += " Eve";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>UE(N);
  vector<int>ST(N);
  vector<int>UES(N);
  vector<int>STS(N);
  vector<int>Ans(N);
  for(int i=0;i<N;i++){
    cin>>UE[i];
    if(i==0){
      UES[i]=UE[i];
    }
    else{
      UES[i]=UES[i-1]+UE[i];
    }
  }
  for(int i=0;i<N;i++){
    cin>>ST[i];
    if(i==0){
      STS[i]=ST[i];
    }
    else{
      STS[i]=STS[i-1]+ST[i];
    }
  }
  Ans[0]=UES[0]+STS[N-1];
  for(int i=1;i<N;i++){
    Ans[i]=UES[i]+STS[N-1]-STS[i-1];
  }
  sort(Ans.begin(),Ans.end());
  cout<<Ans[N-1]<<endl;
}
  
  
  


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.length()==2){
            System.out.println(s);            
        }else{
            for(int i=2; i>=0; i--){
                System.out.print(s.charAt(i));
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 23252
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;
const double pi=2*acos(0.0);
//abc169d



int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=2;i*i<=n;i++){
        
        if(n%i==0){
            ll cnt=0;
        while(n%i==0){
            cnt++;
            n/=i;
        }
        ll now=1;
        while(true){
            if(cnt-now<0) break;
            ans++;
            cnt-=now;
            now++;
        }
        }
    }
    if(n!=1)ans++;
    
    
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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

int main(){
  ll A, B, C, K;
  int max=0;
   cin >> A >> B >> C >> K;
  
  rep(i,K){
    if(i<A) max += 1;
    if(A<=i&&i<A+B) max=max;
    if(A+B<=i&&i<=A+B+C) max-= 1;
    
  }
   cout << max << endl;
   return 0;
  
}
  
  


Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

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

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
    int n,k;
    cin >> k >> n;
    mint sum(n);
    sum = sum.pow(k);
    mint tmp(0);
    
    for(int i = 1;i<=n;i++) {
        combination comb(n);
        mint cnt = mint(n-i).pow(k);
        if(i%2==1) {
            tmp += comb(n,i)*cnt;
        } else {
            tmp -= comb(n,i)*cnt;
        }
        // cout << tmp << endl;
    }
    // cout << sum << endl;
    mint ans = sum - tmp;
    cout << ans.x << endl;
}


Measured memory_bytes: 3128
#include<stdio.h>
int main(){
 	int i;
  int n;
  int a[101]={0};
  	int ans = 0;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
   	scanf("%d",&a[i]); 
  }
  
for(i=0;i<n;i++){
 if(i%2==0&&a[i]%2==1){
  ans++; 
 }
}

  printf("%d",ans);
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=1005;
const int maxm=200005;
int n,m,ql,qr;
vector<pii>dat[maxn];
bitset<maxn>edge[maxn],val1[maxn],val2,vis,cur;
int que[maxn];
bool ans[maxm];

void bfs(){
	while(ql<qr){
		int x=que[ql++];
		cur=~vis&edge[x];
		int y=-1;
		for(;;){
			y=cur._Find_next(y);
			if(y>=n)break;
			vis[y]=1;
			que[qr++]=y;
		}
	}
}

int main(){
	scanf("%d%d",&n,&m);
	rep(i,m){
		int u,v;
		scanf("%d%d",&u,&v);
		u--;v--;
		edge[u][v]=1;
		dat[u].pb(mp(v,i));
	}
	rep(i,n){
		ql=qr=0;
		vis=0;
		vis[i]=1;
		que[qr++]=i;
		bfs(); 
		val1[i]=vis;
	}
	rep(i,n){
		val2=0;
		ql=qr=0;
		vis=0;
		vis[i]=1;
		rep(j,int(dat[i].size())){
			int k=dat[i][j].fst;
			if(vis[k]){
				val2[k]=1;
				continue;
			}
			vis[k]=1;
			que[qr++]=k;
			bfs();
		}
		ql=qr=0;
		vis=0;
		vis[i]=1;
		for(int j=int(dat[i].size())-1;j>=0;j--){
			int k=dat[i][j].fst;
			if(vis[k]){
				val2[k]=1;
				continue;
			}
			vis[k]=1;
			que[qr++]=k;
			bfs();
		}
		rep(j,int(dat[i].size())){
			int k=dat[i][j].fst;
			ans[dat[i][j].snd]=(val1[k][i]!=val2[k]);
		}
	}
	rep(i,m)puts(ans[i]?"diff":"same");
	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<29;
const ll LINF = 1LL<<58;

void solve() {
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, n) cin >> A[i];
    map<ll, int> mp;
    rep(i, n) mp[i - A[i]]++;
    ll ans = 0;
    rep(i, n) {
        mp[i - A[i]]--;
        ans += mp[A[i] + i];
    }
    cout << ans << endl;
    return;
}

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


Measured memory_bytes: 26576
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
int n,i,x,mn=inf,mx;
int main() 
{
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(i=1;i<=n;i++)
	{
		cin>>x;
		mn=min(mn,x);
		mx=max(mx,x);
	}
	cout<<mx-mn<<endl;
	return 0;
}

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

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

    vector<char> ACGT = {'A','C','G','T'};

    int kan = 0;
    int max = 0;
    bool ni = false;

    for (int i = 0; i < s.length(); i++){
        for (char x : ACGT){
            if (s[i] == x){
                kan++;
                ni = true;
                break;
            }
        }
        if (ni == false || i == s.length() - 1){
            if(max < kan) max = kan;
            kan = 0;
        }else{
            ni = false;
        }
    }

    cout << max << endl;
    return 0;
}

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

int main() {
	int a;
	int b;
	int c;
	int d;

	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	if (a + b > c + d)
		cout << "Left" << endl;
	else if (a + b == c + d)
		cout << "Balanced" << endl;
	else
		cout << "Right" << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    adj=[[]for _ in range(N)]
    for i in range(N-1):
        a,b=MI()
        a-=1
        b-=1
        adj[a].append(b)
        adj[b].append(a)
    c=LI()
    c.sort(reverse=True)    
    
    import queue
    q=queue.Queue()
    q.put(0)
    ans=[0]*N
    ans[0]=c[0]
    now=0
    
    while not q.empty():
        v=q.get()
        for nv in adj[v]:
            if ans[nv]==0:
                now+=1
                ans[nv]=c[now]
                q.put(nv)
                
    S=sum(c)-c[0]
    print(S)
    print(' '.join(map(str, ans)))
        

    

main()


Measured memory_bytes: 78596
n = int(input())
c = 0

def divisors(n):
    yakusu = []
    for i in range(1, int(n ** 0.5) + 1):
        if (n % i == 0):
            yakusu.append(i)
            if (i * i != n):
                yakusu.append(n // i)
    return yakusu

for i in range(1, n + 1, 2):
    if (len(divisors(i)) == 8):
        c += 1
print(c)




Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;
const long long MAXN=1005,SIZE=5,MOD=1000000007;

long long PowMod(long long a,long long b)
{
	long long res=1;
	while(b)
	{
		if(b&1)
			res=1LL*res*a%MOD;
		a=1LL*a*a%MOD;
		b>>=1;
	}
	return res;
}

struct Matrix
{
	long long n,A[SIZE][SIZE];

	long long * operator [] (long long i)
	{return A[i];}
	const long long * operator [] (long long i)const
	{return A[i];}
	
	Matrix operator * (const Matrix &B)const
	{
		Matrix res;
		res.n=n;
		for(long long i=1;i<=n;i++)
			for(long long j=1;j<=n;j++)
				res[i][j]=0;
		for(long long i=1;i<=n;i++)
			for(long long j=1;j<=n;j++)
				for(long long k=1;k<=n;k++)
					res[i][j]=(res[i][j]+1LL*A[i][k]*B[k][j])%MOD;
		return res;
	}
	Matrix Pow(long long x)
	{
		Matrix res;
		res.n=n;
		for(long long i=1;i<=n;i++)
			for(long long j=1;j<=n;j++)
				res[i][j]=0;
		for(long long i=1;i<=n;i++)
			res[i][i]=1;
		while(x)
		{
			if(x&1)
				res=res*(*this);
			*this=(*this)*(*this);
			x>>=1;
		}
		return res;
	}
};

long long H,W,K;
char str[MAXN][MAXN];
long long lr,ud,v,ev,eh;

int main()
{
	scanf("%lld%lld%lld",&H,&W,&K);
	for(long long i=1;i<=H;i++)
		scanf("%s",str[i]+1);
	for(long long j=1;j<=W;j++)
		ud+=(str[1][j]=='#'&&str[H][j]=='#');
	for(long long i=1;i<=H;i++)
		lr+=(str[i][1]=='#'&&str[i][W]=='#');
	for(long long i=1;i<=H;i++)
		for(long long j=1;j<=W;j++)
			v+=(str[i][j]=='#');
	for(long long i=1;i<H;i++)
		for(long long j=1;j<=W;j++)
			ev+=(str[i][j]=='#'&&str[i+1][j]=='#');
	for(long long i=1;i<=H;i++)
		for(long long j=1;j<W;j++)
			eh+=(str[i][j]=='#'&&str[i][j+1]=='#');
	if(lr>0&&ud>0)
		puts("1");
	else if(lr==0&&ud==0)
		printf("%lld\n",PowMod(v,K-1));
	else if(lr>0&&ud==0)
	{
		swap(lr,ud);
		swap(ev,eh);
	}
	if(lr==0&&ud>0)
	{
		//printf("%lld %lld %lld\n",v,ev,ud);
		Matrix f;
		f.n=2;
		f[1][1]=v;
		f[1][2]=0;
		f[2][1]=ev;
		f[2][2]=ud;
		f=f.Pow(K-1);
		long long V=f[1][1],E=f[2][1];
		printf("%lld\n",((V-E)%MOD+MOD)%MOD);
	}
	
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#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
*/
int main() {
  ll a,b,n;
  cin >> a >> b >> n;
  if(n>=b){n=b-1;}
  cout << (a*n/b) << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int a[200010],num[200010];

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

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

#define ll long long
#define pb push_back

void solve()
{
    char c;
    cin >> c;
    if(c>=65 && c<=90)
        cout << "A" << "\n";
    else
        cout << "a" << "\n";
}

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

    int tt=1;
    ///cin >> tt;
    while(tt--)
        solve();
}


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

using namespace std;

template<typename T>
bool chmax(T& a, const T& b){
  if(a < b){
    a = b;
    return true;
  }else return false;
}

int main(){
  int R, C, K;
  cin >> R >> C >> K;
  
  vector<vector<long long>> item(R, vector<long long>(C, 0));
  for(int k = 0; k < K; k++){
    int r, c;
    long long v;
    cin >> r >> c >> v;;
    item[r - 1][c - 1] += v;
  }
  
  vector<vector<vector<long long>>> dp(R + 1, vector<vector<long long>>(C + 1, vector<long long>(4, 0)));
  for(int i = 0; i < R; i++){
    for(int j = 0; j < C; j++){
      for(int t = 3; t >= 0; t--){
        if(t){
          chmax(dp[i][j][t], dp[i][j][t - 1] + item[i][j]);
        }
        chmax(dp[i][j + 1][t], dp[i][j][t]);
        chmax(dp[i + 1][j][0], dp[i][j][t]);
      }
    }
  }
  
  long long max_v = 0;
  for(int i = 0; i <= R; i++){
    for(int j = 0; j <= C; j++){
      max_v = max({dp[i][j][0], dp[i][j][1], dp[i][j][2], dp[i][j][3], max_v});
    }
  }
  
  cout << max_v << endl;
  
  return 0;
}

Measured memory_bytes: 707188
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
    n,k=map(int,input().split())
    s=input()
    print(s[:k-1]+s[k-1].lower()+s[k:])

resolve()

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

int M[3][3], n, cnt[200];

int32_t main()
{   
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++)
			cin >> M[i][j];

	cin >> n;
	vector<int> arr;
	while(n--)
	{
		int x;
		cin >> x;
		cnt[x]++;
	}
	
	bool fl = false;
	for(int i = 0; i < 3; i++)
	{
		int c1 = 0, c2 = 0;
		for(int j = 0; j < 3; j++)
		{
			if(cnt[M[i][j]])
				c1++;
			if(cnt[M[j][i]])
				c2++;
		}
		if(c1 == 3 or c2 == 3) fl = true;
	}
	
	if( cnt[ M[0][0] ] and cnt[ M[1][1] ] and cnt[ M[2][2] ])
		fl = true;
	
	if( cnt[ M[2][0] ] and cnt[ M[1][1] ] and cnt[ M[0][2] ])
		fl = true;
	
	puts(fl ? "Yes" : "No");
	
	
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
    string s;
    cin>>s;

    if ( s[1] == 'R' )
    {
        cout<<"ABC"<<endl;
    }
    else
    {
        cout<<"ARC"<<endl;
    }
    
}

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

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define DEBUG(x) cout<<(#x)<<" is "<<(x)<<endl //to debug values of variables
#define ZINDA cout<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
#define mod 1000000007
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
lld power(lld b, lld e)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
 
int nDig(lld n)
{
	return floor(log10(n) + 1);
}

//--------------------------------------------------------------------------------
 
int main()
{
    SPEEDUP;
 	lld h,a,k=0;
 	cin>>h>>a;

 	while(h>0)
 	{
 		h-=a;
 		k++;
 	}

 	cout<<k;
    return 0;
}

Measured memory_bytes: 256
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;

ll dp[100005][13];
int arr[100005];

int main() //PointBlank's code ¯\_(ツ)_/¯
{
    string s;
    cin >> s;
    int n = s.size();
    rep(i, 0, n) if(s[i] == '?') arr[i + 1] = -1; else arr[i + 1] = s[i] - '0';
    dp[0][0] = 1;

    repp(i, 1, n){
        if(arr[i] == -1) rep(k, 0, 10) rep(j, 0, 13) dp[i][(k  + j*10) % 13] += dp[i - 1][j];
        else rep(j, 0, 13) dp[i][(arr[i] + j*10) % 13] += dp[i - 1][j];
        rep(j, 0, 13) dp[i][j] %= MOD;
    } 

    cout << dp[n][5];
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 14188
gets
s = gets.chomp

top = ""

a_b = 0

s.chars{|c|
    if c == "("
        a_b += 1
    else
        a_b -= 1
    end
    
    if a_b < 0
        top += "("
        a_b += 1
    end
}
result = top + s
a_b.times{|i|
    result += ")"
}
puts result

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

using namespace std;

using int64 = long long;

struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};

#define int long long

signed main() {
  int N, M, A[100000], B[100000];
  cin >> N >> M;
  UnionFind uf(N);

  for(int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
    --A[i], --B[i];
  }
  int ret = 0;

  vector< int > ans(M);
  for(int i = M - 1; i >= 0; i--) {
    ans[i] = 1LL * N * (N - 1) / 2 - ret;
    if(uf.find(A[i]) != uf.find(B[i])) {
      ret += 1LL * uf.size(A[i]) * uf.size(B[i]);
      uf.unite(A[i], B[i]);
    }
  }
  for(auto &p : ans) cout << p << endl;
}






Measured memory_bytes: 4096
/*************************************************************************
    > File Name: D.cpp
    > Author: PumpkinYing
    > Created Time: 2018/8/18 20:21:30
 ************************************************************************/

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define PII pair<int,int>
typedef long long ll;

const int maxn = 510;

int num[maxn][maxn];

int main()
{
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	for(int i = 0;i < m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		num[u][v]++;
	}
	for(int i = 1;i <= n;i++)
		for(int j = 2;j <= n;j++) num[i][j] += num[i][j-1];

	for(int i = 0;i < q;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		int ans = 0;
		for(int l = u;l <= v;l++) ans += num[l][v];
		printf("%d\n",ans);
	}

	return 0;
}


Measured memory_bytes: 1920
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;


int main() {
    long long X, Y;
    cin >> X >> Y;

    cout << ((abs(X - Y) > 1) ? "Alice" : "Brown" )<< endl;
}



Measured memory_bytes: 256
#if defined(ONLINE_JUDGE) && !defined(NDEBUG)
#define NDEBUG
#endif

#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;


static int item[3010][3010];
static large dp[3010][3010][4];

int main()
{
    int R, C, K; // 3000, 200'000
    cin >> R >> C >> K;
    for (int i = 0; i < K; ++i) {
        int r, c, v;
        cin >> r >> c >> v;
        item[r][c] = v;
    }




    for (int row = 1; row <= R; ++row) {
        for (int col = 1; col <= C; ++col) {

            dp[row][col][0] = max({
                dp[row][col-1][0],
                dp[row-1][col][0],
                dp[row-1][col][1],
                dp[row-1][col][2],
                dp[row-1][col][3],
            });

            {
                dp[row][col][1] = dp[row][col][0] + item[row][col];
                if (dp[row][col][1] < dp[row][col-1][1]) {
                    dp[row][col][1] = dp[row][col-1][1];
                }
            }

            for (int i = 2; i <= 3; ++i) {
                if (dp[row][col-1][i-1] + item[row][col] < dp[row][col-1][i]) {
                    dp[row][col][i] = dp[row][col-1][i];
                } else {
                    dp[row][col][i] = dp[row][col-1][i-1] + item[row][col];
                }
            }
        }
    }

#ifndef NDEBUG
    for (int row = 1; row <= R; ++row) {
        for (int col = 1; col <= C; ++col) {
            for (int i = 0; i < 4; ++ i) {
                cerr << dp[row][col][i] << (i+1==4 ? " " : "/");
            }
        }
        cerr << "\n";
    }
    for (int row = 1; row <= R; ++row) {
        for (int col = 1; col <= C; ++col) {
            cerr << setw(4) << item[row][col] << " ";
        }
        cerr << "\n";
    }
#endif

    cout << max({
        dp[R][C][0],
        dp[R][C][1],
        dp[R][C][2],
        dp[R][C][3],
    });
    return 0;
}


Measured memory_bytes: 320912
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

cs = Counter(s)
ct = Counter(t)

ans = -10000
for key, value in cs.items():
    if ct[key] > 0:
        ans = max(ans, value - ct[key])
    else:
        ans = max(ans, value)
for key, value in ct.items():
    if cs[key] > 0:
        ans = max(ans, -value + ct[key])
    else:
        ans = max(ans, -value)

print(ans)

Measured memory_bytes: 3316
import java.util.*;
public class Main{
  public static void main(String[] args)
  {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] x = new int[n];
    int[] y = new int[n];
    for(int i=0;i<n;i++)
    {
      x[i] = input.nextInt();
      y[i] = input.nextInt();
    }
    float sum = 0.0f;
    for(int i=0;i<n;i++)
    {
      for(int j=i+1;j<n;j++)
      {
        sum+=(2.0*dist(x,y,i,j))/(float)n;
        }   
      
    }
    System.out.printf("%.10f\n",sum);
  }
   public static float dist(int[] x,int[] y,int i,int j)
   {
     double a = (double)(x[i]-x[j]);
     double b = (double)(y[i]-y[j]);
     
     return (float)Math.pow((a*a+b*b),0.5);
   }
}

Measured memory_bytes: 22740
#include<stdio.h>
int main()
{
	int n, d, x, a, i, j, count;
	while(~scanf("%d %d %d", &n, &d, &x))
	{
		count = 0;
		for(i=0; i<n; i++)
		{
			scanf("%d", &a);
			for(j=0; (j*a+1)<=d; j++) count++;
		}
		printf("%d\n", x+count);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  string s;
  cin >> s;

  string t;
  cin >> t;

  int count =0;

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

      if (s.at(i) == t.at(i)){
        count++;
      }       

  }

  cout << count << endl;
}


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

typedef long long ll;
using namespace std;

int gcd(int a, int b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

int lcm(int a, int b) { //最小公倍数
  return a * b / gcd(a, b);
}


int main()
{
  string s;
  cin>>s;
  ll cnt[26]={0};
  rep(i,s.length()){
    cnt[s[i]-'a']++;
  }


  rep(i,26){
    if(cnt[i]==0){
      printf("%c\n",'a'+i);
      return 0;
    }
  }
  cout<<"None"<<endl;
  return 0;
}


Measured memory_bytes: 3768
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args){

		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		int no=0;
		try {
			String buf = br.readLine();
			no = Integer.parseInt(buf);

		} catch (Exception e) {
			// TODO: handle exception
			no = 0;

		}
		int Ans=(int)Math.pow(no, 3.0);

		System.out.println(Ans);


	}
}

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

#define PAI 3.14159

int main(void)
{
        int walk = 0;
        int kakudo = 0;
        double  x = 0, y = 0;
        double rad = 0;
        int next = 90;

        while(1)
        {
                scanf("%d,%d", &walk, &kakudo);

                if(walk == 0 && kakudo == 0)
                {
                        break;
                }

                rad = ( (double)next / 180.0 )*PAI;

                x = x + (cos(rad) * walk);
                y = y + (sin(rad) * walk);
                next = next - kakudo;
        }

        printf("%d\n",(int)x);
        printf("%d\n",(int)y);

        return 0;
}

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

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

	vector<int> v(5);
	for(int i = 0 ; i < 5 ; i++){
		cin>>v[i];
	}  

	for(int i=0 ; i < 5 ; i++){
		
		if(v[i] == 0){
				cout<<i+1; break;
			}
		
		}

  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>

long int Euclid(long int A, long int B){
  if(A<B) return Euclid(B, A);
  while(B!=0){
    long int R = A%B;
    A = B; B = R;
  }
  return A;
}

int main(){
  long int N;
  std::cin>>N;
  std::vector<int> A(N);
  std::copy_n(std::istream_iterator<int>(std::cin),N,A.begin());
  std::vector<long int> gcd_front(N+1);
  std::vector<long int>  gcd_back(N+1);
  gcd_front[1]=A[0];
  gcd_back[1] =A[N-1];
  long int gcd_f = A[0]; long int gcd_b = A[N-1];
  for(int i = 1 ; i < N ; i++ ){
    gcd_front[i+1]=Euclid(gcd_f, A[i]);
    gcd_back[i+1] =Euclid(gcd_b, A[N-i-1]);
    gcd_f = gcd_front[i+1];
    gcd_b = gcd_back[i+1];
  }
  long int gcd = gcd_back[N-1];
  for(int i = 2 ; i < N ; i++ ){
    gcd = std::max(gcd, Euclid(gcd_front[i-1],gcd_back[N-i]));
  }
  gcd = std::max(gcd, gcd_front[N-1]);
  std::cout<<gcd<<std::endl;
  return 0;
}


Measured memory_bytes: 2176
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] AB = Console.ReadLine().Split(' ');
            int A = int.Parse(AB[0]);
            int B = int.Parse(AB[1]);

            int addC = A + B;
            int subD = A - B;
            int mulE = A * B;

            if(addC > subD)
            {
                if(addC > mulE)
                {
                    Console.WriteLine(addC);
                }
                else
                {
                    Console.WriteLine(mulE);
                }
            }
            else
            {
                if(subD > mulE)
                {
                    Console.WriteLine(subD);
                }
                else
                {
                    Console.WriteLine(mulE);
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define MODNUM (INT(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

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

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
void chmax(T& m, T x) {
	m = max(m, x);
}

template <typename T>
void chmin(T& m, T x) {
	m = min(m, x);
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int n;
	cin >> n;
	vector<string> si(n);
	REP(i, n) { cin >> si[i]; }
	vector<string> result;
	map<string, int> count;
	REP(i, n) { count[si[i]]++; }
	int max = 0;
	EACH(e, count) { chmax(max, e.second); }
	EACH(e, count) {
		if(e.second == max) {
			cout << e.first << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 26752
import Data.List
import GHC.Float
import Text.Printf

main = do
  nab <- map (read :: String -> Int) . words <$> getLine
  v <- reverse . sort . map (read :: String -> Double) . words <$> getLine
  let a = toInteger $ nab !! 1
      b = toInteger $ nab !! 2
      vv = take (nab !! 1) v
      ave = average vv
      lastV = last vv
      selected = length . elemIndices lastV $ vv
      all = toInteger . length . elemIndices lastV $ v
  putStrLn $ printf "%.6f" ave
  if head v == lastV then putStrLn . show . foldl1 (+) . map (conb all) $ [a..b]
                  else putStrLn . show $ conb all (toInteger selected)

average :: [Double] -> Double
average xs = (sum $ map (flip (/) (int2Double $ length xs)) xs)

conb :: Integer -> Integer -> Integer
conb n k = f n k `div` f k k
        where f n k = foldr1 (*) [n-k+1..n]


Measured memory_bytes: 1020
/* به نام یزدان */
#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 200 * 1000 + 10;
long long n, h[MAX_N], a[MAX_N], dp[MAX_N], fen[MAX_N];

void read_input() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	for (int i = 0; i < n; i++)
		cin >> a[i];
}

void modify(int idx, long long k) {
	for (; idx < MAX_N; idx += idx & -idx)
		fen[idx] = max(fen[idx], k);
}

long long get(int idx) {
	long long res = 0;
	for (; idx; idx -= idx & -idx)
		res = max(res, fen[idx]);
	return res;
}

void solve() {
	for (int i = 0; i < n; i++) {
		dp[i] = get(h[i]) + a[i];
		modify(h[i], dp[i]);
	}
}

void print_output() {
	long long ans = 0;
	for (int i = 0; i < n; i++)
		ans = max(ans, dp[i]);
	cout << ans;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	read_input();
	solve();
	print_output();
}


Measured memory_bytes: 6528