akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

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

int main()
{
    int H,W;
    cin >> H >> W;
    int tile[H+1][W+1], cnt[H+1][W+1];
    memset(tile, 0, sizeof(tile));
    memset(cnt, 0, sizeof(cnt));
    int all_dot=0;
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            char tmp;
            cin >> tmp;
            if(tmp=='.'){
                tile[i][j]=1;
                all_dot++;
            }else tile[i][j]=0;
        }
    }
    queue <P> que;
    que.push(P(1,1));
    cnt[1][1]=1;
    while(que.size()!=0){
        int h=que.front().first;
        int w=que.front().second;
        que.pop();
        for(int i=-1; i<=1; i+=2){
            if(cnt[h+i][w]==0 && tile[h+i][w]==1){
                cnt[h+i][w]=cnt[h][w]+1;
                que.push(P(h+i, w));
            }
            if(cnt[h][w+i]==0 && tile[h][w+i]==1){
                cnt[h][w+i]=cnt[h][w]+1;
                que.push(P(h, w+i));
            }
        }
    }

    if(cnt[H][W]==0) cout << -1 << endl;
    else cout << all_dot-cnt[H][W] << endl;
    return 0;
}


Measured memory_bytes: 256
import math
A, B, H, M = map(int, input().split())
HT =  30*H + 0.5*M
MT = 6*M

ax = A*math.cos(math.radians(HT))
ay = A*math.sin(math.radians(HT))
bx = B*math.cos(math.radians(MT))
by = B*math.sin(math.radians(MT))

d = math.sqrt(abs(ax-bx)**2 + abs(ay-by)**2)
print(d)

Measured memory_bytes: 9412
list = gets.chomp.split.map{|aa| aa.to_i}
n = list[0]
k = list[1]

height_list = gets.chomp.split.map{|aa|  aa.to_i}

result = 0
for i in 0..n-1
  if height_list[i] >= k
    result += 1
  end
end

puts result

Measured memory_bytes: 8324
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	ll N;
	cin >> N;
	int consecutive_not_max = (N % 2 == 0) ? 2 : 3;
	vl A(N);
	rep(i, N)
		cin >> A[i];
	vector<vector<vl>> DP(N + 1);
	rep(i, N + 1) {
		DP[i].resize(consecutive_not_max);
		rep(j, consecutive_not_max) {
			// 0 : i番目を選ばない (out)
			// 1 : i番目を選ぶ (in)
			DP[i][j].resize(2, -InfLL);
		}
	}
	DP[0][0][0] = 0;
	rep(i, N) {
		rep(j, consecutive_not_max) {
			// out - in
			DP[i + 1][j][1] = max(DP[i + 1][j][1], DP[i][j][0] + A[i]);
			// out - out
			if (j + 1 != consecutive_not_max)
				DP[i + 1][j + 1][0] = max(DP[i + 1][j + 1][0], DP[i][j][0]);
			// in - out
			DP[i + 1][j][0] = max(DP[i + 1][j][0], DP[i][j][1]);
		}
	}
	ll ans = max(DP[N][consecutive_not_max - 2][0], DP[N][consecutive_not_max - 1][1]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 43852
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <iostream>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef vector<int> VI;

int main(){
	int a, b;
	cin >> a >> b;
	if (a * b == 15) puts("*");
	else if (a + b == 15) puts("+");
	else puts("x");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num,init) vector<ll> name((num),(init));
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define mat(name,fnum,snum,init); vector<vector<ll>> name((fnum),vector<ll>((snum),(init)));
#define debugP int debug_point; cin>>debug_point;


int main(){
    ll n;
    cin>>n;
    mat(a,3,100001,0);
    rep(i,3){
        rep(j,n){
            
            cin>>a[i][j];
        }
    }
    rep(i,3){
        sort(&a[i][0],&a[i][n]);
    }
    ll ans=0;
    rep(i,n){
        ans+=(lower_bound(&a[0][0],&a[0][n],a[1][i])-&a[0][0])*(&a[2][n]-upper_bound(&a[2][0],&a[2][n],a[1][i]));
    }
    op(ans);
    return 0;
}

Measured memory_bytes: 3328
N = int(input())
a = [int(_) for _ in input().split()]
s = set()
for i in range(N):
    s.add(a[i])
if len(s) == 1 and 0 in s:
    print('Yes')
elif len(s) == 2 and 0 in s:
    if N%3 == 0 and a.count(0) == N//3:
        print('Yes')
    else:
        print('No')
else:
    if N%3 != 0 or len(s) != 3:
        print('No')
    else:
        cnt = []
        for x in s:
            cnt.append(a.count(x))
        if len(set(cnt)) != 1:
            print('No')
        else:
            xor = 0
            for x in s:
                xor ^= x
            if xor == 0:
                print('Yes')
            else:
                print('No')


Measured memory_bytes: 14708
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    } 
    sort(all(a));
    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += a[i];
    }
    cout << ans << "\n";
    

    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,h,m;
    scanf("%d%d%d%d", &a, &b, &h, &m);

    //求时钟的角度
    double x1=h*30+m*0.5;
    //求分钟的角度
    double x2=m*6;
    //求夹角
    double xita = fabs(x1-x2);
    if (xita>180) {
        xita = 360-xita;
    }
    double ans = sqrt(a*a+b*b-2*a*b*cos(xita*acos(-1.0)/180));

    printf("%.20lf\n",ans);

    return 0;
}

Measured memory_bytes: 4216
#include <stdio.h>
#define swap(a, b)a^=b^=a^=b

static const int N =1000;

void trace(int A[], int n){
  int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main()
{
  int n, i, j, swap, count = 0;
  int A[N];
  scanf("%d", &n);

  for(i = 0; i < n; i++) scanf("%d", &A[i]);

  for(i = 0; i <= n-1; i++){
    for(j = n-1; j >= i+1; j--){
    if( A[j] < A[j-1]){
      swap = A[j];
      A[j] = A[j -1];
      A[j - 1] = swap;
	count++;
    }
    }
  }
  trace(A, n);
  printf("%d\n", count);
  
  return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#include <map>
#include <string.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(a) (a).begin(), (a).end()
using namespace std;

int main(){
    long a, b;
    cin >> a >> b;
    int x = a % 4;
    int y = b % 4;
    long ans = 0;
    rep(i, 4 - x) ans ^= a + i;
    rep(i, y+1) ans ^= b - i;
    cout << ans << endl;
}


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

int main(){
    cout.setf(ios_base::fixed);
    cout.precision(12);

    int n, odd=0;
    cin >> n;
    for(int i=1;i<=n;++i){
        if(i & 1) ++odd;
    }

    cout << 1.0*odd / n << endl;

    return 0;
}

Measured memory_bytes: 256
/*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:,'..'xXWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .:kOo.,kNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .lNWWo..lXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MNOxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMMMMWKxoloxKWNc  .:xxd;  ,dxxxkXMXkxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMM
MKc''''''''''''''''.  ..'''''.   .''''.  .''MMMWx..,:. .xXo''.  .''.  ..'';kMk;'''''.  .'.''.  .''''''.  ..''.   .''MM
MWNXNNNNNNNNNNNNNNNO' ;KNNNNNKo. cKNNNd. lXNMMMK; ,0Wx. :NWXXl .dNNO' ;KNNNWMWNNNNNXc .kNNNNx. cXNNNNNO' ;KNN0; 'ONNMM
MMMMMMMMMMMMMMMMMWM0' :NMMMMWMX: .OMWWx. oWMMMMWx. ';. .dNMWWo .xMM0' :NWWMMMMMMMMWWl .OMMMWk. lWWMMWM0' ;XMMX: ,KMMMM
MMMMMMWMWkccccccccc;. :NMWNNNKd. :XMMWx. oWMMMWKo. .',. .,ldx; .dMM0' :NMMMMMMMNNWMWl .OMMMWk. lWMMMMM0' ;XMMX: ,0MMMM
MMWXKNWMWxcc,. .;cc;. :XMk,''..'lKWMMWx. oWMNx:. .lONNKxl.     .xMM0' :NMMMMMM0:,oKO' ,KMMMMk. lWWNkoc,. .;::;. ,KMMMM
MMXc.lXMMWWWNd..xWM0' :NM0;  ;kXWMMMWNl  oWMK:.;xXWWMWXx:. ,c' .dMM0' :NMMMMMMKc. ...;kWMMMMk. lWWc .:;. .clc:. ,KMMMM
MWWx. lXMWMMMK, lWM0' :NMMNx'.,ldxxoc'   oWMWNKNWWWN0o' .:kNWo .dMM0' :NMMMMMMMNO;  ,OWWWMMMk. lWM' lXx. lNMMX: ,KMMMM
MMMWk'.,xKNX0c..kWM0' :NMMMMNkl;,'',:l:  oWMMMMMWMWO' 'l0WMWWo .xMM0' :NMMMMMMMMMNd. .oXWMMMk. lWMd.....;0WMMX: ,KMMMM
MMMMWKo'...'..:kWMM0' :NMMMMMMMWWNNWWWx. oWMMMMMMMMWOxXWMWMWWo .xMM0' :NMMMMMMMMMMMKl. ,kNMMk. lWMWKkxx0NMWMMX: ,KMMMM
MMMMMMMN0kxk0XNWMMWKl;xNMMMMMMMMMMMMWM0c;kWMMMMMMMMMMMWWMMMMWk;:OMMXl,dNMMMMMMMMMMMMWO; .dNM0c;kWWMMMMMMMMMMMNd,oXMMMM
MMMMMMMMWWMWMMMMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWWMMWMMMMMMMMMMMMMMNkxKWMMWWMMMMMMMMMMMMMMWMMWMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*/

//             Author: Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)                  //


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;

#define         TESTCASES()    cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define         _input(V3C)    for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define   mems(A77AY, V4LU)    memset((A77AY), (V4LU), sizeof((A77AY)))
#define    CH3K(I7, E4, S7)    (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define   for4(I7,S4,E4,S7)    for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))



void solveEachTest(lld T35TC453N = 1) {
	string s; cin >> s;
	cout << ((s[0] == s[2]) ? "Yes" : "No");

	// cout << "\n";

	return;
}


signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  null

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
using namespace std;
using ll=long long;
using R=double;

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

int main(){
	int N;
	ll K;
	cin >> N >> K;
	ll A[N]; ll maxi=0;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		if(A[i] == K){
			puts("POSSIBLE");
			return 0;
		}
		maxi = max(maxi, A[i]);
	}

	if(maxi < K){
		puts("IMPOSSIBLE");
		return 0;
	}

	ll x = A[0];

	for(int i = 1; i < N; i++){
		x = gcd(x, A[i]);
	}

	if(K%x == 0){
		puts("POSSIBLE");
		return 0;
	}else{
		puts("IMPOSSIBLE");
		return 0;
	}

}


Measured memory_bytes: 1024
#include <iostream>

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

	int count2 = 0, count4 = 0;
	for (int i = 0; i < n; ++i) {
		int a;
		std::cin >> a;
		
		if (a % 4 == 0)
			++count4;
		else if (a % 2 == 0)
			++count2;
	}

	if (count4 + count2 / 2 >= n / 2)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

//nCr mod m
#define MOD 1000000007
#define M 2200000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}

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

	int n,m;
    cin>>n>>m;
	vi in(n+1);
	rep(i,n)cin>>in[i+1],(in[i+1]+=in[i]+m-1)%=m;
	int out=0;
	map<int,int>c;
	c[0]=1;
	rep(i,n){
		if(i-m+1>=0)c[in[i-m+1]]--;
		out+=c[in[i+1]]++;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 14336
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >> A >> B;
    if ((B - A) % 2 == 1) {
        cout << "Borys" << endl;
    } else {
        cout << "Alice" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
// package app;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);

        final String S = sc.next();
        // final int A = sc.nextInt();
        // final int A = sc.nextInt();
        // final int B = sc.nextInt();
        // final int C = sc.nextInt();

        // System.out.println();
        StringBuffer sb = new StringBuffer(S);
        sb.setCharAt(3, '8');
        System.out.println(sb.toString());

        // System.out.println(A <= X && A + B >= X ? "YES" : "NO");

    }
}

Measured memory_bytes: 23636
#include<stdio.h>
#include<math.h>
int main(){
    double N;
    scanf("%lf",&N);
    int a;
    double S=0;
    a= floor(log10(N))+1; //桁数
    int i;
    if(a==1){
        S=N;
    }
    else if(a%2==0){
        for(i=0;i<(a/2);i++){
            S=S+9*pow(100,i);
           // printf("i=%d\n",i);
             //printf("s=%lf\n",S);
        }
    }
    else{
        for(i=0;i<(a/2);i++){
            S=S+9*pow(100,i);
           
        }
        S=S+(N-pow(100,(a/2)))+1;
    }
    int s;
    s=S;
    printf("%d\n",s);
   // printf("%d",a);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define R(i,n) for(int i=0;i<n;i++)
int n,a=1e9,c[2][20],p[1<<18][51];main(){cin>>n;R(i,n*2)cin>>c[i/n][i%n];fill(p[1],p[1<<n],1e9);R(B,1<<n){int o=0,d[n];R(i,n)if(~B&1<<i)d[i]=o++;R(i,n){int k=c[abs(i-n+o)%2][i],&t=p[B|1<<i][k];R(j,k+1)t=min(t,p[B][j]+d[i]);}}R(i,51)a=min(a,p[(1<<n)-1][i]);cout<<(a>1e8?-1:a);}

Measured memory_bytes: 52608
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    cout << a + b + c - max({a,b,c});
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
typedef __int128_t lll;
using namespace std;

//-------------------------------------------------------------------
#define P 1000000007
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll x, y;std::cin >> x >> y;
  init();
  ll A = 2*y - x, B = 2*x - y;
  if(A%3||B%3||A<0||B<0){
    std::cout << 0 << '\n';
    return 0;
  }
  A/=3, B/=3;
  std::cout << comb(A+B, A) << '\n';
  return 0;
}


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

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

 int s_length = s.size();
 int p_length = p.size();

 bool cheak = false;
 int count = 0;
 while( count<s_length && cheak==false ){
  if( s[count] == p[0] ){
   for( int i=0; i<p_length; i++ ){
    if( s[(count+i)%s_length] != p[i] ){
      cheak = false;
      break;
    }else{
      cheak = true;
    }
   }
  }
  count++;
 }

 if( cheak ){
  cout << "Yes" << endl;
 }else{
  cout << "No" << endl;
 }

 return 0;
}


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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
const long long INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int gcd(int x, int y) {
  while (y > 0) {
    int r = y;
    y = x % y;
    x = r;
  }
  return x;
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (c % gcd(a, b) == 0 ? "YES" : "NO") << endl;
}


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

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define REVREP(i, n)      for(ll i = n - 1; i >= 0 ; i--)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }

void Solve()
{
	ll N, K;
	cin >> N >> K;
	VL p(N);
	REP(i, N) cin >> p[i];
	sort(ALL(p));
	ll ans = 0;
	REP(i, K) ans += p[i];

	cout << ans << endl;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


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

using namespace std;

int main(void)
{
	int N;
	char S[105];
	
	cin >> N;
	scanf("%s", S);
	
	int stock_left = 0;
	int over_right = 0;
	
	for(int i = 0; i < N; i++){
		if(S[i] == '(') stock_left++;
		else{
			if(stock_left > 0) stock_left--;
			else over_right++;
		}
	}
	
	int stock_right = 0;
	int over_left = 0;
	
	for(int i = N-1; i >= 0; i--){
		if(S[i] == ')') stock_right++;
		else{
			if(stock_right > 0) stock_right--;
			else over_left++;
		}
	}
	
	for(int i = 0; i < over_right; i++) printf("(");
		printf("%s", S);
	for(int i = 0; i < over_left; i++) printf(")");
	
	return 0;
}
	
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(0);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  fix10;
  long n,k;
  cin >> n >> k;
  if(k == 1){
    cout << pow(n,3) << endl;
    return 0;
  }
  long tmp;
  if(k % 2 == 1){
    tmp = n / k;
    cout << pow(tmp,3) << endl;
    return 0;
  }
  if(k % 2 == 0){
    tmp = (n-(k/2)) / k;
    if(n >= k/2) tmp++;
    long answer = pow(tmp,3);
    answer += pow(n/k,3);
    cout << answer << endl;
    return 0;
  }
}

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

using namespace std;

#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 each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

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

int main () {
    int X, A, B; cin >> X >> A >> B;
    if (A-B >= 0) cout << "delicious" << endl;
    else if (A-B >= -X) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}



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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;

void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int n;
    cin >> n;
    int a[n + 1];
    int b[n + 1];
    int c[n];
    FOR(i, 1, n) cin >> a[i];
    FOR(i, 1, n) cin >> b[i];
    FOR(i, 1, n - 1) cin >> c[i];
    ll res = 0;
    res = b[a[1]];
    FOR(i, 2, n)
    {
        res += b[a[i]];
        if(a[i] - a[i - 1] == 1)
            res += c[a[i - 1]];
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
x, y = list(map(int, input().split()))

a = {1, 3, 5, 7, 8, 10, 12}
b = {4, 6, 9, 11}
c = {2}

if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
using System;

namespace cola2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s_num = Console.ReadLine().Trim().Split(' ');
            if (int.Parse(s_num[0]) < int.Parse(s_num[1]))
            {
                Console.WriteLine("a < b");
            }
            else if (int.Parse(s_num[0]) > int.Parse(s_num[1]))
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
        }
    }
}

Measured memory_bytes: 8728
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber
// 29 06 2020

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a*b/gcd(a, b));
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void bruce()
{
    cout << "\nExpected answer:\n";
    cout << "\nAnswer recieved:\n";
}

void task()
{
    //code here...

    string s;
    cin >> s;

    int n = s.length();
    vi ara(26);

    for(int K=0; K<n; K++){
        ara[s[K]-'a']++;
    }

    for(int K=0; K<26; K++){
        if(ara[K]%2==1){
            cout << "No\n";
            return;
        }
    }

    cout << "Yes\n";
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}






Measured memory_bytes: 3608
import java.io.*;
 
import java.text.*;
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.println((H - h) * (W - w));
	}
 
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;

    int a[n];

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

    sort(a, a + n);
    double ans = a[0];
    for(int i = 0; i < n - 1; i++){
            ans = (ans+a[i+1])/2;
    }
    cout << ans << '\n';
}



Measured memory_bytes: 256
STDIN.each do |value|
	a,b,c,d,e,f = value.split.map(&:to_i)
	x = ((e*c-b*f)*1.0/(a*e-b*d)*1000).round/1000.0
	y = ((a*f-d*c)*1.0/(a*e-b*d)*1000).round/1000.0
	puts sprintf("%.3f %.3f", x.to_f, y.to_f)
end

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

int main(void)
{
	char s[3];
	cin >> s;
	int a = 0, b = 0, c = 0;
	for (int i = 0; i < 3; i++)
	{
		if(s[i] == 'a')
			a++;
		else if(s[i] == 'b')
			b++;
		else if(s[i] == 'c')
			c++;
	}
	if(a == 1 && b == 1 && c == 1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    if (a + b <= 2 * c)
        ans = a * x + b * y;
    else
    {
        if (x <= y)
            ans = 2 * c * x + (y - x) * min(b, 2 * c);
        else
            ans = 2 * c * y + (x - y) * min(a, 2 * c);
    }
    OP(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

void solve() {
	ll l, r, d;
	cin>>l>>r>>d;
	ll ans = 0;
	ans += r/d - l/d;
	ans += l%d==0;
	cout<<ans<<endl;
}	

int32_t main() 
{
    fastio
    int t;
    t = 1; //cin>>t;
    while(t--) {
		solve();
	}
}


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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  for (int i = k; i < n; i++) {
    if (a[i - k] < a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4044
import java.util.*;

class Main{
    Main(){
        Scanner SC = new Scanner(System.in);

        String S = SC.next();

        boolean A=false, B=false;

        for(int i=0;i<S.length();i++){
            if(S.charAt(i) == 'A'){
                A = true;
            } else {
                B = true;
            }
        }

        if(A && B){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    public static void main(String[] args){
        Main main = new Main();
    }
}


Measured memory_bytes: 23764
#include<stdio.h>
#define N 101
 
void print(int *a, int n){
  int i;
  for(i=0;i<n;i++){
    if(i) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n");
}
 
void insertionsort(int *a, int n){
  int i,j,key;
 
  for(i=1;i<n;i++){    //０の時は前に数字がないので、１からスタート
    key=a[i];
    j=i-1;
    while(j>=0&&key<a[j]){  //前の数字より大きい時点で、最大なので移動はしない
      a[j+1]=a[j];
      j--;           //大きい方を前に、小さい方を後ろに移動させる
      a[j+1]=key;
    }
    print(a,n);  //表示
  }
}
 
int main(){
  int i,n,a[N];
 
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
 
  print(a,n);
  insertionsort(a,n);
 
  return 0;
}


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

class MainClass
{
    public static void Main(string[] args)
    {
        var input_N_K = Console.ReadLine().Split(' ');

        var N = int.Parse(input_N_K[0]);
        var K = int.Parse(input_N_K[1]);

        var input = Console.ReadLine().Split(' ');

        var h = new int[N];
        // テーブル
        var dp = new int[N];

        for (var i = 0; i < N; i++)
        {
            h[i] = int.Parse(input[i]);
            dp[i] = int.MaxValue; // 初期値を無限大の大きさに設定
        }

        dp[0] = 0; // 最初の場所は0にする
        
        // 1番目以降のテーブルを評価する
        for (var i = 1; i < N; i++)
        {
            for(var j = i - K; j < i; j++)
            {
                if (j < 0)
                    continue;

                dp[i] = chmin(dp[i], dp[j] + Math.Abs(h[i] - h[j]));
            }
        }

        Console.WriteLine(dp[N - 1]);
    }

    public static T chmin<T> (T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) > 0)
        {
            a = b;
            return a;
        }
        return a;
    }

    public static T chmax<T> (T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) < 0)
        {
            a = b;
            return a;
        }
        return a;
    }
}




Measured memory_bytes: 24032
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	arr := make([]int, N)
	count := map[int]int{}
	result := map[int]int{}
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		arr[i] = a
		count[a]++
	}
	for _, v := range arr {
		if res, ok := result[count[v]]; ok {
			fmt.Println(res)
			continue
		}
		var res int
		for i := 1; i <= N; i++ {
			var c int
			if i == v {
				c = count[i] - 1
			} else {
				c = count[i]
			}
			res += c * (c - 1) / 2
		}
		fmt.Println(res)
		result[count[v]] = res
	}
}


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

namespace AIZU
{
    class Program
    {
        static int cin() { return int.Parse(Console.ReadLine()); }
        static int cin(int D)
        {
            string s = Console.ReadLine();
            if (string.IsNullOrEmpty(s)) return D;
            return int.Parse(s);
        }
        static int[] cins()
        {
            string s = Console.ReadLine();
            if (string.IsNullOrEmpty(s)) return new int[] { };
            string[] ss = s.Split(' ');
            int[] Res = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++) Res[i] = int.Parse(ss[i]);
            return Res;
        }
        static void print(object j) { Console.WriteLine(j.ToString()); }
        static void print(string j) { Console.WriteLine(j); }
        static void Main(string[] args)
        {
            int[] K = cins();
            int H = K[0], W = K[1];
            print(Exp(H, W));
            Console.ReadLine();
        }

        static int Exp(int H, int W)
        {
            int Res = int.MaxValue;
            if (H % 3 == 0 || W % 3 == 0) Res = 0;
            if (Res > W) Res = W;
            if (Res > H) Res = H;
            Res = Math.Min(split(H, W),Res);
            Res = Math.Min(split(W, H), Res);
            return Res;
        }

        static int split(int H,int W) {
            ulong[] D;
            ulong rl;
            bool even;
            D = new ulong[H];
            D[0] = ulong.MaxValue;
            if (W % 2 == 0)
            {
                rl = (ulong)Math.Min(-W * (H / 3) + (H - H / 3) * (W / 2), W * (H / 3 + 1) - (H - H / 3 - 1) * (W / 2));
            }
            else
            {
                Func<long, long> A = i => Math.Abs(i);
                long S0, S1, S2;
                for (int H0 = 1; H0 < H; H0++)
                {
                    S0 = W * H0;
                    S1 = (W + 1) / 2 * (H - H0);
                    S2 = (W - 1) / 2 * (H - H0);
                    D[H0] = (ulong)Math.Max(Math.Max(A(S0 - S1), A(S2 - S0)), H - H0);
                }
                rl = D.Min();
            }
            return (int)rl;
        }
    }
}


Measured memory_bytes: 14560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int N=1e6+5; 
 
int main(){
	double  n,x,t;
	 cin>>n>>x>>t;
	 int s=(int)(ceil(n/x))*t;
	 cout<<s<<endl;
} 

Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = Long.parseLong(sc.next());
		long a = Long.parseLong(sc.next());
		long b = Long.parseLong(sc.next());
		long c = Long.parseLong(sc.next());
		long d = Long.parseLong(sc.next());
		long e = Long.parseLong(sc.next());
		sc.close();
		
		long m = Math.min(a, b);
		m = Math.min(m, c);
		m = Math.min(m, d);
		m = Math.min(m, e);
		
		System.out.println((n-1)/m + 1 + 4);

	}

}


Measured memory_bytes: 23252
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);
 
int main() {
	string s;
	cin >> s;
	if (s[0] == '9' || s[1] == '9')cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main() {
    int N,ans=0;
    cin >> N;
    vector<int> L(2*N);
    for(int i=0;i<2*N;i++) cin >> L[i];

    sort(L.begin(),L.end());
    for(int i=0;i<2*N;i += 2){
        ans += L[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    double a,b;
    cin >> a >> b;
    bool flg=true;

    double tmp8, tmp10;
    int ans8, ans10;
    int i=1;
    int ans;
    while(flg){
        tmp8 = i*0.08e0;
        tmp10 = i*0.10e0;

        //cout << " tmp8 = " << tmp8 << endl;
        //cout << " tmp10 = " << tmp10 << endl;

        ans8 = floor(tmp8);
        ans10 = floor(tmp10);
        //cout << " ans8 = " << ans8 << endl;
        //cout << " ans10 = " << ans10 << endl;
        if( ans8 == a && ans10 == b){
            ans = i;
            break;
        }else if( ans8 > a && ans10 > b){
            ans = -1;
            break;
        }
        i++;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
n = input()
a = list(map(int, input().split()))
a.sort()

w = 0
while len(a) > 1:
    if a[-1] == a[-2]:
        w = a[-1]
        a.pop()
        a.pop()
        break
    else:
        a.pop()
h = 0
while len(a) > 1:
    if a[-1] == a[-2]:
        h = a[-1]
        a.pop()
        a.pop()
        break
    else:
        a.pop()

print(w*h)
exit(0)

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;


int N,M,X,Y;
int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> X >> Y;
    int X_max=-100,Y_min=100;
    int x,y;
    bool is_there_war = false;
    REP(i,N){
        cin >> x;
        if(X_max < x) X_max = x;
    }
    REP(i,M){
        cin >> y;
        if(Y_min > y) Y_min = y;
    }
    if(X_max >= Y_min){
        is_there_war = true;
    }else{
        if(X >= Y_min){
            is_there_war = true;
        }
        if(Y <= X_max){
            is_there_war = true;
        }
    }

    if(is_there_war){
        cout << "War" << endl;
    }else{
        cout << "No War" << endl;
    }


    

    return 0;
}

Measured memory_bytes: 256
n,k=[int(x) for x in input().split()]
bunshi=0
for i in range(1,min(k-1,n)+1):
    for j in range(20):
        if i*2**j>=k:
            bunshi+=2**(20-j)
            break
print("{0:.10f}".format(max(0,(n-k+1)/n)+bunshi/(n*2**20)))

Measured memory_bytes: 39920
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<int,int> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
int N=1e5+9;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 
	string s;
	cin>>s;
	int n=s.length();
	ll sum=0;
	for(int i=0;i<n;i++) sum+=(s[i]-'0');
	if(sum%9) cout<<"No";
	else cout<<"Yes";
	return 0; 
	
}


Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <string>
#include <cstring>
#include <list>
#include <queue>
#include <numeric>
#include <map>
using namespace std;

typedef long long ll;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    ll k;
    cin>>s;
    cin>>k;
    if (s[0]!='1') {
    	cout<<s[0]<<endl;
    	return 0;
    }
    int j=0;
    for (int i=0; i<s.length(); ++i) {
    	if (s[i]=='1') {++j; --k;}
    	else break;
    }
    if (k<=0) {
    	cout<<'1'<<endl;
    	return 0;
    }
    s=s.substr(j);
    cout<<s[0]<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  string s;
  int n;
  cin >> n >> s;
  
  int cnt = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s[i] + n > 'Z') s[i] = 'A' + (s[i]+n - 'Z' - 1);
    else s[i] += n;
  }

  cout << s << endl;
}

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

using namespace std;

typedef long long ll;
const ll INF = (1ll << 60);

int main(){
  int n, c;
  cin >> n >> c;
  
  vector<vector<ll>> d(c + 1, vector<ll>(c + 1, INF));
  for(int i = 1; i <= c; i++) for(int j = 1; j <= c; j++) cin >> d[i][j];
  
  vector<vector<ll>> grid(n, vector<ll>(n));
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> grid[i][j];
  
  vector<vector<ll>> d_ling_yi_er(3, vector<ll>(c + 1, 0));
  d_ling_yi_er[0][0] = d_ling_yi_er[1][0] = d_ling_yi_er[2][0] = INF;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      for(int k = 1; k <= c; k++){
        d_ling_yi_er[(i + j) % 3][k] += d[grid[i][j]][k];
      }
    }
  }
  
  ll strange = INF;
  for(int i = 1; i <= c; i++){
    ll s_ling = d_ling_yi_er[0][i];
    for(int j = 1; j <= c; j++){
      if(i == j) continue;
      
      ll s_yi = d_ling_yi_er[1][j];
      for(int k = 1; k <= c; k++){
        if(j == k || k == i) continue;
        
        ll s_er = d_ling_yi_er[2][k];
        strange = min(s_ling + s_yi + s_er, strange);
      }
    }
  }
  
  cout << strange << endl;
  
  return 0;
}

Measured memory_bytes: 2176
#include<iostream>
using namespace std;
int main()
{
    int x,n; cin >> x >> n;
    int arr[107]={0};
    for(int i=0;i<n;i++)
    {
        int temp; cin >> temp;
        arr[temp]=1;
    }
    int diff = INT_MAX;
    int num;

    for(int i=0;i<=101;i++)
    {
        if(arr[i]==0 && diff>abs(x-i))
        {
            diff = abs(x-i);
            num = i;
        }
    }
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 3136
import sys
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))

flip_a = [0]*n
cnt_minus = 0

for i in range(n):
	if a[i] < 0:
		cnt_minus += 1
		flip_a[i] = -a[i]
	else:
		flip_a[i] = a[i]

flip_a.sort()

if cnt_minus%2 == 1:
	flip_a[0] = -flip_a[0]

print(sum(flip_a))

Measured memory_bytes: 20136
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long A, long long B, long long C){
    lint res = max<lint>(A + 10*B + C, -1);
    res = max<lint>(A + 10*C + B, res);
    res = max<lint>(B + 10*A + C, res);
    res = max<lint>(B + 10*C + A, res);
    res = max<lint>(C + 10*A + B, res);
    res = max<lint>(C + 10*B + A, res);
    cout << res << endl;
}

int main(){

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static int main0(String[] args) {
		int servalDPS, monsterHealth;
		Scanner sc = new Scanner(System.in);
		monsterHealth = sc.nextInt();
		servalDPS = sc.nextInt();
		int remains = monsterHealth % servalDPS;
		if (remains == 0) return monsterHealth / servalDPS;
		else return monsterHealth / servalDPS + 1;
	}

	public static void main(String[] args) {
		int res = main0(args);
		System.out.print(res);
	}
}

Measured memory_bytes: 21204
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
//#define ll __int64
#define ll long long
int n;
int t[100];
int t2[100];
int cnt;

int main(){
    cin>>n;
    rep(i,n)cin>>t[i];
    rep(i,n){
        if(t[i]!=i+1)cnt++;
    }
    if(cnt==2||cnt==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
	return 0;
}


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

using namespace std;

typedef long long llint;

int main() {
  int k, n;
  cin >> k >> n;
  vector<llint> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 2) {
    cout << min(a.back() - a[0], k - (a.back() - a[0])) << endl;
    return 0;
  }
  llint ans = k;
  for (int i = 0; i + 1 < n; i++) {
    ans = min(ans, k - (a[i + 1] - a[i]));
  }
  ans = min(ans, a.back() - a[0]);
  cout << ans << endl;

  return 0;
}


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

typedef long long ll;
const int Maxn=1e5;
const int Mod=1e9+7;

char s[Maxn+5];

ll P[Maxn+5];
ll A[Maxn+5],C[Maxn+5];
ll M[Maxn+5],N[Maxn+5];
int len;

void Prepare() {
	P[0]=1;
	for(int i=1;i<=Maxn;i++)
		P[i]=(P[i-1]*3)%Mod;
	len=strlen(s+1);
	for(int i=2;i<=len;i++) {
		A[i]=A[i-1]+(s[i-1]=='A');
		M[i]=M[i-1]+(s[i-1]=='?');
	}
	for(int i=len-1;i>=1;i--) {
		C[i]=C[i+1]+(s[i+1]=='C');
		N[i]=N[i+1]+(s[i+1]=='?');
	}
}

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%s",s+1);
	Prepare();
	ll ans=0;
	for(int i=1;i<=len;i++)
		if(s[i]=='B'||s[i]=='?') {
			ans=(ans+(A[i]*C[i])%Mod*P[M[i]+N[i]]%Mod)%Mod;
			ans=(ans+(A[i]*P[M[i]+N[i]-1])%Mod*N[i]%Mod)%Mod;
			ans=(ans+(C[i]*P[M[i]+N[i]-1])%Mod*M[i]%Mod)%Mod;
			ans=(ans+(N[i]*M[i])%Mod*P[N[i]-1]%Mod*P[M[i]-1]%Mod)%Mod;
		}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4224