akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>

#define IO std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);

#define MOD 1000000007
#define ull unsigned long long int
#define ll  long long int
#define MAX 100005

using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;




int main() {

    IO
    //freopen("entrada.txt", "r", stdin);


    int n;

    cin >> n;

    ll resp=0;

    for(int i=1; i<=n; i++) {
        for(int j=1; j<=n; j++) {
            for(int k=1; k<=n; k++) {
                resp+=__gcd(i, __gcd(j, k));
            }
        }
    }

    cout << resp << "\n";


    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const long long INF = 1LL << 60;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int main() {
    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    rep(i,99999){
        C-=B;
        if(A<1||C<1){
            break;
        }
                A-=D;
        if(A<1||C<1){
            break;
        }
    }

    if(C<1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3632
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (x, y) = (v[0], v[1]);

    for turu in 0..x + 1 {
        let kame = x - turu;
        if turu * 2 + kame * 4 == y {
            println!("Yes");
            return;
        }
    }
    println!("No");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2064
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  vector<int> M;
  rep(i, 10) {
    int mi;
    cin >> mi;
    M.pb(mi);
  }
  sort(all(M));
  cout << M[9] << endl;
  cout << M[8] << endl;
  cout << M[7] << endl;
}



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

int n, m, f[200][200];
char s[200][200];

int main() {
#ifdef isLOCAL
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        scanf("%s", s[i] + 1);

    f[1][1] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (i + j == 2) continue;
            f[i][j] = 1e9;
            if (i > 1) f[i][j] = min(f[i][j], f[i - 1][j] + (s[i][j] != s[i - 1][j]));
            if (j > 1) f[i][j] = min(f[i][j], f[i][j - 1] + (s[i][j] != s[i][j - 1]));
        }
    }

    int ans = f[n][m];
    if (s[1][1] == '#') ans++;

    cout << ans / 2 << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int k; cin >> k;
    int ans = 0;
    set<int> loop;
    int loop_init = 7%k;
    loop.insert(loop_init);
    if(loop_init==0) ans = 1;
    else if(k%2==0) ans = -1;
    else{
        int s = 77;
        int cnt = 2;
        int mod = s % k;
        while(1){
            if(mod == 0){
                ans = cnt;
                break;
            }
            if(loop.find(mod)!=loop.end()){
                ans = -1;
                break;
            }
            loop.insert(mod);
            mod = (mod*10 + 7) % k;
            cnt++;
        }
    }
    pr(ans);
    return 0;}

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

int main(){
    int N; cin >> N;
    vector<string> array(N);
    string s;
    for( int i = 0; i < N; i++ ){
        cin >> s;
        sort(s.begin(), s.end());
        array[i] = s;
    }
    sort(array.begin(),array.end());
    long long ans = 0;
    long long count = 1;
    for( int i = 1; i < N; i++ ){
        if( array[i] == array[i-1] ){
            count++;
            if( i == N-1 ){
                ans += count * (count - 1) / 2;
                count = 1;
            }
        } else {
            ans += count * (count - 1) / 2;
            count = 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const int MOD=1e9+7;
const ll INF=1e18;
const ll inf=1e9;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int n,u,v;
  cin >> n >> u >> v;
  u--;
  v--;
  vector<vector<int>> G(n);
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vector<int>du(n,inf),dv(n,inf);
  du[u]=0,dv[v]=0;
  queue<int>qu,qv;
  qu.push(u),qv.push(v);
  while(!qu.empty()){
    int t = qu.front();
    qu.pop();
    for(auto nt:G[t]){
      if(du[nt]<=du[t]+1)continue;
      du[nt]=du[t]+1;
      qu.push(nt);
    }
  }
  while(!qv.empty()){
    int t = qv.front();
    qv.pop();
    for(auto nt:G[t]){
      if(dv[nt]<=dv[t]+1)continue;
      dv[nt]=dv[t]+1;
      qv.push(nt);
    }
  }

  int ans = 0;
  rep(i,n){
    if(du[i]<dv[i] && dv[i]!=inf){
      ans=max(dv[i]-1,ans);
    }
  }
  
  cout << ans << endl;
  return 0;
}


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

int main()
{
  string s;
  cin >> s;
  int n = s.size() + 1;
  int a[n];
  rep(i, n) a[i] = 0;
  for(int i = 0; i < n - 1; i++){
    if(s[i] == '<'){
      a[i + 1] = a[i] + 1;
    }
  }
  for(int i = n - 2; i >= 0; i--){
    if(s[i] == '>'){
      a[i] = max(a[i], a[i + 1] + 1);
    }
  }
  ll sum = 0;
  rep(i, n) sum += a[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 5812
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	private static long dp[];

	private static long util(int arr[], int start, int k, int end) {

		if (start >= end - 1)
			return 0;

		if (dp[start] != 0)
			return dp[start];
		long ans = Long.MAX_VALUE;

		for (int j = 1; j <= k; j++) {

			if (start + j < end) {
				ans = Math.min(ans, Math.abs(arr[start] - arr[start + j]) + util(arr, start + j, k, end));
			}
		}
		return dp[start] = ans;

	}

	private static long util1(int arr[],int k,int end) {
		
		dp[0] = 0;
		dp[1] = Math.abs(arr[1] - arr[0]);
		
		for(int i=2; i<arr.length; i++) {
			dp[i] = Integer.MAX_VALUE;
			for(int j = i - 1;  j >= 0 && j >=i - k;  j--  ) {
			
				dp[i] = Math.min(dp[j] + Math.abs(arr[i] - arr[j]) ,dp[i] );
				
			}
		}
		return dp[end-1];
		
	}

	public static void main(String[] args) {

		FastReader sc = new FastReader();

		int n = sc.nextInt();
		int k = sc.nextInt();

		int arr[] = new int[n];

		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		dp = new long[n];
		System.out.println(util1(arr, k, n));

	}

}


Measured memory_bytes: 44564
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100005;
set<int> st;
int n;
bool is_prime(int n){
    if(n == 1) return false;
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
void div(int n){
    for (int i = 1; i * i <= n; i++){
        if(n%i==0){
            if(is_prime(i))st.insert(i);
            if(is_prime(n/i))st.insert(n / i);
        }
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    div(n);
    int res=0;
    for(auto it:st){
        int a=it;
        while(true){
            if(n%a==0){
                res++;
                n/=a;
                a*=it;
            }else{
                break;
            }
        }
    }
    cout<<res<<endl;
}

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

ll mod(ll a)
{
	if(a>0)
		return a;
	return -a;
}

int main()
{
	int n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	ll dp[n];
	dp[0]=0;
	dp[1]=mod(a[1]-a[0]);
	for(int i=2;i<n;i++)
	{
		ll mi=100000000000000000;
		for(int j=max(0,i-k);j<i;j++)
		{
			mi=min(mi,dp[j]+mod(a[i]-a[j]));
		}
		dp[i]=mi;
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  if(S=="SSS")
    cout<<0<<endl;
  if(S=="RSS"||S=="SRS"||S=="SSR"||S=="RSR")
    cout<<1<<endl;
  if(S=="RRS"||S=="SRR")
    cout<<2<<endl;
  if(S=="RRR")
    cout<<3<<endl;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin>>N;
    bool A[101] = {}, B[101] = {}, C[101] = {};
    int X;
    cin>>X;
    for (int i=0; i<X; i++)
    {
        int a;
        cin>>a;
        A[a] = true;
    }
    int Y;
    cin>>Y;
    for (int i=0; i<Y; i++)
    {
        int b;
        cin>>b;
        B[b] = true;
    }
    int Z;
    cin>>Z;
    for (int i=0; i<Z; i++)
    {
        int c;
        cin>>c;
        C[c] = true;
    }
    int ans = 0;
    for (int i=1; i<=N; i++)
        if (!A[i] && C[i] || B[i] && C[i])
            ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3092
#Union Find

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]


n = int(input())

edge = [[] for _ in [0]*n]
for i in range(n):
	s = input()
	for j in range(n):
		if s[j] == '1':
			edge[i].append(j)


res = -1
for start in range(n):
	par = [-1]*n
	used = [False]*n
	used[start] = True

	tank = set()
	new = {start}
	judge = True

	while len(new) != 0 and judge:
		tank = set()
		for e in new:
			for go in edge[e]:
				if not used[go]:
					if same(e,go):
						judge = False
					else:
						tank.add(go)
		for e in new:
			used[e] = True
		if len(tank) >= 1:
			qqq = list(tank)[0]
			for e in tank:
				unite(e,qqq)
		new = tank

	if judge:
		cnt = 0
		for e in par:
			if e < 0:
				cnt += 1
		res = max(cnt,res)
print(res)








Measured memory_bytes: 50412
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S, T = map(str, input().split())
A, B = MAP()
U = input()

if S == U:
  print(A-1, B)
elif T == U:
  print(A, B-1)
  

Measured memory_bytes: 5780
N = int(input())
src = list(map(int,input().split()))
asc = None
ans = 1
for i in range(N-1):
    d = src[i+1] - src[i]
    if d == 0: continue
    if asc is None:
        asc = d > 0
    elif (asc and d < 0) or (not asc and d > 0):
        ans += 1
        asc = None
print(ans)

Measured memory_bytes: 14224
using System;

namespace AtCoder
{
	public class ProblemA
	{
		public static void Main(string[] args)
		{
			string s = Console.ReadLine();

			long sum = 0;
			int digits = s.Length;
			int limit = (1 << (digits - 1));

			for (int i = 0; i < limit; i++)
			{
				sum += Calc(s, i);
			}
			

			Console.WriteLine(sum);
		}

		private static long Calc(string s, int bit)
		{
			long ans = 0;

			int first = 0;
			for (int i = 0; i < s.Length && bit > 0; i++, bit >>= 1)
			{
				bool add = (bit & 1) == 1;

				if (add)
				{
					ans += long.Parse(s.Substring(first, i - first + 1));
					first = i + 1;
				}
			}

			ans += long.Parse(s.Substring(first));

			return ans;
		}
	}
}


Measured memory_bytes: 27312
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)

int main(){
  vector<int> x(5);
  rep(i,5){
    cin >> x.at(i);
  }
  rep(i,5){
    if(x.at(i)==0){
      cout << i+1;
    }
  }
  return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define rv(s) reverse(s.begin(),s.end());
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n,m;cin>>n>>m;
  vpii v(n);
  rep(i,n){
    int a,b;cin>>a>>b;
    v[i]=mp(a,b);
  }
  vsort(v);
  int counter=0;
  ll ans=0;
  rep(i,n){
    rep(j,v[i].second){
      ans+=v[i].first;
      counter++;
      if(counter==m){
        cout<<ans<<endl;
        return 0;
      }
    }
  }
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<class T>
struct Point {
	typedef Point P;
	T x, y;
	explicit Point(T x=0, T y=0) : x(x), y(y) {}
	bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
	bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
	P operator+(P p) const { return P(x+p.x, y+p.y); }
	P operator-(P p) const { return P(x-p.x, y-p.y); }
	P operator*(T d) const { return P(x*d, y*d); }
	P operator/(T d) const { return P(x/d, y/d); }
	T dot(P p) const { return x*p.x + y*p.y; }
	T cross(P p) const { return x*p.y - y*p.x; }
	T cross(P a, P b) const { return (a-*this).cross(b-*this); }
	T dist2() const { return x*x + y*y; }
	double dist() const { return sqrt((double)dist2()); }
	// angle to x-axis in interval [-pi, pi]
	double angle() const { return atan2(y, x); }
	P unit() const { return *this/dist(); } // makes dist()=1
	P perp() const { return P(-y, x); } // rotates +90 degrees
	P normal() const { return perp().unit(); }
	// returns point rotated 'a' radians ccw around the origin
	P rotate(double a) const {
		return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
};

using P = Point<double>;
pair<vi, vi> ulHull(const vector<P>& S) {
	vi Q(sz(S)), U, L;
	iota(all(Q), 0);                                                                                                                                                                         
	sort(all(Q), [&S](int a, int b){ return S[a] < S[b]; }); 
	trav(it, Q) {
#define ADDP(C, cmp) while (sz(C) > 1 && S[C[sz(C)-2]].cross(\
	S[it], S[C.back()]) cmp 0) C.pop_back(); C.push_back(it);
		ADDP(U, <=); ADDP(L, >=);
	}   
	return {U, L}; 
}

vi convexHull(const vector<P>& S) {
	vi u, l; tie(u, l) = ulHull(S);
	if (sz(S) <= 1) return u;
	if (S[u[0]] == S[u[1]]) return {0};
	l.insert(l.end(), u.rbegin()+1, u.rend()-1);
	return l;
}


vector<pii> antipodal(const vector<P>& S, vi& U, vi& L) {
	vector<pii> ret;
	int i = 0, j = sz(L) - 1;
	while (i < sz(U) - 1 || j > 0) {
		ret.emplace_back(U[i], L[j]);
		if (j == 0 || (i != sz(U)-1 && (S[L[j]] - S[L[j-1]])
					.cross(S[U[i+1]] - S[U[i]]) > 0)) ++i;
		else --j;
	}
	return ret;
}

double polygonDiameter(const vector<P>& S) {
	vi U, L; tie(U, L) = ulHull(S);
	pair<double, pii> ans;
	trav(x, antipodal(S, U, L))
		ans = max(ans, {(S[x.first] - S[x.second]).dist2(), x});
	return ans.first;
}

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vector<P> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i].x >> a[i].y;
	}
	cout << sqrt(polygonDiameter(a)) << '\n';
}



Measured memory_bytes: 4316
M, D = [int(_) for _ in input().split()]
ans = 0
for d in range(10, D + 1):
    d = str(d)
    d0 = int(d[0])
    d1 = int(d[1])
    if d0 > 1 and d1 > 1 and d0 * d1 < M + 1:
        ans += 1
print(ans)


Measured memory_bytes: 2940
n = int(input())
s = str(input())
cnt = 0
def f(x):
	tgt = [ x[0], x[1], x[2] ]
	now = 0
	global n
	for i in range(n):
		if s[i] == tgt[now]: now += 1
		if now == 3: return True
	return False
for i in range(1000):
	if len(str(i)) == 1: t = "00"+str(i)
	elif len(str(i)) == 2: t = "0"+str(i)
	else: t = str(i)
	if f(t): cnt += 1
print(cnt)

Measured memory_bytes: 69164
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n,c,cal=0;
  cin>>n>>c;
  vector<long> x(n+1),v(n+1),vtcw(n+1,0);
  vector<pair<long,long>> calcwmax(n+1,make_pair(0,0)),calccwmax(n+1,make_pair(0,0));
  x[0]=v[0]=0;
  for(long i=1;i<=n;++i)cin>>x[i]>>v[i];
  vtcw[0]=0;
  for(long i=1;i<=n;++i)vtcw[i]=v[i]+vtcw[i-1];
  auto vtccw = [&](long k){return k==0?0:vtcw[n]-vtcw[k-1];};
  calcwmax[0].second=vtcw[0]-x[0];
  for(long i=1;i<=n;++i){
    if(calcwmax[i-1].second<vtcw[i]-x[i])calcwmax[i]=make_pair(i,vtcw[i]-x[i]);
    else calcwmax[i]=calcwmax[i-1];
  }
  calccwmax[n]=make_pair(n,vtccw(n)-c+x[n]);
  for(long i=n-1;i>=0;--i){
    if(calccwmax[i+1].second<vtccw(i)-c+x[i])calccwmax[i]=make_pair(i,vtccw(i)-c+x[i]);
    else calccwmax[i]=calccwmax[i+1];
  }
  cal=calcwmax[n].second;
  for(long xccwi=n;xccwi>0;--xccwi){
    long calt=calccwmax[xccwi].second+calcwmax[xccwi-1].second;
    cal=max(cal,calt-min(c-x[xccwi],x[calcwmax[xccwi-1].first]));
  }
  cout<<cal<<"\n";
  return 0;
}

Measured memory_bytes: 5760
#ABC095C
def main():
    import sys, math
    A,B,C,X,Y = map(int, sys.stdin.readline().split())
    L =[]
    #全部C
    L.append(max(X, Y)*2*C)
    
    #できるだけC 不足分A,B
    if X <= Y:
        L +=[X*2*C + (Y-X)*B]
    else:
        L +=[Y*2*C + (X-Y)*A]
    
    #全部A,B
    L.append(A*X+B*Y)
    print(min(L))


if __name__=='__main__':
    main()


Measured memory_bytes: 3060
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    vint a(n);
    rep(i, n) cin >> a[i];

    int r=0, c;
    rep(i, n) chmax(r, a[i]);
    c = a[0];
    if(c==r) c = a[1];
    rep(i, n) {
        if(a[i]==r) continue;
        if(abs(r/2.0 - c) > abs(r/2.0-a[i])){c = a[i];};
    }
    cout << r << " " << c << endl;
    return 0;}

Measured memory_bytes: 3784
#include <iostream>
#include <string.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
    int p=0;
	// ユークリッドの方法
	while( m > n )
	{
        m = m/2;
        p+=1;
	}
	return p;
}//gcd

int main()
{
    int i,n,a[50],b,c=0;
    memset(a,0,sizeof(a));
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        if(a[i] != i+1)
        {
            c++;
        }
    }
    if(c <= 2)
    {
        cout << "YES";
    }else
    {
        cout << "NO";
    }
    
}

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

using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e6 + 5;
const ll MOD = 998244353;

int parent[N];

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

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

int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}

void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}

int main()
{
    IOS
    int n;
    cin >> n;
    map<ll, ll> mp;
    ll sum = 0;
    for(int i=0;i<n;i++) {
        ll x;
        cin >> x;
        mp[x]++;
        sum += x;
    }
    //for(auto p : mp) cout << p.first << " " << p.second << endl;
    int q;
    cin >> q;
    while(q--) {
        ll b, c;
        cin >> b >> c;
        sum -= mp[b] * b;
        sum += mp[b] * c;
        mp[c] += mp[b];
        mp[b] = 0;
        //for(auto p : mp) cout << p.first << " " << p.second << endl;
        cout << sum << endl;
    }
    return 0; 
}



Measured memory_bytes: 9488
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	
	while(getline(cin, s)){
		for(int i=0;i<s.size()-4;i++){
			if(s[i]=='a'){
				if(s[i+1]=='p'){
					if(s[i+2]=='p'){
						if(s[i+3]=='l'){
							if(s[i+4]=='e'){
								s[i]='p'; s[i+1]='e'; s[i+2]='a'; s[i+3]='c'; s[i+4]='h';
								continue;
							}
						}
					}
				}
			}
			if(s[i]=='p'){
				if(s[i+1]=='e'){
					if(s[i+2]=='a'){
						if(s[i+3]=='c'){
							if(s[i+4]=='h'){
								s[i]='a'; s[i+1]='p'; s[i+2]='p'; s[i+3]='l'; s[i+4]='e';
								continue;
							}
						}
					}
				}
			}
		}
		cout<<s<<endl;
		
	}
	return 0;
}
	

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

long long N;
long long A[30], B[30], C[30];

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		cin >> A[i];
	}
	for(long long i = 0; i < N; i++){
		cin >> B[i];
	}
	for(long long i = 0; i < N - 1; i++){
		cin >> C[i];
	}

	long long sumi = 0;
	set<long long> done;
	for(long long i = 0; i < N; i++){
		long long food = A[i] - 1;
		sumi += B[food];
		done.insert(food);
		if(i < N - 1){
			long long nextfood = A[i + 1] - 1;
			if(food + 1 == nextfood){
				sumi += C[food];
			}
		}

	}
	cout << sumi << endl;
}

Measured memory_bytes: 256
main(s,t,T){double x,y;
	for(t=90;scanf("%d,%d",&s,&T),s||T;t-=T)x+=s*cos(t*3.1415/180),y+=s*sin(t*3.1415/180);
	printf("%d\n%d\n",(int)x,(int)y);
	exit(0);
}

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

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String W = in.readLine();
		int N = Integer.parseInt(W.split(" ")[0]);
		int K = Integer.parseInt(W.split(" ")[1]);

		long ans = N-K;

		if(K==1){
			ans =0;
		}
		System.out.println(ans);
	}

}


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

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

  cout << Z << " " << X << " " << Y << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double A = scan.nextDouble();
		double B = scan.nextDouble();
		if(A > B) System.out.print("GREATER");
		else if(A < B) System.out.print("LESS");
		else System.out.print("EQUAL");
		scan.close();
	}
}


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

typedef long long int lli;
#define pb push_back
#define gcd __gcd
#define MOD 1000000007
#define mod2 998244353
#define forz(i,n) for(long long int i=0;i<n;i++)

double mod(double a){
    if(a<0) return -1*a;
    return a;
}

bool prime[100000000+1];

void SieveOfEratosthenes() 
{ 
    lli n=100000000;
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
}

bool aa(string a,string b){
    for(int i=0;i<7;i++){
        if(a[i]=='?') continue;
        else if(a[i]==b[i]) continue;
        else return 0;
    }
    return 1;
}

bool bb(string t2){
    map<string,lli> solve;
    map<string,lli>::iterator itr;
    for(int i=0;i<t2.size()-6;i++){
        solve[t2.substr(i,7)]++;
    }
    string s="abacaba";
    if(solve[s]==1) return 1;
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t=1,u,j;
    
    
    //cin>>t;
    ///SieveOfEratosthenes();
    for(u=1;u<=t;u++){
        lli m,n, i,j,k,p=0,q=0,p1=0,p2=0,p3=0,ans=0,l,r,index=-1;
        cin>>n;
        if(n>=400 & n<600) cout<<"8"<<endl;
        if(n>=600 & n<800) cout<<"7"<<endl;
        if(n>=800 & n<1000) cout<<"6"<<endl;
        if(n>=1000 & n<1200) cout<<"5"<<endl;
        if(n>=1200 & n<1400) cout<<"4"<<endl;
        if(n>=1400 & n<1600) cout<<"3"<<endl;
        if(n>=1600 & n<1800) cout<<"2"<<endl;
        if(n>=1800 & n<2000) cout<<"1"<<endl;
    }
}


Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
ll a[2000005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  ll sum = 0;
  REP(i, n) {
    cin >> a[i];
    sum += a[i];
  }

  ll sums = 0;
  ll ans = LLINF;
  REP(i, n - 1) {
    sums += a[i];
    ans = min(ans, abs((sum - sums) - sums));
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  int l;
  if(a>=b&&a>=c)l=a*10+b+c;
  else if(b>=a&&b>=c)l=b*10+a+c;
  else if(c>=a&&c>=a)l=c*10+b+a;

  printf("%d\n",l);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main()
{
    int n,a,b,tmp,sum=0,tmp2nd;
    scanf("%d %d %d",&n,&a,&b);
    for(int i = 1; i<=n; i++)
    {
        tmp = i;
        tmp2nd = tmp/10000 + (tmp%10000)/1000 + (tmp%1000)/100 + (tmp%100)/10 + tmp%10;
        if(tmp2nd >= a && tmp2nd <= b)
        {
            sum += tmp;
        }
    }
    printf("%d\n",sum);
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int res = 0;
int n, m, q;
vector<tuple<int, int, int, int>> queries;

void update(vector<int>& values)
{
    // pvec(values);
    int now = 0;
    for (auto query: queries)
    {
        int a, b, c, d;
        tie(a, b, c, d) = query;
        if (values[b]-values[a] == c) now+= d;
    }
    res = max(res, now);
}

void dfs(vector<int>& values, int prev)
{
    if (values.size() == n)
    {
        update(values);
        return;
    }
    rep(n, prev, m+1)
    {
        values.push_back(n);
        dfs(values, n);
        values.pop_back();
    }
}


int main()
{
    cin >> n >> m >> q;
    rep(i, 0, q)
    {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        --a, --b;
        queries.emplace_back(a, b, c, d);
    }

    vector<int> values;
    dfs(values, 1);
    
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        int x,i;
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            x = sc.nextInt();
            x +=sc.nextInt();
            for (i = 1; x / 10 > 0; i++) {
                x = x / 10;
            }
            System.out.println(i);
        }
    }
}

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

char s[100010];
queue<int> q;

int main() {
    int n, K;
    scanf("%d%d", &n, &K);
    scanf("%s", s);
    int sum = 0, cnt = 0, res = 0;
    for (int i = 0; i < n; i++) {
        int pos = i;
        while (i < n && s[i] == s[pos]) {
            i++;
        }
        sum += i - pos;
        if (s[pos] == '1') {
            q.push(i - pos);
        } else {
            q.push(pos - i);
            cnt++;
        }

        while (cnt > K && !q.empty()) {
            int x = q.front();
            q.pop();
            sum -= abs(x);
            if (x < 0) {
                cnt--;
            }
        }
        if (cnt <= K) {
            res = max(res, sum);
        }
        i--;
    }
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 528
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ cin>>vec[i];}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define S second
#define F first
const int  MOD = 1e9 + 7;
const int  N = 1e5 + 7;
ll dp[102][N] , prefix[102][N] , a[102];

inline int add(int a, int b){
	a += b;
	if(a >= MOD)a -= MOD;
	return a;
}
 
inline int sub(int a, int b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}

//  a d f j k  l  ;
int main(){
    ios::sync_with_stdio(0);  cin.tie(0);
    ll n , k;
    cin>>n>>k;
    for(ll i = 1 ; i <= n ; i++) cin>>a[i];
    
    for(ll i = 0;i <= n; i++) dp[i][0] = prefix[i][0] = 1;
	for(ll j = 0;j <= k; j++) prefix[0][j] = 1;

    for(ll i = 1 ; i <= n ; i++){
        for(ll j = 1 ; j <= k ; j++){
            int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
			int last = prefix[i - 1][j];
			dp[i][j] = add(dp[i][j], sub(last, first));
			prefix[i][j] = add(prefix[i][j - 1], dp[i][j]);
        }
    }
    cout<<dp[n][k]<<endl;

    return 0;
}

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

#define ll long long

using namespace std;

const int N = (int)1e5 + 7;

int x, y, a, b, c;
multiset <int> s[3];
vector <int> vv[2];

main() {
  cin >> x >> y >> a >> b >> c;
  for (int i = 0; i < a; i++) {
    int X;
    scanf("%d", &X);
    vv[0].push_back(X);
  }
  for (int i = 0; i < b; i++) {
    int X;
    scanf("%d", &X);
    vv[1].push_back(X);
  }
  vector <int> vec;
  for (int i = 0; i < c; i++) {
    int X;
    scanf("%d", &X);
    vec.push_back(X);
  }
  sort(vv[0].rbegin(), vv[0].rend());
  sort(vv[1].rbegin(), vv[1].rend());
  sort(vec.rbegin(), vec.rend());
  for (int i = 0; i < x; i++) {
    s[0].insert(vv[0][i]);
  }
  for (int i = 0; i < y; i++) {
    s[1].insert(vv[1][i]);
  }
  for (int to : vec) {
    int dif[2] = {to - *s[0].begin(), to - *s[1].begin()};
    if (dif[0] > 0 && dif[1] > 0) {
      if (dif[0] > dif[1]) {
        s[0].erase(s[0].begin());
        s[0].insert(to);
      } else {
        s[1].erase(s[1].begin());
        s[1].insert(to);
      }
    } else if (dif[0] > 0) {
      s[0].erase(s[0].begin());
      s[0].insert(to);
    } else if (dif[1] > 0) {
      s[1].erase(s[1].begin());
      s[1].insert(to);
    } else {
      break;
    }
  }
  ll ans = 0;
  for (int to : s[0]) {
    ans += to;
  }
  for (int to : s[1]) {
    ans += to;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 9848
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define int long long
#define m_k make_pair
using namespace std;
const int N=2*1e5+100;
int n,a[N],b[N],sum[100][100],ans;
char s[1000];
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",s);
		int len=strlen(s);
		int x=0,cnt=0;
		bool bl=1;
		for (int j=0;j<len;j++)
		{
			if (s[j]=='.')
			{
				bl=0;
				continue;
			}
			if (!bl) cnt++;
			x=x*10ll+s[j]-'0';
		}
		for (int j=1;j<=9-cnt;j++) x*=10ll;
		while (x%2==0) a[i]++,x/=2ll;
		while (x%5==0) b[i]++,x/=5ll;
		sum[a[i]][b[i]]++;
		if (a[i]+a[i]>=18 && b[i]+b[i]>=18) ans--;
	}
	for (int i=70;i>=0;i--)
	{
		for (int j=70;j>=0;j--) sum[i][j]+=sum[i][j+1];
	}
	for (int j=70;j>=0;j--)
	{
		for (int i=70;i>=0;i--) sum[i][j]+=sum[i+1][j];
	}
	for (int i=1;i<=n;i++) ans+=sum[max(18-a[i],0ll)][max(18-b[i],0ll)];
	ans/=2;
	printf("%lld\n",ans);
}

Measured memory_bytes: 6896
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<cstring>
#define  si(a)       scanf("%d",&a);
#define  sl(a)       scanf("%lld",&a);
#define  sii(a,b)    scanf("%d%d",&a,&b)
#define  sll(a,b)    scanf("%lld%lld",&a,&b);
#define  queues      priority_queue
#define mod 998244353
#define mem(a)  memset(a,0,sizeof(a))
#include<vector>
typedef long long ll;
const int INF=0x3f3f3f3f;
//priority_queue<int,vector<int >,greater<int > >q;
// nth_element()
#define PI acos(-1)
using namespace std;
int gcd(int a,int b)
{
    return b==0?a:gcd(b,a%b);
}
int main(){
 double a,b;
 cin>>a>>b;
 printf("%.10f",a/b);

}
/******************************************
**        **             ********       **
**       ** **           **             **
**      **   **          **             **
**     **     **         **             **
**    ***********        **             **
**   **         **       ********       **
******************************************/


Measured memory_bytes: 256
n = int(input())
lst = [input() for i in range(3)]

cnt = 0

for i in range(n):
    a = lst[0][i]
    b = lst[1][i]
    c = lst[2][i]

    if a == b and b == c:
        pass
    elif a == b or b == c or c == a:
        cnt += 1
    else:
        cnt += 2

print(cnt)


Measured memory_bytes: 3060
n,x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
ans = 0
cnt = 0
for i in range(n):
    if a[i]<=x:
        cnt += 1
    x-=a[i]
if x>0:
    cnt -= 1
print(max(0,cnt))

Measured memory_bytes: 3064
program ABC155A
    implicit none
    integer(8)::i
    integer(8)::flg=0
    integer(8),dimension(3)::A
    read(5,*)(A(i),i=1,3)
    A=iqsort(A)

    if(A(1)==A(2))then
        if(A(2)/=A(3))flg=1
    else if(A(2)==A(3))then
        if(A(1)/=A(2))flg=1
    end if

    if(flg==0)print'(A)',"No"
    if(flg==1)print'(A)',"Yes"
contains
    recursive function iqsort(ix) result(ires)
      integer(8), allocatable :: ires(:)
      integer(8), intent(in)  :: ix(:)
      integer :: k
      if (size(ix) <= 1) then 
        ires = ix
      else  
        k = ix(size(ix) / 2)
        ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
      end if
    end function iqsort
end program ABC155A

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)<<"\n"
#define vll vector<ll>
#define pb push_back

using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {x++;}
template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
template<class T> T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

void solve(ll A, ll B, ll C, ll K){
    ll ans = (K % 2) ? (B - A) : (A - B);
    if (abs(ans) <= 1e18) printf("%lld", ans);
    else printf("Unfair\n");
}

int main() {
    ll A;
    ignore_ret(scanf("%lld",&A));
    ll B;
    ignore_ret(scanf("%lld",&B));
    ll C;
    ignore_ret(scanf("%lld",&C));
    ll K;
    ignore_ret(scanf("%lld",&K));
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

lint energy(vector<int>& _x, int _met){
    lint cnt = 0;
    REP(i, _x.size()){
        cnt += pow(_x[i]-_met, 2);
    }
    return cnt;
}

int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    REP(i,n){
        cin >> x[i];
    }

    int meeting = 50;
    lint need_ene = energy(x, meeting);
    while(1){
        if(meeting != 100 && need_ene > energy(x, meeting+1)){
            meeting++;
            need_ene = energy(x, meeting);
        }else if(meeting != 1 && need_ene > energy(x, meeting-1)){
            meeting--;
            need_ene = energy(x, meeting);
        }else{
            break;
        }
    }

    cout << need_ene << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// 自分の得意な言語で
		// Let's チャレンジ！！

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		int cnt = 0;
		cnt = n / m;
		
		if (n % m != 0) {
			cnt++;
		}

		System.out.println(cnt);

	}

}

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

int main() {
    int n;
    cin >> n;
    int flag = 0;
    rep(i, n) {
        int a; cin >> a;
        if (a & 1) flag = 1;
    }
    cout << (flag ? "first" : "second") << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::Read;
use std::collections::HashMap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = Vec::new();
    let mut counts: HashMap<usize, usize> = HashMap::new();
    for _ in 0..n {
        let ai: usize = iterator.next().unwrap().parse().unwrap();
        *counts.entry(ai).or_insert(0) += 1;
        a.push(ai);
    }

    let mut ans: usize = 0;
    for i in 0..n {
        let ai = a[i];

        let mut is_ok = true;
        let mut x = 1;
        while x * x <= ai {
            if ai % x == 0 {
                let y = ai / x;
                if x == ai {
                    if *counts.get(&x).unwrap() >= 2 {
                        is_ok = false;
                    }
                } else {
                    if counts.contains_key(&x) {
                        is_ok = false;
                    }
                }
                if y == ai {
                    if *counts.get(&y).unwrap() >= 2 {
                        is_ok = false;
                    }
                } else {
                    if counts.contains_key(&y) {
                        is_ok = false;
                    }
                }
            }
            x += 1;
        }
        if is_ok {
            ans += 1;
        }
    }

    return ans.to_string();
}


Measured memory_bytes: 10832
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define S(v) sort(v.begin(), v.end())
#define print(v) for(auto i:v)cout<<i<<" "
#define ff first
#define ss second
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	ll t= 1;
	// cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		vector<ll> v(n);
		loop(i,0,n)cin>>v[i];
		ll dp[n];
		dp[0] = 0;
		dp[1] = abs(v[1] - v[0]);
		loop(i, 2, n){
			dp[i] = min(abs(v[i] - v[i-1]) + dp[i-1], abs(v[i] - v[i-2])+ dp[i-2]);

		}
		cout<<dp[n-1]<<endl;

		
	}
} 

Measured memory_bytes: 4780
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
const int MaxN = 1e3 + 5;

char a[1005], b[1005];

int main() {
	scanf("%s %s", a, b);
	int l1 = strlen(a);
	int l2 = strlen(b);
	if(l1 < l2) printf("LESS\n");
	else if(l1 > l2) printf("GREATER\n");
	else {
		for(int i = 0; i < l1; i++) {
			if(a[i] < b[i]) {
				printf("LESS\n");
				return 0;
			}
			else if(a[i] > b[i]) {
				printf("GREATER\n");
				return 0;
			}
		}
		printf("EQUAL\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int a, p;
	cin >> a >> p;
	p += a * 3;
	cout << p / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
import collections 
n,k = map(int, raw_input().split(' '))

cc=  collections.Counter()
left = n % k
for ii in range(k):
	cc[ii] += n / k
	if 0<ii <= left:
		cc[ii] += 1


r = 0
for ii in cc:
	if (- 2*ii) % k == 0:
		r += cc[ii] * ((cc[(k - ii) % k ]) ** 2) 

print r

Measured memory_bytes: 107204
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

char input[100001];

int main(void)
{
    int a, b, i, j, k, length;

    scanf("%s %d", input, &k);

    length = strlen(input);

    for (i = 0; i < length; i++) {
        if (input[i] == 'a' || ('z' + 1) - input[i] > k) {
            continue;
        } else {
            k -= ('z' + 1) - input[i];
            input[i] = 'a';
        }
    }
    k %= 26;
    input[i-1] += k;
    if (input[i-1] > 'z') {
        input[i-1] = input[i-1] - 'z' + 'a';
    }

    printf("%s\n", input);

    return 0;
}


Measured memory_bytes: 384