akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
map<pair<ll,ll>,ll>MP;
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=2211111;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});E[to].pb({from,cost});}
  void dijkstra(ll s){
    priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >que;
    init();
    d[s] = 0;
    que.push(pair<ll,ll>(0,s));
    while(!que.empty()){
      pair<ll,ll> p=que.top();que.pop();
      ll v = p.second;
      if(d[v]<p.first)continue;
      for(int j=0;j<E[v].size();j++){
	Edge t = E[v][j];
	if(d[t.to]>d[v]+t.cost){
	  d[t.to]=d[v]+t.cost;
	  que.push(pair<ll,ll>(d[t.to],t.to));
	}
      }
    }
  }
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  int cnt=1;
  Graph G(2211110);
  for(int i=0;i<m;i++){
    ll a,b,c;cin>>a>>b>>c;
    if(MP[mp(a,-1)]==0)MP[mp(a,-1)]=cnt++;
    if(MP[mp(b,-1)]==0)MP[mp(b,-1)]=cnt++;
    if(MP[mp(a,c)]==0)MP[mp(a,c)]=cnt++;
    if(MP[mp(b,c)]==0)MP[mp(b,c)]=cnt++;
    G.add_edge(MP[mp(a,-1)],MP[mp(a,c)],1);
    G.add_edge(MP[mp(b,-1)],MP[mp(b,c)],1);
    G.add_edge(MP[mp(a,c)],MP[mp(b,c)],0);
  }
  if(MP[mp(1,-1)]==0){
    cout<<-1<<endl;
    return 0;
  }
  G.dijkstra(MP[mp(1,-1)]);
  if(G.d[MP[mp(n,-1)]]==llINF)cout<<-1<<endl;
  else cout<<G.d[MP[mp(n,-1)]]/2<<endl;
  return 0;
}


Measured memory_bytes: 131824
#include <stdio.h>
#include <stdlib.h>
#define NOT_FOUND -1

int binarySearch(int);

int n,*S,q,*T;
int main(){
  int C=0,i,j,key;
  scanf("%d",&n);
  S=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  
  scanf("%d",&q);
  T=(int *)malloc(sizeof(int)*q);
  for(i=0;i<q;i++) scanf("%d",&T[i]);

  

  while(j!=q){
    key=T[j];
    if(binarySearch(key)!=NOT_FOUND) C++;
    j++;
  }
  
  printf("%d\n",C);
  return 0;
}

int binarySearch(int key){
  int left=0;
  int right=n;
  int mid;
  while(left<right){
    mid=(left+right)/2;
    if(S[mid]==key){
      return mid;
    }else if(key<S[mid]){
      right=mid;
    }else{
      left=mid+1;
    }
  }
  return NOT_FOUND;
}



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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9+1)
#define MAXX (int)1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (ll)(1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
//printf("myco\n");//for debug
/*--------------------------------------------*/
ll lcm(ll A, ll B) {//最小公倍数
    ll a=A;
    ll b=B;
    if (a==0 || b==0) {return 0;}
    if (a<0) {a=-a;}
    if (b<0) {b=-b;}
    while(b>0) {
        ll c=a%b;
        a=b;
        b=c;
    }
    return A/a*B;
}
int main(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll e=lcm(c,d);
    a--;
    ll ans=b-a-((b/c-a/c+b/d-a/d)-(b/e-a/e));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void calc(int[] a) {
    int n = cast(int)a.length;

    auto b = new int[n + 1];
    for (int i = n; i >= 1; i--) {
        // i の倍数の箱に入っているボールをカウントする
        int s = 0;
        for (int j = i + i; j <= n; j += i) {
            s += b[j];
        }

        // 偶奇が一致するように i 番目の箱にボールを入れるか判定
        b[i] = a[i-1] ^ (s % 2);
    }

    int t = b.sum;
    writeln(t);
    if (t > 0) {
        for (int i = 1; i <= n; i++) {
            if (b[i]) write(i, " ");
        }
        writeln();
    }
}

void main() {
    readint;
    auto a = readints;
    calc(a);
}


Measured memory_bytes: 7796
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  rep(i, n - 1) a[i + 1] += a[i];
  ll ans = INF;
  rep(i, n - 1) ans = min(ans, abs(2 * a[i] - a[n - 1]));
  cout << ans << endl;



  
  return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc=new Scanner(System.in);
    	long i=sc.nextLong(),j=sc.nextLong();
    	long m = i*j/gcd(i,j);
    	System.out.println(m);
	}
	public static long gcd(long i,long j) {
		if(j==0)
			return i;
		else
			return gcd(j,i%j);
	}
}

Measured memory_bytes: 21844
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    x = int(input())
    m = 100
    ans = 0
    while m < x:
        m = int(m * 1.01)
        ans += 1
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

int main(void) {
	ll n,x;
	cin>>n>>x;
	n*=500;
	if(n>=x)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,t;
  cin>>n;
  vector<int>c(500),s(500),f(500),ans(n);
  rep(i,n-1){
    cin>>c.at(i)>>s.at(i)>>f.at(i);
  }
  rep(i,n-1){
    t=0;
    for (int j=i;j<n-1;j++) {
      if (t<=s.at(j)) {
        t=s.at(j)+c.at(j);
      }
      else if (t>s.at(j) && t%f.at(j)!=0) {
        while (t%f.at(j)!=0) {
          t+=1;
        }
        t+=c.at(j);
      }
      else{
        t+=c.at(j);
      }
    }
    ans.at(i)=t;
  }
  rep(i,n){
    cout<<ans.at(i)<<endl;
  }
}



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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  bool judge=false;
  if(a==b) judge=true;
  if(b==c) judge=true;
  if(c==a) judge=true;
  if(a==b&&a==c) judge=false;
  if(judge==false){
    cout << "No" << endl;
  }
  if(judge==true){
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
def main(N, K):
    e_max = (N - 1) * (N - 2) // 2
    if K > e_max:
        print(-1)
        return

    edge = []
    add = []
    for i in range(2, N + 1):
        edge.append((1, i))
    for i in range(2, N):
        for j in range(i + 1, N + 1):
            add.append((i, j))

    while e_max != K:
        edge.append(add.pop())
        K += 1

    print(len(edge))
    for x, y in edge:
        print(x, y)
    return


N, K = map(int, input().split())
main(N, K)

Measured memory_bytes: 9476
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		//単語Wの読み込み
		String W = sc.nextLine();

		int count = 0;//回数初期化

		//判定のループ
		while (true) {

			//判定用文章読み込み
			String T = sc.nextLine();

			//END_OF_TEXTで抜ける
			if (T.equals("END_OF_TEXT")) {
				break;
			}

			//取り込み文をスペースで区切って格納
			String[] t = T.split(" ");

			//配列の取り出し
			for (int i = 0; i < t.length; i++) {

				if (t[i].equalsIgnoreCase(W)) {
					count++;
				} else if (!t[i].equalsIgnoreCase(W)) {

				}

			}

		}

		//1文の中に何回単語が出るかの判定

		//出力
		System.out.println(count);
		sc.close();
	}

}


Measured memory_bytes: 26300
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
#define MAX 100010
int main(){
  ll l, r;
  cin >> l >> r;
  int ans = 2018;
  r = min(r, l + 2019);
  for(ll i = l; i <= r; i++){
   for(ll j = i + 1; j <= r; j++){
     int x = i*j%2019;
     ans = min(x, ans);
   }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

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

int main() {
    int N;
    scanf("%d", &N);

    char S[2];
    bool isFour = false;
    REP(0, i, N) {
        scanf("%s", S);
        if ('Y' == S[0]) {
            isFour = true;
            break;
        }
    }

    printf("%s\n", isFour ? "Four" : "Three");

    return 0;
}


Measured memory_bytes: 128
"""
グラフが二部グラフかどうかを判定する。
二部グラフであれば、AグループのノードとBグループのノード同士をそれぞれ結ぶことができる。
二部グラフでない場合、すべてのノード同士を結ぶことができる。
"""
import math
from collections import Counter
import sys
sys.setrecursionlimit(200000)
def choose(n):
    return math.factorial(n)//(math.factorial(n-2)*math.factorial(2))
N,M = map(int,input().split())
edges = [[]for _ in range(N+1)]
for _ in range(M):
    A,B = map(int,input().split())
    edges[A].append(B)
    edges[B].append(A)

colors = [-1]*(N+1)
def f(n,p):
    c = colors[n]
    for v in edges[n]:
        if v != p:
            if colors[v] == -1:
                colors[v] = 1 if c==0 else 0
                f(v,n)
            elif colors[v] == c:
                print(choose(N)-M)
                exit()
colors[1]=0
f(1,0)
count1 = colors.count(0)
count2 = colors.count(1)
print(count1*count2-M)

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

int main(void)
{
        char u[3];
        int N, i;
        double ans=0, x;

        scanf("%d", &N);
        for(i=0;i<N;i++){
                scanf("%lf%s", &x, u);
                if(strcmp(u,"JPY")==0) ans = ans + x;
                else ans = ans + x * 380000;
        }
        printf("%10lf\n", ans);
        return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  int h,n;
    long long int a[n];
    cin >> h >> n;
    long long int q=0;
    long long int i=0;
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        q=q+a[i];
        if(q>=h)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

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

int main() {
	int m[10], v, j;
	for(int k=0; k<10; k++)
		cin >> m[k];
	for(int i=1; i<10; i++){
		v = m[i];
		j = i-1;
		while(j>=0 && m[j]<v){
			m[j+1] = m[j];
			j--;
			m[j+1] = v;
		}
	}
	for(int l=0; l<3; l++)
		cout << m[l] << endl;
	return 0;
}


Measured memory_bytes: 3076
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;
struct BIT{
private:
   int sz;
   vector<ll> node;
public:
   BIT(int n):sz(n),node(n+1){};
   void add(int k,ll x){
       k++;
       while(k<=sz){
           node[k]+=x;
           k+=k&-k;
       }
   }
   ll sum(int k){
       k++;
       ll ret=0;
       while(k>0){
           ret+=node[k];
           k-=k&-k;
       }
       return ret;
   }
   ll sum(int l,int r){
       return sum(r-1)-sum(l-1);
   }
   ll get(int k){
       return sum(k,k+1);
   }
};
int main(){
  int n;
  cin>>n;
  ll k;cin>>k;
  vector<ll> a(n+1);
  rep(i,n){
      cin>>a[i+1];
      a[i+1]-=k;
  } 
  vector<ll> sum;
  sum.push_back(0);
  rep(i,n){
      a[i+1]+=a[i];
      sum.push_back(a[i+1]);
  }
  sort(sum.begin(),sum.end());
  sum.erase(unique(sum.begin(),sum.end()),sum.end());
  BIT bit(n+1);
  ll ans=0;
  rep(i,n+1){
      ll idx=lower_bound(sum.begin(), sum.end(), a[i])-sum.begin();
      ans+=bit.sum(idx);
      bit.add(idx, 1);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5104
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int Maxn=15,inf=0x3f3f3f3f;
int c[Maxn],s[Maxn];
int a[Maxn][Maxn];
int n,m,k,ans=inf;
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
inline bool check()
{
	for(int i=1;i<=m;++i)
	if(s[i]<k)return 1;
	return 0;
}
int main()
{
//	freopen("in.txt","r",stdin);
	n=read(),m=read(),k=read();
	for(int i=1;i<=n;++i)
	{
		c[i]=read();
		for(int j=1;j<=m;++j)
		a[i][j]=read();
	}
	for(int x=0;x<(1<<n);++x)
	{
		memset(s,0,sizeof(s));
		int tot=0;
		for(int i=0;i<n;++i)
		{
			if(!((x>>i) & 1))continue;
			++i,tot+=c[i];
			for(int j=1;j<=m;++j)
			s[j]+=a[i][j];
			--i;
		}
		if(check())continue;
		ans=min(ans,tot);
	}
	if(ans==inf)puts("-1");
	else printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
int s[10005];
int main()
{
    int n,m,sum=0;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%d",&s[i]),sum+=s[i];
    int ans=0;
    for(int i=1;i<=n;i++){
        if(4*m*s[i]>=sum)ans++;
        //printf("%d %d\n",4*m*s[i],sum);
    }
    if(ans>=m)printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n , rez(0);
    cin >> n;
    int a;
    int p = 0;
    for(int i = 1; i<= n ; i++){
        cin >> a;
        if(a == i){
            if(p == 0){
                rez++;
                p = 1;
            }else{
                p = 0;
            }
        }else{
        p = 0;
        }
    }
    cout << rez;
}


Measured memory_bytes: 256
N = int(input())

def dfs(s, mx):
    if len(s) == N:
        print(s)
    else:
        for c in range(ord('a'), ord(mx)+1):
            if chr(c) == mx:
                mx = chr(c+1)
            dfs(s+chr(c), mx)

dfs("", 'a')

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <utility>

typedef long long ll;
typedef unsigned long long ull;

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b%a, a); }
ll mod(ll a) { return a % MOD < 0 ? (a % MOD) + MOD : a % MOD; }
ll mod_add(ll a, ll b) { return (a%MOD + b%MOD) % MOD; }
ll mod_sub(ll a, ll b) { return mod((a%MOD - b%MOD) % MOD); }
ll mod_mul(ll a, ll b) { return (a%MOD * b%MOD) % MOD; }
ll mod_pow(ll a, ll b) 
{
    if(b == 0) return 1;
    ll p = mod_pow(a, b/2) % MOD;
    p = mod_mul(p, p);
    return (b%2 == 0) ? p : mod_mul(a, p);
}
ll mod_inv(ll a) { return mod_pow(a, MOD-2); }
ll mod_div(ll a, ll b) { return a%MOD * mod_inv(b) % MOD; }

ll res(ll n)
{
    ll ten = 1, nine = 1, eight = 1;
    while(n > 0)
    {
        ten = mod_mul(ten, 10);
        nine = mod_mul(nine, 9);
        eight = mod_mul(eight, 8);
        n--;
    }
    
    return mod_add(mod_sub(mod_sub(ten, nine), nine), eight);
}

int main()
{
    ll N;
    std::cin >> N;

    if(N == 1)
    {
        print(0);
    }

    else
    {
        print(res(N));
    }
    return 0;
}

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

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  int l = 0, r = w, d = 0, u = h;
  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        l = max(x, l);
        break;
      case 2:
        r = min(x, r);
        break;
      case 3:
        d = max(y, d);
        break;
      case 4:
        u = min(y, u);
        break;
    }
  }
  cout << max(u - d, 0) * max(r - l, 0) << endl;
  return 0;
}

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

typedef long long LL;

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

int n,m,sk;

void into(){
  scanf("%d%d%d",&n,&m,&sk);
}

LL ans;

LL Get_ans(int n,int m,int sk){
  LL res=0;
  sk=sk-1<<1;
  for (int i=1;i<n;++i)
	for (int k=0;k<m&&i*k<=n*2+sk+2;++k){
	  int t=i*k-gcd(k,n),j=min((sk-t)/n+1,m-k);
	  res+=max(j-1,0)+(j&&j<m-k&&t+n*j<=sk+gcd(n-i,j+k)+gcd(i,j))<<(bool)k;
	}
  return res;
}

void Get_ans(){
  ans=Get_ans(n,m,sk)+Get_ans(m,n,sk)<<1;
}

void work(){
  Get_ans();
}

void outo(){
  printf("%lld\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 3836
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        KStones solver = new KStones();
        solver.solve(1, in, out);
        out.close();
    }

    static class KStones {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int k = in.scanInt();
            boolean dp[] = new boolean[k + 1];
            int arr[] = new int[n];
            in.scanInt(arr);
            for (int s = 0; s <= k; s++) {
                for (int x : arr) {
                    if (s - x >= 0 && !dp[s - x]) dp[s] = true;
                }
            }

            out.println(dp[k] ? "First" : "Second");
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public void scanInt(int[] A) {
            for (int i = 0; i < A.length; i++) A[i] = scanInt();
        }

    }
}



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

using ll = long long;
using pii = pair<int, int>;

template <typename T> constexpr T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;
template <> constexpr double inf<double> = 1e18;

template<typename T>
std::vector<T> table(int n, T v) { return std::vector<T>(n, v); }
 
template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return std::vector<decltype(val)>(n, std::move(val));
}

int main() {
    int x; cin >> x;
    string ans = "ai1333";
    for(int i = 0; i < x / 100; ++i) {
        ans += '3';
    }
    cout << ans << endl;
}


Measured memory_bytes: 3216
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
import math
import string
import fractions
import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop

# from itertools import accumulate
# from collections import deque
import random




def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def main():
    r,d,x = map(int, input().split())
    for i in range(10):
        x=r*x-d
        print(x)
if __name__ == '__main__':
    main()


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

using namespace std;

unsigned long long s, xb=0, yb=0, xc=0, yc=0;

void Input()
{
    cin >> s;

    //cout << trunc(sqrt(s)) + 1 << endl;

    xb = yc = trunc(sqrt(s)) + 1;
    while (xb > 1000000000)
    {
        //cout << xb << endl;
        xb--;       yc--;
    }

    unsigned long long o = xb * xb - s, k = trunc(sqrt(o));

    if (k != 0)
    {
        while (o % k != 0) k--;
        yb = k, xc = o / k;
    }

    cout << 0 << " " << 0 << " " << xb << " " << yb << " " << xc << " " << yc;
}

int main()
{
    Input();
    return 0;
}

//1000000000000000000


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

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

    int cnt = 0;
    repi(i, n, m+1){
        string judge = to_string(i);
        if(judge[0] == judge[4] && judge[1] == judge[3]) cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int mod = 1e9+7;

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

ll lcm(ll C, ll D) {
		ll t = gcd(C, D);
		return C / t * D;
}
int main() {
		ll A, B, C, D;
		cin >> A >> B >> C >> D;
		ll lcm_num = lcm(C, D);
		ll cc = B / C - A / C;
		if (A % C == 0) cc++;
		ll cd = B / D - A / D;
		if (A % D == 0) cd++;
		ll c_lcm = B / lcm_num - A / lcm_num;
		if (A % lcm_num == 0) c_lcm++;
		cout << B - A + 1 - (cc + cd - c_lcm) << endl;
		return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		int a,b,c;
		a=x+y;
		b=x-y;
		c=x*y;
		if(a>=b&&a>=c){
			System.out.print(a);
		}else if(b>=a&&b>=c){
			System.out.print(b);	
		}else if(c>=a&&c>=b){
			System.out.print(c);	
		}
	}
}

Measured memory_bytes: 23764
import sys
input = sys.stdin.readline
import bisect
n = int(input())
a = [int(i) for i in input().split()]
a = tuple(sorted(a))
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    chk = a[i]+a[j]
    ind = bisect.bisect_left(a,chk)
    ans += (ind-j-1)
print(ans)  

Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstring>
#include <map>
#include<cmath>
#include <algorithm>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin >> n;
    int ret =0 ;
    int mxx = 0;
    for(int i = 1; i <= n; i ++){
        int t = 0;
        int tmp = i;
        while(tmp){
            t ++;
            tmp /= 2;
        }
        if(t > mxx){
            mxx = t;
            ret = i;
        }
    }
    cout << ret << endl;
    return 0;
}


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

using LD = long double;

struct vec2 {
	LD x, y;
	vec2(LD x = 0, LD y = 0) : x(x), y(y) {}
	vec2 operator + (const vec2 &rhs) const {
		return vec2(x + rhs.x, y + rhs.y);
	}
	vec2 operator - (const vec2 &rhs) const {
		return vec2(x - rhs.x, y - rhs.y);
	}
	LD operator * (const vec2 &rhs) const {
		return x * rhs.x + y * rhs.y;
	}
	LD operator ^ (const vec2 &rhs) const {
		return x * rhs.y - y * rhs.x;
	}
	vec2 operator * (const LD rhs) const {
		return vec2(x * rhs, y * rhs);
	}
	friend vec2 operator * (const LD lhs, const vec2 rhs) {
		return vec2(lhs * rhs.x, lhs * rhs.y);
	}
	vec2 operator / (const LD rhs) const {
		return vec2(x / rhs, y / rhs);
	}
	LD norm2() const {
		return x * x + y * y;
	}
	LD norm() const {
		return std::sqrt(norm2());
	}
	friend std::istream& operator >> (std::istream &cin, vec2 &v) {
		return cin >> v.x >> v.y;
	}
	friend std::ostream& operator << (std::ostream &cout, const vec2 v) {
		return cout << std::fixed << std::setprecision(10) << v.x << ' ' << std::fixed << std::setprecision(10) << v.y;
	}
};
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	vec2 v1, v2, v;
	std::cin >> v1 >> v2, v2 = v2 - v1, v2 = v2 / v2.norm();
	int q; std::cin >> q;
	for (int i = 1; i <= q; ++i) {
		std::cin >> v, v = v - v1;
		LD l = v * v2;
		std::cout << v1 + l * v2 << '\n';
	}
}



Measured memory_bytes: 3296
#include<bits/stdc++.h> 
#define ll long long
using namespace std;
int main(){
int n , w;
cin>>n >> w;
vector<ll> wei(n) , val(n);
ll sum =0; 
for(int i =0; i< n;++i) {
	cin>>wei[i] >> val[i];
   sum+=val[i];
}
long long  dp[n+1][sum+1];
for(int i = 0; i <= n; ++i){
	for(int j = 0; j<= sum; ++j){
		if(j == 0 )
			dp[i][j] = 0;
		else if( i == 0)
			dp[i][j] = INT_MAX;
		else if(val[i-1] > j )
			dp[i][j] = dp[i-1][j];
			else
			dp[i][j]  = min(dp[i-1][j] , wei[i-1] + dp[i-1][j - val[i-1]]);
		}
	}
	int ans =0 ;
	for(int i = 0; i <= sum; ++i){
		if(dp[n][i] <= w && dp[n][i] != INT_MAX)
		    ans = i; 
	}
	cout<<ans<<endl;
}
	


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

int main(){

    int N;
    cin >> N;

    vector<int> A(N, 0);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }

/*
    vector<int> invX(N, 0);
    for(int i = 0; i < N; i++){
        invX.at(i) = pow(-1, i);
    }
*/

    int X1 = 0;
    // mountain 1
    for(int i = 0; i < N; i++){
            X1 += pow(-1, i) * A.at(i);
    }
    cout << X1 << " ";

    // Xi, i=2,3,...
    int Xi = X1;
    for(int i = 1; i < N; i++){
        Xi = 2*A.at(i-1) - Xi;
        cout << Xi;
        if( i != N - 1){
            cout << " ";
        }
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 1664
import sys
from collections import deque

dic={'o':lambda s:1-(s[1]^s[0]), 'x':lambda s:s[1]^s[0]}
def mknseq(ox,ld):
    for x in ld:
        x.append(dic[ox]([x[-2],x[-1]]))
def main():
    N=int(sys.stdin.readline().strip())
    s=list(sys.stdin.readline().strip())
    ans=[deque([x,y]) for x in range(2) for y in range(2)]
    for x in range(N):
        mknseq(s[x],ans)
    ans=[list(x) for x in ans]
    # print(ans)
    for x in ans:
        if x[:2]==x[-2:]:
            return print(''.join([['W','S'][i] for i in x[1:-1]]))
    print(-1)

if __name__=='__main__':
    main()


Measured memory_bytes: 16300
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var H, W, K int
  NextInt(&H, &W, &K)
  S := make([]string, H)
  for i := range S { S[i] = NextLine() }
  ans := 0
  for p := 0; p < 1 << uint(H); p++ {
    for q := 0; q < 1 << uint(W); q++ {
      cnt := 0
      for i := range S {
        for j, s := range S[i] {
          if 1 << uint(i) & p == 0 && 1 << uint(j) & q == 0 && s == '#' { cnt++ }
        }
      }
      if cnt == K { ans++ }
    }
  }
  Write(ans)
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntSlice(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatSlice(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(S ...interface{}) {
  fmt.Fprintln(writer, S...)
}
func WriteIntSlice(A []int) {
  B := make([]interface{}, len(A))
  for i, a := range A { B[i] = a }
  Write(B...)
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

Measured memory_bytes: 1816
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

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

const ll oo = 1e18;
const ll mod = 998244353,maxn = 303;
const double PI = acos(-1);



int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int v[200], n, ans = 0;

    cin >> n;

    for (int i=0; i<n; i++){
        cin >> v[i];
        if (i%2==0 and v[i]&1) ans++;
    }

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

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int a, b, c;
int	main(){
	cin >> a;
	cin >> b;
	cin >> c;
	if (a < b && b < c)
	{
		cout << "Yes"<<endl;
	}
	else
	{
		cout << "No"<<endl;
	}
	
	return 0;
}
	


Measured memory_bytes: 3072
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		ArrayList<String> list = new ArrayList<>();

		while(true) {

			int middle = in.nextInt();
			int term_end = in.nextInt();
			int retest = in.nextInt();
			int sum = middle + term_end;

			if(middle == -1 && term_end == -1 && retest == -1) {

				break;

			}else if(middle == -1 || term_end == -1) {

				list.add("F");

			}else if(sum >= 80) {

				list.add("A");

			}else if(sum < 80 && sum >= 65) {

				list.add("B");

			}else if(sum < 65 && sum >= 50) {

				list.add("C");

			}else if(sum < 50 && sum >= 30) {

				if(retest >=  50) {

					list.add("C");

				}else {

					list.add("D");

				}

			}else if(sum < 30) {

				list.add("F");

			}
		}

		for(String seiseki: list) {

			System.out.println(seiseki);

		}
	}
}

Measured memory_bytes: 26276
#include<bits/stdc++.h>
 using namespace std;
 
#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0)
#define mod                     1000000007
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
#define fill(a,v)               memset(a, v, sizeof a)
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define eps                     1e-6
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
typedef  long long                   ll;
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  unordered_map<int, int>    mii;
typedef  vector<ll>                 vll;
typedef  long double                 ld;
 
 int fun(int x)
 {
  int cnt=0;
  while(1)
  {
    if(x%2==0)
      {
         x/=2;
        cnt++;
      }
    else
      break;
  }
  return cnt;
 }

int main()
{
  FIO;
 /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
  #endif  */
  
 int n,x;
 cin>>n;
 //int a[n];
 int res=0;
 forn(i,n)
 {
   cin>>x;
   res+=fun(x);
 }
cout<<res;
 return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int q = sc.nextInt();
    
    int[] a = new int[n];
    int[] b = new int[q];
    
    for(int j = 0; j < q; j ++ ) {
      b[j] = sc.nextInt();
      a[b[j]-1] ++;
    }
 
    for(int i = 0; i < n; i ++) {
      if(a[i] > q-k) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
    
  }
}


Measured memory_bytes: 62684
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        int count0 = 0;
        int count1 = 0;
        String[] arr = s.split("");
        for (int i = 0; i < s.length(); i++) {
            if ("0".equals(arr[i])) {
                count0++;
            } else {
                count1++;
            }
        }
        int result = s.length() - Math.abs(count0 - count1);

        // 出力
        System.out.println(result);
        sc.close();
    }
}

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/c.in", "r", stdin);
//  freopen("../IO/c.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  vector<string> z(n);
  for (auto &s : z) in >> s;
  sort(z.begin(), z.end());
  z.resize(unique(z.begin(), z.end()) - z.begin());
  out << z.size() << '\n';
}



Measured memory_bytes: 9492
N, M = map(int, input().split())
road_list = []
for i in range(M):
  road_list.append(list(map(int, input().split())))

road_dict = {}
for road in road_list:
  first_city = road[0]
  second_city = road[1]
  first_city_road_list = road_dict.get(first_city, [])
  first_city_road_list.append(second_city)
  road_dict[first_city] = first_city_road_list
  
  second_city_road_list = road_dict.get(second_city, [])
  second_city_road_list.append(first_city)
  road_dict[second_city] = second_city_road_list

for i in range(1, N+1):
  city_road_list = road_dict.get(i, [])
  road_num = len(city_road_list) if city_road_list != [] else 0
  print(road_num)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
ll cnt[100];
int main(){
  ll n,a;
  cin>>n;
  cin>>a;
  ll ans=a;
  for(int i=1;i<n;i++){
    cin>>a;
    ans=__gcd(ans,a);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
//
// Created by mustafa on 05/07/19.
//
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std ;

#define ll long long
#define submitStage int TCF = 1 ;
#define testStage int TCF = 1000 ;
#define Start while(TCF--)
#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 REP(i, n) FOR(i, 0, n)
#define FastInputOutput ios_base :: sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ;
#define ReadFromFile(x)  freopen( x, "rt" , stdin ) ;
#define WriteToFile(x)  freopen( "in.txt", "wt" , stdout ) ;
#define D(x) scanf("%d",&x);
#define LLD(X) scanf("%lld",&x);
#define in(x,...) scanf(x,__VA_ARGS__)
#define out(x,...) printf(x,__VA_ARGS__)
/// for debugging
string to_string(string s) {return '"' + s + '"';}string to_string(const char* s) {return to_string((string) s);}string to_string(bool b) {return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out() { cerr << endl; }template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) {}
#endif
/// start driven program
const int N = 2e4+5, M = 1e4, OO = 0x3f3f3f3f;

int main(){
    submitStage Start{
        // 1 , 5 , 10;
        int n,y;
        scanf("%d %d",&n , &y);
        y/=1000;
        int mx10=y/10 , mx5=0 , mx1=0;
        int t10 =0 , t5 =0 , t1=0;
        int a10=-1,a5=-1,a1=-1;
        bool get=true;
        for(int i=0 ; i <= mx10 & get; ++i){
            t10=y- (i*10);
            mx5=t10/5;
            for(int j=0 ; j <= mx5 & get ; ++j){
                t5=t10-(j*5);
                mx1=t5;
                if(i+j+mx1==n){
                    a10=i;
                    a5=j;
                    a1=mx1;
                    get=false;
                }
            }

        }
        printf("%d %d %d",a10,a5,a1);

    }
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long vs[200005];
signed main(){
	string s;
	cin >> s;
	long long ans=0;
	long long cnt=0;
	memset(vs,0,sizeof(vs));
	for(int i=0;i<s.length();i++){
		if(vs[i]==1){
			i++;
		}
		//cout << i << endl;
		if(s[i]=='A'){
			cnt++;
		}
		else if(s[i]=='B')
		{
			if(s[i+1]=='C'){
				//cout << i << " " << i+1 << " " << cnt<<endl;
				ans+=cnt;
				if(s[i+2]=='A'||s[i+2]=='B'){
					vs[i+1]=1;
				}
			}
			else{
				cnt=0;
			}
		}
		else if(s[i]=='C'){
			//cout << i<<endl;
			cnt=0;
		}
	}
	cout << ans;
}

Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}
int dfs(int v, ll N, bool visited[nmax])
{
    bool all_visited = true;

    for (int i = 0; i < N; i++)
    {
        if (!visited[i])
        {
            all_visited = false;
        }
    }

    if (all_visited)
    {
        return 1;
    }
    int ret = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (!graph[v][i])
        {
            continue;
        }
        if (visited[i])
        {
            continue;
        }

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}


void solve(long long A, long long B, long long C, long long D){
    cout << max(A*B,C*D) << endl;
}

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


Measured memory_bytes: 256
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int n,m;
	cin >> n >> m;
	priority_queue<int> pq;
	REP(i,0,n){
		int x;
		cin >> x;
		pq.push(x);
	}

	for(int i = 0; i < m; ++i){
		int x = pq.top();
		pq.pop();
		x /= 2;
		pq.push(x);
	}

	ll ans = 0;
	while(sz(pq)){
		ans += pq.top();
		pq.pop();
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3892
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m, *x = map(int, read().split())
x.sort(reverse=True)
memo = [0] * m
for i, (bf, af) in enumerate(zip(x, x[1:])):
    memo[i] = bf - af
memo.sort(reverse=True)
print(sum(memo[n - 1:]))


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

int main() {
int64_t a,b,c,d;
cin>>a>>b>>c>>d;

int64_t z=a*c;

if(z<a*d)
z=a*d;
if(z<b*c)
z=b*c;
if(z<b*d)
z=b*d;

cout<<z<<endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int a,b,c,x;

int main()
{
    cin >> a >> b >> c >> x;
    int res = 0;

    rep(i,0,a) rep(j,0,b) rep(k,0,c) 
    {
        int sum = i * 500 + j * 100 + 50 * k;
        if(x== sum) res++;
    }   
    cout << res << endl;
}

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

using namespace std;
#define ll long long int 
const int MAXN = 1e5 + 10;
long long  a[MAXN];

int n,w;
int main ()
{
   
    cin>>n>>w;
    
    for(ll i=0;i<n;i++)
    {
        ll wi,vi;
        cin>>wi>>vi;
        for(ll j=w;j>=wi;j--)
        {
            a[j]=max(a[j-wi]+vi,a[j]);
        }

    }
  ll ans;
  ans=0;
  for(ll i=0;i<=w;i++)
  {
      ans=max(ans,a[i]);
  }
 cout<<ans<<endl;
}


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

int solve(int N,const vector<int> &A){
  int count = 1;
  for ( int i = 0; i < N; i ++){
    if ( A.at(i) == count ){
      count ++;
    }
  }
  
  if ( count == 1 ){
    return -1;
  }else{
    return N - ( count - 1);
  }

}

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  for ( int i = 0; i < N; i ++){
    cin >> A.at(i);
  }
  
  int ans;
  
  ans = solve(N,A);
  cout << ans << endl;
  
}

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

using namespace std;

int main() {
    long long x;
    cin >> x;

    long long res = x / 11 * 2;

    if (x % 11 > 0) {
        res++;
    }
    if (x % 11 > 6) {
        res++;
    }
    cout << res << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    const int start=100;
    double r=1.05;
    double result;
    int n,i;
    result = start;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        result=result*r;
        if(!(result-(int)result==0)){
            result=(int)result+1;
        }
    }
    printf("%d\n",(int)result*1000);
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

void build(ll node, ll start, ll end){
	if(start == end)
		segtree[node] = A[start];
	else{
		ll mid = (start + end)/2;
		build(left(node), start, mid);
		build(right(node), mid+1, end);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

void update(ll node, ll start, ll end, ll l, ll r, ll val){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(start > end or l > start or r < end)
		return ;
	else if(start >= l and r >= end){
		segtree[node] += val;
		if(start != end){
			lazy[left(node)] += val;
			lazy[right(node)] += val;
		}
	}
	else{
		ll mid=(start + end)/2;
		update(left(node), start, mid, l, r, val);
		update(right(node), mid+1, end, l, r, val);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

ll sums(ll node, ll start, ll end, ll l, ll r){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(l > end or r < start or start > end)
		return 0;
	if(l <= start and r >= end)
		return segtree[node];
	ll mid = (start+end)/2;
	return sums(left(node), start, mid, l , r) + sums(right(node), mid + 1, end, l , r);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	ll a[n];
	for(ll i=0; i<n; i++)
		cin >> a[i];
	sort(a, a+n);
	vector<bool> isOK(a[n-1]+1, 1);
	ll cnt = 0;
	for(ll i=0; i<n; i++){
		if(isOK[a[i]]){
			if(i > 0 and a[i] == a[i-1]){
				cnt--;
				isOK[a[i]] = 0;
			}
			else
				cnt++;
			for(ll j=a[i]*2; j<=a[n-1]; j+=a[i])
				isOK[j] = false;
		}
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 5268