akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

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

int main(void)
{
    long a, b, c, g;
    
    while (scanf("%ld %ld", &a, &b) != EOF){
    	if (a < b){
        	c = a;
        	a = b;
        	b = c;
    	}
    	g = gcd(a, b);
    	printf("%ld", g);
    	printf(" %ld\n", a * b / g);
    }	
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	cout << n + n * n + n * n * n << endl;
	return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int values_num = sc.nextInt();
		int[] values = new int[values_num];
		for (int i = 0; i < values_num; i++) {
			values[i] = sc.nextInt();
		}

		int change_counter = selectionSort(values);

		for(int i = 0; i < values.length; i++) {
			if(i != 0) System.out.print(" ");
			System.out.print(values[i]);
		}
		System.out.print("\n");
		System.out.println(change_counter);
	}
	public static int selectionSort(int[] values) {
		int change_counter = 0;
		for (int i = 0; i < values.length; i++) {
			int min_index = i;
			for(int j = i + 1; j < values.length; j++) {
				if(values[j] < values[min_index]) {
					min_index = j;
				}
			}
			if (min_index != i) {
				int tmp = values[min_index];
				values[min_index] = values[i];
				values[i] = tmp;
				change_counter++;
			}
		}
		return change_counter;

	}
}



Measured memory_bytes: 26372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
#define Clr(x) memset(x, 0, sizeof(x))
ll n, m;

ll maxT(ll x, ll y) {
	if(x > y) return x;
	else return y;
}

ll minT(ll x, ll y) {
	if(x < y) return x;
	else return y;
}

int main() {
	ll ans = (ll)Inf;
	ll res = (ll)Inf;
	cin >> n >> m;
	ll S = n * m;
	if(S % 3 == 0) puts("0");
	else {
		ll s1, s2, s3, dd, Smax, Smin, ds;
		for(ll i = 1; i <= n; i++) {
			s1 = m * i;
			dd = n - i;
			s2 = (dd / 2) * m;
			s3 = S - s1 - s2;
			Smax = maxT(s1, s2);
			Smax = maxT(Smax, s3);
			Smin = minT(s1, s2);
			Smin = minT(Smin, s3);
			ds = Smax - Smin;
			ans = minT(ans, ds);

			s1 = m * i;
			dd = n - i;
			s2 = (m / 2) * dd;
			s3 = S - s1 - s2;
			Smax = maxT(s1, s2);
			Smax = maxT(Smax, s3);
			Smin = minT(s1, s2);
			Smin = minT(Smin, s3);
			ds = Smax - Smin;
			ans = minT(ans, ds);
		}
		for(ll i = 1; i <= m; i++) {
			s1 = n * i;
			dd = m - i;
			s2 = (dd / 2) * n;
			s3 = S - s1 - s2;
			Smax = maxT(s1, s2);
			Smax = maxT(Smax, s3);
			Smin = minT(s1, s2);
			Smin = minT(Smin, s3);
			ds = Smax - Smin;
			res = minT(res, ds);

			s1 = n * i;
			dd = m - i;
			s2 = (n / 2) * dd;
			s3 = S - s1 - s2;
			Smax = maxT(s1, s2);
			Smax = maxT(Smax, s3);
			Smin = minT(s1, s2);
			Smin = minT(Smin, s3);
			ds = Smax - Smin;
			res = minT(res, ds);
		}
		cout << minT(ans, res) << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,y;
  cin>>n>>m;
  long int a[n],b[n],c[m],d[m],ans[n];
  for(i=0;i<n;++i){
    cin>>a[i]>>b[i];
  }
  for(i=0;i<m;++i){
    cin>>c[i]>>d[i];
  }
  for(i=0;i<n;++i){
    long min = 400000001;
    for(int j=0;j<m;++j){
      y = (abs(a[i]-c[j])+abs(b[i]-d[j]));
      if(min>y){
        min = y;
        ans[i] = j+1;
      }
    }
  }
  for(i=0;i<n;++i){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  string S;
  int w;
  cin >> S >> w;
  string ans;
  for (int i = 0; i < S.size(); i += w)
  {
    ans.push_back((S[i]));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static long MOD = 1_000_000_007;

	public static void main(String[] args) {
		int N = sc.nextInt();
		long[] sum = new long[N + 1];
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			sum[i + 1] = sum[i] + A[i];
		}
		long[][] dp = new long[N + 1][N + 1];
		for (long[] a : dp) {
			Arrays.fill(a, Long.MAX_VALUE / 8);
		}
		for (int i = 0; i < N; i++) {
			dp[i][i + 1] = A[i];
		}
		for (int i = 2; i <= N; i++) {
			for (int j = 0; j + i <= N; j++) {
				for (int k = 1; k < i; k++) {
					dp[j][j + i] = Math.min(dp[j][j + i], dp[j][j + k] + dp[j + k][j + i] + sum[j + i] - sum[j]);
				}
			}
		}
		System.out.println(dp[0][N] - sum[N]);
	}
}

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

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int sum1=0,sum2=0;
    sum1+=(s[0]-'0')-1;
    sum1+=(s.length()-1)*9;
    for(int i=0;i<s.length();i++)
    {
        sum2+=(s[i]-'0');
    }
    cout<<max(sum1,sum2)<<endl;
    return 0;
}


Measured memory_bytes: 3624
using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
typedef pair<int,int> pa;
int main()
{
	int n;
	while(cin>>n&&n){
		pa p[10000]={};//d,p
		for(int i=0;i<n;i++){
			int d1,d2;cin>>p[i].second>>d1>>d2;
			p[i].first=d1+d2;
		}
		sort(p,p+n,greater<pa>());
		cout<<p[0].second<<" "<<p[0].first<<endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

long solve(int k)
{
  long count = 1;
  const long rem7 = 7 % k;
  long rem = 7 % k;
  if (rem == 0) return count;
  for (++count; count < 10000000; ++count) {
    rem = ((10 * rem) % k + rem7) % k;
    if (rem == 0) return count;
  }

  return -1;
}

int main()
{
  int k;
  std::cin >> k;

  std::cout << std::setprecision(20);
  std::cout << solve(k) << std::endl;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <algorithm>
using namespace std;

int n, m;
pair<int,int> sv[300001];
bool comp_r(pair<int,int> p1, pair<int,int> p2){
	return p1.second < p2.second;
}

void input(){
	scanf("%d %d", &n, &m);
	for(int i=1; i<=n; i++)
		scanf("%d %d", &sv[i].first, &sv[i].second);
}

struct MergeTree{
	vector<int> data[1<<18];
	const int base=1<<17;

	void update(int p, int v){
        for(p+=base-1; p; p/=2)
			data[p].push_back(v);
	}
	int query(int s, int e, int x){
		int ans=0;
        for(s+=base-1, e+=base-1; s<=e; s/=2, e/=2){
            if(s&1){
				ans += data[s].size() - (lower_bound(data[s].begin(), data[s].end(), x)-data[s].begin());
				s++;
            }
            if(!(e&1)){
				ans += data[e].size() - (lower_bound(data[e].begin(), data[e].end(), x)-data[e].begin());
				e--;
            }
        }
        return ans;
	}
} mt;

int query(int d){
	int ans=0;
    for(int now=d, bef=0; now<=m; now+=d, bef+=d){
		ans += mt.query(bef+1, now, now);
    }
    return ans;
}

int main(){
	input();

	sort(sv+1, sv+1+n, comp_r);
	for(int i=1; i<=n; i++)
		mt.update(sv[i].first, sv[i].second);

	for(int i=1; i<=m; i++)
		printf("%d\n", query(i));
	return 0;
}


Measured memory_bytes: 37364
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring> //memset
using namespace std;

int main()
{
	long K, X;

	cin >> K >> X;

	for (long i = -(K - 1); i <= K - 1; i++) {
		long result = X + i;

		if (result >= -1000000 && result <= 1000000) {
			cout << result << " ";
		}
	}

	cout << endl;
}

//int main()
//{
//	long A, B;
//
//	cin >> A >> B;
//
//	cout << std::max(A + B, std::max(A - B, A * B)) << endl;
//}


Measured memory_bytes: 256
a,b,h,m=(int(x) for x in input().split())
import math
ka=360*(60*h+m)/720
kb=360*m/60
x=abs(ka-kb)
if x==360 or x==0:
    if a > b:
        print(a-b)
    else:
        print(b-a)
elif x==180:
    print(a+b)
elif x < 180:
    c=a**2+b**2-2*a*b*math.cos(math.radians(x))
    print(abs(math.sqrt(c)))
else:
    y=360-x
    c=a**2+b**2-2*a*b*math.cos(math.radians(y))
    print(abs(math.sqrt(c)))


Measured memory_bytes: 9564
import bisect

def main():
    N = int(input())
    a = [int(i) for i in input().split()]

    a.sort()
    n = a[-1]
    m = n // 2
    right = bisect.bisect_right(a, m)

    if a[right-1] == m:
        r = m

    else:
        if n % 2 == 0:
            if m - a[right-1] <= a[right] - m:
                r = a[right-1]
            else:
                r = a[right]

        else:
            if m - a[right-1] < a[right] - (m+1):
                r = a[right-1]
            else:
                r = a[right]

    print(n, r)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14348
import java.util.*

fun dfs(n : Int, s : String, mx : Char) {
    if (s.length == n) {
        println(s)
    } else {
        for (next in 'a'..mx) {
            dfs(n, s + next, mx)
        }
        dfs(n, s + (mx + 1), mx + 1)
    }
}
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val t1 = cin.nextInt()
    val t2 = cin.nextInt()
    val a1 = cin.nextLong()
    val a2 = cin.nextLong()
    val b1 = cin.nextLong()
    val b2 = cin.nextLong()
    val c1 = a1 - b1
    val c2 = a2 - b2
    val set : Long = c1 * t1 + c2 * t2
    if (set == 0.toLong()) {
        println("infinity")
    } else if ((set > 0.toLong() && c1 < 0) || (set < 0.toLong() && c1 > 0)) {
        val n = - c1 * t1 / set
        if (- (c1 * t1) % set == 0.toLong()) {
            println(2*n)
        } else {
            println(2*n + 1)
        }
    } else {
        println(0)
    }
}

Measured memory_bytes: 31392
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n, m, sum;
vll t;

int main() {
    fast_io; cout_precision;
    cin >> n;
    t.resize(n);
    for (ll i = 0; i < n; i++) {
        cin >> t[i];
        sum += t[i];
    }
    cin >> m;
    for (ll i = 0, p, x; i < m; i++) {
        cin >> p >> x; p--;
        cout << sum - t[p] + x << endl;
    }
}

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

int main () {
  int n;
  cin >> n;
  
  if (n < 4) {
    cout << "No" << endl;
    return 0;
  }
  
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j ++) {
      if (4 * i + 7 * j == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
main()
{
	long long int n, s, a, b, k;
	cin >> k >> a >> b;
	long long int i;
	for(i=1;i<=1001;i++)
	{
		if(k*i>=a && k*i<=b)
		{
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	
	
	return 0;
}

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

typedef long long int LL;
typedef unsigned long long uLL;
typedef pair < int , int > ii;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;
const int mod = 1000000007;
const double eps = 1e-8;
const double pi = acos( -1.0 );

int main( int argc , char const *argv[] ) {
        ios_base :: sync_with_stdio(false); cin.tie(NULL);
        int a[5];
        cin >> a[1] >> a[2] >> a[3];
        sort( a+1 , a+4 );
        int ans = inf;
        //do {
                ans = min( ans , abs(a[2]-a[1])+abs(a[3]-a[2] ) );
        //} while( next_permutation( a+1 , a+4 ) );
        cout << ans << endl;
        return 0;
}








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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

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

	int h, w;
	cin >> h >> w;

	int cur = 0;
	for(int i=0; i<h; i++){
		string t;
		cin >> t;

		int next = 0;
		for(int j=0; j<w; j++){
			if(t[j] == '#'){
				next = j;
				if(j < cur){
					puts("Impossible");
					return 0;
				}
			}
		}
		cur = next;
	}
	puts("Possible");

	return 0;
}


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

using namespace std;

const int maxn = 2e3;

bool a[maxn + 1][maxn + 1];
int s[maxn + 1][maxn + 1], vec[maxn + 1][maxn + 1];
int veclin[maxn + 1][maxn + 1], veccol[maxn + 1][maxn + 1];

int main()  {
//    freopen("a.in", "r", stdin);
//    freopen("a.out", "w", stdout);
    int n, m, q;
    cin >> n >> m >> q;
    for(int i = 1;i <= n;i++)
        for(int j = 1;j <= m;j++)  {
            char ch;
            cin >> ch;
            a[i][j] = ch - '0';
        }
    for(int i = 1;i <= n;i++)
        for(int j = 1;j <= m;j++)  {
            s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
        }
    for(int i = 1;i <= n;i++)   {
        for(int j = 1;j <= m;j++)  {
            int nr = 0;
            if(a[i][j] == 1 && a[i - 1][j] == 1)
                nr++;
            if(a[i][j] == 1 && a[i][j - 1] == 1)
                nr++;
            vec[i][j] = vec[i - 1][j] + vec[i][j - 1] - vec[i - 1][j - 1] + nr;
        }
    }
    for(int i = 1;i <= n;i++)  {
        for(int j = 1;j <= m;j++)  {
            veclin[i][j] += (a[i][j] == 1 & a[i][j - 1] == 1);
            veclin[i][j] += veclin[i][j - 1];
        }
    }
    for(int i = 1;i <= n;i++)
        for(int j = 1;j <= m;j++)  {
            veccol[i][j] = veccol[i - 1][j] + (a[i][j] == 1 & a[i - 1][j] == 1);
        }
    for(int i = 1;i <= q;i++)  {
        int x1, y1, x2, y2;//l si c
        cin >> x1 >> y1 >> x2 >> y2;
        int dif, s1, vec1;
        s1 = s[x2][y2] + s[x1 - 1][y1 - 1] - s[x1 - 1][y2] - s[x2][y1 - 1];
        vec1 = vec[x2][y2] + vec[x1][y1] - vec[x1][y2] - vec[x2][y1];
        vec1 += veclin[x1][y2] - veclin[x1][y1];
        vec1 += veccol[x2][y1] - veccol[x1][y1];
        dif = s1 - vec1;
        cout << dif << "\n";
    }
    return 0;
}


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

using namespace std;

int main () {
    vector<int> v;
    int n, s, res;
    int e = 0, d = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        v.push_back(s);
        s = e + s;
        e = s;
    }
    //cout << e << endl;
    sort(v.begin(), v.end());
    //for (int i = 0; i < n; i++) {
       // cout << v[i] << " ";
   // }
    if (e % 10 == 0) {
        //cout << "Multiple" << endl;
        for (int i = 0; (i < n) && d == 0; i++) {
            int temp = e - v[i];
            if (temp % 10 != 0){
                cout << temp << endl;
                d = 1;
            }
        }
        if (d == 0) cout << "0" << endl;        
    }
    else {
        //cout << "Not Multiple" << endl;
        cout << e << endl;
    }
}

Measured memory_bytes: 256
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    c = collections.Counter(S)
    c['a'] += 1
    c['a'] -= 1
    c['b'] += 1
    c['b'] -= 1
    c['c'] += 1
    c['c'] -= 1

    if c.most_common()[0][1] - c.most_common()[2][1] >= 2:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()



Measured memory_bytes: 9392
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int i;
	long long int n;
	cin >> n;
	vector<long long int> a(n * 3);
	//cout << a.size();

	for(i=0; i<a.size(); i++)
		cin >> a[i];	
	
	sort(a.begin(), a.end(),greater<int>());

	long long int sum = 0;
	for(i=0; i<n; i++)
		sum += a[i * 2 + 1];
	cout << sum << endl;	

}


Measured memory_bytes: 2560
def swap(A,i,j):
    A[i],A[j] = A[j],A[i]
    return A

def mincost(A):
    B = sorted(A)
    cost = 0
    
    for i, bi in enumerate(B):
        t = 0
        j = A.index(bi)
        tmp_cost = 0
        
        # swap in a cyclic group
        while j != i:
            t += 1
            bj = B[j]
            k = A.index(bj)
            tmp_cost += bi + bj
            swap(A,j,k)
            j = k
        
        # diff. to swap with min(B)
        dec = t * (bi - B[0])
        inc = 2 * (bi + B[0])
        
        if dec < inc:
            cost += tmp_cost
        else:
            cost += tmp_cost - dec + inc
    return cost

if __name__ == "__main__":
    input()
    A = list(map(int, input().strip().split()))
    cost = mincost(A)
    print(cost)

Measured memory_bytes: 7856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
// #define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int n, d, ans = 0;
  cin >> n >> d;
  int x[n][d];
  REP(i, n) {
    REP(j, d) { cin >> x[i][j]; }
  }

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int dist = 0;
      REP(k, d) { dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]); }
      REP(l, 128) {
        if (l * l == dist) ans++;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>

using namespace std;

int gcd(int x,int y){
    if(x<y){
        int tmp=x;
        x=y;
        y=tmp;
    }
    if(x%y==0)return y;
    else return gcd(y,x%y);
}

int main(void)
{
    int n;
    int a[10];
    int temp;

    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    temp=a[0];
    for(int i=1;i<n;i++){
        temp=(temp*a[i])/gcd(temp,a[i]);
    }
    cout<<temp<<endl;
    return 0;
}


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

#define FOR(i, n) for(int i = 0; i < n; ++i)
typedef vector <int> vi;
typedef pair<int, int> iPair;
const int MOD = 1e9+7;

bool compare1(iPair a, iPair b)
{
    return (a.first+a.second) < (b.first + b.second);
}
bool compare2(iPair a, iPair b)
{
    return (a.first - a.second) < (b.first - b.second);
}

int dist(iPair a, iPair b)
{
    return abs(a.first - b.first) + abs(a.second - b.second);
}

void solve()
{
    int n;
    cin >> n;
    vector <int> arr(n);
    vector <int> brr(n);
    vector <iPair> v1;
    vector <iPair> v2;

    FOR(i, n)
    {
        cin >> arr[i] >> brr[i];
        v1.push_back({arr[i], brr[i]});
        v2.push_back({arr[i], brr[i]});
    }

    sort(v1.begin(), v1.end(), compare1);
    sort(v2.begin(), v2.end(), compare2);

    vi ans;

    ans.push_back(dist(v1[0], v1[n-1]));
    ans.push_back(dist(v1[0], v2[n-1]));
    ans.push_back(dist(v1[0], v2[0]));
    ans.push_back(dist(v1[n-1], v2[n-1]));
    ans.push_back(dist(v1[n-1], v2[0]));
    ans.push_back(dist(v2[n-1], v2[0]));


    cout<<*max_element(ans.begin(), ans.end());

}

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

    int t = 1;
    int i,j;
    // cin>>t;
    
    while(t--)
    {
        solve();
    }

	return 0;
}


Measured memory_bytes: 12908
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
  int a, b, c, arr[3], i, parity[3];
  for (i = 0; i < 3; i++)
    cin >> arr[i];
  sort(arr, arr+3, greater<int>());
  int num=0, sum=0, max;
  sum = accumulate(arr, arr+3, sum);
  bool cond = (3*arr[0])%2 == sum%2;
  if (cond)
    max = arr[0];
  else
    max = arr[0] + 1;

  num = (3*max - sum) / 2;

  cout << num << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main(){
	int n;
	cin >> n;
	int a[n];
	REP(i,n) cin >> a[i];
	
	double ans=0.0;
	REP(i,n) ans += 1/(double)a[i];
	printf("%.8f\n", 1/ans);
	
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n, y;
  int result[3] = {-1, -1, -1};
  int p0, p1, p2;
  scanf("%d %d", &n, &y);
  if(n < 1 || 2000 < n || y < 1000 || 20000000 < y || (y%1000))
    return 1;

  for(p0 = 0; p0 <= n + 1; p0++){
    for(p1 = 0; p1 <= n - p0; p1++){
      p2 = n - p1 - p0;
      if((p0 * 10000 + p1 * 5000 + p2 * 1000) == y){
        result[0] = p0;
        result[1] = p1;
        result[2] = p2; 
      }   
    }
  }

  if(0 <= result[0])
    printf("%d %d %d\n", result[0], result[1], result[2]);
  else
    printf("%d %d %d\n", -1, -1, -1);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;




int main(){
    int n;cin >> n;
    vector<LL> a(n);
    vector<LL> x(n);
    LL sx = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sx ^= a[i];
    }
    LL ans = 0;
    LL tx = 0;
    for (int i = 0; i < 60; i++) {
        if(sx>>i&1) ans += (1LL<<i);
    }
    for (int i = 0; i < n; i++) {
        x[i] = a[i];
        for (int k = 0; k < 60; k++) {
            if(sx>>k&1){
                x[i] &= ~(1LL<<k);
            }
        }
        tx ^= x[i];
    }
    sort(RALL(x));
    int index = 0; 
    for (int i = 60; i >= 0; i--) {
        LL maxInd = index; 
        LL maxEle = -LINF; 
        for (int j = index; j < n; j++) {
            if((x[j] & (1LL << i)) != 0 && x[j] > maxEle) maxEle = x[j], maxInd = j;
        }
        if (maxEle == -LINF) continue; 
        swap(x[index], x[maxInd]);
        maxInd = index;
        for (int j = 0; j < n; j++) {
            if(j!= maxInd && (x[j] & (1LL << i)) != 0) x[j] ^= x[maxInd];
        }
        index++;
    }
    LL res = 0; 
    for (int i = 0; i < n; i++) {
        res ^= x[i];
    }
    cout << ans + res + (tx ^ res) << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5+100;
int t[MN];
int t2[MN];
int main() {
    int n,m;
    cin>>n>>m;
    t2[1] = 1;
    for(int i = 1; i <= n; ++i) {
        t[i] = 1;
    }
    for(int i = 0; i < m; ++i) {
        int x, y;
        cin>>x>>y;
        if(t2[x] == 1) {
            t2[y] = 1;
        }
        if(t[x] == 1) {
            t2[x] = 0;
        }
        --t[x];
        ++t[y];
    }
    int ans = 0;
    for(int i = 1; i <=n; ++i) {
        ans += t2[i];
    }
    cout<<ans<<'\n';
}


Measured memory_bytes: 1024
_n = int(input())
_odd = 0.0
_even = 0.0
for _i in range(_n):
  _num = _i + 1
  if _num % 2 == 0:
    _even = _even + 1
  else:
    _odd = _odd + 1
_prob = _odd / (_odd + _even)
print(_prob)

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

int main(){
	int n;
	cin >> n;
	vector<string> w(n);
	map<string,int> mp;
	bool ok = true;
	rep(i,n){
		cin >> w[i];
		if(i>0){
			if(w[i][0] != w[i-1][w[i-1].size()-1] || mp[w[i]] != 0) ok = false;
		}
		mp[w[i]]++;
	}
	
	if(ok){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
    return 0;
}



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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
using namespace std;

int32_t main() {
	fastio;

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while(true) {
		c -= b;
		if(c <= 0) break;
		a -= d;
		if(a <= 0) break;
	}
	if(a > 0) cout << "Yes";
	else cout << "No";

	return 0;
}


Measured memory_bytes: 3612
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define INFTY (1<<21)
using namespace std;
static const int N = 100;

int main() {
	int n;
	int M[N][N];
	cin >> n;
	int u, k;
	int index;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			M[i][j] = 0;
		}
	}

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> index;
			M[u - 1][index - 1] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j > 0) cout << ' ';
			cout << M[i][j];
		}
		cout << "\n";
	}

}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define debug(a) cout << #a << ": " << a << endl
const int INF = 1e9 + 5;
int main(){
	int h,n; cin>>h>>n;
	vector<int> dp(h + 1, INF);
	// dp[x] - the minimum total cost to get value x
	dp[0] = 0;
	while(n--){
		int value, cost; cin>>value>>cost;
		for(int i = 0; i<=h; i++){
			//dp[i] -> dp[i + value]
			int j = min(h, i + value);
			dp[j] = min(dp[j], dp[i] + cost);
		}
	}
	cout<<dp[h]<<endl;
}
	


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

        int main() {
            
        // 入力    
          ll N, Q;
          cin>> N >> Q;
          vector<ll> S(N);
          vector<ll> T(N);
          vector<ll> X(N);
          for(ll i=0; i< N; i++ ){
              cin >> S.at(i); 
              cin >> T.at(i);
              cin >> X.at(i);
          }
          
          vector<ll> D(Q);
          for(ll i=0; i< Q; i++ ){
              cin >> D.at(i); 
          }
        //入力終了
        
          vector<pair<ll,ll>> p(N); 
          
          for(ll i=0; i< N; i++ ){
              p.at(i) = make_pair( S.at(i)-X.at(i), i ); 
          }
          sort(p.begin(), p.end());
          
          // For check
          /*
          for(ll i=0; i< N; i++ ){
            int x, j;
            tie(x, j) = p.at(i); 
             cout<< x <<" "<<  j <<" "<< T.at(j)-X.at(j) << endl;  
          }
          */
          //
          
          int pointer =0;
          priority_queue<pair<ll,ll>> pq; 
          
          for(int k=0; k<Q; k++){
              ll d = D.at(k);
              
              while( pointer<N && p.at(pointer).first <= d ){
                  
                  ll s, i;
                  tie(s, i) = p.at(pointer);
                  pq.push( make_pair( -X.at(i), -T.at(i)+X.at(i) ) );
                  
                  pointer++; 
                  
              }
              
              // 後は条件満たさないやつを捨てつつxの最小値を探すだけのはず。。。
              
              bool flag=0;
              while( flag==0 ){
                  if( pq.size()==0 ){
                      cout<< -1 << endl; 
                      flag=1; 
                  }else{
                        ll y, s;
                        tie(y, s) = pq.top();
                        ll x=-y;
                        ll t=-s; 
                        
                        
                        if( d<t ){
                            cout<<x<<endl;
                            flag=1; 
                            
                        }else{
                          pq.pop();
                        }
                  }
                  
              }
              
              
              
              
              
          }// D_i 処理のためのfor終了
          
          
          
        }

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

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

	cout << (ceil((double)d / s) <= t ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>

int a[110], b[110];

int min(int a, int b){
    return (a < b ? a : b);
}

int main(){
    int n, ans = 0;
    scanf("%d", &n);
    for(int i = 0; i < n - 1; i++){
        scanf("%d", &b[i]);
        a[i] = b[i];
    }
    a[n - 1] = 100010;
    for(int i = 0; i < n - 1; i++) a[i + 1] = min(a[i + 1], b[i]);
    for(int i = 0; i < n; i++) ans += a[i];
    printf("%d\n", ans);
}

Measured memory_bytes: 128
from collections import deque


reverse = 0
S = deque(list(input()))
q = int(input())

for _ in range(q):
    query = input()
    if query[0] == '1':
        reverse = 1 - reverse
        continue

    _, f, c = query.split()
    f = int(f)
    action = (reverse + f) % 2
    if action:
        S.appendleft(c)
    else:
        S.append(c)

if reverse:
    S = list(S)[::-1]

print(''.join(S))

Measured memory_bytes: 10084
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
#define MOD1 1000000007
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)a - *(ll *)b;}

int main(void){
    ll n,i,j,l,alpha[26],mins[26];
    scanf("%lld",&n);
    char s[55];
    for(i=0;i<26;i++){
        alpha[i]=0;
        mins[i]=INF;
    }
    for(i=0;i<n;i++){
        scanf("%s",s);
        l=strlen(s);
        for(j=0;j<26;j++){
            alpha[j]=0;
        }
        for(j=0;j<l;j++){
            alpha[(ll)s[j]-97]++;
            // alpha[(ll)s[j]-97][1]=s[j];
        }
        for(j=0;j<26;j++){
            mins[j]=min2(mins[j],alpha[j]);
        }
    }
    for(i=0;i<26;i++){
        for(j=0;j<mins[i];j++){
            printf("%c",(char)i+97 );
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <numeric>
#include <cmath>

using namespace std;

template<class T>
class Input {
public:
    auto operator()() const {
        T v;
        cin >> v;
        return v;
    }
};

template<class L, class R>
class Input<pair<L, R>> {
public:
    auto operator()() const {
        L l;
        R r;
        cin >> l >> r;
        return make_pair(l, r);
    }
};

template<class U>
class Input<vector<U>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        return (*this)(n);
    }
    auto operator()(size_t n) const {
        vector<U> v;
        v.reserve(n);
        Input<U> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in();
            v.emplace_back(move(u));
        }
        return v;
    }
};

template<class U>
class Input<vector<vector<U>>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        auto m = in();
        return (*this)(n, m);
    }
    auto operator()(size_t n, size_t m) const {
        vector<vector<U>> v;
        v.reserve(n);
        Input<vector<U>> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in(m);
            v.emplace_back(move(u));
        }
        return v;
    }
};

class InputType
{
public:
    template<class T>
    operator T() const {
        Input<T> i{};
        return i();
    }
};

class InputType2
{
public:
    InputType2(size_t n)
        : n_(n)
    {}
    template<class T>
    operator T() const {
        Input<T> i{};
        return i(n_);
    }
private:
    size_t n_;
};

auto input() {
    return InputType();
}

template<class... Args>
auto input(Args&&... args) {
    return InputType2(std::forward<Args>(args)...);
}

size_t bitcount(size_t n) {
    size_t c = 0;
    while (n) {
        if (n & 1ull)
            ++c;
        n >>= 1;
    }
    return c;
}

auto make_order(size_t n) {
    vector<size_t> a(n, 0);
    iota(begin(a), end(a), 0);
    return a;
}

template<class T>
auto next_permutation(T&& x) {
    using std::begin;
    using std::end;
    return next_permutation(begin(x), end(x));
}

using ll = long long;
using ull = unsigned long long;

auto gcd(size_t l, size_t r) {
    if (r == 0)
        return l;
    return gcd(r, l % r);
}

auto gcd(size_t a, size_t b, size_t c) {
    return gcd(a, gcd(b, c));
}

int main() {
    size_t a = input();
    size_t b = input();
    size_t c = input();
    size_t d = input();
    for (size_t i = 0; a > 0 && c > 0; ++i) {
        if (i % 2 == 0) {
            if (b <= c)
                c -= b;
            else
                c = 0;
        } else {
            if (d <= a)
                a -= d;
            else
                a = 0;
        }
    }
    if (a == 0)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3640
n,m=map(int,input().split())
a=[0]*(n+1)
b=[int(input()) for i in range(m)]
a[0]=a[1]=1
if m==0:
  for i in range(2,n+1):
    a[i]=(a[i-1]+a[i-2])%(10**9+7)
else:
  j=0
  if b[0]==1:
    a[1]=0
    if m>1:
      j=1
  for i in range(2,n+1):
    if i==b[j]:
      if j<m-1:
        j+=1
    else:
      a[i]=(a[i-1]+a[i-2])%(10**9+7)
print(a[n])

Measured memory_bytes: 7848
# C - Alchemist
# https://atcoder.jp/contests/abc138/tasks/abc138_c

# 書く材料の組み合わせを作成して、一番価値の大きい商品を作り出せばよい。
n = int(input())
v = sorted(list(map(int,input().split())))

tmp = 0

for i in range(n):
    if i == 0:
        tmp = v[i]
    else:
        tmp = (tmp + v[i])/2

print(tmp)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int[] pw = new int[10];
		int[] pk = new int[10];
		for(int i = 0; i < 10; i++){
			pw[i] = stdIn.nextInt();
		}
		for(int i = 0; i < 10; i++){
			pk[i] = stdIn.nextInt();
		}
		
		for(int i = 0; i < 3; i++){
			int maxW = i;
			int maxK = i;
			for(int j = i+1; j <10; j++){
				if( pw[j] > pw[maxW] ){
					maxW = j;
				}
				if( pk[j] > pk[maxK] ){
					maxK = j;
				}
			}
			int tempW = pw[maxW];
			pw[maxW] = pw[i];
			pw[i] = tempW;
			int tempK = pk[maxK];
			pk[maxK] = pk[i];
			pk[i] = tempK;
		}
		
		int sumW = 0;
		int sumK = 0;
		for(int i = 0; i < 3; i++){
			sumW += pw[i];
			sumK += pk[i];
		}
		System.out.println(sumW + " " + sumK);
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
int n,t,x,y;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>t>>x>>y;
        if(!(x+y<=t&&(t-x-y)%2==0))
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

const ll INF = 1LL << 60;

ll f(ll A) {
    A++;

    ll res = 0;

    // 50 桁
    for (ll i = 0; i < 41; i++) {
        // 周期
        // 2, 4, 8... 前半0 後半1
        ll loop_cnt = 1LL << (i + 1);
        // cout << "loop_cnt: " << loop_cnt << endl;

        ll one = 0;
        // 何セットあるか
        ll cnt = (A / loop_cnt);
        one += (cnt * loop_cnt) / 2;
        // cout << "one_init: " << one << endl;

        // はみ出た分
        if (A % loop_cnt != 0) {
            one += max(0LL, A % loop_cnt - loop_cnt / 2);
        }
        // cout << "one_second: " << one << endl;

        // 奇数ならフラグがたつ
        if (one % 2 == 1) {
            res += (1LL << i);
        }
        // cout << "i: " << i << " one: " << one << " res: " << res << endl;
        // cout << endl;
    }

    // cout << "result: " << res << endl; 
    return res;
}

ll A, B;
int main() {
    // f(5);
    // return 0;
    cin >> A >> B;
    ll ans = f(B) ^ f(A - 1);
    cout << ans << endl;
}

Measured memory_bytes: 3644
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
template <class T>
bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
template <class T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main(void) {
	string s; cin >> s;
	lint a = 0;
	lint b = 0;
	lint c = 0;
	lint d = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'N')a++;
		if (s[i] == 'W')b++;
		if (s[i] == 'S')c++;
		if (s[i] == 'E')d++;
	}
	if (b == 0 && d >= 1) {
		cout << "No" << endl;
		return 0;
	}
	if (b >= 1 && d == 0) {
		cout << "No" << endl;
		return 0;
	}
	if (a == 0 && c >= 1) {
		cout << "No" << endl;
		return 0;
	}
	if (a >= 1 && c == 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3596
A,B,C = (list(input()) for T in range(0,3))
Next = A.pop(0)
while True:
    if Next=='a':
        if not len(A):
            print('A')
            break
        Next = A.pop(0)
    elif Next=='b':
        if not len(B):
            print('B')
            break
        Next = B.pop(0)
    else:
        if not len(C):
            print('C')
            break
        Next = C.pop(0)

Measured memory_bytes: 9020
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        d: u32
    }
    
    let s = match d {
    25 => "Christmas",
    24 => "Christmas Eve",
    23 => "Christmas Eve Eve",
    22 => "Christmas Eve Eve Eve",
    x => "error"
    };
    println!("{}",s);
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(a)-1;i>=n;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define sn st.nd 
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
/****************************/
ll n,m,k;
string s;
unsigned long long ans=1;
ll a;
long double b;
int main()
{
	cin>>a>>b;
	cout<<(ll)(a*b);
	return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    auto ys=vector<pair<int, pair<int, int>>>(m);
    auto ps=vector<int>(m);
    for(int i=0; i<m; ++i){
        int p, y; cin >> p >> y;
        ys[i]=make_pair(y, make_pair(i, p));
        ps[i]=p;
    }
    sort(ys.begin(), ys.end());
    auto xs=vector<int>(n, 0);
    auto rs=vector<int>(m, 0);
    for(int i=0; i<m; ++i){
        ++xs[ys[i].second.second-1];
        rs[ys[i].second.first]=xs[ys[i].second.second-1];
    }
    for(int i=0; i<m; ++i){
        printf("%06d%06d\n", ps[i], rs[i]);
    }
    return 0;
}


Measured memory_bytes: 3840
import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int n = sc.nextInt();
    for (int i = 0; i < n; i++)
	  list.add(sc.nextInt());
    int count = 0;
    for (int i = 1; i < n - 1; i++)
      if ((list.get(i-1) > list.get(i) && list.get(i) > list.get(i+1)) || list.get(i-1) < list.get(i) && list.get(i) < list.get(i+1))
        count++;
    System.out.print(count);
  }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define x first
#define y second
#define y1 WHO_DEFINE_Y1_IN_HEADER
#define all(v) v.begin(), v.end()
using namespace std;

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

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin >> s;
	if(s == "Sunny") cout << "Cloudy";
	if(s == "Cloudy") cout << "Rainy";
	if(s == "Rainy") cout << "Sunny";
}

Measured memory_bytes: 256
function main()
  
  (N, M) = map(x -> parse(Int, x), split(readline()))

  check_1 = zeros(Int, N)
  check_N = zeros(Int, N)

  for i in readlines()
    (a, b) = map(x -> parse(Int, x), split(i))
    if a == 1
      check_1[b] = 1
    elseif b == 1
      check_1[a] = 1
    elseif b == N
      check_N[a] = 1
    elseif a == N
      check_N[b] = 1
    end
  end
  
  ans = false
  
  for i in 1:N
    if check_1[i] ==  check_N[i] == 1
      ans = true
      break
    end
  end  
  
  if ans
    println("POSSIBLE")
  else
    println("IMPOSSIBLE")
  end
  
end

main()

Measured memory_bytes: 169940
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
dist = 0
for x1, y1 in XY:
    for x2, y2 in XY:
        dist += ((x1 - x2)**2 + (y1 - y2)**2)**(1/2)
print(dist/N)

Measured memory_bytes: 3060
import numpy as np
A, B, Q, *L = map(int, open(0).read().split())
s = L[:A]
t = L[A:A+B]
x = L[A+B:]

s = [-float('inf')]+s+[float('inf')]
t = [-float('inf')]+t+[float('inf')]
sls = np.searchsorted(s,x)
tls = np.searchsorted(t,x)
for ar, br, c in zip(sls,tls,x):
  bl = br-1
  al = ar-1
  n = s[ar]-t[bl]+min(s[ar]-c,c-t[bl])
  m = t[br]-s[al]+min(t[br]-c,c-s[al])
  p = c-min(t[bl],s[al])
  q = max(s[ar],t[br])-c
  print(min(n,m,p,q))

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

int main() {
    vector<int> sss(20);
    for (int l=0;l<20;l++){

int A;
cin >>A;
 if (A==0){
        break;
    }
int cnt=0;
vector<int> vec(A);
for (int i=0;i<A;i++){
    cin >> vec[i];
    cnt+=vec[i];
}
sort(vec.begin(),vec.end());

cout << ((cnt-(vec[0]+vec[A-1]))/(A-2))<<endl;
   
    }
}


Measured memory_bytes: 3072
import java.util.*;

public class Main {
  
  public static void main(String[] args) {
    try(Scanner sc = new Scanner(System.in)) {
      int N = sc.nextInt();
      String S = sc.next();
      char[] s = S.toCharArray();
      int answer = Integer.MAX_VALUE;
      int count0 = 0;
      for ( int i = 1; i < N; i++ ) {
        if ( s[i] == 'E' ) {
          count0++;
        }
      }
      if ( count0 < answer ) {
        answer = count0;
      }
      int prev = count0;
      for ( int i = 1; i < N; i++ ) {
        int count = prev + ( s[i-1] == 'W' ? 1 : 0 ) - ( s[i] == 'E' ? 1 : 0 );         
        if ( count < answer ) {
          answer = count;
        }
        prev = count;
      }
      System.out.println(answer);
    }
  }
  
}

Measured memory_bytes: 27760
N=int(input())
a=input().strip().split(" ")
a=[int(i) for i in a]
kisuu=0
guusu=0

a.sort(reverse=True)

for i in range(N):
    if(i%2==1):
       kisuu+=a[i]
    else:
        guusu+=a[i]

print(abs(kisuu-guusu))
       


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 1000000000;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define pb push_back 
#define all(c) (c).begin(),(c).end()
int n,mn=2*oo;
ll s;
int main(){
	cin>>n;
	for(int x,i=0; i<n; ++i){
		scanf("%d",&x);
		s+=x;
		if(x%10)
			mn=min(mn,x);
	}
	if(s%10)return cout<<s<<endl,0;
	cout<<max(0ll,s-mn)<<endl;
	
}




Measured memory_bytes: 256