akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int diffx = x1 - x2;
	int diffy = y1 - y2;
	cout << x2 + diffy << " " << y2 - diffx << " " << x1 + diffy << " " << y1 - diffx;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int min(int a,int b){
  if(a>b){
    return b;
  }else{
    return a;
  }
}
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<min(a,b)+min(c,d)<<endl;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)

typedef long long ll;

int main() {
    
    int X;
    cin >> X;
    if (X == 7 || X == 5 || X== 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

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

}


int main(){
int k;
cin>>k;
int total=0;
for(int i=1;i<=k;++i){
  for(int j=1;j<=k;++j){
    for(int m=1;m<=k;++m){
      int x=gcd(i,j);
      int y=gcd(x,m);
      total+=y;}}}

cout<<total<<endl;
    }


Measured memory_bytes: 3636
// Vicfred
// https://atcoder.jp/contests/abc157/tasks/abc157_b
// simulation
use std::io;
use std::collections::HashSet;

fn main() {
    let mut A = Vec::<Vec<i64>>::new();
    for _ in 0..3 {
        let mut line = String::new();

        io::stdin()
            .read_line(&mut line)
            .unwrap();

        let words: Vec<i64> =
            line
            .split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect();

        A.push(words);
    }

    let mut N = String::new();

    io::stdin()
        .read_line(&mut N)
        .unwrap();

    let N: i64 = N.trim().parse().unwrap();

    let mut bingo = HashSet::new();

    for _ in 0..N {
        let mut b = String::new();

        io::stdin()
            .read_line(&mut b)
            .unwrap();

        let b: i64 = b.trim().parse().unwrap();
        bingo.insert(b);
    }

    let row1: HashSet<_> = [A[0][0], A[0][1], A[0][2]].iter().cloned().collect();
    let row2: HashSet<_> = [A[1][0], A[1][1], A[1][2]].iter().cloned().collect();
    let row3: HashSet<_> = [A[2][0], A[2][1], A[2][2]].iter().cloned().collect();
    let col1: HashSet<_> = [A[0][0], A[1][0], A[2][0]].iter().cloned().collect();
    let col2: HashSet<_> = [A[0][1], A[1][1], A[2][1]].iter().cloned().collect();
    let col3: HashSet<_> = [A[0][2], A[1][2], A[2][2]].iter().cloned().collect();
    let dia1: HashSet<_> = [A[0][0], A[1][1], A[2][2]].iter().cloned().collect();
    let dia2: HashSet<_> = [A[0][2], A[1][1], A[2][0]].iter().cloned().collect();

    let mut ans = false;
    if row1.is_subset(&bingo) ||
        row2.is_subset(&bingo) ||
        row3.is_subset(&bingo) ||
        col1.is_subset(&bingo) ||
        col2.is_subset(&bingo) ||
        col3.is_subset(&bingo) ||
        dia1.is_subset(&bingo) ||
        dia2.is_subset(&bingo) {
        ans = true;
    }

    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

void mod( ll &n, ll m=MOD ){ n%=m,n+=m,n%=m; }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll a,b;
    cin>>a>>b;
    ll ans = (a+b)/2;

    if( (a-b)&1 )
        cout<<"IMPOSSIBLE";
    else
    {
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int a[5];

int main()
{
	for (int i = 0; i < 5; i++)
	{
		cin >> a[i];

		if (a[i] == 0)
		{
			cout << i + 1 << endl;
			break;
		}
	}

	return 0;
}

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

using namespace std;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;
 
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second
 
template<class T> bool ckmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<class T> bool ckmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

const int INF = 1e9;

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

    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n), f(n);

    for(auto &z : a)
        cin >> z;
    for(auto &z : f)
        cin >> z;

    sort(all(a));
    sort(rall(f));

    ll l = 0, r = 1e12;
    ll ans;
    while(l <= r)
    {
        ll mid = l + (r - l) / 2;
        ll temp = 0LL;
        for(int i = 0; i < n; ++i)
        {
            temp += max(0LL, a[i] - mid / f[i]);
        }

        if(temp <= k)
        {
            ans = mid;
            r = mid - 1;
        }
        else
        {
            l = mid + 1;
        }
    }

    cout << ans << "\n";
}


Measured memory_bytes: 6336
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		// 5つの料理を格納する配列
		int dish[] = new int[5];

		// 料理を順番に格納
		for (int i = 0; i < 5; i++) {
			dish[i] = sc.nextInt();
		}
		int sum = 0;
		int max = 0;
      
		// 最後に注文した方がよさそうなものを求める
		for (int i = 0; i < 5; i++) {
			int d = (dish[i] + 9);
			d = d / 10 * 10;
			sum += d;
			max = Math.max(max, d - dish[i]);
		}
		System.out.println(sum - max);
	}
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int A,B,C,D; cin >> A >> B >> C >> D;
    vector<int> num(110);
    num[A]++;
    num[B+1]--;
    num[C]++;
    num[D+1]--;
    int ans = 0;
    REP(i,100) num[i+1] += num[i];
    REP(i,101){
        if (num[i]==2) ans++;
    }

    cout << max(ans-1,0) << endl;
    
    return 0;
}

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

public static partial class Program
{
    public static void Main()
    {
        var xa = CRL().ArrayInts();

        if (xa[0] < xa[1])
        {
            CWL(0);
        }
        else if (xa[0] >= xa[1])
        {
            CWL(10);
        }
    }
}

public static partial class Program
{
    //テンプレここから
    public static int Sigma(int n, int next = 1, int val = 0) => next > n ? val : Sigma(n, next + 1, val + next);
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static readonly int[] Dx = {0, -1, 0, 1};
    public static readonly int[] Dy = {-1, 0, 1, 0};
    public const int Mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToLong();
    public static int ToInt(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    public static string JoinToStr(this IEnumerable<int> array, string sep = "")
        => array.Select(x => x.ToString()).Join(sep);

    //テンプレここまで
}

Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>; // intの2次元の型に vvi という別名をつける
ll R,C,K;

int main(){
  cin >>R>>C>>K;
  vvvi data = vvvi(C, vvi(R, vi(4)));

  vvi item(C, vi(R));  // N * M の2次元配列

  vi v(K);
  REP(i,K){
    ll r,c;
    cin>>r>>c>>v[i];
    r--;
    c--;
    item[c][r]=v[i];
  }

  ll ans=0;
  
  if (item[0][0]!=0){data[0][0][1]=item[0][0];}


  ll x=0;
  ll y=0;
  for(ll i=0;i<R+C;i++){
    ll xx=x;
    ll yy=y;
    for(ll j=0;j<R+C;j++){
      //右
      if (xx<C-1){
        for(ll k=0;k<4;k++){
          data[xx+1][yy][k]=max(data[xx][yy][k],data[xx+1][yy][k]);
        }
        if (item[xx+1][yy]!=0){
          for(ll k=0;k<3;k++){
            data[xx+1][yy][k+1]=max(data[xx][yy][k]+item[xx+1][yy],data[xx+1][yy][k+1]);
          }
        }

      }
      //下
      if (yy<R-1){
        for(ll k=0;k<4;k++){
          data[xx][yy+1][1]=max(data[xx][yy+1][1],data[xx][yy][k]+item[xx][yy+1]);
          data[xx][yy+1][0]=max(data[xx][yy+1][0],data[xx][yy][k]);
        }
      }
      


      xx--;
      yy++;
      if (xx<0)break;
      if (yy>=R)break;
    }

    if (x<C-1){
      x++;
    }else{
      y++;
    }

  }


  for(ll k=0;k<4;k++){
    ans=max(data[C-1][R-1][k],ans);
  }



  //2次元配列結果REP cout
  cout<<ans<<endl;
  return 0;
}
/*
1 10 9
1 1 234
1 2 374
1 3 457
1 4 672
1 5 22
1 6 2444
1 7 444
1 8 4444
1 9 444
*/

Measured memory_bytes: 708008
a = list(input())
b = list(input())
c = list(input())
ga = 0
while 1:
    if ga == 0:
        try:
            if a[0] == "a":
                ga = 0
            elif a[0] == "b":
                ga = 1
            else:
                ga = 2
            a.pop(0)
        except:
            print("A")
            break
    elif ga == 1:
        try:
            if b[0] == "a":
                ga = 0
            elif b[0] == "b":
                ga = 1
            else:
                ga = 2
            b.pop(0)
        except:
            print("B")
            break
    else:
        try:
            if c[0] == "a":
                ga = 0
            elif c[0] == "b":
                ga = 1
            else:
                ga = 2
            c.pop(0)
        except:
            print("C")
            break

Measured memory_bytes: 3064
import math
n = int(input())

def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
        if num > n:
            break
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor

#print(prime(n))

ans = 0

#dic = {}
pr = prime(n)
for num, count in pr.items():
    tmp = count
    ini = 1
    while tmp > 0:
        tmp -= ini
        if tmp < 0:
            break
        ini += 1
        ans += 1
    #print(ans,num,tmp)

print(ans)

Measured memory_bytes: 63272
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    map<int,int> D;
    rep(n,0,N){
        int d; cin>>d;
        D[d]++;
    }
    int M; cin>>M;
    vector<int> T(M);
    rep(m,0,M) cin>>T.at(m);

    string ans="YES";
    for(auto t:T){
        if(D[t]>0) D[t]--;
        else{ ans="NO"; break;}
    }

    cout<<ans<<endl;
}

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

using namespace std;
int main(){
  string s,t;
   cin >> s >> t;
 
  int ptr=-1;
  for(int i=0;i<s.length()-t.length()+1;i++){
     bool dis=true;
    for(int j=0;j<t.length();j++){
     if(s[i+j]!=t[j]&&s[i+j]!='?') {
       dis=false;
       break;
     }
    }
    if(dis) ptr=i;
    }
                
  if(ptr==-1) {cout << "UNRESTORABLE" << endl;
                return 0;
              }
  
  for(int i=0;i<t.length();i++){
  s[ptr+i]=t[i];
  }
    
  for(int i=0;i<s.length();i++){
   if(s[i]=='?') s[i]='a';
  }
  
  
  
 cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<unordered_map>
using namespace std;
#define INF 10000000

void solve(int k, vector<long long> x, long long m, long long* money, long long X, int N, int M, long long C[], vector<vector<long long>> A){
    if(k==N){
        for(int i=0; i<M; i++){
            if(x[i]<X){
                return;
            }
        }
        if(*money > m){
            *money = m;
        }
    }else{
        // false
        solve(k+1, x, m, money, X, N, M, C, A);
        
        // true
        for(int i=0; i<M; i++){
            x[i] += A[k][i];
        }
        solve(k+1, x, m+C[k], money, X, N, M, C, A);    
    }
}

int main()
{   
    int N, M;
    long long X;
    cin >> N >> M >> X;
    
    long long C[N];
    vector<vector<long long>> A(N, vector<long long>(M, 0));
    for(int i=0; i<N; i++){
        cin >> C[i];
        for(int j=0; j<M; j++){
            cin >> A[i][j];
        }
    }
    
    long long money = INF;
    vector<long long> x(M, 0);
    solve(0, x, 0, &money, X, N, M, C, A);
    
    if(money == INF){
        money = -1;
    }
    cout << money << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repj(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define inf 100000001
const double pie  =3.141592653589793238463;
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<=n;i++)
#define vr vector
#define ef else if
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define lenth length()
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n" 
#define t4(x,y,z,a) cout<<"x is "<<x<<"    y is "<<y<<"    z is "<<z<<"    a is "<<a<<endl;
#define t3(x,y,z) cout<<"x is "<<x<<"    y is "<<y<<"    z is "<<z<<endl;
#define t2(x,y) cout<<"x is "<<x<<"    y is "<<y<<endl;
#define t1(x) cout<<"x is "<<x<<endl;
using namespace std;
int main()
{
    // fastio
    ll t,i,j,k,l,m,n,b,x,y,z,c,d,e,p,nl,np,q,r;
    string str2,str3;
    ll mx=INT_MIN;
    ll mn=INT_MAX;
    ll s;

    string s1,s2;
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    rep(i,0,n)
    {
        if(s1[i]!=s2[i])
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;


     
}

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

using namespace std;

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

	if(s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}

	return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define vi vector<int>

#define ll long long int

int ctoi(char c) {return c-'0';}
int ord(char c) {return c-'a';}
int len(string s) {return s.length();}
int itoc(int i) {return i+'a';}

int main (){
int n,i,brojac=0,br=0,x;
cin>>n;
for(i=1;i<=n;i++){
    int x = i;
    while(x>0){
        x=x/10;
        brojac++;
    }
    if(brojac%2==1){
        br++;
    }
    brojac=0;
}
cout<<br<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(llint i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
llint f(int x, vector<llint> &s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	return  s[x] = f(x - 1, s) + f(x - 2, s);
	
}

//aとｂの最大公約数を求めるよ！
llint gcd(llint a, llint b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {
	int x = 0;
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
	cout << x << endl;
}
void press(string& v) { v.erase(unique((v).begin(), (v).end()), v.end()); }

llint min(llint a, llint b) {
	if (a < b)return a;
	return b;
}
llint max(llint a, llint b) {
	if (a < b)swap(a, b);
	return a;
}
llint p(int n) {
	if(n==1)return 1;
	return n * p(n - 1);
}

int main() {
	int s;
	cin >> s;
	hei(int) x(s), y(s), a(s);
	rep(i, 0, s) {
		cin >> x[i] >> y[i];
		a[i] = i;
	}
	long double ans = 0;
	for (int i = 0; i < p(s); i++) {
		rep(j, 0, s - 1) {
			ans+=sqrt(pow(x[a[j + 1]] - x[a[j]], 2) + pow(y[a[j + 1]] - y[a[j]], 2));
		}
		next_permutation(begin(a), end(a));
	}
 ans /= p(s);
	cout << fixed << setprecision(10) << ans<< endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    string S, hi = "";
    bool ans = false;
    cin >> S;

    rep(i, 0, 5){
        hi += "hi";
        if(hi == S){
            ans = true;
            break;
        }
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define N 100005
#define f first
#define s second
using namespace std;
int main() {
    ll n;
    cin>>n;
    for(ll i=1; i<=9; ++i){
        if(n%i==0 && n/i<10){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 1000005
int n,m,len;
int a[N];
bool f[N];
char s[N];
int main()
{
	int T=1;
	//scanf("%d",&T);
	while(T--)
	{
		long long n1;
		scanf("%lld",&n1);
		long long ans=n1-1;
		for(int i=2;1ll*i*i<=n1;i++)
			if(n1%i==0)
				ans=min(ans,i+n1/i-2);
		printf("%lld",ans);
	}
}

Measured memory_bytes: 256
#import <stdio.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
typedef long long INT;

INT GCD(INT a, INT b){
    INT M = MAX(a, b);
    INT m = MIN(a, b);
    while (1) {
        INT r = M % m;
        if (r==0) break;
        M = m;
        m = r;
    }
    return m;
}

int main(){
    INT N;
    INT g = 1;
    scanf("%lld",&N);
    for(INT i=0;i<N;i++){
        INT t;
        scanf("%lld",&t);
        g = t/GCD(t,g) * g;
    }
    printf("%lld", g);
}


Measured memory_bytes: 6232
///not today

#include<bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair<int, pair<int, int> >
#define pf push_front

const int maxn = 1000* 100 + 5;
vector <int> aj[maxn];
bool mrk[maxn];
vector <int> v;
deque <int> q;

void dfs(int vv){
    mrk[vv] = true;
    v.pb(vv);
    for(int i = 0; i < SZ(aj[vv]); i ++){
        int u = aj[vv][i];
        if(!mrk[u]){
            dfs(u);
            return;
        }
    }
    return;
}

int32_t main(){
    int n, m, a, b;
    cin >>n >>m;
    for(int i = 0 ; i < m; i ++){
        int u, v;
        cin >>u >>v;
        u --;
        v --;
        aj[u].pb(v);
        aj[v].pb(u);
        a = u;
        b = v;
    }
    mrk[a] = true;
    mrk[b] = true;
    dfs(a);
    for(int i = 0; i < SZ(v); i ++)
        q.pf(v[i]);
    v.clear();
    dfs(b);
    for(int i = 0; i < SZ(v); i ++)
        q.pb(v[i]);
    cout <<SZ(q) <<endl;
    for(int i = 0; i < SZ(q); i ++)
        cout <<q[i] + 1 <<' ';
}


Measured memory_bytes: 10356
import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        String str = s.next();
        
        char[] cs = str.toCharArray();
        int changes = 0;
        
        for (int i = 1; i < str.length(); i ++) {
            if (cs[i] == cs[i - 1]) {
                changes ++;
                if (cs[i] == '0')
                    cs[i] = '1';
                else
                    cs[i] = '0';
            }
                
        }
        
        
        System.out.println(changes);
        
    }
    
}


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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int b[m], a[n][m];
  int i, j;
  for (i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  int sum[n] = {};
  for (i = 0; i < n; i++) {
    sum[i] += c;
    for (j = 0; j < m; j++) {
      sum[i] += b[j] * a[i][j];
    }
  }
  int count = 0;
  for (i = 0; i < n; i++) {
    if (sum[i] > 0) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i = (a); i >= (b); i--)
#define FORR(i,a,b) for (int i = (a); i > (b); i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

    string s;
    cin >> s;
    int n=s.length(),x;
    int mn=99999999;

    FOR(i,0,n-2){
        string tmp=s.substr(i,3);
        //cout << tmp << " ";
        x=stoi(tmp);
        if(x==753){
            cout << 0 << endl;
            return 0;
        }
        mn=min(mn,abs(x-753));
    }

    cout << mn << endl;

    return 0;
}


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

int main() {
    int64_t n; cin >> n;
    int l = 1; // 名前の文字数
    while (n > 0) {
        if (n > pow(26,l)) { // 26^1+26^2+...+26^l-1の部分を引いてnを更新
            n -= pow(26,l); // nが1~26^lの何番目に当たるかを考えればよい
            l++;
        } else {
            break;
        }
    }
    n--; // 多分必要
    vector<char> name(l); // 名前
    for (int i = l-1; i >= 0; i--) {
        name.at(i) = (char)(n%26+'a'); // nを26進数で表して文字に対応
        n /= 26;
        }
    string ans;
    for (int x : name) {
        ans += x;
    }
    // if (n == 0) { 
    //     for (int i = 0; i < l; i++) {
    //         name.at(i) = 'a';
    //     }
    //     printf("\n");
    // } else {
    //     for (int i = l-1; i >= 0; i--) {
    //         name.at(i) = (char)(n%26+'a');
    //         n /= 26;
    //     }
    //     for (int x : name) {
    //         printf("%c", x);
    //     }
    // }
    printf("%s\n", ans.c_str());
}

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





int main() {
  int h,w;
  cin>>h>>w;
  vector<vector<char>> data(h+2,vector<char>(w+2));
 
  vector<char> tmp(w+2,'0');
  
  data.at(0)=tmp;
  data.at(h+1)=tmp;
  
  for (int i=0;i<h;i++){
    data.at(i+1).at(0)='0';
    data.at(i+1).at(w+1)='0';
    
    string text;
    cin>>text;
    for (int j=0;j<w;j++){
      data.at(i+1).at(j+1)=text.at(j);
    }
  }  
  for (int i=1;i<h+1;i++){
    for (int j=1;j<w+1;j++){
      
      if (data.at(i).at(j)!='#'){
        int a,b,c,d,e,f,g,h;
        a=int(data.at(i-1).at(j-1)=='#');
        b=int(data.at(i-1).at(j)=='#');
        c=int(data.at(i-1).at(j+1)=='#');
        d=int(data.at(i).at(j-1)=='#');
        e=int (data.at(i).at(j+1)=='#');
        f=int(data.at(i+1).at(j-1)=='#');
        g=int(data.at(i+1).at(j)=='#');
        h=int(data.at(i+1).at(j+1)=='#');
        
        string x;
        x=to_string(a+b+c+d+e+f+g+h);
        data.at(i).at(j)=x.at(0);
      }
    }
  }
  
  for (int i=1;i<h+1;i++){
    for (int j=1;j<w+1;j++){
      cout<<data.at(i).at(j);
    }
    cout<<endl;
  }

}

  













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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
struct edge {
  ll to, cost;
};

int main() {
 string s;
  cin >> s;
if(s[s.size()-1]=='s')cout<< s << "es" << endl;
  else cout << s << "s" << endl;
  
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  int max = 0;
  int ans = 0;
  for(int i = 0;i<a;i++){
    int b;
    cin >> b;
    if(max <= b){
      max = b;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, W) = readIntegerList()
    val  INF = W + 1
    val dp = Array(N + 1) { IntArray(100000 + 1) { INF } }
    dp[0][0] = 0
    for (i in 0 until N) {
        val (w, v) = readIntegerList()
        for (j in 0..100000) {
            if (0 <= j - v) {
                dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j - v] + w)
            }
            dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j])
        }
    }
    var ans = 0
    for (v in dp[N].indices) {
        if (dp[N][v] <= W) ans = v
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


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

int main() {
    ll h;
    cin >> h;
    ll zyou = 1;
    ll ans = 0;
    while(true){
        if(h>=1){
            ans += zyou;
            zyou *= 2;
        }else{
            break;
        }
        h /= 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(long long i = 0; i < (long long)(n); i++)
#define ALL(x) (x).begin(),(x).end()

void solve(vector<long long> as){
  auto it = min_element(ALL(as), [](long long a, long long b) {
    return ((a % 10) == 0 ? 10 : (a % 10)) < ((b % 10) == 0 ? 10 : (b % 10));
  });
  long long ceiled = *it;

  REP(i, as.size()) {
    if(i != distance(as.begin(), it)) ceiled += (ceil(as[i]/10.0) * 10);
  }

  cout << ceiled << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long a;
  vector<long long> as;
  REP(i, 5) {
    cin >> a;
    as.push_back(a);
  }

    solve(as);
    return 0;
}


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

int main(){
    int i=0;
    string n;
    cin >>n;
for(; i<3; i++){
    if(n[i]=='1') n[i]='9';
     else if(n[i]=='9') n[i]='1';
}
cout <<n <<endl;
      return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){

  string s;
  cin >> s;
  int res = 0;
  for (int i = 0; i < 4; i++) {
    if(s[i] == '2') res++;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 1e5 + 5;
const int M = 1e5 + 5;
const ll OO = 1e18;
const int mod = 1e9 + 7;

int n,m,a[N];
pair<int,int> x[N];
ll sum = 0;

void init() {

}

int main() {

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

    cin >> n >> m;

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

    for (int j = 0; j < m; ++j) {
        cin >> x[j].s >> x[j].f;
    }

    int i = 0, cur = 0;

    sort(a,a+n);
    sort(x,x+m);
    reverse(x,x+m);

    while(i<n && cur<m) {

        if(x[cur].s) {

            a[i] = max(a[i], x[cur].f);
            ++i;
            if(!(--x[cur].s)) ++cur;

        }

    }

    for (int i = 0; i < n; ++i) {
        sum += a[i];
    }

    cout << sum << '\n';

    return 0;
}

Measured memory_bytes: 4824
import java.io.*;
class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader r =
         new BufferedReader(new InputStreamReader(System.in), 1);
         
        String line = r.readLine();    
        Long s = Long.parseLong(line);
        if ((0<=s) & (s<=86400)){
            long hour = s != 0 ? s / (60 * 60) : 0;
            long zan = s - hour * 60 * 60;
            long minute = zan != 0 ? zan / 60 :0;
            zan = zan - minute * 60;       
            System.out.println(hour+":"+minute+":"+zan);
        }
        r.close();
    }
}

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

static class CirclesIntersection
{
    static void Main()
    {
        var n = int.Parse( Console.ReadLine() );
        var q =
            from f in Enumerable.Repeat<Func<string>>( Console.ReadLine, n )
            let d = Array.ConvertAll( f().Split( ' ' ), double.Parse )

            let abx = d[3] - d[0]
            let aby = d[4] - d[1]

            let ab = Math.Sqrt( abx * abx + aby * aby )
            select
                ab + d[5] < d[2]  ?  2 :
                ab + d[2] < d[5]  ? -2 :
                ab <= d[2] + d[5] ?  1 :
                0;
        q.ToList().ForEach( Console.WriteLine );
    }
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  ll n;
  cin >> n;
  if(n==0){
    cout << 0 << endl;
    return 0;
  }
  ll base = 1;
  int cnt = 0;
  vector<int> ans;
  while(n!=0){
    if(n%abs(base*2)){
      ans.push_back(1);
      n-=base;
    }else{
      ans.push_back(0);
    }
    base *= -2;
  }
  for(int i=0; i<ans.size(); i++){
    cout << ans[ans.size()-i-1];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    //入力
    int A, B, C;
    cin >> A >> B >> C;

    //処理
    bool flg=false;

    if( (A<C && C<B) || (B<C && C<A) )  flg = true;

    //出力
    cout << ( (flg)? "Yes" : "No" ) << endl;

}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
M,D = map(int, input().split())

def check(m,d):
    d1 = d%10
    d2 = d//10
    return d1>=2 and d2>=2 and d1*d2==m

res = 0
for m in range(1,M+1):
    for d in range(1,D+1):
        if check(m,d):
            res += 1

print(res)


Measured memory_bytes: 3316
# 2020/05/31
# AtCoder Beginner Contest 169 - C

# Input
a, b = input().split()

# Calc
bint = int(b[0:len(b)-3])
bfloat = int(b[len(b)-2:len(b)])
ans = int(a) * (bint * 100 + bfloat) // 100

# Output
print(ans)


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

using namespace std;



int a[100];
int main(){
	
int n;
cin>>n;
for(int i=0;i<n;i++){
	cin>>a[i];
}
int min=a[0];
int max=a[0];
for(int i=1;i<n;i++){
	if(a[i]>max){
		max=a[i];
	}
	if(a[i]<min){
	min=a[i];
	}
}
cout<<max-min;
return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> void read(T &x){
	int f=0; x=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) f|=(ch=='-');
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	if(f) x=-x;
}

const int N=6005;
int C[N][N],fac[N],rev[N],n,mod,ans;

int fix(int x){
	return x>=mod?x-mod:x;
}
int power(int x,int p){
	int res=1;
	for(;p;p>>=1,x=(ll)x*x%mod)
		if(p&1) res=(ll)res*x%mod;
	return res;
}

int main(){
	read(n),read(mod);
	C[0][0]=1;
	rep(i,1,n*3){
		C[i][0]=1;
		rep(j,1,i) C[i][j]=fix(C[i-1][j-1]+C[i-1][j]);
	}
	fac[0]=1;
	rep(i,1,n*3) fac[i]=(ll)fac[i-1]*i%mod;
	rev[n*3]=power(fac[n*3],mod-2);
	per(i,n*3,1) rev[i-1]=(ll)rev[i]*i%mod;
	rep(i,0,n){
		int now=1,rem=n*3;
		rep(j,1,i){
			now=(ll)now*C[rem][3]*2%mod;
			rem-=3;
		}
		now=(ll)now*rev[i]%mod;
		int owo=1,sum=1;
		rep(j,1,n-i){
			owo=(ll)owo*C[rem][2]%mod;
			sum=(sum+(ll)owo*rev[j])%mod;
			rem-=2;
		}
		ans=(ans+(ll)now*sum)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 139392
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

#define NIL -1
struct Node {
    int parent;
    int left;
    int right;
};

Node T[100001];
int D[100001];
int H[100001];
int getSibling(int u) {
    if (T[u].parent == NIL) return NIL;
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) {
        return T[T[u].parent].left;
    }
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) {
        return T[T[u].parent].right;
    }
    return NIL;
}
void print(int i) {
    cout << "node " << i << ": ";
    cout << "parent = " << T[i].parent;
    cout << ", sibling = " << getSibling(i);
    int deg = 0;
    if (T[i].left != NIL) deg++;
    if (T[i].right != NIL) deg++;
    cout << ", degree = " << deg;
    cout << ", depth = " << D[i];
    cout << ", height = " << H[i];

    if (T[i].parent == NIL) {
        cout << ", root" << endl;
    } else if (T[i].left == NIL && T[i].right == NIL) {
        cout << ", leaf" << endl;
    } else {
        cout << ", internal node" << endl;
    }
}

void setDepth(int u, int d) {
    if (u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right, d+1);
}

int setHeight(int u) {
    int h1 = 0;
    int h2 = 0;
    if (T[u].left != NIL) {
        h1 = setHeight(T[u].left) + 1;
    }

    if (T[u].right != NIL) {
        h2 = setHeight(T[u].right) + 1;
    }
    return H[u] = max(h1, h2);
}


int n;
int main() {
    int v, l, r, root = 0;
    
    //節点の個数
    cin >> n;
    rep(i, 0, n) {
        T[i].parent = NIL;
    }
    rep(i, 0, n) {
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if (l != NIL) {
            T[l].parent = v;
        }
        if (r != NIL) {
            T[r].parent = v;
        }
    }
    rep(i, 0, n) {
        if (T[i].parent == NIL) {
            root = i;
        }
    }
    setDepth(root, 0);
    setHeight (root);
    rep(i, 0, n) {
        print(i);
    }

    return 0;
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  string fs = "YAKI";
  if (s.size() >= 4) {
    if (equal(fs.begin(), fs.end(), s.begin())) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;

  return 0;
}


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

def main():
    N = int(input())
    a = sorted(list(map(int, input().split())))
    b = sorted(list(map(int, input().split())))
    c = sorted(list(map(int, input().split())))

    ans = 0
    for i in range(N):
        tmp = bisect.bisect_right(a, b[i]-1)
        tmp *= N - bisect.bisect_left(c, b[i]+1)
        ans += tmp
    print(ans)

if __name__ == "__main__":
    main()

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

int main() {
  string s;
  cin >> s;
  
  int sum = 0;
  for(int i=0; i<s.size(); i++) {
    sum += s[i]-'0';
  }
  
  if(sum%9==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,INF=mod*mod*3;//M_PI
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back
#define fs first
#define sc second

ll N,D,A;
ll ans;
ll X[200005];
P mst[200005];

const ll max_n=1<<18;
ll data[2*max_n-1],datb[2*max_n-1];
void add(ll a,ll b,ll x,ll k,ll l,ll r){
    if(a<=l&&r<=b){
        data[k]+=x;
    }
    else if(l<b&&a<r){
        datb[k]+=(min(b,r)-max(a,l))*x;
        add(a,b,x,k*2+1,l,(l+r)/2);
        add(a,b,x,k*2+2,(l+r)/2,r);
    }
}
ll sum(ll a,ll b,ll k,ll l,ll r){
    if(b<=l||r<=a) return 0;
    else if(a<=l&&r<=b) return data[k]*(r-l)+datb[k];
    else{
        ll res=(min(b,r)-max(a,l))*data[k];
        res+=sum(a,b,k*2+1,l,(l+r)/2);
        res+=sum(a,b,k*2+2,(l+r)/2,r);
        return res;
    }
}

int main(){

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

cin>>N>>D>>A;
rep(i,N){
	cin>>mst[i].fs>>mst[i].sc;
	X[i]=mst[i].fs;
}
sort(mst,mst+N);
sort(X,X+N);
rep(i,N) add(i,i+1,mst[i].sc,0,0,N);
rep(i,N){
	ll H=sum(i,i+1,0,0,N);
	if(H<=0) continue;
	ll mid=mst[i].fs+D;
	ll in=upper_bound(X,X+N,mid+D)-X; 
	ll cnt=H/A;
	if(H%A!=0) cnt++;
	ans+=cnt;
	add(i,in,-A*cnt,0,0,N);
}
cout<<ans<<endl;

}
    


Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define rep(i, a, b) for (long long int i = (a); i < (b); i++)

using namespace std;
using ll = long long int;
using ld = long double;

auto p = [](auto s){
    cout << s << endl;
};

int main() {
    string S;
    cin >> S;
    if (S[2] == S[3] and S[4] == S[5]){
        p("Yes");
    }else{
        p("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){
int A[3];
 
cin >> A[0] >> A[1] >> A[2];
 
sort(A,A+3);
 
cout << A[0]  << " "<< A[1] << " " <<A[2] << endl;
 
}


Measured memory_bytes: 3136
import java.util.Scanner
object Main extends App {
  val in = new Scanner(System.in)
  val n = in.nextLong
  val divs: Stream[Long] = 10 #:: divs.map(_ * 5).takeWhile(_ <= 1000000000000000000L)
  println(if (n % 2 == 1) 0 else divs.map(n / _).sum)
}

Measured memory_bytes: 27312
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

//前提:解は必ず存在する
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> count(N, 0);  //何回同じ数値が出てきたかカウント
  bool flag0 = false;

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

  if (N % 2 == 1 && count[0] != 1) {
    cout << '0' << endl;
    return 0;
  }
  // 無理なものを除外
  for (int i = 0; i < N; i++) {
    if (count[A[i]] % 2 != 0 && N % 2 == 0) {
      cout << '0' << endl;
      return 0;
    }

    if (count[A[i]] % 2 != 0 && N % 2 == 1 && A[i] != 0) {
      cout << '0' << endl;
      return 0;
    }

    if (count[A[i]] > 2) {
      cout << '0' << endl;
      return 0;
    }
  }
  int answer = 1;

  for (int i = 0; i < N / 2; i++) {
    answer *= 2;
    answer %= 1000000007;
  }

  cout << answer << endl;
}


Measured memory_bytes: 1024
let [| A; B; K |] = stdin.ReadLine().Split() |> Array.map int

let rec solver r i =
    if A % i = 0 && B % i = 0 then
        if K = r + 1 then i
        else solver (r + 1) (i - 1)
    else solver r (i - 1)

solver 0 (min A B) |> stdout.WriteLine


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

int N,K;
int D[11];
vector<int> d;

bool eval(int n){
  int num=n;
  while(num>0){
    int m = num%10;
    if(find(d.begin(),d.end(),m)!=d.end()){
      return false;
    }
    num /= 10;
  }
  return true;
}

int main()
{
  int res=0;
  cin >> N >> K;

  rep(i,K) {
    int n; cin >> n;
    d.push_back(n);
  }

  FOR(i, N, N*100){
    if(eval(i)) {
      res= i;
      break;
    }
  }

  cout << res << endl;
}


Measured memory_bytes: 256
def solve():
    N = int(input())
    s = 0
    n = [0] * (10**5+1)
    for a in map(int, input().split()):
        s += a
        n[a] += 1
    q = int(input())
    for _ in range(q):
        b, c = map(int, input().split())
        s += (c - b) * n[b]
        print(s)
        n[c] += n[b]
        n[b] = 0


if __name__ == '__main__':
    solve()


Measured memory_bytes: 18052
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int count=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        if(x>=k)
            count++;
    }
    cout<<count<<"\n";

    
}

Measured memory_bytes: 3616
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MultiWayIf #-}


import Control.Arrow
import Control.Concurrent
import Control.Monad
import qualified Data.ByteString.Char8 as C
import Data.Complex
import Data.Function
import Data.Function.HT
import qualified Data.IntMap.Strict as IM
import qualified Data.IntSet as IS
import Data.List
import Data.Ord
import qualified Data.Sequence as Sq
import Data.Vector.Algorithms.Search
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import Debug.Trace


------------------
-- #   Read   # --
------------------

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    [a,b] <- r'
    print $ a * b



Measured memory_bytes: 3772
import java.util.Scanner;

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

    int N = 26;
    int D = scanner.nextInt();
    int[] c = new int[N];
    int[][] s = new int[D][N];
    for (int i = 0; i < N; i++) c[i] = scanner.nextInt();
    for (int i = 0; i < D; i++) for (int j = 0; j < N; j++) s[i][j] = scanner.nextInt();

    int[] t = new int[D];
    int[] last = new int[N];
    for (int d = 0; d < D; d++) {
      int type = -1;
      int score = -36500 * 26;
      for (int i = 0; i < N; i++) {
        int ss = s[d][i];
        for (int j = 0; j < N; j++) if (j != i) ss -= c[j] * (d + 1 - last[j]);
        if (ss > score) {
          score = ss;
          type = i;
        }
      }
      t[d] = type;
      last[type] = d + 1;
    }

    for (int i = 0; i < D; i++) System.out.println(t[i] + 1);
  }
}


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

int main()
{
  string s, t, res = "YES";
  cin >> s >> t;
  for(int i=0; i<3; i++)
    if(s[i] != t[2-i])
      res = "NO";
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3552