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

#define ll long long
#define mod 1000000007
#define inf 9223372036854775807
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll,ll>
#define vll vector<ll>
#define umap unordered_map<ll,ll>
#define lpq priority_queue<ll,vector<ll>,greater<ll>>
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define repr(i,a,n) for(ll i=n-1;i>=a;i--)
ll globe=0;

void solution(){
    ll n,k;
    cin>>n>>k;
    vll h(n);
    for(ll i=0;i<n;i++) cin>>h[i];
    vll dp(n,inf);
    dp[0]=0;
    for(ll i=1;i<n;i++){
        for(ll j=1;j<=k;j++){
            if(i-j>=0) dp[i]=min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
            else break;
        }
    }
    cout<<dp[n-1]<<endl;
}

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

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

    ll T=1;
    //cin>>T;
    while(T--){
        solution();
    }

    return 0;
}

//BitMasking->setBit: n|(1<<i); unsetBit: n&!(1<<i); checkBit: n&(1<<i);
//ll idcharacter=upper_bound(v.begin(),v.end(),val)-v.begin();
//v.erase(unique(v.begin(),v.end()),v.end());
//ll cnt=count(v.begin(),v.end(),val);
//bool f=find(v.begin(),v.end(),val);

Measured memory_bytes: 4696
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq

##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    N, K = rip()
    A = ria()

    sum = [0] * (N + 1)
    for i in range(N):
        sum[i + 1] = sum[i] + A[i]
    
    ma = 0
    for i in range(N - K + 1):
        ma = max(ma, sum[i + K] - sum[i])
    print((ma + K) / 2.0) 



if __name__ == "__main__":
    main()


Measured memory_bytes: 33828
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int t=1,W,v,w,i,n;(W=s.nextInt())>0;System.out.printf("Case %d:\n%d\n%d\n",t++,v,w)){int[]d=new int[W+1];for(n=s.nextInt();n-->0;d[w]=d[w]>v?d[w]:v)for(z=s.next().split(","),v=new Integer(z[0]),w=new Integer(z[1]),i=W-w;i>0;--i)if(d[i]>0)d[i+w]=Math.max(d[i+w],d[i]+v);for(v=w=0,W++;W-->0;)if(v<=d[W])v=d[w=W];}}}

Measured memory_bytes: 13000
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a,b;
        a = scan.nextInt(); b = scan.nextInt();
        int dif = b - a;
        System.out.println(dif*(dif+1)/2-b);
    }
}


Measured memory_bytes: 20692
#include<bits/stdc++.h>
using namespace std;
    int main(){
        char X, Y;
            cin >> X >> Y;
                if(X < Y){
                    cout << "<" << endl;
                }else if(X == Y){
                    cout << "=" << endl;
                }else if(X > Y){
                    cout << ">" << endl;
                }else{}
    return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <queue>
using namespace std;
int main() {
	int N; 
	cin >> N; 
	string ans = "second"; 
	for(int i = 0; i < N; i++){
		int a; 
		cin >> a; 
		if(a % 2 == 1){ans = "first";}
	}
	cout << ans << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int k;
    cin >> k;
    
    vector<ll> ans;
    vector<ll> tmp_ans;

    rep(i,9) ans.push_back(i+1);
    rep(i,9) tmp_ans.push_back(i+1);
    rep(i,10)
    {
        vector<ll> tt_ans;
        for (auto itr=tmp_ans.begin();itr!=tmp_ans.end();itr++)
        {
            if (*itr%10==0)
            {
                tt_ans.push_back(*itr*10+(*itr%10));
                tt_ans.push_back(*itr*10+(*itr%10+1));
            }
            else if (*itr%10==9)
            {
                tt_ans.push_back(*itr*10+(*itr%10-1));
                tt_ans.push_back(*itr*10+(*itr%10));
            }
            else
            {
                tt_ans.push_back(*itr*10+(*itr%10-1));
                tt_ans.push_back(*itr*10+(*itr%10));
                tt_ans.push_back(*itr*10+(*itr%10+1));
            }
        }
        tmp_ans = tt_ans;
        for (auto itr=tt_ans.begin();itr!=tt_ans.end();++itr)
        {
            ans.push_back(*itr);
        }
    }
    sort(ans.begin(), ans.end());
    cout << ans[k-1] << endl;

}




Measured memory_bytes: 16712
def calc_cost(h):
    if (len(h) == 0):
        return 0

    cost = [None] * len(h)
    cost[0] = 0
    for i in range(1, len(h)):
        cost[i] = cost[i-1] + abs(h[i] - h[i-1])
        if i>1:
            cost[i] = min(cost[i], cost[i-2] + abs(h[i] - h[i-2]))

    return cost[len(h)-1]

if __name__ == "__main__":
    n = int(input())
    h = list(map(int, input().split(" ")))
    res = calc_cost(h)
    print(res)

Measured memory_bytes: 14356
#include<iostream>
int c[200000],a[200000],n,d=1,r,x,i;main(){std::cin>>n;for(;n--;)std::cin>>a[r++];for(i=0;i<r;++i){x=a[i];if(x!=a[i-1])c[x]=(c[x]+d)%int(1e9+7);d=c[x];}std::cout<<d;}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define fo(i,n) for(ll i=0;i<n;i++)
#define fok(i,k,n) for(ll i=k;i<n;i++)
#define ci(x) cin>>x
#define ci2(x,y) cin>>x>>y
#define co(x) cout<<x<<"\n"
#define co2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;	
const int INF = 1000000000;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	ci(n);
	vi h(n);
	fo(i,n){
		ci(h[i]);
	}
	string s="Yes";
	for(int  i=n-2;i>=0;i--){
		if(h[i+1]<h[i]){
			if(h[i]-h[i+1]==1){
				h[i]--;
			}
			else{
				s="No";
			}
		}
		
	}
	co(s);
}


Measured memory_bytes: 640
/*
Я засыпаю в темноте, и страшно мне открыть глаза
Я засыпаю в темноте - и помню все, что сделал сам
Я засыпаю в темноте, не добрых мыслей жуткий рой
Я засыпаю в темноте, а завтра - я проснусь другой
*/
#pragma ARCENIY_KIRILLOV_POVELITEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;

const double EPS = 1e-5;
const int mod = 1e9 + 7;
const int fft_mod = 998244353;
const ll INFLL = 1e18;
const int INF = 1e9;
const int maxn = 1e5 + 3;

ll gcd(ll a, ll b){
    if (b == 0ll)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return (a / gcd(a, b) )* b;
}

bool is_prime(ll a){
    if (a == 2 || a == 3 || a == 5 || a == 7) return true;
    if (a % 2 == 0 || a%3 == 0 || a%5 == 0 || a%7 == 0)
        return false;
    for (ll i = 11; i * i <= a; i += 2){
        if (a % i == 0)
            return false;
    }
    return true;
}

ll binpow(ll a, int n){
    if (n == 0)
        return 1;
    if (n % 2 == 0){
        ll q = binpow(a, n / 2);
        return (q * q) % fft_mod;
    }else return (a * binpow(a, n - 1) ) % fft_mod;
}

istream& operator>>(istream &in, pair<int, int> &p) {
    in >> p.fi >> p.se;
    return in;
}

ostream& operator<<(ostream &out, pair<int, int> &p) {
    out << p.fi << " " << p.se << endl;
    return out;
}



















main(){
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    if (k == 0){
        cout << 1;
        return 0;
    }
    ll fact[n + 1];
    fact[0] = 1;
    ll obr_fact[n + 1];
    obr_fact[0] = 1;
    for (ll i = 1; i <= n; i++){
        fact[i] = (fact[i - 1] * i) % fft_mod;
        obr_fact[i] = binpow(fact[i], fft_mod - 2);
    }
    ll ans = 0;
    for (ll j = 0; j <= n; j++){
        ll flex = j * a;
        ll req = k - flex;
        if (req < 0) break;
        if (req % b != 0 || req/b > n) continue;
        ll fle = req/b;
        ans = (ans + (((fact[n] * ( (obr_fact[j] * obr_fact[n - j]) % fft_mod) ) % fft_mod )*( (fact[n] * ( (obr_fact[fle] * obr_fact[n - fle]) % fft_mod)) % fft_mod))%fft_mod )% fft_mod;
    }
    cout << ans;

}


Measured memory_bytes: 4992
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val a = sc.nextLong()
    val b = sc.nextLong()
    val c = sc.nextLong()
    
    val z = c - a - b
    if(z <= 0) println("No")
    else {
        if( 4 * a * b < z * z) println("Yes")
        else println("No")
    }

}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 31264
#include <iostream>
#include <string>
using namespace std;
int main() {
  string input;
  cin >> input;
  int N = input[input.length() - 1] - '0';
  if (N == 3) {
    cout << "bon";
  } else if (N == 0 || N == 1 || N == 6 || N == 8) {
    cout << "pon";
  } else {
    cout << "hon";
  }
  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    int n, x;
    cin >> n >> x;

    int d = 0, num = 1;
    for (int i = 0, l; i < n; ++i) {
        cin >> l;
        d += l;
        if (d <= x) ++num;
    }

    cout << num << endl;

    return 0;
}


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

int main(){
	int a[5];
	while(cin>>a[0]&&a[0]){
		for(int i=1;i<5;i++)cin>>a[i];
		bool t[3]={0};
		for(int i=0;i<5;i++)t[a[i]-1]=true;
		int x=t[0]+t[1]+t[2];
		if(x==2){
			int win=1;
			if(!t[0])win=2;
			if(!t[1])win=3;
			for(int i=0;i<5;i++){
				if(a[i]==win)cout<<1<<endl;
				else cout<<2<<endl;
			}
		}
		else{
			for(int i=0;i<5;i++)cout<<3<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3112
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int n,a,s,maxe=0,b;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        s=0;a=i;
        while(a%2==0)
        {
            a=a/2; s++;
        }
        if(s>maxe) {maxe=s;b=i;}
    }
    if(n==1) cout<<"1"<<endl;
    else cout<<b<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	int suff[n+1][3];
	memset(suff,0,sizeof suff);
	
	suff[n-1][0] = (s[n-1] == 'R');
	suff[n-1][1] = (s[n-1] == 'G');
	suff[n-1][2] = (s[n-1] == 'B');
	
	for(int i = n-2; i >= 0; i--){
		if(s[i] == 'R')
			suff[i][0] = suff[i+1][0] + 1;
		else
			suff[i][0] = suff[i+1][0];
	}
	for(int i = n-2; i >= 0; i--){
		if(s[i] == 'G')
			suff[i][1] = suff[i+1][1] + 1;
		else
			suff[i][1] = suff[i+1][1];
	}
	for(int i = n-2; i >= 0; i--){
		if(s[i] == 'B')
			suff[i][2] = suff[i+1][2] + 1;
		else
			suff[i][2] = suff[i+1][2];
	}
	
		
	for(int i = 0; i < n-2; i++){
		for(int j = i+1; j < n-1; j++){
			if(s[i] == s[j])
				continue;
			if('R' != s[i] && 'R' != s[j]){
				ans += suff[j+1][0];
				if(j+(j-i) < n && s[j+j-i] == 'R')
					ans--;
			}
			else if('G' != s[i] && 'G' != s[j]){
				ans += suff[j+1][1];
				if(j+(j-i) < n && s[j+j-i] == 'G')
					ans--;
			}
			else if('B' != s[i] && 'B' != s[j]){
				ans += suff[j+1][2];
				if(j+(j-i) < 	n && s[j+j-i] == 'B')
					ans--;
			}			
		}
	}
	cout << ans << endl;

	return 0;
}



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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}

int main() {
  int n;cin>>n;
  multimap<ll,ll> w;
  REPl(i,n){
    ll a,b;
    cin>>a>>b;    
    w.emplace(b,a);
  }
  ll t=0;
  bool ans=true;
  for(auto ww=w.begin();ww!=w.end();++ww){
    if(ww->first-ww->second<t){
      ans=false;
      break;
    }
    t+=ww->second;
  }
  cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 13824
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <thread>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)998244353
#define P pair<ll, ll>

ll powmod(ll a, ll b) {
	a %= MOD;
	ll res = 1;
	while (b > 0) {
		if (b % 2 == 1)res = res * a % MOD;
		a = a * a % MOD;
		b /= 2;
	}
	return res;
}
ll n, c, ans = 1, cnt[130000], ma;
int main() {
	cin >> n;
	vector<ll> s(n);
	REP(i, n) {
		cin >> s[i];
		if (s[i] == 0)c++;
		ma = max(ma, s[i]);
		cnt[s[i]]++;
	}
	if (s[0] != 0 or c != 1) {
		cout << 0 << endl;
		return 0;
	}
	FOR(i, 1, ma + 1) {
		ans *= powmod(cnt[i - 1], cnt[i]);
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
N, M = map(int, input().split())
L = []
for i in range(M):
    L.append([int(x) for x in input().split()])
    
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
        
    def find_root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]
        
    def unite(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x == y:
            return
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1
                
    def isSameGroup(self, x, y):
        return self.find_root(x) == self.find_root(y)
    
    def count(self, x):
        return -self.root[self.find_root(x)]
    

ans_list = [0 for i in range(M)]
uftree = UnionFind(N)
temp = N*(N-1)//2
L.reverse()
for i in range(M):
    if uftree.isSameGroup(L[i][0], L[i][1]):
        ans_list[i] = temp
    else:
        temp -= uftree.count(L[i][0])*uftree.count(L[i][1])
        ans_list[i] = temp
    uftree.unite(L[i][0], L[i][1])
    
ans_list.reverse()
for i in range(1, M):
    print(ans_list[i])
print(N*(N-1)//2)

Measured memory_bytes: 28000
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <sstream>
#include <deque>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <iterator>
#include <utility>   // std::pair, std::make_pair
#include <stdlib.h>  //atoi
using namespace std;
typedef long long ll;
const  double PI = 3.141592654;
#define rep(i,x) for(int(i)=0;(i)<(ll)(x);(i)++)
#define all(s)      (s).begin(),(s).end()
#define allv(v)      (v).begin(),(v).end()
#define pb          push_back
#define sz          s.size()
#define vz          v.size()
//x = atoi(a.c_str())
void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL), cout.tie(NULL);
}
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main()
{
	fast();
	bool t = true;
	int x;
	cin >> x;
	vector<int>v(x);
	rep(i, x)
		cin >> v[i];
	int c = 0;
	while (t)
	{
		rep(i, x)
		{
			if (v[i] % 2 == 0)
				v[i] /= 2;
			else
			{
				t = 0;
				break;
			}
		}
		if (t == 1)
			c++;
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

#include <string>
#include <queue>

using namespace std;

int main(){
	int w,h;
	int data[60][60];
	int flag[60][60];
	int dx[8] ={-1,-1,-1,0,1,1,1,0};
	int dy[8] ={-1,0,1,1,1,0,-1,-1};

	while(1){
		cin>>w>>h;
		if(w==0 && h==0)break;

	for(int i=0;i<60;i++){
		for(int j=0;j<60;j++){
			data[i][j]=-1;
			flag[i][j]=0;
		}
	}

	char tmp;
	int startX;
	int startY;
	int cnt=0;

	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>tmp;
			if(tmp=='1')data[i][j] = 0;
		}
	}

	queue<int> qX,qY;
	
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(data[i][j]==0 && flag[i][j]==0){
				flag[i][j]=1;
				qX.push(j);
				qY.push(i);
				cnt++;
			}
			else continue;

			while(qX.size()!=0){
				int topX = qX.front();
				int topY = qY.front();
				qX.pop();
				qY.pop();

				for(int i=0;i<8;i++){
					int nowX = topX + dx[i];
					int nowY = topY + dy[i];

					if(data[nowY][nowX] ==0 && flag[nowY][nowX] == 0){
						qX.push(nowX);
						qY.push(nowY);
						flag[nowY][nowX]=1;
					}
				}
			}
		}
	}

	cout<<cnt<<endl;
	}

	return 0;
}

Measured memory_bytes: 1244
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();

        String a = s1.toUpperCase().substring(0,1);
        String b = s2.toUpperCase().substring(0,1);
        String c = s3.toUpperCase().substring(0,1);

        System.out.println(a+b+c);
    }
}


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

int main() {
  int x;
  cin >> x ;
  int Y;
  Y = x;
  int Z = 0;
  for (int i = 0; i < 9; i++){
    Z += x % 10;
    x /= 10;
    if (x == 0){
      break;
    }
  }
  if(Y % Z == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

void bfs(const vs& grid,int i0,int j0,vvi& vis,vector<tuple<int,int>>& group)
{
	int h=grid.size(),w=grid[0].size();
	queue<tuple<int,int,char>> q;
	q.emplace(i0,j0,'.');
	while(q.size()){
		int i,j; char prev; tie(i,j,prev)=q.front(); q.pop();
		if(i<0||h<=i||j<0||w<=j||grid[i][j]==prev||vis[i][j])
			continue;
		vis[i][j]=1;
		group.emplace_back(i,j);
		rep(k,4){
			int ni=i+"\xff\x1\0\0"[k],nj=j+"\0\0\xff\x1"[k];
			q.emplace(ni,nj,grid[i][j]);
		}
	}
}

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int h,w;cin>>h>>w&&h|w;){
		vs grid(h);
		rep(i,h) cin>>grid[i];

		vvi vis(h,vi(w));
		vector<vector<tuple<int,int>>> groups;
		rep(i,h) rep(j,w) if(grid[i][j]=='#'&&!vis[i][j]){
			vector<tuple<int,int>> group;
			bfs(grid,i,j,vis,group);
			groups.push_back(group);
		}
		ll res=0;
		for(auto group:groups){
			ll bcount=0,wcount=0;
			for(auto p:group){
				if(grid[get<0>(p)][get<1>(p)]=='#')
					bcount++;
				else
					wcount++;
			}
			res+=bcount*wcount;
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 13104
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  int ans;
  while(true) {
    int x = n;
    for(int i = 2; i * i <= n; i++) {
      if(x % i == 0) {
        x /= i;
      }
    }
    if(x == n) {
      ans = n;
      break;
    }
    n++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
 
using namespace std;
 
int main(){
 long long int a;
 float b;
 cin >> a >> b;
 long long int ib = b*100;
 long long int result =a*ib;
 printf("%lld",result/100);
return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  vector<P> p(m);
  rep(i,m) cin >> p[i].first >> p[i].second;
  
  //0から999まで全探索して条件を満たすか確かめる
  rep(x,1000){
  	int nx = x/10;
  	vector<int> d(1);
    d[0] = x%10;
  	while(nx){
  		d.push_back(nx%10);
  		nx /= 10;
  	}
  	reverse(d.begin(), d.end());
  	bool can = true;
  	if(n != d.size())continue;
  	rep(i,m){
  		if(d[p[i].first-1] != p[i].second) can = false;
  	}
  	if(can){
  		cout << x << endl;
  		return 0;
  	}
  }
  cout << -1 << endl;
  return 0;
}



Measured memory_bytes: 256
import numpy as np
T = np.array([int(input()) for i in range(5)])

T_0 = T[np.mod(T, 10) == 0]
T_o = T[np.mod(T, 10) != 0]

T_c = T_o + 10 - np.mod(T_o, 10)
T_s = np.sort(np.mod(T_o, 10))
if T_0.size == 5:
    print(np.sum(T_0))
else:
    print(np.sum(T_c) - 10 + np.sum(T_0) + T_s[0])


Measured memory_bytes: 12428
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans;
int N,K;
vi W;

int checkNum(ll P){
    int i = 0;
    rep(j, K){
        ll s = 0;
        while(s + W[i] <= P){
            s += W[i];
            i++;
            if(i == N) return N;
        }
    }
    return i;
}

void solve(){
    // Pの値を二部探索!
    ll left = 0;
    ll right = 1e10;

    while(left + 1 < right){
        ll mid = (left+right)/2;
        if(checkNum(mid) >= N) right = mid;
        else left = mid;
    }

    cout << right << endl;
}

int main(){
    cin >> N >> K;
    W.resize(N);

    rep(i, N) cin >> W[i];

    solve();
}




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

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
//typedef long long int i64;
typedef int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

const double PI = 3.141592653589793238463;

using namespace std;

const int MAXN = 1000500;
const int MAXVALUE = 1000000500;
//const long double EPS = 1e-7;

i64 mod = 1e9 + 7;

i64 T, n, m, k, q;

vector <i64> a;

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


	cin >> n >> k;

	a.assign(n + 1, 0);

	i64 di;
	i64 x;
	for (int i = 0; i < k; ++i) {
		cin >> di;
		for (int j = 0; j < di; ++j) {
			cin >> x;
			a[x] = 1;
		}
	}

	i64 res = 0;
	for (int i = 1; i <= n; ++i) {
		if (a[i] == 0) {
			res += 1;
		}
	}

	cout << res << endl;


	return 0;
}

Measured memory_bytes: 3192
n = int(input())
ans = 0 
for i in range(1, n+1):
  if i % 3 == 0 and i % 5 == 0:
    pass 
  elif i % 3 == 0:
    pass 
  elif i % 5 == 0:
    pass 
  else:
    ans += i 

print(ans)

Measured memory_bytes: 9168
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
    char s[205],t[205];
    cin >> s >> t;
    
    cout << strcat(t,s) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> PDL;
typedef pair<LD, LD> PDD;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
void in(T& x) {
	cin >> x;
}

template<class T1,class T2>
void in(pair<T1, T2>& p) {
	in(p.first);
	in(p.second);
}

template<class T>
void in(vector<T>& v,LL st=-1,LL en=-1) {
	if (st == -1) {
		st = 0;
		en = v.size() - 1;
	}
	for (LL n = st; n <= en; n++) {
		in(v[n]);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, K;
	cin >> N >> K;
	LL temp = K;
	for (LL n = 1;; n++) {
		if (temp > N) {
			cout << n << "\n";
			return 0;
		}
		temp *= K;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
#include<queue>
struct S{int x,y,m,a;};
int R,C,d[]={0,1,0,-1,0},f[20][20][16][4];
char M[32][32];
int F()
{
	S s={0,0,0,1};
	std::queue<S>q;
	q.push(s);
	while(!q.empty())
	{
		s=q.front();q.pop();
		s.x=(s.x+C)%C;
		s.y=(s.y+R)%R;
		if(f[s.x][s.y][s.m][s.a]++)continue;
		char c=M[s.y][s.x];
		if(c=='@')return 1;
		if(c=='?')
		{
			for(int i=0;i<4;++i)
			{
				S t={s.x+d[i],s.y+d[i+1],s.m,i};
				q.push(t);
			}
		}
		if(isdigit(c))s.m=c-'0';
		if(c=='v')s.a=0;
		if(c=='>')s.a=1;
		if(c=='^')s.a=2;
		if(c=='<')s.a=3;
		if(c=='_')s.a=(s.m?3:1);
		if(c=='|')s.a=(s.m?2:0);
		if(c=='+')s.m=(s.m+1)%16;
		if(c=='-')s.m=(s.m+15)%16;
		s.x+=d[s.a];
		s.y+=d[s.a+1];
		q.push(s);
	}
	return 0;
}
int main()
{
	scanf("%d%d",&R,&C);
	for(int i=0;i<R;++i)scanf("%s",M[i]);
	puts(F()?"YES":"NO");
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int main() {
	int k;
	std::vector<int> vec;

	for (int i = 0; i < 5; ++i) {
		int a;
		std::cin >> a;
		vec.push_back(a);
	}

	std::cin >> k;

	if (vec[4] - vec[0] > k) {
		std::cout << ":(" << std::endl;
	}
	else {
		std::cout << "Yay!" << std::endl;
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi
#define se second
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) 
 
using namespace std;

int main()
{
	lli  a, b, p1, p2, count =0;
	cin >>a >> b;
	forz(i, 1500)
	{
		if(floor(i*0.08)== a && floor(i*0.1)== b)
		{
			cout << i << endl;
			count  = 1;
			break;
		} 
	} 
	if (count == 0)
	{
		cout << "-1" << endl;
	}
	
	// p1 = a/ 0.08;
	// p2 = b/ 0.1;
	// if (floor(p2*0.08) == a && floor(p1*0.1) == b)
	// {
	// 	cout << min(p1 , p2)<< endl;
	// }
	// else if (floor(p2*0.08) == a)
	// {
	// 	cout << p2<< endl;
	// }
	// else if(floor(p1*0.1) == b)
	// {
	// 	cout << p1 << endl;
	// }
	// else
	// {
	// 	cout << "-1" << endl;
	// }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
map<string,ll> ms;
int main(){
  int n; cin >> n;
  rep(i,n){
    string in; cin >> in;
    sort(in.begin(), in.end());
    ms[in]++;
  }
  ll ans = 0;
  for(auto itr : ms){
    ll num = itr.SEC;
    ans += num*(num-1)/2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
  string S1, S2;
  cin >> S1 >> S2;
  int l = min(S1.length(), S2.length());
  vector< vector<int> > c1(S1.length()+1,vector<int>(26,0)),
    c2(S2.length()+1,vector<int>(26,0));
  for(int i = 0; i < S1.length(); ++i){
    for(int j = 0; j < 26; ++j){
      c1[i+1][j] = c1[i][j];
    }
    ++c1[i+1][S1[i]-'a'];
  }
  for(int i = 0; i < S2.length(); ++i){
    for(int j = 0; j < 26; ++j){
      c2[i+1][j] = c2[i][j];
    }
    ++c2[i+1][S2[i]-'a'];
  }
  for(int i = l; i >= 0 ; --i){
  }
  for(int i = l; i >= 0 ; --i){
    set< vector<int> > S;
    for(int j = i; j < S1.length(); ++j){
      vector<int> t = c1[j+1];
      for(int k = 0; k < 26; ++k) t[k] -= c1[j-i][k];
      S.insert(t);
    }
    for(int j = i; j < S2.length(); ++j){
      vector<int> t = c2[j+1];
      for(int k = 0; k < 26; ++k) t[k] -= c2[j-i][k];
      if(S.find(t) != S.end()){
	cout << i+1 << endl;
	return 0;
      }
    }
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 4784
#ifdef ConanYu
#include "local.hpp"
#else
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

const int N = 2e5 + 10;

pair<int, ll> a[N];

ll cf[N];

void Main() {
  int n; ll d, p; cin >> n >> d >> p;
  for(int i = 1; i <= n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a + 1, a + n + 1);
  long long ans = 0, tmp = 0;
  int j = 1;
  for(int i = 1; i <= n; i++) {
    while(j <= n && a[i].first + 2ll * d >= a[j].first) {
      j++;
    }
    tmp -= cf[i];
    ll cur = a[i].second - tmp;
    if(cur > 0) {
      ll tms = (cur + p - 1) / p;
      ans += tms;
      tms *= p;
      cf[j] += tms;
      tmp += tms;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 4992
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
#endif

#ifdef _DEBUG
void init_global_C() {}
#else

#endif


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

    string S, T; cin >> S >> T;    
    int SL = S.size();
    int TL = T.size();

    vi idxs;
    for (int i = 0; i <= SL - TL; i++) {
        bool match = true;
        for (int j=0; j<TL; j++) {
            if (S[i+j] != T[j] && S[i+j] != '?') {
                match = false;
                break;
            }
        }
        if (match) idxs.push_back(i);
    }

    int idx = idxs.size() > 0 ? idxs.back() : -1;
    string ans = "";
    if (idx < 0) ans = "UNRESTORABLE";
    else {
        ans = S;
        REP(i, TL) ans[idx + i] = T[i];

        REP(i,SL) {
            if (ans[i] == '?') ans[i] = 'a';
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N;
  vector<char> vec(N);
  for(int i = 0; i < N; i++){
  cin >> vec.at(i);
  }
  
  bool ans = false;
  for(int i = 0; i < N; i++){
  if(vec.at(i) == 'Y'){
    ans = true;
   }
  }
  
  if(ans){
     cout << "Four" << endl;
  }else
    cout << "Three" << endl;
}

Measured memory_bytes: 256
if __name__=="__main__":
    N = int(input())
    a = list(map(int,input().split()))

    odd=0
    even=0
    for x in a:
        if x % 2 ==0:
            even += 1
        else:
            odd += 1

    answer = (odd % 2 == 0)

    if odd % 2 == 0:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 14236
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

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

	ll A=in<ll>(),B=in<ll>(),X=in<ll>();
	ll NA = B/X;
	ll NB = max(A-1LL,0LL)/X;
	if(!A) NA++;
	out(NA-NB);
	return 0;
}


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

int
main(void)
{
  int n;
  string color;
  string arr[100010];
  cin >> n >> color;
  for (int i = 0; i < n; i++) {
    arr[i] = color[i];
  }

  int result = 1;
  for (int i = 0; i < n-1; i++) {
    if (arr[i] == arr[i+1]) continue;

    result += 1;
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <functional>
#define rep(i, a, b) for(int i=a;i<b;++i)
#define MOD 1000000007
#define N 100
#define RAND 1000
using namespace std;

int main(void)
{
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0])
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.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;
    vector<int> a(n);
    vector<int> b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    double dist = 0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            dist += sqrt(pow(a[i]-a[j],2)+pow(b[i]-b[j],2));
        }
    }
    double ans = 2*dist/n;
    
    
    printf("%.10f",ans);
}


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

using namespace std;
long long b[55], a[55]; 

int main() {
  long long k;
  cin >> k;
  int n = 50;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    b[i] = k/n;
    if ((k % n) > i)
      b[i]++; 
    sum += b[i];
  }
  assert(sum == k);
  for (int i = 0; i < n; i++) {
    a[i] = min(b[i] * (n + 1) - k + n-1, (long long)(1e16 + 1e3));
    assert(a[i] >= 0);
  }
  printf("%d\n", n);
  for (int i = 0; i < n; i++)
    printf("%lld%c", a[i], i == n-1 ? '\n' : ' ');
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string w;
  string t;
  cin >> w;
  int i;
  for(i=0;i<w.size();i++) {
    if('A'<=w[i]&&w[i]<='Z') w[i]+='a'-'A';
  }
  int o=0;
  cin >> t;
  while(t!="END_OF_TEXT"){
  
    for(i=0;i<t.size();i++) {
      if('A'<=t[i]&&t[i]<='Z') t[i]+='a'-'A';
    }
    if(w==t) o++;
    cin >> t;
  }
  cout << o << endl;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll dp[MAXn];
ll d[105];
int main(){
  IOS();
  ll n,k;
  cin >> n >> k;
  REP (i,n) cin >> d[i];

  dp[0] = 0;
  REP1 (i,k) {
    REP (j,n) {
      if (i < d[j]) continue;
      dp[i] = max(dp[i],ll(!dp[i-d[j]]));
    }
  }
  if (dp[k]) cout << "First" << endl;
  else cout << "Second" << endl;
}


Measured memory_bytes: 1152
n = int(input().strip())
a = [ list(map(int, input().strip().split())) for i in range(2) ]

maximum = 0
mov = 0
for i in range(n):

    ans = 0
    for i in range(mov+1):
        ans += a[0][i]
    for i in range(n-mov):
        ans += a[1][i+mov]

    mov += 1
    
    if maximum < ans:
        maximum = ans

print(maximum)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  LL N, M, K;
  cin >> N >> M >> K;
  VEC<LL> A(N), B(M);
  REP(i, 0, N) cin >> A[i];
  REP(i, 0, M) cin >> B[i];
  VEC<LL> ca(N + 1, 0);
  VEC<LL> cb(M + 1, 0);
  REP(i, 1, N + 1) { ca[i] = ca[i - 1] + A[i - 1]; }
  REP(i, 1, M + 1) { cb[i] = cb[i - 1] + B[i - 1]; }
  LL ans = 0;
  // DUMP(ca);
  // DUMP(cb);
  REP(i, 0, N + 1) {
    LL t = ca[i];
    LL rem = K - t;
    if (rem < 0) break;
    if (rem == 0) {
      ans = max(ans, i);
      break;
    }
    auto res = upper_bound(ALL(cb), rem);
    LL num = max(0LL, (LL)distance(cb.begin(), res) - 1);
    // DUMP(i, t, rem, num);
    ans = max((LL)ans, i + num);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9592
#include <stdio.h>

int main () {
  int a,b,c;
  scanf ("%d %d %d",&a,&b,&c);
  int x;
  int n;
  for (n=0;n<9999999;n++) {
  if (a > b) {
    x = b;
    b = a;
    a = x;
  }
  if (b > c) {
    x = b;
    b = c;
    c = x;
  }
  if (a > c) {
    x = a;
    a = c;
    c = x;
  }
  }
  printf ("%d %d %d\n",a,b,c);
  return 0;
}

Measured memory_bytes: 596
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new string[n + 1];
        for (int i = 0; i < n + 1; i++) a[i] = Console.ReadLine().Trim();
        var p1 = getNum(a, "a");
        var p2 = getNum(a, "z");
        Console.WriteLine(string.Join(" ", Enumerable.Range(p2, p1 - p2 + 1)));
    }
    public static int getNum(string[] a, string t)
    {
        var n = a.Length;
        var st = a[n - 1];
        var b = new string[n];
        for (int i = 0; i < n; i++)
            b[i] = a[i].Replace("?", t);
        Array.Sort(b);
        if (t == "a")
        {
            for (int i = n - 1; i >= 0; i--)
                if (b[i] == st)  return i + 1; 
        }
        else
        {
            for (int i = 0; i < n; i++)
                if (b[i] == st)  return i + 1; 
        }
        return 0;
    }
}

Measured memory_bytes: 11616
N,M=map(int,input().split())
P=list(map(int,input().split()))

par=[i for i in range(N)]
rank=[1]*N

ans=0

def root(x):
    if par[x]==x:
        return x
    else:
        par[x]=root(par[x])
        return par[x]

def same(x,y):
    return root(x)==root(y)

def connect(x,y):
    if root(x)==root(y):
        return
    else:
        if rank[x]<rank[y]:
            x,y=y,x
        par[root(y)]=root(x)
        rank[y]+=1

for i in range(M):
    x,y=map(int,input().split())
    connect(x-1,y-1)

for i in range(N):
    if same(i,P[i]-1):
        ans+=1

print(ans)

Measured memory_bytes: 14008
import math

A,B = list(map(int, input().split()))

flg = False
for i in range(2000):
    
    if math.floor(i * 0.08) == (A) and math.floor(i * 0.1 ) == B:
        flg = True
        break
if flg:
    print(i)
else:
    print(-1)

Measured memory_bytes: 3060
N,K = map(int,input().split())
A = [int(i) for i in input().split()]
loop = min(41,K)
for _ in range(loop):
    B = [0]*N
    for n in range(N):
        l = max(0,n-A[n])
        r = min(N-1,n+A[n])
        B[l]+=1
        if r+1<N:
            B[r+1] -= 1
    for n in range(1,N):
        B[n] += B[n-1]
    A = [b for b in B]
print(*A)


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

const int MAX = 510000;
const int MOD = 998244353;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1; finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  long long n, a, b, k;
  cin>>n>>a>>b>>k;
  COMinit();
  long long ans = 0;
  for (long long i=0; i<=n; i++) {
    if (k - a * i >= 0 && (k - a * i) % b == 0) {
      long long v = COM(n, i) * COM(n, (k - a * i) / b);
      v %= MOD;
      ans += v;
      ans %= MOD;
    }
  }
  cout<<ans<<endl;
}

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

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

    if(n == k){
        cout << 0 << endl;
        exit(0);
    }

    ans = n % k;
    if(ans == 0) ans++;
    cout << min(n,abs(k-ans)) << endl;
}

Measured memory_bytes: 256