akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(int, m, d);

  auto d1 = [](int d) {
    string s = to_string(d);
    if (sz(s) != 2) return 0;
    return s[1] - '0';
  };
  auto d10 = [](int d) {
    string s = to_string(d);
    if (sz(s) != 2) return 0;
    return s[0] - '0';
  };

  int ans = 0;
  for (int i = 2; i <= m; ++i) {
    for (int j = 22; j <= d; ++j) {
      if (!(d1(j) >= 2 && d10(j) >= 2)) continue;
      if (i == d1(j) * d10(j)) ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
	
	stack<int> S1;
	stack<pair<int, int> > S2;
	char ch;
	int sum = 0;
	for( int i=0; cin >> ch; i++){
		if(ch == '\\') S1.push(i);
		else if(ch == '/' && S1.size() > 0){
			int j= S1.top(); S1.pop();
			sum += i-j;
			int a = i-j;
			while(S2.size() > 0 && S2.top().first > j){
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}
	
	vector<int> ans;
	while( S2.size() > 0){ ans.push_back(S2.top().second); S2.pop(); }
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for(int i=0; i < ans.size(); i++){
		cout << " ";
		cout << ans[i];
	}
	cout << endl;
	
	return 0;
}

 	



Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  int n,k,s;
  cin >> n >> k >> s;
  vector<int> v(n);
  for(int i=0;i<k;i++) v[i] = s;
  for(int i=k;i<n;i++)
  {
    if(s == 1e9) v[i] = 1;
    else v[i] = 1e9;
  }

  for(int i=0;i<n;i++) cout << v[i] << " " ; cout << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
/*
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
*/
typedef vector<int> V;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
int main() {
	int a, b;
	cin >> a >> b;
	int q;
	cin >> q;
	vector<bool> order(1100,false);
	rep(iii,q){
	    int x,y;
	    cin >> x >> y;
	    for(int i=x;i<=y;i++) order[i]=true;
	}
	bool cheak=false;
	for(int i=a;i<=b;i++){
	    if(i==a){
	        if(order[i] && order[i+1]) cheak=true;
	    }
	    else if(i==b){
	        if(order[i-1] && order[i]) cheak=true;
	    }
	    else{
	        if(order[i]) cheak=true;
	    }
	}
	cout << cheak << endl;
	return 0;
}



Measured memory_bytes: 3096
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int all = sc.nextInt();
        int[] valList = new int[all];
        for (int i = 0; i < all; i++) {
            valList[i] = sc.nextInt();
        }
        boolean isAllEven = true;
        int count = 0;
        while (isAllEven) {
            for (int i = 0; i < all; i++) {
                if (valList[i] % 2 == 0) {
                    valList[i] = valList[i] / 2;
                } else {
                    isAllEven = false;
                    break;
                }
            }
            if (isAllEven) {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  1 20:52:55 2020

@author: H_Hoshigi
"""

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

s_c_dict = {}
for i in range(1, N+1):
    s_c_dict[i] = -1

for i in range(M):
    s_c_list = list(map(int, input().split()))
    if s_c_dict[s_c_list[0]] == -1:
        s_c_dict[s_c_list[0]] = s_c_list[1]
    elif s_c_dict[s_c_list[0]] != s_c_list[1]:
        s_c_dict[s_c_list[0]] = -2
    else:
        s_c_dict[s_c_list[0]] = s_c_list[1]

answer = ""

if N == 1:
    if s_c_dict[1] == -2:
        answer = "-1"
    elif s_c_dict[1] == -1:
        answer += "0"
    else:
        answer += str(s_c_dict[1])
else:
    if s_c_dict[1] == -2 or s_c_dict[1] == 0:
        answer = "-1"
    elif s_c_dict[1] == -1:
        answer += "1"
    else:
        answer += str(s_c_dict[1])
    
    if answer != "-1":
        for i in range(2, N+1):
            if s_c_dict[i] == -2:
                answer = "-1"
                break
            elif s_c_dict[i] == -1:
                answer += "0"
            else:
                answer += str(s_c_dict[i])

print(answer)



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

import javax.sound.midi.MidiChannel;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	}

	
	public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	}
}

Measured memory_bytes: 68496
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    int n; cin >> n;
    vector<int> nums;
    for(int i = 0; i < n; ++i){
        int x; cin >> x;
        nums.push_back(x);
    }
    ll sum = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j)
        {
            sum += nums[i] * nums[j];
        }
    }
    cout << sum << endl;
	return 0;
}


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

#define ii pair<int, int>
#define lli long long int
#define ll pair<lli, lli>
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

int ans = 0, c[100005];
vector<ii> child[100005];

void dfs(int pos, int prev) {
	int temp = 0;
	ii nxt;
	ans = max(ans, prev);
	for (int i = 0; i < (int) child[pos].size(); i++) {
		nxt = child[pos][i];
		temp++;
		if (temp == prev)
			temp++;
		c[nxt.se] = temp;
		dfs(nxt.fi, temp);
	}
}

int main() {
	int n, a, b;
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		scanf("%d %d", &a, &b);
		child[a].pb(mp(b, i));
	}
	dfs(1, 0);
	printf("%d\n", ans);
	for (int i = 1; i < n; i++)
		printf("%d\n", c[i]);
	return 0;
}

Measured memory_bytes: 8448
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


class SegTree{
private:
    int n;
    vector<pii> seg;
    pii init = pii(0,INF); //初期化の値（単位元）
    pii combine(pii a, pii b){
        if(a.first == b.first && a.second < b.second)return a;
        if(a.first > b.first)return a;
        return b;
    }
public:
    SegTree (){}
    SegTree(const vi &in){
        n=1;
        while(n<in.size())n<<=1;
        seg=vector<pii>(2*n,init);
        for(int i=n-1+in.size()-1;i>=0;i--){
            if(n-1<=i)seg[i]=pii(in[i-(n-1)],i-(n-1));
            else seg[i]=combine(seg[i*2+1],seg[i*2+2]);
        }
    }

    void update(int k,int a){
        k+=n-1;
        seg[k].first = a;
        while(k>0){
            k=(k-1)/2;
            seg[k]=combine(seg[k*2+1],seg[k*2+2]);
        }
    }

    //[a,b)について調べる
    pii query(int a,int b,int k=0,int l=0,int r=-1){
        if(r==-1)r=n;
        if(r<=a || b<=l)return init;
        if(a<=l &&r<=b)return seg[k];
        pii vl=query(a,b,k*2+1,l,(l+r)/2);
        pii vr=query(a,b,k*2+2,(l+r)/2,r);
        return combine(vl,vr);
    }

    void show(){
        rep(i,n)cout << " " << seg[i+n-1].first;
        cout << endl;
    }

};

signed main(void) {
    int n,q;
    cin >> n >> q;
    vi v(n);
    SegTree st(v);
    while(q--){
        int a,b;
        cin >> a >> b;
        a--;
        pii t = st.query(a, a+1);
        st.update(a, t.first + b);
        //st.show();
        pii ans = st.query(0,n);
        cout << ans.second + 1 << " " << ans.first << endl;
    }
}



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

using namespace std;

const int maxN = 2e5 + 10;

int n, k, c;
string s;

int dp[2][maxN];

int main()
{
	cin>>n>>k>>c>>s;
	for(int i = 0; i <= min(n - 1, c); i++) dp[0][i] = (s[i] == 'o' ? 1 : dp[0][i - 1]);
	for(int i = c + 1; i < n; i++) dp[0][i] = (s[i] == 'o' ? max(dp[0][i], dp[0][i - c - 1] + 1) : dp[0][i - 1]);
	for(int i = n - 1;i >= max(0, n - c - 1); i--) dp[1][i] = (s[i] == 'o' ? 1 : dp[1][i + 1]);
	for(int i = n - c - 2; i >= 0; i--) dp[1][i] = (s[i] == 'o' ? max(dp[1][i], dp[1][i + c + 1] + 1) : dp[1][i + 1]);
//	for(int i = 0; i < n; i++) cout<<dp[0][i]<<" ";cout<<endl;
//	for(int i = 0; i < n; i++) cout<<dp[1][i]<<" ";cout<<endl;
	for(int i = 0; i < n; i++) if(dp[0][i - 1] + dp[1][i + 1] < k && s[i] == 'o') cout<<i + 1<<endl;
	return 0;
}

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

double pi = 3.14159265358979323846;


int main() {
  double A,B,H,M,Q,radQ,ans;
  cin >> A >> B >> H >> M;
  
  Q = H*60 + M;
  radQ = Q * 11 * pi / 360;
  
  while(radQ >= 2*pi) {
    radQ -= 2*pi;
  }
  
  if (radQ >= pi) {
    radQ = (2*pi) - radQ;
  }
  
  ans = A*A + B*B;
  ans -= 2 * A * B * cos(radQ);
  cout << fixed << setprecision(15) << sqrt(ans) << endl;
}


Measured memory_bytes: 4228
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int k = sc.nextInt();

    int[] seq = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    System.out.println(seq[k-1]);
  }
}


Measured memory_bytes: 21204
#include <bits//stdc++.h>
using namespace std;
int main(void){
    int a,b,i,j;
    cin>>a;
    int line[a];
    for(i=0;i<a;i++)
    {
        cin>>line[i];
    }
    vector<int> mini;
    for(i=0;i<a;i++){
        if(i==0){
            mini.push_back(line[i]);
            continue;
        }
        b=mini.size();
        if(mini[b-1]<line[i])
        mini.push_back(line[i]);
        else if(mini[0]>line[i])
        mini[0]=line[i];
        else if(b!=1){
                int front=0;
                int last=b-1;
                int point=(b-1)/2;
                while(1){
                    if(mini[point]<line[i]&&mini[point+1]>line[i]){
                        mini[point+1]=line[i];
                        break;
                    }
                    else if(mini[point]>line[i]){
                        last=point;
                        point=(last+front)/2;
                    }
                    else if(mini[point+1]<line[i]){
                        front=point;
                        point=(front+last)/2;
                    }
                    else
                    break;
                }    
        
        }
            
        
    }
    cout<<mini.size()<<endl;
}



Measured memory_bytes: 3840
using System;

namespace Project
{
	class Dice
	{
		public int face;
		public int N;
		public int E;
		public int S;
		public int W;
		public int back;

		public Dice(int a1, int a2, int a3, int a4, int a5, int a6)
		{
			face = a1;
			N = a5;
			E = a3;
			S = a2;
			W = a4;
			back = a6;
		}
		public void roll(char D)
		{
			int pface = face;
			int pN = N;
			int pE = E;
			int pW = W;
			int pS = S;
			int pback = back;
			switch (D)
			{
				case 'N':
					face = pS;
					N = pface;
					S = pback;
					back = pN;
					break;
				case 'E':
					face = pW;
					E = pface;
					W = pback;
					back = pE;
					break;
				case 'W':
					face = pE;
					E = pback;
					W = pface;
					back = pW;
					break;
				case 'S':
					face = pN;
					N = pback;
					S = pface;
					back = pS;
					break;
			}
		}
	}

	class MainClass
	{
		public static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split(' ');
			int[] a = new int[6];
			for (int i = 0; i < 6; i++)
			{
				a[i] = int.Parse(s[i]);
			}
			Dice dice = new Dice(a[0], a[1], a[2], a[3], a[4], a[5]);
			string command = Console.ReadLine();
			char[] c = new char[command.Length];
			for (int i = 0; i < command.Length; i++)
			{
				c[i] = command[i];
				dice.roll(c[i]);
			}
			Console.WriteLine(dice.face);
		}
	}
}

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

#define INF 1e9
#define ll long long int
#define ff first
#define ss second


int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	int r=sqrt(n);
	if(r*r==n)
		r--;
	
	n--;
	ll count=0;
	for(int i=1;i<=r;i++)
	{
		count+=(((n/i)-(i-1))*2)-1 ;
	}
	
	cout<<count<<'\n';
	
	return 0;
}

Measured memory_bytes: 3660
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <cstdio>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;

#define fs first
#define sc second
#define pb push_back
#define mp make_pair 
typedef pair<int, int> pii;
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;

const int N = 2e5 + 10;
const int mo = 1e9 + 7;

int qpow(int a, int b) {
	int ans = 1;
	for(; b >= 1; b >>= 1, a = (ll) a * a % mo)
		if(b & 1) ans = (ll) ans * a % mo;
	return ans;
}
int n, rpos; ll k;
int a[N];
ll C(ll n) { return n * (n - 1) / 2; }
ll fl(ll a, ll b) {
	bool f = (a < 0) ^ (b < 0);
	if(a < 0) a = -a;
	if(b < 0) b = -b;
	return f ? - ( a / b + 1 ) : a / b;
}
ll cl(ll a, ll b) {
	bool f = (a < 0) ^ (b < 0);
	if(a < 0) a = -a;
	if(b < 0) b = -b;
	return f ? - ( a / b ) : (a + b - 1) / b;
}
int main() {
	scanf("%d%lld", &n, &k);
	for(int i = 1; i <= n; i ++) scanf("%d", a + i);
	sort(a + 1, a + n + 1);
	ll l = 0, r = 0, z = 0, L = 0, R = 0, Z = 0;
	for(int i = 1; i <= n; i ++) z += a[i] == 0;
	for(int i = 1; i <= n; i ++) l += a[i] < 0;
	for(int i = 1; i <= n; i ++) r += a[i] > 0;
	L = l * r; R = C(l) + C(r); Z = C(n) - L - R;
	rpos = n + 1;
	for(int i = 1; i <= n; i ++) if(a[i] > 0) {
		rpos = i; break ;
	}
	if(k <= L) {
		ll ql = -1e18, qr = -1, mid, ans = -233;
		while(ql <= qr) {
			mid = (ql + qr) >> 1;
			ll sum = 0, now = r, cur = rpos;
			for(int i = 1; i <= n && a[i] < 0; i ++) {
				ll up = mid % a[i] == 0 ? mid / a[i] + 1 : cl(mid, a[i]);
				while(now && a[cur] < up) cur ++, now --;
				sum += now;
			}
			if(sum < k) ql = (ans = mid) + 1;
			else qr = mid - 1;
		}
		printf("%lld\n", ans);
	} else if(k <= L + Z) {
		puts("0");
	} else {
		k -= L + Z;
		ll ql = 1, qr = 1e18, mid, ans = -233;
		while(ql <= qr) {
			mid = (ql + qr) >> 1;
			ll sum = 0, now = r, cur = n;
			for(int i = rpos; i <= n; i ++) {
				ll up = mid % a[i] == 0 ? mid / a[i] - 1 : fl(mid, a[i]);
				while(now && a[cur] > up) cur --, now --;
				sum += cur >= i ? now - 1 : now; //
			}
			now = l; cur = 1;
			for(int i = n; i >= 1; i --) if(a[i] < 0) {
				ll up = mid % a[i] == 0 ? mid / a[i] + 1 : cl(mid, a[i]);
				while(now && a[cur] < up) cur ++, now --;
				sum += cur <= i ? now - 1 : now;
			}
			sum >>= 1;
			if(sum < k) ql = (ans = mid) + 1;
			else qr = mid - 1;
		}
		printf("%lld\n", ans);
	}
	return 0;
} 

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String [] inp =buffer.readLine().split(" ");
        long a = Integer.parseInt(inp[0]), b = Integer.parseInt(inp[1]), c = Integer.parseInt(inp[2]), d = Integer.parseInt(inp[3]);
        long res1 = a*d, res2 = a*c, res3 = b*c, res4 = b*d;
        long res = Math.max(res1,Math.max(res2, Math.max(res3, res4)));
        System.out.println(res);
    }
}


Measured memory_bytes: 32592
n=int(input())
U=[n-1-i for i in range(n)]
ind='0'+str(n)+'b'

t=list(map(int,input().split()))
T=t[1:]

for i in range(2**n):
    compare=[int(j) for j in format(i,ind)]
    disp=[U[j] for j in range(n) if compare[j]==1]
    disp.reverse()
    if sorted(list(set(T)&set(disp)))==T:
        print(i,end=":")
        if len(disp)!=0:
            print(" "+' '.join(map(str,disp)),end="")
        print()



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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;


const int SIZE = 1e5+100;
ll n;
ll a[SIZE];
vector<ll> mem;

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

    sort(a, a+n, std::greater<ll>());
    for(int i = 1; i < n; i++){
        if(a[i] != 0){
            if(a[i] == a[i-1]){
                mem.push_back(a[i]);
                a[i] = a[i-1] = 0;
            }
        }
    }

    if(mem.size() >= 2){
        cout << mem[0]*mem[1] << endl;
    }
    else{
        cout << "0\n";
    }

}

Measured memory_bytes: 1660
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
char comm_char(string a,string b)
{
    if(a[0]==b[0])return a[0];
    if(a[1]==b[1])return a[1];
    if(a[1]==b[0])return a[1];
    if(a[0]==b[1])return a[0];
}
void solve()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll alp[3];
    int N;
    cin>>N>>alp[0]>>alp[1]>>alp[2];
    vector<string>op;
    for(int u=0;u<N;u++){
        string t;
        cin>>t;
        op.push_back(t);
    }
    ll sum=alp[0]+alp[1]+alp[2];
    char tbl[4]="ABC";
    vector<int>ans;
    if(sum==0){
        cout<<"No"<<"\n";
        return;
    }
    else 
    {
        for(int u=0;u<N;u++){
            int a=op[u][0]-'A',b=op[u][1]-'A';
            if(alp[a]==0&&alp[b]==0){
                cout<<"No"<<'\n';
                return;
            }
            else if(alp[a]==1&&alp[b]==1){
                if(u<N-1){
                    int c=comm_char(op[u],op[u+1])-'A';
                    alp[c]++;
                    if(c==a)alp[b]--;
                    else alp[a]--;
                    ans.push_back(c);
                }
                else {
                    alp[a]++,alp[b]--;
                    ans.push_back(a);
                }
            }
            else {
                if(alp[a]==0){
                    alp[a]++,alp[b]--;
                    ans.push_back(a);
                }
                else if(alp[b]==0){
                    alp[a]--,alp[b]++;
                    ans.push_back(b);
                }
                else {
                    if(alp[a]>alp[b]){
                        alp[a]--,alp[b]++;
                        ans.push_back(b);
                    }
                    else {
                        alp[a]++,alp[b]--;
                        ans.push_back(a);
                    }
                }
            }
        }
    }
    cout<<"Yes\n";
    for(auto c:ans)cout<<tbl[c]<<"\n";
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

Measured memory_bytes: 7436
import itertools
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(m)]
y = 0
s = []
for i in range(1, n):
  s.append(i+1)
for x in itertools.permutations(s):
  if [1, int(x[0])] in a:
      for i in range(n-2):
          if not [int(x[i]), int(x[i+1])] in a and not [int(x[i+1]), int(x[i])] in a:
            break
      else: y += 1
print(y)

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

using namespace std;

const int MAX = 10000000;
const int MOD = 1000000007;

long long finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    long long res = 1;
    for (int i = n; i >= n - k + 1; i--){
        res = res * i % MOD;
    }
    return res * finv[k] % MOD;
}

// a^n % m
long long modpow(long long a, long long n, long long m){
    long long res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
}

void solve() {
    COMinit();
    int n, a, b;
    cin >> n >> a >> b;
    long long ans;
    ans = (modpow(2, n, MOD) - 1 - COM(n, a) - COM(n, b)) % MOD;
    ans = (ans + 2 * MOD) % MOD;
    cout << ans << endl;
}
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 156544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
int n, m, c;
int b[25];
int a[25][25];
int ans;

int main() {
	cin >> n >> m >> c;
	for(int i = 1; i <= m; i++) cin >> b[i];
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) cin >> a[i][j];
	for(int i = 1; i <= n; i++) {
		int sum = 0;
		for(int j = 1; j <= m; j++) sum += b[j] * a[i][j];
		sum += c;
		if(sum > 0) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
from collections import Counter

M = 10 ** 9 + 7

def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    print(solve(a, n))

def solve(a, n):
    counter = Counter(a)

    if n % 2 == 0:
        for i in range(1, n, 2):
            if counter.get(i, None) != 2:
                return 0
    else:
        if counter.get(0, None) != 1:
            return 0
        for i in range(2, n, 2):
            if counter.get(i, None) != 2:
                return 0

    return modpow(2, n // 2, M)

def modpow(a, b, m):
    r = 1

    while b != 0:
        if b & 0x01:
            r = (r * a) % m
        a = (a * a) % m
        b >>= 1

    return r

main()


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

using namespace std;

int main(){
    int a,n,sum=0,x;
    scanf("%d%d",&a,&n);
    for(int i =1;i<=n;i++){
        scanf("%d",&x);
        sum+=x;
    }
    printf(sum>=a?"Yes":"No");


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
string k;
int div(int x)
{
	string sk(x,'0');
	sk = '1'+ sk;
	return stoi(sk);
}
void change()
{
	cin>>k;
	ll ks = ll(k.size());
	if(stoi(k)<1000){
		cout<<1000-stoi(k)<<"\n";
		return;
	}
	else{

		double tr = ceil(stod(k)/div(ks-1));
	    cout<<(tr*div(ks-1))-stoi(k)<<"\n";
	}
}
int main()
{
	change();
}

Measured memory_bytes: 3792
n,t = map(int,input().split())
a = list(map(int,input().split()))

max1 = [0] * n
max1[-1] = a[-1]

for i in range(1, n):
    max1[-i-1] = max(max1[-i], a[-i-1])

ans = 0
tmp = -1

for i in range(n):
    if max1[i] - a[i] > tmp:
        tmp = max1[i] - a[i]
        ans = 1
    elif max1[i] - a[i] == tmp:
        ans += 1

print(ans)


Measured memory_bytes: 20328
#include<bits/stdc++.h>
using namespace std;
int main(void){
string s,t;cin>>s>>t;
int n=s.length(),c,p=0;
char x[n+1],y[n+1];
strcpy(x,s.c_str());
strcpy(y,t.c_str());
while(p<n-1){
for(int i=0;i<n;i++){
    if(x[i]!=y[i])
        break;
    if(i==(n-1)){
        cout<<"Yes"<<endl;return 0;
    }}
for(int i=0;i<n;i++){
    if(i==(n-1))
        break;
    c=x[n-1];
    x[n-1]=x[i];
    x[i]=c;
}
p+=1;
}
for(int i=0;i<n;i++){
    if(x[i]!=y[i])
        break;
    if(i==(n-1)){
        cout<<"Yes"<<endl;return 0;
    }}
cout<<"No"<<endl;
return 0;}


Measured memory_bytes: 3632
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
edges = 0
nodes = 0
for i in range(1, N+1):
    nodes += i*(N-i+1)
for _ in range(N-1):
    u, v = mapint()
    if u>v:
        u, v = v, u
    edges += u*(N-v+1)

print(nodes-edges)
    

Measured memory_bytes: 73952
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  int res = 0;
  rep(i, 5){
    int x;
    scanf("%d", &x);
    if(x<40) x = 40;
    res += x;
  }
  printf("%d\n", res/5);
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MAXN = 200005;
using lint = long long;
using pi = pair<int, int>;

int n, chk[MAXN];
vector<pi> v;
pi a[MAXN];

int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%d %d",&a[i].first,&a[i].second);
		if(a[i].first > a[i].second) swap(a[i].first, a[i].second);
	}
	int sx = 1e9, sy = 1e9, ex = -1e9, ey = -1e9;
	for(int i=0; i<n; i++){
		sx = min(sx, a[i].first);
		sy = min(sy, a[i].second);
		ex = max(ex, a[i].first);
		ey = max(ey, a[i].second);
		v.push_back(pi(a[i].first, i));
		v.push_back(pi(a[i].second, i));
	}
	lint ans = 1ll * (ex - sx) * (ey - sy);
	sort(v.begin(), v.end());
	int e = 0, gap = 1e9, cnt = 0;
	for(int i=0; i<v.size(); i++){
		while(e < v.size() && cnt < n){
			if(!chk[v[e].second]){
				cnt++;
			}
			chk[v[e].second]++;
			e++;
		}
		if(cnt == n) gap = min(gap, v[e-1].first - v[i].first);
		chk[v[i].second]--;
		if(chk[v[i].second] == 0) cnt--;
	}
	ans = min(ans, 1ll * (v.back().first - v[0].first) * gap);
	cout << ans << endl;
}


Measured memory_bytes: 8048
#include<iostream>
#include<limits>
#define MAX 500000
#define SENTINEL 2000000000

int cnt ;
void merge( int A[], int left, int mid, int right )
{
    int i, j, k ;
    int n1, n2 ;

    n1 = mid - left ;
    n2 = right - mid ;

    int L[n1+1], R[n2+1] ;

    for( i = 0 ; i < n1 ; i++ )
        L[i] = A[left+i] ;
    for( i = 0 ; i < n2 ; i++ )
        R[i] = A[mid+i] ;

    L[n1] = SENTINEL ;
    R[n2] = SENTINEL ;

    i = 0 ;
    j = 0 ;
    for( k = left ; k < right ; k++ )
    {
        cnt++ ;
        if( L[i] <= R[j] )
        {
            A[k] = L[i] ;
            i++ ;
        }
        else
        {
            A[k] = R[j] ;
            j++ ;
        }
    }
}

void merge_sort( int A[], int left, int right )
{
    if( left + 1 < right )
    {
        int mid = (left+right)/2 ;
        merge_sort(A, left, mid) ;
        merge_sort(A, mid, right ) ;
        merge(A, left, mid, right ) ;
    }
}

int main() 
{
    int S[MAX], n, i ;
    cnt = 0 ;

    std::cin >> n ;
    for( i = 0 ; i < n ; i++ )
        std::cin >> S[i] ;

    merge_sort(S, 0, n) ;
    for( i = 0 ; i < n ; i++ )
    {
        if(i)
            std::cout << " " ;
        std::cout << S[i] ;
    }
   
    std::cout << std::endl ;

    std::cout << cnt << std::endl ;

    
}



Measured memory_bytes: 6976
#include <stdio.h>

int n,a[20];

int solve(int sum,int p,int key){
  if(sum > key || p == n+1){
    return 0;
  }

  if(sum == key){
    return 1;
  }

  if(solve(sum+a[p],p+1,key)){
    return 1;
  }

  if(solve(sum,p+1,key)){
    return 1;
  }

  return 0;
}

int main(){
  int i,q,key;
  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d" ,a + i);
  }

  scanf("%d" ,&q);
  while(q--){
    scanf("%d" ,&key);
    if(solve(0,0,key)){
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }

  return 0;
}

Measured memory_bytes: 580
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;
#define N 100000
int main(void){
    int n;
    cin>>n;
    int num[N]={};
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        num[a]++;
    }
    bool ok=true;
    //nが偶数
    if(n%2==0){
        for(int i=n-1;i>=1;i-=2){
            if(num[i]!=2)ok=false;
        }
    //nが奇数
    }else{
        for(int i=n-1;i>=2;i-=2){
            if(num[i]!=2)ok=false;
        }
        if(num[0]!=1)ok=false;
    }
    ll ans=1;
    if(ok==false){
        printf("0\n");
        return 0;
    }else{
        if(n%2){
            for(int i=0;i<(n-1)/2;i++){
                ans*=2;
                ans%=MOD;
            }
        }else{
            for(int i=0;i<n/2;i++){
                ans*=2;
                ans%=MOD;
            }
        }
        cout<<ans<<endl;
        return 0;
    }
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll n,m,ans=0,c=1;
    cin>>n>>m;
    while(m>c){
        ans++;
        c--;
        c+=n;
    }
    cout<<ans el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


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

int sigma(int k)
{
	if (k == 1)
		return 1;
	else
		return k + sigma(k-1);
}

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

	int depth = 0;
	int i;
	for (i = 1; i <= 999; i++) {
		if (sigma(i) - a == sigma(i+1) - b)
			break;
	}

	printf("%d\n", sigma(i) - a);

	return 0;
}


Measured memory_bytes: 128
n=int(input())
h=[int(i) for i in input().split()]

dp=[]
dp.append(0)
dp.append(abs(h[1]-h[0]))
for i in range(2,n):
    x=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))
    dp.append(x)
print(dp[-1])


Measured memory_bytes: 89780
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
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; }

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

int main(){
    int n; cin >> n;
    string s; cin >> s;

    int x=0, max=0;
    for(char c: s){
        if(c=='I'){
            x++;
            if(x>max) max=x;
        }
        else{
            x--;
        }
    }
    out(max);
}

Measured memory_bytes: 3636
N, M = map(int, input().split())

result = [-2] * N
edge_from = [[] for _ in range(N)]
edge_to = [[] for _ in range(N)]

for _ in range(N - 1 + M):
    A, B = map(int, input().split())
    edge_from[B-1].append(A-1)
    edge_to[A-1].append(B-1)

parent = []
for i in range(N):
    if len(edge_to[i]) > 0 and len(edge_from[i]) == 0:
        parent.append(i)
        result[i] = -1

while True:
    next_ = []
    for p in parent:
        for child in edge_to[p]:
            edge_from[child].remove(p)
            if len(edge_from[child]) == 0:
                result[child] = p
                next_.append(child)
    if len(next_) == 0:
        break
    parent = next_.copy()

for x in result:
    print(x + 1)

Measured memory_bytes: 34644
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	unsigned long long p[m+1],y[m+1],x[m+1];
	for(int i=0;i<m;i++){
		cin>>p[i]>>y[i];
		x[i]=(p[i]<<47)+(y[i]<<17)+i;
	}
	sort(x,x+m);
	int c=1;
	y[(x[0]<<47)>>47]=c;
	for(int i=1;i<m;i++){
		if(x[i]>>47==x[i-1]>>47)
		   c++;
		else
		   c=1;
		y[(x[i]<<47)>>47]=c;
	}
	for(int i=0;i<m;i++){
		x[i]=p[i]*1000000+y[i];
		printf("%012lu\n",x[i]);
	}
	return 0;
}


Measured memory_bytes: 3840
res = 0
minS = 10
for i in range(5):
  N = int(input())
  s = N % 10
  t = N // 10
  if s == 0:
    res = res + t * 10
  else:
    minS = min(minS, s)
    res = res + (t + 1)*10
if minS != 10:
  minS -= 10
else:
  minS = 0
print(minS + res)

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

int main() {
    string s;
    cin >> s;
    int index;
    rep(i,s.size()) {
        if(s[i]=='A') { index = i; break;}
    }
    int index2;
    for(int i = s.size()-1; i >= 0; --i){
        if(s[i]=='Z') {index2 = i; break;}
    }
    int ans = index2 - index + 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3688
#include<iostream>
#include<cmath>
using namespace std;
int d[105];
int e;
int main(void)
{
    int n,sum=0,cnt=0,mn=1000000;
    cin >> n;
    for(int i=0;i<n;i++)
    {
         cin >> d[i];
         sum+=d[i];
    }
    for(int i=0;i<n;i++)
    {
        cnt+=d[i];
        e=abs(sum-2*cnt);
        mn = min(e,mn);
    }
    cout << mn;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n,k;
  cin >> n>> k;
  double a[n];
  for(ll i=0;i<n;i++)cin >> a[i];
  /*priority_queue<pair<double,ll>, vector<pair<double,ll>>, less<pair<double,ll>>> b;
  double c[n];
  for(ll i=0;i<n;i++)c[i]=1;
  for(ll i=0;i<n;i++)b.push({a[i],i});

  bool owari=false;
  ll s=0;
  for(ll i=0;i<n;i++)s+=a[i];
  if(s<=k){
    cout << 1 << endl;
    return 0;
  }

  //cout << b.top().first << endl;

  for(ll i=0;i<k;i++){
    pair<double,ll> v=b.top();
    //cout << v.first << " " << v.second << endl;
    b.pop();
    if(v.first<1){
      owari=true;
      break;
    }
    c[v.second]+=1;
    v.first=a[v.second]/c[v.second];
    //cout << v.first << " " << v.second << endl;
    b.push(v);

    //cout << b.top().first << " " << b.top().second << endl;
  }

  if(owari){
    cout << 1 << endl;
    return 0;
  }

  for(ll i=0;i<n;i++){
    a[i]/=c[i];
  }

  //for(ll i=0;i<n;i++)cout << a[i] << endl;

  double m=0;
  for(ll i=0;i<n;i++)m=max(m,a[i]);

  cout << (ll) ceil(m) << endl;*/

  ll r=(ll)pow(10,9);
  ll l=0;
  ll h=(r+l)/2;
  while(abs(r-l)>1){
    double hp=h;
    ll s=0;
    for(ll i=0;i<n;i++)s+=ceil(a[i]/hp)-1;
    if(s<=k){
      r=h;
    }
    else{
      l=h;
    }
    h=(r+l)/2;
  }

  cout << r << endl;



  // printf("%lf",ceil(m)); 


}

Measured memory_bytes: 5240
#include<iostream>
#include<algorithm>
using namespace std;
long long b[3];
int main ()
{
	cin>>b[0]>>b[1]>>b[2];
	sort(b, b+3);
	if(b[0]%2 == 0 || b[1]%2==0 || b[2]%2 == 0)	cout<<0<<endl;
	else
	{
		cout<<b[0]*b[1]<<endl;
	} 
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    char s[10];
    for(int i = 0; i < 6; i++) {
        scanf("%c", &s[i]);
    }
    if(s[2] == s[3] && s[4] == s[5]) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 128
a, b, c, d = gets.split.map(&:to_i)

b_cmod = b / c
b_dmod = b / d
b_cdmod = b / c.lcm(d)
bb = b_cmod + b_dmod - b_cdmod
# bt = b - b_cmod - b_dmod + b_cdmod

a_cmod = (a - 1) / c
a_dmod = (a - 1) / d
a_cdmod = (a - 1) / c.lcm(d)
aa = a_cmod + a_dmod - a_cdmod
# at = a - a_cmod - a_dmod + a_cdmod

# puts aa
# puts bb

# puts bt - at

puts b - a  + 1 - bb + aa

# puts b - a - bt + at

Measured memory_bytes: 1788
a,b,c=map(int,input().split())

uhen=c-a-b

ans=True

if(uhen<=0):
    ans=False
else:
    uhen=uhen*uhen
    sahen=4*a*b
    if(sahen<uhen):
        ans=True
    else:
        ans=False

if(ans):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38496
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int dx[] = { -1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};


int main() {

	long long  n, k; cin >> n >> k;
	//~logk(n)+1
	long long  ans = floor(log2(n) / log2(k)) + 1;
	cout << ans;

	return 0;
}

Measured memory_bytes: 3352
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    bool is_used[30] = {false};
    int n;
    
    rep(i,0,28){
        cin >> n;
        is_used[n-1] = true;
    }
    
    rep(i,0,30){
        if(!is_used[i]){
            cout << i+1 << endl;
        }
    }
    
    return 0;
    
}


Measured memory_bytes: 3108
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m,x,y,z,len,vis[500010],dist[500010],lst[500010];
vector <int> all[1000010],g2[500010];
vector <pii> g[500010];
queue <int> q;

int main()
{
	cin>>n>>m;
	len=n;
	rep(i,m)
	{
		scanf("%d%d%d",&x,&y,&z);
		g[x].pb(mpr(z,y));
		g[y].pb(mpr(z,x));
		all[z].pb(x);
		all[z].pb(y);
	}
	repn(i,n) sort(g[i].begin(),g[i].end());
	repn(i,1e6)
	{
		if(all[i].size()==0) continue;
		rep(j,all[i].size())
		{
			if(vis[all[i][j]]==i) continue;
			q.push(all[i][j]);
			vis[all[i][j]]=i;
			vector <int> v;
			v.clear();
			v.pb(all[i][j]); 
			while(!q.empty())
			{
				int t=q.front();
				q.pop();
				while(lst[t]<g[t].size())
				{
					//if(i==2) cout<<j<<' '<<all[i].size()<<endl;
					if(g[t][lst[t]].fi!=i) break;
					if(vis[g[t][lst[t]].se]!=i)
					{
						vis[g[t][lst[t]].se]=i;
						q.push(g[t][lst[t]].se);
						v.pb(g[t][lst[t]].se);
					}
					lst[t]++;
				}
			}
			len++;
			rep(k,v.size())
			{
				g2[len].pb(v[k]);
				g2[v[k]].pb(len);
			}
		}
	}
	rep(i,500005) dist[i]=-2;
	dist[1]=0;
	q.push(1);
	while(!q.empty())
	{
		int t=q.front();
		q.pop();
		rep(i,g2[t].size())
		{
			if(dist[g2[t][i]]>-2) continue;
			dist[g2[t][i]]=dist[t]+1;
			q.push(g2[t][i]);
		}
	}
	cout<<dist[n]/2<<endl;
	return 0;
}

Measured memory_bytes: 73088
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ll c = n / i;
		ans += c * (c + 1) / 2 * i;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3648
is_prime=[True for i in range(1000000+1)]
is_prime[0]=is_prime[1]=False
for i in range(2,1000):
	if not is_prime[i]:
		continue
	for j in range(2,int(1000000/i)+1):
		is_prime[i*j]=False
cnt=0
primepi=[0 for i in range(1000000)]
for i in range(1000000):
	if is_prime[i]:
		cnt+=1
	primepi[i]=cnt

while True:
	try:
		n = int(input())
	except EOFError:
		break
	print(primepi[n])


Measured memory_bytes: 23572