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

int main(){
	int n,a,b;
	scanf("%d", &n);
	int cont = 0;
	for(int i = 0; i < n; i++){
		scanf("%d %d", &a, &b);
		cont += b - a + 1;
	}
	printf("%d\n", cont);
	return 0;	
}


Measured memory_bytes: 128
import itertools

n = int(input())
seq = [i for i in range(1,n+1)]
p = list(map(int, input().split()))
q = list(map(int, input().split()))
p = tuple(p)
q = tuple(q)
a = list(itertools.permutations(seq))
ans = [0,0]
for i in range(len(a)):
    if a[i]==p:
        ans[0] = i+1

    if a[i] ==q:
        ans[1] = i+1
print(abs(ans[0]-ans[1]))

Measured memory_bytes: 8052
def main():
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    N,X,T=map(int,input().split())
    if N%X==0:
        print(int((N/X)*T))
        sys.exit()
    print((N//X+1)*T)



if __name__ == '__main__':
    main()

Measured memory_bytes: 9116
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int n;
string s, t;

int main(){
	cin >> n;
	cin >> s >> t;
	
	int cnt = 0;
	for(int i = 1; i <= n; i++){
		bool b = 1;
		for(int j = 0; j < i; j++){
			if(s[n-i+j] != t[j]) b = 0;
		}
		if(b) cnt = i;
	}
	cout << n*2 - cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int j=0;
    cin>>n;
    string s;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s=="A") j++;
        if(s=="Un") j--;
        if(j<0){break;}
    }
    if(!j) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main(){
    Hello
    int n;
    cin >> n;
    int mx = 0, ans = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(mx <= a) ans++;
        mx = max(mx, a);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int INF=0x3f3f3f3f;
const int N = 210;
struct node
{
    int x ,y;
    node(){}
    node(int x1 ,int y1):x(x1),y(y1){}
    bool operator < (const node &a)const{
        if(x!=a.x)
            return x < a.x;
        else
            return y < a.y;
    }
}point[N];
struct Line
{
    node p1 , p2;
    Line(){}
    Line(node x , node y):p1(x),p2(y){}
}line[N];

bool judge(Line L1 , Line L2)
{
    int x1 , y1 , x2 , y2;
    x1=L1.p2.x - L1.p1.x;
    y1=L1.p2.y - L1.p1.y;
    x2=L2.p2.x - L2.p1.x;
    y2=L2.p2.y - L2.p1.y;
    ///cout<<x1*y2-y1*x2<<endl;
    if(x1 * y2 - y1*x2 >= 0)
        return true;
    else
        return false;
}

int main()
{
    int n;
    while(scanf("%d", &n)!=EOF){
        int x , y;
        for(int i=1;i<=n;i++){
            scanf("%d%d", &x, &y);
            point[i]=node(x , y);
        }
        int m = 0;
        for(int i=1;i<=n;i++){
            if(i==n)
                line[m++]=Line(point[n] , point[1]);
            else
                line[m++]=Line(point[i] , point[i+1]);
        }
        bool p=true;
        for(int i=0;i<m;i++){
            if(i==m-1){
                if(!judge(line[i] , line[0])){
                    p=false;
                    break;
                }
            }
            else if(!judge(line[i] , line[i+1])){
                p=false;
                break;
            }
        }
        printf("%d\n",p ? 1 : 0);
    }
    return 0;
}




Measured memory_bytes: 3228
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

void solve(){  
	int a;
	cin>>a;
	string s;
	cin>>s;
	if(a<3200) cout<<"red"<<endl;
	else cout<<s<<endl;  
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
//Solution for AOJ 0529: Darts
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX_N = 1000, MAX_M = 200000000;
int n, m;
int p[MAX_N + 1], p2[MAX_N*MAX_N], ans, roop, s, mid;
void search(int end, int start){
	if ((end + start) % 2)
		mid = (end + start) / 2 + 1;
	else
		mid = (end + start) / 2;
	if (p2[mid] == s)
		return;
	if (p2[mid] < s){
		if (end - mid == 1){
			if (p2[end]<s)
				mid++;
			return;
		}
		search(end, mid);
	}
	else{
		if (mid - start == 1){
			mid--;
			return;
		}
		search(mid, start);
	}
}
int main(){
	while (cin >> n >> m){
		ans = 0;
		if (!n&&!m)
			return 0;
		for (int i = 1; i <= n; i++){
			cin >> p[i];
		}
		roop = 0;
		for (int i = 0; i <= n; i++){
			for (int j = i; j <= n; j++){
				if (p[i] + p[j] <= m){
					p2[roop] = p[i] + p[j];
					roop++;
				}
			}
		}
		sort(p2, p2 + roop);
		for (int i = 0; i < roop; i++){
			s = m - p2[i];
			search(roop - 1, 0);
			ans = max(ans, p2[i] + p2[mid]);
			if (ans == m)
				break;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3148
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n;
int stone[100];

int memo[30][1 << 15];
int calc(int turn, int rest) {
  if (rest == 0) { return 1; }
  if (turn == 2 * n) { turn = 0; }
  if (memo[turn][rest] != -1) { return memo[turn][rest]; }
  int ret = 0;
  FOREQ(i, 1, min(rest, stone[turn])) {
    ret |= 1 ^ calc(turn + 1, rest - i);
  }
  return memo[turn][rest] = ret;
}

int main() {
  while (scanf("%d", &n), n) {
    MEMSET(memo, -1);
    int s;
    scanf("%d", &s);
    REP(i, n * 2) {
      scanf("%d", &stone[i]);
    }
    puts(calc(0, s) == 1 ? "1" : "0");
  }
}

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


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;cin>>n;
	ll i,j;
	ll v[n];
	vector<vector<ll>> dp(n,vector<ll>(2,0));
	for(i=0;i<n;i++) cin>>v[i];
		//dp[0]={v[0],v[0],1};
		dp[0][0]=0;
		dp[0][1]=0;
		dp[1][0]=v[0];
	dp[1][1]=v[1];

		for(i=2;i<n;i++)
		{	if(i%2==0){
			dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
			dp[i][1]=max(dp[i-2][0],dp[i-2][1])+v[i];
		}
			else {dp[i][0]=dp[i-2][0]+v[i-1];
				dp[i][1]=(dp[i-1][0])+v[i];
			}

		}
		cout<<max(dp[n-1][0],dp[n-1][1]);
	return 0;
} 

Measured memory_bytes: 15608
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	if (S.size() == 2) {
		cout << S << endl;
	}
	else {
		for (int i = 2; i >= 0; i--) {
			cout << S.at(i);
		}
		cout << endl;
	}
}

Measured memory_bytes: 3612
import java.util.*;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String kk = stdIn.next();
		int k = Integer.parseInt(kk);
		String xx = stdIn.next();
		int x = Integer.parseInt(xx);
		
		if(k*500>=x) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


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

int N, M, K, S, P, Q;
queue< int > zombie;
vector< int > graph[100001];
int danger[100001];

void preBFS()
{
  while(!zombie.empty()) {
    int p = zombie.front(); zombie.pop();
    for(int to : graph[p]) {
      if(~danger[to]) continue;
      danger[to] = danger[p] + 1;
      zombie.push(to);
    }
  }
}

long long Dijkstra()
{
  typedef pair< long long, int > Pi;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  long long v[100001];
  fill_n(v, 100001, 1LL << 58);
  v[1] = danger[N] > S ? -P : -Q;
  que.emplace(v[1], 1);
  while(!que.empty()) {
    long long cost, now;
    tie(cost, now) = que.top(); que.pop();
    if(cost > v[now]) continue;
    if(now == N) return(cost);
    for(int to : graph[now]) {
      if(danger[to] == 0) continue;
      long long next = cost + (danger[to] > S ? P : Q);
      if(next >= v[to]) continue;
      v[to] = next;
      que.emplace(next, to);
    }
  }
  return(-1);
}
int main()
{
  scanf("%d %d %d %d", &N, &M, &K, &S);
  scanf("%d %d", &P, &Q);

  memset(danger, -1, sizeof(danger));
  while(K--) {
    int C;
    scanf("%d", &C);
    zombie.push(C);
    danger[C] = 0;
  }
  while(M--) {
    int A, B;
    scanf("%d %d", &A, &B);
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  preBFS();
  printf("%lld\n", Dijkstra());
}

Measured memory_bytes: 11076
#include <iostream>
#include<limits.h>
using namespace std;
int dp[100004];
int mincost(int n,int height[])
{
    if(n==1||n==0)
    return 0;
    int cost1=INT_MAX;
    int cost2=INT_MAX;
    if(dp[n]!=-1)
    return dp[n];
    if(n>=2)
     cost1=abs(height[n-1]-height[n-2])+mincost(n-1,height);
     if(n>=3)
     cost2=abs(height[n-1]-height[n-3])+mincost(n-2,height); 
     return dp[n]=min(cost1,cost2);
}
int main() {
    int n;
    cin>>n;
    int height[100004];
    for(int i=0;i<n;i++)
    cin>>height[i];
    for(int i=0;i<100004;i++)
    dp[i]=-1;
    cout<<mincost(n,height);

}


Measured memory_bytes: 7296
import * as fs from 'fs';

export class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
}

let reader: Reader = new Reader();
let N = reader.readInt();
let A: number[] = reader.readInts();
A.sort((a, b) => a-b);
let S = 0;
let j = -1;
for(let i=0; i<N-1; i++) {
	S += A[i];
	if (2*S < A[i+1]) {
		j = i;
	}
}
console.log(N-1-j);


Measured memory_bytes: 41120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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 calc(vector<vector<int>> data, int sx, int sy, int gx, int gy, int step){
    if(sx == gx && sy == gy) return 0;
    if(step >= 10) return 100;
    int h = data.size(), w = data[0].size();
    int res = 100;

    if(sx > 0 && data[sx - 1][sy] != 1){
        for(int i = sx - 1; i >= 0; i--){
            if(data[i][sy] == 1){
                data[i][sy] = 0;
                chmin(res, 1 + calc(data, i + 1, sy, gx, gy, step + 1));
                data[i][sy] = 1;
                break;
            }else if(data[i][sy] == 3){
                chmin(res, 1);
            }
        }
    }

    if(sx < h - 1 && data[sx + 1][sy] != 1){
        for(int i = sx + 1; i < h; i++){
            if(data[i][sy] == 1){
                data[i][sy] = 0;
                chmin(res, 1 + calc(data, i - 1, sy, gx, gy, step + 1));
                data[i][sy] = 1;
                break;
            }else if(data[i][sy] == 3){
                chmin(res, 1);
            }
        }
    }

    if(sy > 0 && data[sx][sy - 1] != 1){
        for(int i = sy - 1; i >= 0; i--){
            if(data[sx][i] == 1){
                data[sx][i] = 0;
                chmin(res, 1 + calc(data, sx, i + 1, gx, gy, step + 1));
                data[sx][i] = 1;
                break;
            }else if(data[sx][i] == 3){
                chmin(res, 1);
            }
        }
    }

    if(sy < w - 1 && data[sx][sy + 1] != 1){
        for(int i = sy + 1; i < w; i++){
            if(data[sx][i] == 1){
                data[sx][i] = 0;
                chmin(res, 1 + calc(data, sx, i - 1, gx, gy, step + 1));
                data[sx][i] = 1;
                break;
            }else if(data[sx][i] == 3){
                chmin(res, 1);
            }
        }
    }

    return res;
}

int main(){
    while(true){
        int w, h; cin >> w >> h;
        if(w == 0 && h == 0) break;
        vector<vector<int>> data(h, vector<int>(w));
        int sx, sy, gx, gy;
        rep(i, h){
            rep(j, w){
                cin >> data[i][j];
                if(data[i][j] == 2){
                    sx = i; sy = j;
                }else if(data[i][j] == 3){
                    gx = i; gy = j;
                }
            }
        }
        int res = calc(data, sx, sy, gx, gy, 0);
        if(res > 10) cout << -1 << endl;
        else cout << res << endl;

    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#define mst(a,b) memset((a),(b),sizeof(a))
#define debug printf("debug\n")
#define INF 0x3f3f3f3f
#define lson lef,mid,rt<<1
#define rson mid+1,rig,rt<<1|1
const int maxn=1e5+5;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int ans[505][505];
int main()
{
	int H,W,h,w;
	int val=2000;
	scanf("%d %d %d %d",&H,&W,&h,&w);
	if(H%h==0&&W%w==0){
		puts("No");
	}else{
		for(int i=1;i<=H;i++){
			for(int j=1;j<=W;j++){
				if(i%h==0&&j%w==0){
					ans[i][j]=-(h*w-1)*val-1;
				}else{
					ans[i][j]=val;
				}
			}
		}
		puts("Yes");
		for(int i=1;i<=H;i++){
			for(int j=1;j<=W;j++){
				printf("%d%c",ans[i][j],j==W?'\n':' ');
			}
		}
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}



int main()
{
	ll n,k;
	cin >> n >> k;
	ll sum=0;
	for(ll i=k;i<=n+1;i++) sum=(sum+n*(n+1)/2-(n-i)*(n-i+1)/2-i*(i-1)/2+1)%mod;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3620
def resolve():
    import sys
    input = sys.stdin.readline    
    a,b,c,x,y=map(int,input().split())
    z=min(x,y)
    ans=min(a*x+b*y,a*(x-z)+b*(y-z)+c*z*2,max(x,y)*2*c)
    print(ans)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 9120
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(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 all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

void solve(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int ans = 0;
  forn (i,n) {
    cin >> a[i];
    ans += min((k-a[i])*2, 2*a[i]);
  }
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	ll x,y;cin>>x>>y;
	int cnt=0;
	while(x<=y){
		cnt++;
		x*=2;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 768
n = int(input())
a = list(map(int,input().split()))
kar = a[0]
ans = 0
while True:
    if kar % 2 == 0:
        kar = kar//2
        ans += 1
    else:
        break

for i in range(1,n):
    for j in range(ans):
        if a[i] % 2 == 0:
            a[i] = a[i] // 2
        else:
            ans = j
print(ans)

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

long long int banjian(long long int a)
{
    if(a%2==0)
        a=a/2;
    else
        a=(a-1)/2;
    return a;
}
int main() {
    long long int a, b = 1;
    scanf("%lld", &a);
    if (a == 0)
{ printf("0\n");
    return 0;}
    while(a>1)
    {
        a=banjian(a);
        b++;
    }
    printf("%lld\n",b);
    return 0;
}



Measured memory_bytes: 3192
total_cost = 0

N, M = (map(int, input().split()))

AB_list = []
for i in range(N):
    AB_list.append((list(map(int, input().split()))))

AB_list = sorted(AB_list)

for i in range(N):
    if AB_list[i][1]<M:
        M = M - AB_list[i][1]
        total_cost =  total_cost + AB_list[i][0]*AB_list[i][1]
    else:
        total_cost = total_cost + M * AB_list[i][0]
        break
print(total_cost)


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

int main() {
  vector<vector<int>> A(3, vector<int>(3));
  
  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
        cin >> A.at(i).at(j);
    }
  }
  
  int N; 
  cin >> N;
  
  vector<int> b(N);
  
  for(int i = 0; i < N; i++){
    cin >> b.at(i);
   }
   
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 3; j++){
        for(int k = 0; k < 3; k++){
            if(b.at(i) == A.at(j).at(k)){
                A.at(j).at(k) = 0;
            }
        }
    }
  }
    
    
    
  for(int i = 0; i < 3; i++){
      if(A.at(i).at(0) == 0 && A.at(i).at(1) == 0 && A.at(i).at(2) == 0){
          cout << "Yes" << endl;
          return 0;
      }
  }
    
    for(int i = 0; i < 3; i++){
      if(A.at(0).at(i) == 0 && A.at(1).at(i) == 0 && A.at(2).at(i) == 0){
          cout << "Yes" << endl;
          return 0;
      }
  }
  
    if(A.at(0).at(0) == 0 && A.at(1).at(1) == 0 && A.at(2).at(2) == 0){
        cout << "Yes" << endl;
        return 0;
    }
    
    if(A.at(0).at(2) == 0 && A.at(1).at(1) == 0 && A.at(2).at(0) == 0){
        cout << "Yes" << endl;
        return 0;
    }
    
    cout <<"No" << endl;
    
  
  

  }
  




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ii pair<int,int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define int long long int
#define modulo 1000000007
using namespace std;
int n,k;
vector<int> A(n),B(n);
bool ok(vector<int>& data,int x){
    int K=k;
    for(int i=0;i<n;i++){
        int y=(x/B[i]);
        if(data[n-i-1]>y){
            K-=data[n-i-1]-y;
        }
    }
    return K>=0;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>k;
    vector<int> q(n);
    A=q,B=q;
    for(int i=0;i<n;i++)cin>>A[i];
    for(int i=0;i<n;i++)cin>>B[i];
    int l=0,r=INF;
    int ans=INF;
    sort(all(B));
    sort(all(A));
    multiset<int>data;
    while(l<=r){
        int mid=(l+r)/2;
        if(ok(A,mid)){
            ans=mid;
            r=mid-1;
        }
        else l=mid+1;
    }
    cout<<ans;
}


Measured memory_bytes: 4992
N = int(input())
A = list(map(int,input().split()))
d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
#print(d)
s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2
#print("s=",s)
for i in range(N):
    t = d[A[i]]
    #print("t=",t)
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)

Measured memory_bytes: 32056
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
    #define debug(...) printf(__VA_ARGS__)
#else
    #define debug(...) (void)0
#endif
#define mp make_pair
#define pb push_back
#define LL long long
#define pii pair<int,int>
#define PII pair<long long, long long>
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
const int inf = 0x7fffffff; //beware overflow
const LL INF = 0x7fffffffffffffff; //beware overflow
#define mem(x, y) memset(x, (y), sizeof(x) );
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) {
     return s<<"("<<p.first<<","<<p.second<<")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
    s << "[ ";
    for (auto it : c) s << it << " ";
    s << "]";
    return s;
}
template<typename T>
ostream& operator << (ostream &o, const set<T> &st) {
    o << "{";
    for (auto it=st.begin(); it!=st.end(); it++) o << (it==st.begin() ? "" : ", ") << *it;
    return o << "}";
}
template<typename T1, typename T2>
ostream& operator << (ostream &o, const map<T1, T2> &mp) {
    o << "{";
    for (auto it=mp.begin(); it!=mp.end(); it++) {
        o << (it==mp.begin()?"":", ") << it->fi << ":" << it->se;
    }
    o << "}";
    return o;
}
#define maxn 2005
LL mn[maxn], a[maxn], n, x;

int main() {
    cin>>n>>x;
    for(int i =0;i<n;i++)scanf("%lld", a+i);
    LL ans = INF;
    fill(mn, mn+n, INF);
    for(int k = 0; k < n; k++) {
        LL cur_ans = k*x;
        for(int j = 0; j < n; j++)
            mn[j] = min( mn[j], a[ (j-k+n)%n ] );
        for(int j = 0; j < n; j++) {
            cur_ans += mn[j];
        }
        ans = min(ans, cur_ans);
    }
    cout<<ans<<endl;
}


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

int N;

int main() {
  cin >> N;
  ll X[N], L[N];
  for (int i = 0; i < N; i++) cin >> X[i] >> L[i];

  vector<pair<ll, ll>> data(N);
  for (int i = 0; i < N; i++) {
    data[i].first = X[i] + L[i];
    data[i].second = X[i] - L[i];
  }

  sort(data.begin(), data.end());

  int ans = 0, x = -1000000000;
  for (int i = 0; i < N; i++) {
    if (x <= data[i].second) {
      ans++;
      x = data[i].first;
    }
  }
  cout << ans << endl;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll x;cin>>x;
	for(ll i=0;i<=200;i++){
		for(ll j=-i;j<=i;j++){
			if(i*i*i*i*i-j*j*j*j*j==x){cout<<i<<" "<<j<<'\n';return 0;}
		}
	}
	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(void)
{

	int a, b,sum=0;
	char c[101];
	scanf("%s", c);

	for (a = 0;c[a] != '\0';a++);
	

	b = a-1;
	
	

	for (int i = 0;i <= a/2-1;i++) {
		if (b == i)break;
		
		if (c[b] != c[i])sum++;
		
		b--;
	}
	printf("%d", sum);


	return 0;
}

Measured memory_bytes: 128
def main():
  t = 0
  n,l = map(int, input().split())
  a = []
  for i in range(l, l+n):
    a.append(i)
  max = n + l - 1
  if max <= 0:
    t = max
  elif l >= 0:
    t = l
  else:
    t = 0
  print(sum(a)-t)

if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main()
{
        char input_s[100];
        char input_p[100];
        char s[200];
        int input_s_num = 0;

        scanf("%s", input_s);
        scanf("%s", input_p);
        strcpy(s, input_s);
        strcat(s, input_s);

        if ( strstr(s, input_p) )
        {
                printf("Yes\n");
        }
        else
        {
                printf("No\n");
        }
        return 0;
}

Measured memory_bytes: 540
#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> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    ll h,w;
    int n;
    scanf("%lld%lld%d",&h,&w,&n);
    vector<pll> around;
    set<pll> st;
    rep(i,n){
        ll a,b;
        scanf("%lld%lld",&a,&b);
        --a;--b;
        st.insert(pll(a,b));
        for(int i=-1;i<=1;++i){
            for(int j=-1;j<=1;++j){
                if(a+i<=0||b+j<=0||a+i>=h-1||b+j>=w-1) continue;
                around.push_back(pll(a+i,b+j));
            }
        }
    }
    sort(around.begin(),around.end());
    around.erase(unique(around.begin(),around.end()),around.end());
    vector<ll> ans(10,0);
    for(pll p:around){
        int res = 0;
        for(int i=-1;i<=1;++i){
            for(int j=-1;j<=1;++j){
                if(st.count(pll(p.first+i,p.second+j))>0) ++res;
            }
        }
        ++ans[res];
    }
    ll all = (h-2)*(w-2);
    for(int i=1;i<10;++i) all-=ans[i];
    ans[0] = all;
    rep(i,10) printf("%lld\n",ans[i]);
    return 0;
}

Measured memory_bytes: 23596
use std::cmp::{max, min};
use std::collections::VecDeque;
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let a = (0..n).map(|_| read::<usize>()).collect::<Vec<_>>();
    let msb = 60;
    let mut t = vec![vec![0; msb + 1]; n + 1];

    for s in 0..msb {
        t[0][s] = if (a[0] & (1 << s)) > 0 { 1 } else { 0 };
    }

    for i in 1..n {
        for s in 0..msb {
            t[i][s] = t[i - 1][s] + (if a[i] & (1 << s) > 0 { 1 } else { 0 })
        }
    }

    let mut ans = 0;

    for i in 0..(n - 1) {
        for s in 0..msb {
            let stand = t[n - 1][s] - t[i][s];
            if a[i] & (1 << s) == 0 {
                ans += (((1 << s) % 1000000007) * stand % 1000000007);
                ans %= 1000000007
            } else {
                let no_stand = (n - (i + 1)) - stand;
                ans += (((1 << s) % 1000000007) * no_stand % 1000000007);
                ans %= 1000000007
            }
        }
    }
    println!("{}", ans)
}


Measured memory_bytes: 170236
#include<bits/stdc++.h>
#define ll long long
#define F(i,a,b) for(i = a; i <= b; i ++)
#define RF(i,a,b) for(i = a; i >= b;i --)
#define sz(a) sizeof(a)
#define next_line cout<<'\n'
#define space cout<<' '
#define deb(a) cout<<#a<<' '<<a
using namespace std;

typedef pair<int ,int > pii;
typedef pair<ll,ll> pll;
typedef pair<char,int > pci;
typedef map<int ,int > mii;
typedef map<ll,ll> mll;
typedef map<char,int > mci;
typedef unordered_map<int ,int > umii;
typedef unordered_map<ll,ll> umll;
typedef unordered_map<char,int > umci;
typedef vector<ll>  vll;
typedef vector<vector<ll> > vvll;
ll  mod = 1e9 + 7LL;
vector<ll >  dp(1000001, -1LL);

ll  n, m, i, j;
ll  NumberOfWays(ll  st_i, ll  st_j, vector<vector<char> > &Grid){
    if((st_i >= n) || (st_j >= m))
        return 0LL;
    ll  indx = (st_i * m + st_j);
    if(dp[indx] != -1LL)
        return dp[indx];
    if(Grid[st_i][st_j] == '#')
        return 0LL;
    
    if((st_i == (n - 1LL)) && (st_j == (m - 1LL)))  
        return 1LL;
    //deb(indx);space;deb(dp[indx]);
    //next_line;
    dp[indx] = (NumberOfWays(st_i, st_j + 1LL, Grid) + NumberOfWays(st_i + 1LL, st_j, Grid)) % mod;
    return dp[indx];
}

void solve()
{
    cin>>n>>m;
    vector<vector<char> > Grid(n, vector<char> (m));
    F(i, 0LL, n - 1LL){
        F(j, 0LL, m - 1LL){
            cin>>Grid[i][j];
        }
    }
    cout<<NumberOfWays(0LL, 0LL, Grid)<<'\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#else
    //#endif
    solve();
}


Measured memory_bytes: 12172
N = int(input())
alist = sorted([int(input()) for x in range(N)])

tmpNum = alist[0]
cnt = 1
ans = 0
for i in range(1, N):
	num = alist[i]
	if tmpNum == num:
		cnt = cnt + 1
		if i == N-1 and cnt % 2 != 0:
			ans = ans + 1
	else:
		if cnt % 2 != 0:
			ans = ans + 1
		tmpNum = num
		cnt = 1
		if i == N-1:
			ans = ans + 1

if len(alist) == 1:
	ans = ans + 1


print(ans)

Measured memory_bytes: 8280
#include <stdio.h>
int main(void){
	int k;
	char s[101] = { '\0' };
	int flg = 0;
	int l = 1;
	scanf("%d", &k);
	scanf("%s", s);
	while(s[l] != '\0'){
		l++;
	}
	if(l <= k){
		for(int i=0; i<l; i++){
			printf("%c", s[i]);
		}
		printf("\n");
	}
	else{
		for(int i=0; i<k; i++){
			printf("%c", s[i]);
		}	
		printf("...");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1728
{$mode Delphi} //謎
uses SysUtils, //謎
     fgl; //TFPGListを使えるようにする

function IntCompare(a1, a2 : integer) : integer; //昇順ソートのための比較関数
begin
  result := a1 - a2;
  //この値の符号によって操作を決める
end;

var arr: TFPGList<integer>;
    i, temp : integer;
    
begin
  arr := TFPGList<integer>.Create();
  for i := 0 to 2 do begin
    read(temp);
    arr.Add(temp);
  end;
  arr.Sort(@IntCompare);
  writeln(arr[0] + arr[1] + arr[2] * 10);
end.

Measured memory_bytes: 128
N = int(input())
A = list(map(int,input().split()))
def cal(A,b):
    a = 0
    for i in range(len(A)):
        a += abs(A[i] - b)
    return a
#cal(A,b)の値の最小値
A_2 = A
for i in range(N):
    A_2[i] = A[i] - (i+1)
A_2.sort()

if N%2 == 0:
    cnum = N//2 - 1
    chu = A_2[cnum]
else:
    cnum = (N-1)//2
    chu = A_2[cnum]
ans = cal(A_2,chu)
print(ans)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    set<string> s;
    for (int i=0;i<N;++i){
        string S; cin >> S;
        s.emplace(S);
    }
    cout << s.size() << '\n';
}

Measured memory_bytes: 19264
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
template<const LL mod> struct MI{
	LL a;
	MI operator + (const MI & b) {
		MI res{a + b.a};
		if(res.a >= mod) res.a -= mod;
		return res;
	}
	MI operator - (const MI & b) {
		MI res{a - b.a};
		if(res.a <= 0) res.a += mod;
		return res;
	}
	MI operator * (const MI & b) {
		return MI{a * b.a % mod};
	}
	MI operator / (const MI & b) {
		return MI{a * fastpo(b.a, mod - 2, mod) % mod};
	}
};
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
	LL n;
	cin >> n;
	map<LL, int> mp;
	for(int i = 2; i <= 1000000; i++) {
		while(n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if(n > 1) mp[n]++;
	int ans = 0;
	for(auto tmp : mp) {
		int cnt = 1;
		while((cnt + 1) * (cnt + 2) / 2 <= tmp.second) {
			cnt++;
		}
		ans += cnt;
	}
	cout << ans << endl;
}






Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int A[100];
int n;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  for(int j=0;j<n;j++){
    int key=A[j];
    int i=j-1;
    while(0<=i && key<A[i]){
      A[i+1]=A[i];
      i=i-1;
    }
    A[i+1]=key;
    for(int k=0;k<n;k++){
      cout<<A[k];
      if(k!=n-1){
        cout<<" ";
      }else{
        cout<<endl;
      }
    }
  }
}

Measured memory_bytes: 1160
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  int n;// # of edge
  while (true)
    {
      cin >> n;
      if (n == 0)
	break;
      set<int> towns;
      map<PI,int> edges;
      REP(i,0,n)
	{
	  int a, b, c;
	  cin >> a >> b >>c;
	  towns.insert(a);
	  towns.insert(b);
	  PI p;
	  if (a < b)
	    p = PI(a,b);
	  else
	    p = PI(b,a);
	  edges[p] = c;
	}
      VI t(towns.size());
      vector<VI> e(towns.size(), VI(towns.size()));
      int j = 0;
      for (auto i = towns.begin(); i != towns.end(); i++)
	{
	  t[j] = *i;
	  j++;
	}
      for (uint i = 0; i < t.size(); i++)
	for (uint j = i; j < t.size(); j++)
	  if (edges.find(PI(t[i],t[j]))!=edges.end()) 
	    {
	      e[i][j] = edges[PI(t[i],t[j])];
	      e[j][i] = edges[PI(t[i],t[j])];
	    }
	  else if (i == j)
	    e[i][i] = 0;
	  else 
	    {
	      e[i][j] = 1000;
	      e[j][i] = 1000;
	    }

      for (uint r = 0; r < t.size(); r++)
	for (uint p = 0; p < t.size(); p++)
	  for (uint q = 0; q < t.size(); q++)
	    if (e[p][q] > e[p][r] + e[r][q])
	      e[p][q] = e[p][r] + e[r][q];
      int min = 0;
      int i_min = 0;
      bool first = true;
      for (uint p = 0; p < t.size(); p++)
	{
	  if (accumulate(e[p].begin(), e[p].end(), 0) < min|| first)
	    {
	      min = accumulate(e[p].begin(), e[p].end(), 0);
	      i_min = t[p];
	      first = false;
	    }
	}
      cout << i_min <<" "<< min << endl;
    }
}

Measured memory_bytes: 3148
package main

import "os"
import "fmt"
import "bufio"
import "strconv"

func main() {
    var sc = bufio.NewScanner(os.Stdin)
    sc.Split(bufio.ScanWords)
    sc.Scan()
    n, _ := strconv.Atoi(sc.Text())
    sc.Scan()
    k, _ := strconv.Atoi(sc.Text())
    a := []int{}
    for i := 0; i < n; i++ {
        sc.Scan()
        num, _ := strconv.Atoi(sc.Text())
        a = append(a, num)
    }

    r := (n - 1) / (k - 1) + 1

    if (n - 1) / (k - 1) * (k - 1) == (n - 1) {
        r = r - 1
    }

    fmt.Printf("%d\n", r)
}


Measured memory_bytes: 4992
def solve():
    n = int(input())
    a = sorted(int(input()) for _ in range(n))
    c0 = n // 2 - 1
    c1 = n // 2
    c2 = n // 2 + 1
    ans = 0
    if n & 1:
        for i in range(c0):
            ans -= a[i] * 2
        for i in range(c2 + 1, n):
            ans += a[i] * 2
        ans += -a[c0] + a[c2] + max(-a[c0] + a[c1], - a[c1] + a[c2])
    else:
        for i in range(c0):
            ans -= a[i] * 2
        for i in range(c1 + 1, n):
            ans += a[i] * 2
        ans += -a[c0] + a[c1]
    return ans
print(solve())


Measured memory_bytes: 7504
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cerr << #v << " = "; array_out(v , __VA_ARGS__ );} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////////////
void solve(){
  ini(N);
  map<int ,int> m;
  rep(i,N){
    ini(x); m[x]++;
  }
  priority_queue<int> Q;
  each(x , m){
    rep(i , x.se / 2) Q.push(x.fi);
  }
  if(Q.size() <= 1) die(0);
  int a = Q.top(); Q.pop();
  int b = Q.top(); Q.pop();
  out(1LL * a * b);
}



Measured memory_bytes: 4992
using System;

namespace abc045A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int a = Int32.Parse(Console.ReadLine());
            int b = Int32.Parse(Console.ReadLine());
            int h = Int32.Parse(Console.ReadLine());
            int X = (a + b) * h / 2;
            Console.WriteLine(X.ToString());
        }
    }
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

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

signed main() {
	bool isprime[1000000];
  rep(i, 1000000) isprime[i] = true;
  isprime[0] = isprime[1] = false;
  FOR(i, 2, sqrt(1000000)) {
    if(isprime[i]) {
      ll j = i + i;
      while(j <= 1000000) {
        isprime[j] = false;
        j += i;
      }
    }
  }
  ll n;
  while(cin >> n) {
    ll cnt = 0;
    rep(i, n + 1) if(isprime[i]) cnt++;
    cout << cnt << endl;
  }
	return 0;
}


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

int abc(long long int h,long long int w){
    
    long long int sa,sb,sc;
    
    long long int ans1=2e9,ans2=2e9;
    
    for(int i=1;i<h;i++){
        sa=i*w;
        sb=(h-i)*(w/2);
        sc=(h-i)*(w-(w/2));
        ans1=min(ans1,max(sa,max(sb,sc))-min(sa,min(sb,sc)));
    }
    //swap(h,w);
    for(int i=1;i<h;i++){
        sa=i*w;
        sb=w*((h-i)/2);
        sc=w*((h-i)-((h-i)/2));
        ans2=min(ans2,max(sa,max(sb,sc))-min(sa,min(sb,sc)));
    }
    
    return min(ans1,ans2);
}

int main(void){
    
    int h,w;
    cin>>h>>w;
    
    cout<<min(abc(h,w),abc(w,h))<<endl;
}


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

int main() {
    string S;
    unsigned long K;
    cin >> S >> K;
    unsigned long c=0, n=0;
    
    for (unsigned long i = 0; i < S.length(); i++) {
        if (S[i] != '1') {
            n = S[i] - 48;
            break;
        }
        c++;
    }

    if (c >= K) cout << '1' << endl;
    else cout << n << endl;
}

Measured memory_bytes: 256
using System;

namespace agc003_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = new int[n]; int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                x[i] = int.Parse(Console.ReadLine());
                a[i] = i;
            }
            Array.Sort(x,a);
            int ret = 1;
            for (int i = 0; i < n; i++) if (Math.Abs(a[i] - i) % 2 == 1) ret++;
            Console.WriteLine(ret / 2);
        }
    }
}

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

const int INF = 1e9 + 7;

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

    std::vector<int> broken(n + 1, 0);
    for(int i = 0; i < m; ++i){
        int val;
        std::cin >> val;
        ++broken.at(val);
    }
    
    std::vector<long long> steps(n + 1, 0);
    steps.at(0) = 1;
    if(0 == *(broken.begin() + 1)){
        steps.at(1) = 1;
    }

    for(int i = 2; i <= n; ++i){
        if(0 == broken.at(i)){
            steps.at(i) = (steps.at(i - 1) + steps.at(i - 2)) % INF;
        }
    }

    std::cout << steps.at(n) << std::endl;

    return 0;
}

Measured memory_bytes: 1408
n, k, c = map(int, input().split())
s = input()
l = []
r = []
i = 0
while len(l) < k:
    if s[i] == 'o':
        l.append(i)
        i += c + 1
    else:
        i += 1

i = n - 1
while len(r) < k:
    if s[i] == 'o':
        r.append(i)
        i -= c + 1
    else:
        i -= 1

r = r[::-1]

for i, j in zip(l, r):
    if i == j:
        print(i + 1)


Measured memory_bytes: 102228
count = 0
S = [int(i) for i in list(input())]

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        if S[i] == 0:
            S[i+1] = 1
        elif S[i] == 1:
            S[i+1] = 0
        count += 1 
print(count)

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

int main() {
    char c[4]; REP(i,4) cin >> c[i];
    char b=c[0]; bool can = true;
    for(int i=1;i<4;i++){
        if(b == c[i]){
         can = false;
         cout << "Bad" << endl;
         break;
        }

        b = c[i];
    }
    if(can) cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)){
            System.out.println("Yes");
        }else{
            System.out.println("No");

        }

    }

}

Measured memory_bytes: 24148
#include<iostream>
 
int main()
{
	int num;
	std::cin >> num;
  for(int i=0;i<=2;i++)
  {
      if((num-7)%10==0)
      {
        std::cout<<"Yes";
        return 0;
      }
    num/=10;
  }
  std::cout<<"No";
    return 0;
}

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

int main(void){

  int a,b;

  cin >> a >> b;

  if( a < b ){

    cout << "a < b" << endl;
  }else if( a > b){

    cout << "a > b" << endl;
  }
  else{
    cout << "a == b" << endl;
  }
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define int long long
int p[45];
int soin[45];
using namespace std;
signed main(){
    int n;
    cin>>n;
    int sum=0;
    int ban=0;
    for(int i=2;i<n;i++){
        sum=0;
        for(int j=2;j<i;j++){
            if(i%j==0){
                sum++;
            }
        }
        if(sum==0){
            p[ban]=i;
            ban++;
        }
    }
    int n2=n;
    for(int i=0;i<ban;i++){
        n=n2;
        for(int j=0;j<10;j++){
            soin[i]+=n/p[i];
            n=n/p[i];
        }
    }
    int d75=0;
    int d25=0;
    int d15=0;
    int d5=0;
    int d3=0;
    for(int i=0;i<ban;i++){
        if(soin[i]>=74){
            d75++;
        }
        if(soin[i]>=24){
            d25++;
        }
        if(soin[i]>=14){
            d15++;
        }
        if(soin[i]>=4){
            d5++;
        }
        if(soin[i]>=2){
            d3++;
        }
    }
    cout<<d75+d25*(d3-1)+d15*(d5-1)+d5*(d5-1)/2*(d3-2)<<endl;
}

Measured memory_bytes: 256