akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n, c;
    cin >> n >> c;
    const int MAX = 100005;
    vvint tl(c, vint(MAX, 0));
    rep(i, n) {
        int s, t, c;
        cin >> s >> t >> c;
        --s;
        --t;
        --c;
        tl[c][s]++;
        tl[c][t+1]--;
    }
    rep(i, c) {
        srep(j, 1, MAX) {
            tl[i][j] = tl[i][j-1] + tl[i][j];
        }
    }

    int ans = 0;
    rep(i, MAX) {
        int tmp = 0;
        rep(j, c) {
            if (tl[j][i]) tmp++;
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12416
#include "iostream"
using namespace std;
int main(){
    int x,y,price=0;
    cin>>x>>y;
    for (int i=1; i<=3; i++) {
        if (x==i) {
            price+=(4-i)*100000;
        }
        if (y==i) {
            price+=(4-i)*100000;
        }
    }
    if (x==1&&y==1) {
        cout<<"1000000"<<endl;
    } else {
        cout<<price<<endl;
    }
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	ll n;
	cin >> n;
	/*
	rep(i, n) {
		int I = i + 1;
		if (n % I == n / I) cout << n / I << " " << I << endl;
	}
	cout << endl;
	*/
	if (n == 2) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	for (ll i = 1; i * i < n; i++) {
		ll N = n - i;
		if (N % i == 0) {
			ll tmp = N / i;
			if(n / tmp == i) ans += tmp;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    double N,M,all=0;
    cin>>N>>M;
    vector<double> A(N);
    for(auto &x:A){
        cin>>x;
        all+=x;
    }
    double t = all/M/4;
    sort(A.begin(), A.end(),std::greater<int>());
    for(int i=0;i<M;i++){
        if(A[i]<t){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define init(c) memset(c,0,sizeof c)
#define S second
#define F first
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=20000005;
int n,k,x,t,a,b,m;
string s;
vi v;
int main(){

	cin >> n >> k;
	set<int>st;
	for(int i =0;i<k;i++){
		cin >> t;
		while(t--){
			cin >> x;
			st.insert(x);
		}
	}
	cout << n-st.size();

	
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

int N, K, NN;
vector<int> v;
vector<long long> sum;

long long calc(int kk, int j){
 long long p = (j == 0) ? sum[min(j+kk,(int)sum.size())-1] : sum[min(j+kk,(int)sum.size())-1] - sum[j-1];
 return p;
}

int main(){
  ios_base::sync_with_stdio(false); 
  cin >> N >> K;
  string s;
  cin >> s;
  N = s.length();
  int c = 1;
  int f = (s[0] == '1');
  for(int i=0; i+1<N; ++i){
    if(s[i] == s[i+1])
       ++c;
    else{
      v.push_back(c);
      c = 1;
    } 
  }
  v.push_back(c);
  for(const auto it: v){
    long long x = ((int)sum.size() > 0) ? sum.back() : 0;
    sum.push_back(it+x);
  }
  NN = sum.size();
  long long res = 0;
  if(f){
    for(int i=0; i<NN; ++i){
      long long p = (i&1) ? calc(2*K, i) : calc(2*K+1, i);
      res = max(res, p);
    }
  }
  else{
   for(int i=0; i<NN; ++i){
     long long p = (i&1) ? calc(2*K+1, i) : calc(2*K, i);
     res = max(res, p);
   }
  }
  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 1976
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

ll calc(ll n, ll a, ll b) {
	ll d1 = abs(a - 1);
	ll rez = d1;
	a -= d1;
	b -= d1;

	if(b > 1) {
		++rez;
		--b;
	}

	rez += (b - a) / 2;

	return rez;
}

void solve() {
	ll n = fetch<ll>();
	ll a = fetch<ll>();
	ll b = fetch<ll>();
	ll dist = abs(b - a);

	if(dist % 2 == 0) {
		cout << dist / 2 << '\n';
	} else {
		cout << min(calc(n, a, b), calc(n, n - b + 1, n - a + 1)) << '\n';
	}
}

int main() {
	fast_io();
	solve();

	return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int dp[305][305][305];
int main(){
	//ios_base::sync_with_stdio(false);
	int N, K;
	string S;

	cin >> S >> K;
	N = S.length();

	rep(k,K+1) rep(l,N) rrep(r,N) if( l <= r ){
		if( S[l] == S[r] ){
			chmax(dp[l+1][r][k], dp[l][r+1][k] + 1);
		}else{
			chmax(dp[l+1][r][k+1], dp[l][r+1][k] + 1);
		}
		chmax(dp[l][r][k]    , dp[l][r+1][k]);
		chmax(dp[l+1][r+1][k], dp[l][r+1][k]);
	}
	// rep(k,K+1){
	// 	cout << "k = " << k << endl;
	// 	rep(l,N){
	// 		rep(r,N) cout << dp[l][r][k] << " ";
	// 		cout << endl;
	// 	}
	// }

	int ans = 0;
	rep(k,K+1) rep(i,N) rep(j,2) chmax(ans, dp[i+1][i+j][k] * 2 - (j==0));

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 110464
#include<iostream>
using namespace std;
int main(){
	char a,b;
	cin>>a>>b;
	cout<<"\n";
	if(a=='H'&&b=='H')
	cout<<"H";
	else if(a=='D'&&b=='H')
	cout<<"D";
	else if (a=='D'&&b=='D')
	cout<<"H";
	else if(a=='H'&&b=='D')
	cout<<"D";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<ll>a(n),b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    ll cnt=0;
    for(int i=n-1; i>=0; --i){
        a[i]+=cnt;
        cnt+=(b[i]-(a[i]%b[i]))%b[i];
    }
    cout<<cnt<<endl;
}

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

int main() {
    ll n;
    cin >> n;

    string s = "";
    while (n > 0) {
        n -= 1;
        s = char('a' + n % 26) + s;
        n /= 26;
    }

    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int x,a,b,c;
int arr[10];
int main(){
    cin>>x>>a>>b;
    for(int i=0;i<10;i++){
    arr[i]=(x*b)-a;
    b=arr[i];
    cout<<arr[i]<<endl;

    }
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
int main()
{
  int n,m,r,i,j,k,count=0,A[N];
  scanf("%d",&n);
  m=n-1;
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  for(i=0;i<n;i++)
    {
      if(A[i]>A[m])
        {
          if(i==m)
            k=count;
          count++;
          continue;
        }
      else if(A[i]<=A[m]&&count!=0)
        {
          if(i==m)
            k=i-count;
          r=A[i];
          A[i]=A[i-count];
          A[i-count]=r;
        }
    }
  for(i=0;i<n;i++)
    {
      if(i==k)
        {
        printf("[%d]",A[i]);
        if(i!=m)
          printf(" ");
                  continue;
        }
      printf("%d",A[i]);
      if(i!=m)
        printf(" ");
    }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2108
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from copy import deepcopy
def resolve():
    H,W,K=pin()
    maze=[list(input()) for a in range(H)]
#    print(maze)

    #double bit full search
    ans=0
    for i in range(2**H):
        for j in range(2**W):
            #i,j is a set such that not colored red
            notred=[]
            numh=[0]*W
            #Height
            for ci in range(H):
                check=1<<ci
                if i & check:
                    #nukiidasi
                    for k in range(W):
                        if maze[ci][k]=="#":
                            numh[k]+=1

            cal=0
            for cj in range(W):
                check=1<<cj
                if j & check:
                    cal+=numh[cj]
            if cal==K:ans+=1
    print(ans)

#%%submit!
resolve()

Measured memory_bytes: 69236
from fractions import gcd
N = int(input())
A=list(map(int,input().split()))
L=[0]*N
R=[0]*N
M=[0]*N
L[0]=A[0]
R[-1]=A[-1]
for i in range(1,N):
  L[i]=gcd(L[i-1],A[i])
  R[-i-1]=gcd(R[-i],A[-i-1])
for i in range(N):
  if i == 0:
    M[i]=R[i+1]
  elif i == N-1:
    M[i]=L[i-1]
  else:
    M[i]=gcd(L[i-1],R[i+1])
print(max(M))

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

int arr[5], k;
int main(){
	for(int i = 0; i< 5; i++){
		scanf("%d", &arr[i]);
	}
	sort(arr, arr+5);
	scanf("%d", &k);

	for(int i = 1; i < 5; i++){
		if(arr[i]-arr[0] > k){
			printf(":(\n");
			return 0;
		}
	}
	printf("Yay!\n");

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class10
    {
         static void Main()
        {
            int a = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            if (a >= 3200)
                Console.WriteLine(s);
            else
                Console.WriteLine("red");
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
#define SIZE 10005
vector< ll > dp[SIZE];
ll height[SIZE];
ll n ,m;
vector< int > graph[SIZE];
vector< int > ans;
vector< int > color(SIZE,0);
bool dfs(int u){
	color[u] = 1;// entry of a node
	for(auto it : graph[u]){
		if(color[it] == 0){
				if(dfs(it))
					return true;
		}
		if(color[it] == 1)
			return true;
	}
	color[u] = 2;// exit of a node
	return false;
}
int main(){
	dhoom;
	int n , e;
	cin >> n >> e;
	for(int i = 0 ; i < e ; i++){
			int u , v;
			cin >> u >> v;
			graph[u].push_back(v);
	}
	for(int i = 0 ; i < n ; i++){
		if(color[i] == 0){
				if(dfs(i) == true)
					return cout << "1\n" , 0;
		}
	}
	cout << 0 << endl;
    return 0;
}




Measured memory_bytes: 3704
#include<cstdio>
using namespace std;
int main()
{
    int n,t,x,y;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&t,&x,&y);
        if(x+y>t)//不用绕，使出吃奶的劲儿都到不了
        {
            printf("No\n");
            return 0;
        }
        if((x+y)%2==0&&t%2==1)//如果最优路径与时间的积偶不一，一定到不了
        {
            printf("No\n");
            return 0;
        }
        if((x+y)%2==1&&t%2==0)//同理
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");//因为如果No就都return 0了，所以剩下一定是Yes。
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	private int[] a;
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	private void run(){
		Scanner scan = new Scanner(System.in);
		
		while (true) {
			int n = scan.nextInt();
			int k = scan.nextInt();
			if ((n | k) == 0) break;
			
			a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = scan.nextInt();
			}
			
			int max = -100000;
			for (int i = 0; i < n - k + 1; i++) {
				int sum = 0;
				for (int j = i; j < i + k; j++) {
					sum += a[j];
					//System.out.println(a[j]);
				}
				if (sum > max) {
					max = sum;
				}
			}
			
			System.out.println(max);
		}
	}

}

Measured memory_bytes: 64132
#include<cstdio>
#define N 1000001
#define p 1000000007
#define ll long long
int a[N],i,n,x;
int main()
{
	scanf("%d",&n),a[1]=x=1;
	for(i=2;i<=n;i++)a[i]=(ll)(p-p/i)*a[p%i]%p;
	for(i=1;i<=n;i++)a[i]=(ll)a[i]*a[n]%p;
	for(i=n;i;i--)x=333333336ll*x%p,a[i]=(ll)a[i]*x%p;
	for(i=1,x=0;i<=n;i++)x=(x+a[i])%p;
	return 0*printf("%d\n",x);
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  char a;
  cin >> a;
  if (a=='a' || a=='i' || a=='u' || a=='e' || a=='o') cout << "vowel" << endl;
  else cout << "consonant" << endl; 
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Usize1;

#[proconio::fastout]
pub fn main() {
    input! {
    n:usize,
    m:usize,
    q:usize,
    abcd:[(Usize1,Usize1,usize,usize);q],
    }
    let mut acd: Vec<Vec<(usize, usize, usize)>> = vec![Default::default(); n];
    for (a, b, c, d) in abcd.into_iter() {
        acd[b].push((a, c, d));
    }
    let mut a = vec![1; n];
    let ans = rec(&mut a, &acd, 1, 0, n, m);
    println!("{}", ans);
}

pub fn rec(a: &mut Vec<usize>, acd: &Vec<Vec<(usize, usize, usize)>>, cur: usize, point: usize, n: usize, m: usize) -> usize {
    if cur == n {
        return point;
    }
    if cur == 0 {
        unreachable!();
    }
    let mut ans = 0;
    for i in a[cur - 1]..=m {
        a[cur] = i;
        let np: usize = acd[cur].iter()
            .filter(|&(ab, cb, _db)| i - a[*ab] == *cb)
            .map(|&(_ab, _cb, db)| db)
            .sum();
        ans = std::cmp::max(ans,
                            rec(a, acd, cur + 1, point + np, n, m));
    }
    ans
}

Measured memory_bytes: 2176
// Problem : D - Floor Function
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
//#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
//int rnd(int x) { return mrand() % x;}
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

int main()
{
	fastIO;
	ll a,b,n; cin >> a >> b >> n;
	cout << a * min(n,b - 1) / b;	
	return 0;
}

Measured memory_bytes: 3652
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();
    let x: usize = itr.next().unwrap().parse().unwrap();

    let mut c: Vec<usize> = vec![0; n + 1];
    let mut a: Vec<Vec<usize>> = vec![vec![0; m + 1]; n + 1];
    for i in 0..n {
        c[i] = itr.next().unwrap().parse().unwrap();
        for j in 0..m {
            a[i][j] = itr.next().unwrap().parse().unwrap();
        }
    }

    let mut ans = 1 << 30;
    for bit in 1..1 << n {
        let mut sum = 0;
        let mut ok = true;
        let mut memo = vec![0; m + 1];
        for i in 0..n {
            if bit >> i & 1 == 1 {
                sum += c[i];
                for j in 0..m {
                    memo[j] += a[i][j];
                }
            }
        }

        for i in 0..m {
            if memo[i] < x {
                ok = false;
            }
        }
        if ok {
            ans = std::cmp::min(ans, sum);
        }
    }

    if ans == 1 << 30 {
        println!("-1")
    } else {
        println!("{}", ans)
    }
}


Measured memory_bytes: 2132
/*
g++ --std=c++17 A.cpp
*/

#include <iostream>
#include <iomanip> //! for setprecision(20)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int INF = 1000000000;
const int MOD = 1000000007;

/*
  == AC Library Cheat sheet
  documentation: file:///Users/nobu/Downloads/ac-library/document_ja/index.html

  mint
    mint m.pow(int p)  //! return m^p
    mint m.inv() //! returns i that gives (m * i).val() == 1 
    int m.val() 

  fenwick_tree (BIT)
    fenwick_tree<T> fw(int n) //! init a[0] .. a[n-1] with all 0
    void fw.add(int idx, T x); //! a[idx] += x
    T fw.sum(int l, int r); //! return a[l] + .. + a[r-1]

  dsu (UnionFind)
    dsu d(int n)  //! prepare dsu with n nodes
    void d.merge(int x, int y)  //! connect node x and y
    bool d.same(int x, int y)  //! return true if node x and y are connected
    int d.leader(int x)  //! return the leader node of the connected group
    int d.size(int x) //! return the size of the group that node x belongs to
    vector<vector<int>> d.groups() //! return a vector of vectors that contain the nodes in each group

  scc_graph
    scc_graph　g(int n)  //! create a directed graph with n nodes
    g.add_edge(int from, int to)  //! create a directed edge from node from to node to
    vector<vector<int>> g.scc()  //! return the vector of strongly connected components that are topologically sorted

  segtree
    segtree<S, op, e>
      S: type of the monoid 
      op: function to return the product of two elements
      e: function to return the identity element such that op(x, e) == x fo any x 

  lazy_segtree
    lazy_segtree<S, op, e, F, mapping, composition, id>
      F: type of parameters to define the operation applied to the target elements
      mapping: function to return the element after applying the operation to the target element
      composition: function to combine the two sets of operation parameters to one
      id: function to return the operation parameter i such that mapping(i, x) = x for any x

      using S = int;
      S op(S a, S b) { return min(a, b); }
      S e() { return INF; }
      using F = int;
      S mapping(F f, S x) { return min(f, x); }
      F composition(F f, F g) { return min(f, g); }
      F id() { return INF; }

  floor_sum(ll n, ll m, ll a, ll b)   
*/



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

  int n, m, d;
  cin >> n >> m >> d;

  double p = 0;
  if (d == 0) {
    p = 1.0 / n;
  } else {
    p = 2.0 * (n-d) / n / n;
  }

  double ans = p * (m-1);

  cout << setprecision(20) << ans << endl;

  return 0;
}


Measured memory_bytes: 3760
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e18
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const int MOD = 1e9 + 7;

void Nimk(int N, int K, vector<int>& pile) {
	vector< vector<int> > bin(N, vector<int>(30, 0)); // 2次元配列

	for (int i = 0; i < N; i++) { //pile[i]について、2進数に展開する
		int twopow = 1; // 2のべき乗
		for (int x = 0; x < 30; x++) {
			if (twopow & pile[i])// 2^xにくっつく数は0か1か
				bin[i][x] = 1;
			else
				bin[i][x] = 0;
			twopow = twopow * 2;
		}
	}

	vector<int> digitsum(N, 0); // 桁ごとの和

	for (int x = 0; x < 30; x++) {// 桁xについて
		for (int i = 0; i < N; i++) {
			digitsum[x] = digitsum[x] + bin[i][x];
		}
	}

	int win = 0; // 負けを0、勝ちを1とする
	for (int x = 0; x < 30; x++) {
		if (digitsum[x] % (K + 1) != 0) {
			// 桁の値が0ではないときは勝ちのポジション、grundy数が0でないことが確定する
			win = 1;
		}
	}

	if (win == 1) { // 先手の勝ち
		cout << "first" << endl;
	}
	else { // 先手の負け
		cout << "second" << endl;
	}

}

int main(){
   int n;
   cin >> n;
   bool f = true;
   rep(i, n){
      ll a;
      cin >> a;
      if(a % 2 != 0)f = false;
   }
   cout << (f ? "second" : "first") << endl;
}


Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main()
{

    int h,n;
    cin>>h>>n;
    int total=0;
    while(n--)
    {int a;
        cin>>a;
        total+=a;
    }
    int k=0;
    k=h-total;
    if(k<=0)
        cout<<"Yes";
    else cout<<"No";

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n, y;
  cin >> n >> y;
  for (int i = 0; i < n + 1; i++){
    for (int j = 0; j < n + 1 - i ; j++){
      int k = n - i - j;
      if (i*1000 + j*5000 + k*10000 == y){
        cout << k << " " << j << " " << i << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}

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

int main(void) {
	int A,B,C,D;
	scanf("%d %d %d %d\n",&A,&B,&C,&D);

	while(A>0 ){
		C = C-B;
		if(C<=0){
			printf("Yes");
			return 0;
		}
		A = A-D;
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
vector<int>vt;
set<int>st;
map<int,int>mp;
unordered_map<string,int> umap; 
const long long MAX = 1e5;
const long long INF = 1e9;
const double pi = acos(-1);




int main() {
  
 string s,t;
 cin>>s>>t;
 for(int i=0;i<s.length();i++)
 {
   if(s[i]!=t[i])
   {
     cout<<"No"<<endl;
     exit(0);
   }
 }
 cout<<"Yes"<<endl;


}

Measured memory_bytes: 3628
#include <iostream>
#include <map>
#include <cmath>

int main(){
    int n;
    float t, a;
    std::cin >> n >> t >> a;

    float diff;
    std::map<float, int> h{};
    for(int i = 1; i <= n; ++i){
        std::cin >> diff;
        diff = std::fabs(a - (t - diff * 0.006));
        h.insert(std::make_pair(diff, i));
    }
    
    std::cout << h.begin()->second << std::endl;

    return 0;
}


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

int main() {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  cout << a[0] << " " << a[1] << " " << a[2] << endl;
}



Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;
const ll INF = 100100100100100100;

ll N;
ll ans[1000][1000];

void func(ll cnt, ll start, ll repeat) {
  rep(i,repeat){
    ans[cnt][cnt+i] = start+i;
    ans[cnt+i+1][cnt] = start+i;
  }
}
int main(){
  cin >> N;
  ll K = 1;
  while(1){
    ll tmp = K * (K -1) / 2;
    if (tmp == N){
      break;
    }
    else if( tmp > N){
      cout << "No" << endl;
      return 0;
    }
    K++;
  }
  cout << "Yes" << endl;
  cout << K << endl;
  ll L = 2*N/K;

  ll start= 1;
  rep(i,K-1){
    func(i,start,K-1-i);
    start += K-i-1;
  }
  rep(i,K){
    cout << L;
    rep(j,L){
      cout << " " << ans[i][j];
    }
    cout << endl;
  }
}


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

int main(void){
  int a,b,c;
  char str[100],*p;
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  a=atoi(p);
  p=strtok(NULL," \n");
  b=atoi(p);
  
  c=(b-a-1)*(b-a)/2-a;
  
  printf("%d\n",c);
  
  return 0;
}

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

ll total = 0;
int n;
bool can = true;

int main(){
  cin >> n;
  vector<pair<ll, ll>> time(n);
  rep(i, n){
    ll a, b;
    cin >> a >> b;
    time.at(i) = make_pair(b, a);
  }
  
  sort(time.begin(), time.end());
  
  rep(i, n){
    if((total += time.at(i).second) <= time.at(i).first) 
      continue;
    can = false;
    cout << "No" << endl;
    break;
  }
  if(can) cout << "Yes" << endl;
}

Measured memory_bytes: 3328
N,M = map(int,input().split())
s = [[] for i in range(N)]
m = []
for i in range(M):
    a,b = map(int,input().split())
    s[a-1].append(b)
    s[b-1].append(a)
    m.append([a,b])
ans = 0
from collections import deque
import copy
d = deque()
for i in range(M):
    n = [0] * N
    a = m[i][0]
    b = m[i][1]
    c = s[a-1].copy()
    c.remove(b)
    d.append(c)
    n[a-1] = 1
    while len(d) > 0:
        e = d.popleft()
        for j in e:
            if n[j-1] == 0:
                n[j-1] = 1
                d.append(s[j-1])
    if 0 in n:
        ans += 1
print(ans)

Measured memory_bytes: 9500
//use itertools::Itertools;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

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:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        k: usize,
        a: [usize;n]
    }

    let mut ans = 0;

    let mut visited: HashMap<usize, usize> = HashMap::new();

    visited.insert(0, 0);

    let mut already = false;
    let mut last_town = 0;
    let mut turn = 0;
    while !already {
        turn += 1;
        last_town = a[last_town] - 1;
        if visited.get(&last_town) != None {
            already = true;
        } else {
            visited.insert(last_town, turn);
        }
    }

    let offset = *visited.get(&last_town).unwrap();
    let period = turn - offset;

    if k >= offset {
        let count = (k - offset) % period;
        //println!("{} {} {} {}", count, offset, period, last_town);

        let mut town = last_town;
        for i in 0..count {
            town = a[town] - 1;
        }

        println!("{}", town + 1);
    } else {
        let mut town = 0;
        for i in 0..k {
            town = a[town] - 1;
        }

        println!("{}", town + 1);
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 9188
#include<stdio.h>
#include <stdlib.h>

int main(){
	
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	
	
	printf((abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))?"Yes":"No");
	
	
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int i,atotal,btotal;
	atotal=0;btotal=0;
	int a[10];
	int b[10];
	for(i=1;i<=4;i++){
		scanf("%d",&a[i-1]);
		atotal+=a[i-1];
	}
	for(i=1;i<=4;i++){
		scanf("%d",&b[i-1]);
		btotal+=b[i-1];
	}
	if(atotal>=btotal){
		printf("%d\n",atotal);
	}else{
		printf("%d\n",btotal);
	}
	return 0;
}

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

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main()
{
    int N,M,H[100010]={},cnt[100010]={};
    cin>>N>>M;
    for(int i=1;i<=N;i++){
        cin>>H[i];
    }

    for(int i=1;i<=M;i++){
        int A,B;
        cin>>A>>B;

        if(H[A]==H[B]){
            cnt[A]++;
            cnt[B]++;
        }else if(H[A]>H[B]){
            cnt[B]++;
        }else{
            cnt[A]++;
        }
    }
    int ans=0;

    for(int i=1;i<=N;i++){
        if(cnt[i]<1)ans++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4416
from operator import itemgetter 
n = int(input())
point = []
ans = []
for i in range(n):
    a,b = input().split()
    s = [a,int(b),i+1]
    point.append(s)

s_point = sorted(point,key=itemgetter(1),reverse=True)
s_point = sorted(s_point,key=itemgetter(0))
[print(s_point[j][2]) for j in range(n)]

Measured memory_bytes: 9200
#include <iostream>
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main() {
  int n, a[100000], b[3] = {};
  ll cnt, ans = 1LL;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt = 0LL;
    for (int j = 0; j < 3; j++) {
      if (a[i] == b[j]) {
        cnt++;
      }
    }
    ans *= cnt;
    ans %= MOD;
    for (int j = 0; j < 3; j++) {
      if (a[i] == b[j]) {
        b[j]++;
        break;
      }
    }
  }
  cout << ans << endl;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------
void make_divisors(vector<ll> &v, ll x){
  for(ll i=1; i*i<=x; i++){
    if(x%i==0){
      v.push_back(i);
      if(i!=x/i) v.push_back(x/i);
    }
  }
  sort(v.begin(), v.end());
}

int main(void) {
  int n;
  cin >> n;

  int ans=0;
  REP(i,1,n+1){
    if(i%2==0) continue;
    vecll v;
    make_divisors(v, i);
    if(v.size()==8) ans++;
  }

  prt(ans);

}


Measured memory_bytes: 256
/**
 *  Author: Wasi Ur Rahman
 *  FROM RMSTU
**/
#include<bits/stdc++.h>
#define  fast           ios::sync_with_stdio(false);cin.tie(0)
using namespace std;
#define  min3(a,b,c) min(a,min(b,c))
#define pi acos(-1.0)
int arr[101];
int main()
{
    fast;
     int sum = 0,n,m;
     scanf("%d%d",&n,&m);
     for(int i = 1;i<=m;i++){
        int p;scanf("%d",&p);
        sum += p;
     }
     if(sum > n)
        printf("-1\n");
     else printf("%d\n",n-sum);
     return 0;
}




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

int main(void)
{
	double x1, y1, r1, x2, y2, r2;
	int n, res;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin>>x1>>y1>>r1>>x2>>y2>>r2;
		double d = ((x1-x2) * (x1-x2) + (y1-y2) * (y1-y2));
		double sr = ((r1+r2) * (r1+r2));
		double dr = ((r1-r2) * (r1-r2));
		if (sr < d) cout << "0" << endl;
		else if (d < sr && dr < d) cout << "1" << endl;
		else if (d < dr){
			if (r2 < r1) cout << "2" << endl;
			else cout << "-2" << endl;
		}
		else cout << "1" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
N,i,j,k;
long long A[301][301],inf=1e15,z;
main(){
	for(scanf("%d",&N);i++<N;){
		for(j=0;j++<N;){
			scanf("%d",A[i]+j);
		}
	}
	for(;k++<N;){
		for(i=0;i++<N;){
			if(i==k)continue;
			for(j=0;j++<N;){
				if(j==k||j==i||A[i][j]==inf)continue;
				if(A[i][j]>A[i][k]+A[k][j]){
					return!puts("-1");
				}
				if(A[i][j]==A[i][k]+A[k][j]){
					A[i][j]=inf;
				}
			}
		}
	}
	for(i=0;i++<N;){
		for(j=0;j++<N;){
			z+=A[i][j]==inf?0:A[i][j];
		}
	}
	printf("%lld",z/2);
}


Measured memory_bytes: 896
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, 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, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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
 
n = INT()
v = LIST()

v1 = v[::2]
v2 = v[1::2]

def cnt(v1, v2):
	ans1 = len(v1) - Counter(v1).most_common()[0][1]

	if Counter(v1).most_common()[0][0] != Counter(v2).most_common()[0][0]:
		ans2 = len(v2) - Counter(v2).most_common()[0][1]
	else:
		if len(Counter(v2).most_common()) == 1:
			ans2 = Counter(v2).most_common()[0][1]
		else:
			ans2 = len(v2) - Counter(v2).most_common()[1][1]

	return ans1 + ans2

print(min(cnt(v1, v2), cnt(v2, v1)))

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

int main (void) {
  string s;
  cin >> s;
  
  int n = s.size();
  vector<char> s0(n), s0r(n), s1((n - 1) / 2), s2((n - 1) / 2), s1r((n - 1) / 2), s2r((n - 1) / 2);
  for (int i = 0; i < n; i++) {
    s0.at(i) = s.at(i);
    s0r.at(i) = s.at(i);
  }
  for (int i = 0; i < (n - 1) / 2; i++) {
    s1.at(i) = s.at(i);
    s1r.at(i) = s.at(i);
  }
  for (int i = 0; i < (n - 1) / 2; i++) {
    s2.at(i) = s.at(i + (n + 1) / 2);
    s2r.at(i) = s.at(i + (n + 1) / 2);
  }
  
  reverse(s0r.begin(), s0r.end());
  reverse(s1r.begin(), s1r.end());
  reverse(s2r.begin(), s2r.end());
  
  if (s0 == s0r && s1 == s1r && s2 == s2r)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

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

using namespace std;

int main() {
  long long n, m;
  cin >> n >> m;

  long long ans = min(n, m);
  if (n % 3 == 0 || m % 3 == 0) {
    ans = 0;
  }

  for (int i = 1; i < n; i++) {
    long long a, b, c;
    a = i * m;
    b = (n - i) * (m / 2);
    c = (n - i) * (m - m / 2);
    ans = min(ans, max({a, b, c}) - min({a, b, c}));
  }

  swap(n, m);
  for (int i = 1; i < n; i++) {
    long long a, b, c;
    a = i * m;
    b = (n - i) * (m / 2);
    c = (n - i) * (m - m / 2);
    ans = min(ans, max({a, b, c}) - min({a, b, c}));
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	string a, aa, aaa;
	cin >> a >> aa >> aaa;
	char l1 = a[0];
	char l2 = aa[0];
	char l3 = aaa[0];
	l1-=32;
	l2-=32;
	l3-=32;
	cout << l1 << l2 << l3 << "\n";
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

string s[2];

int main(){
  while(1){
    cin>>s[0];
    if(s[0]==".")break;
    cin>>s[1];
    vector<string> ss[2];
    rep(k,2)for(int i=0;i<s[k].size();){
      string tmp="";
      while(i<s[k].size()&&s[k][i]!='\"'){
        tmp+=s[k][i];
        i++;
      }
      ss[k].push_back(tmp);
      i++;
    }
    if(ss[0].size()!=ss[1].size()){
      cout<<"DIFFERENT"<<endl;
    }else{
      bool ok=true;
      int cnt=0;
      rep(i,ss[0].size()){
        if(i%2==0){
          if(ss[0][i]!=ss[1][i])ok=false;
        }else{
          if(ss[0][i]!=ss[1][i])cnt++;
        }
      }
      if(ok&&cnt==0)cout<<"IDENTICAL"<<endl;
      else if(ok&&cnt==1)cout<<"CLOSE"<<endl;
      else cout<<"DIFFERENT"<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3068
#include<stdio.h>

int main(){

  int c[4][4];
  for(int i = 1; i <= 3 ; ++i){
    for(int j = 1; j <= 3 ; ++j){
      scanf("%d",&c[i][j]);
    }
  }

  if(c[1][1] - c[2][1] != c[1][2] - c[2][2] ){
    printf("No"); return 0;
  }
  if(c[2][1] - c[3][1] != c[2][2] - c[3][2] ){
    printf("No"); return 0;
  }
  if(c[1][1] - c[1][2] != c[2][1] - c[2][2] ){
    printf("No"); return 0;
  }
  if(c[1][2] - c[1][3] != c[2][2] - c[2][3] ){
    printf("No"); return 0;
  }
  if(c[2][2] - c[2][3] != c[3][2] - c[3][3] ){
    printf("No"); return 0;
  }
  if(c[2][2] - c[3][2] != c[2][3] - c[3][3] ){
    printf("No"); return 0;
  }

  printf("Yes");

  return 0;

}


Measured memory_bytes: 128
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    s, t = rl()
    print(t+s)


if __name__ == '__main__':
    main()


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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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 N;
int a[200005];

signed main(){
    cin>>N;
    for(int i=0;i<N;++i)cin>>a[i];
    int S=0;
    for(int i=0;i<N;++i)S=S^a[i];
    for(int i=0;i<N;++i){
        cout<<(S^a[i])<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 5056
s = input()
n = len(s)

def is_parin(s):
    return all((s[i]==s[len(s)-1-i] for i in range(len(s)//2)))

print('Yes' if is_parin(s) and is_parin(s[:(n//2)]) and is_parin(s[((n+1)//2):]) else 'No')

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

int main() {
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double ans,hangle,mangle,pai=3.14159265359,round;
    h=60*h+m;
    hangle=(double)h/2.0;
    mangle=6*m;
    double angledif;
    if (hangle>mangle) angledif=hangle-mangle;
    else angledif=mangle-hangle;
    round=min(angledif,360-angledif);
    double rad=round*(pai/180);
    ans=a*a+b*b-2*a*b*cos(rad);
    printf("%.18f\n",sqrt(ans));
}


Measured memory_bytes: 4072
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	string s, t;
	cin >> s >> t;
	if(s == t.substr(0, s.size())) puts("Yes");
	else puts("No");

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n,x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    
    int ans = 0;
    for (int i=0; i<n; i++) {
        if (x < a[i]) break;
        x -= a[i];
        if (i!=n-1 || x==0) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  string s;cin>>s;
  ll l=s.length();
  ll num='Z'-'A'+1;
  rep(i,l){
    s[i]=(((s[i]-'A')+n)%num+'A');
  }
  cout<<s<<endl;
  return 0;

}


Measured memory_bytes: 256