akhauriyash/Code-Regression huggingface dataset:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n,k = I()
a = l()
p = list(set(a))

for i in range(n-1):
    for j in range(i+1, n):
        if a[i]>a[j]:
            ans += ((k+1)*k//2)
        elif a[i] < a[j]:
            ans += ((k-1)*k//2)

print(ans%mod)


Measured memory_bytes: 10656
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______      
 * |\  \|\  \  |\  ___ \  |\  ___ \     
 * \ \  \/  /|_\ \   __/| \ \   __/|    
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__  
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \ 
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int N;
	cin>>N;
	vector<int> a(N);
	for(int i = 0;i < N;i++) {
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	int res = 0;
	for(int i = 0;i < N;) {
		int j = i;
		while(j < N && a[j] == a[i])
			j++;
		res += j - i - 1;
		i = j;
	}
	cout<<N - (res+1)/2 * 2<<'\n';
	return 0;
}
/**/


Measured memory_bytes: 640
#editorial参照

import sys
from collections import deque
sys.setrecursionlimit(200000)

n,m = map(int, input().split( ))
G = [[] for _ in range(n)]

for _ in range(m):
    a,b = map(int, input().split( ))
    a-=1;b-=1
    G[a].append(b)
    G[b].append(a)

if m&1:
    print(-1)
    sys.exit()

Tr = [0]*n#k木に属しているか
Q = deque()
Q.append(0)
Tr[0] = 1
TrE = [[] for _ in range(n)]
P = [-1]*n#親
Leaf = []
while Q:
    v = Q.popleft()
    leaf_v = True
    for u in G[v]:
        if not Tr[u]:
            Tr[u] = 1
            P[u]=v
            TrE[v].append(u)
            Q.append(u)
            leaf_v = False
    if leaf_v:
        Leaf.append(v)

out = [0]*n
D = set()             
for v in range(n):
    for u in G[v]:
        if (u,v) not in D and P[v]!=u and P[u]!=v:
            D.add((v,u))
            out[v]^=1
            

"""
幅優先探索で葉から辿ったところ、
すべての子を考慮する前にpのdegreeが決まってしまっている。
深さ優先探索に修正
"""
def dfs(x = 0, parent = -1):
    for y in TrE[x]:
        if y == parent:
            continue
        dfs(y,x)
        if out[y]:
            D.add((y,x))
            out[y] ^= 1
        else:
            D.add((x,y))
            out[x] ^= 1
 
dfs()

for u,v in D:
    print(u+1,v+1)


Measured memory_bytes: 169120
#include <iostream>
    #include <string>
    #include <vector>
    #include <algorithm>
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int a,b;
        string s;
        cin >> a >> b >> s;
        int sum = a+b+1;
        string ans = "Yes";
        if(s.length()!=sum){
            ans = "No";
        }
        if(s.substr(a,1)!="-"){
            ans = "No";
        }
        bool flag = false;
        for(int i=0;i<sum;i++){
            if(i!=a){
                flag = false;
                for(int j=0;j<=9;j++){
                    string num = to_string(j);
                    if(s.substr(i,1)==num){
                        flag=true;
                    }
                }
                if(flag == false){
                    ans="No";
                    break;
                }
            }
        }
        cout << ans << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
  
#define mp make_pair

#define ll long long
#define pb push_back
  
using namespace std;
/*
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  */
const int inf = 2e9+7, mod=1e9+7;
const int N = 2e6;

int ans=0;

int used[N];
 
int xx[8]={1, 1, -1, -1, 2, 2, -2, -2};
int yy[8]={2, -2, 2, -2, 1, -1, 1, -1};

vector <double> g;

int main(){
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
	int n;
	cin >> n ;
	double sum1=0, s=1, d[4000][2000];
	for(int i=0;i<n; i++){
		double a;
		cin >> a;
		g.pb(a);
		s*=a;
	}
	d[0][0]=g[0];
	d[0][1]=1-g[0];
	for(int i=1; i<n; i++){
		for(int j=0; j<=n/2; j++){
			d[i][j]=d[i-1][j]*g[i];
			if(j>0)
				d[i][j]+=d[i-1][j-1]*(1-g[i]);	
		}
	}		
	sum1=0;
	for(int i=0; i<=n/2; i++){
		sum1+=d[n-1][i];	
	}
	cout << fixed;

	cout.precision(10);
	cout << sum1;
	return 0;
}



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

using namespace std;

typedef long long ll;

int main() {
  int n; cin >> n;
  vector <ll> a(n + 1);
  ll sum = 0;
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ll ans = 1e18;
  ll cur = 0;
  for(int i = 1; i <= n; i++) {
    cur += a[i];
    ll L = cur;
    ll R = sum - cur;
    ans = min(ans, abs(L - R));
  }
  cout << ans << '\n';
}

Measured memory_bytes: 1792
<?php
list($n,$m)=explode(' ',trim(fgets(STDIN)));

$a=[];
for($i=0;$i<$n;$i++)$a[$i]=explode(' ',trim(fgets(STDIN)));

$b=[];
for($i=0;$i<$m;$i++)$b[$i]=trim(fgets(STDIN));
 
$o='';
for($i=0;$i<$n;$i++){
  $c=0;
  for($j=0;$j<$m;$j++) $c+=$a[$i][$j]*$b[$j];
  $o.=$c.PHP_EOL;
}
print $o;

Measured memory_bytes: 17200
import java.util.*;

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

        String s = sc.next();

        if (s.equals("SUN")){
            System.out.println(7);
        }else if (s.equals("MON")){
            System.out.println(6);
        }else if (s.equals("TUE")){
            System.out.println(5);
        }else if (s.equals("WED")){
            System.out.println(4);
        }else if (s.equals("THU")){
            System.out.println(3);
        }else if (s.equals("FRI")){
            System.out.println(2);
        }else if (s.equals("SAT")){
            System.out.println(1);
        }else {
            return;
        }


    }
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int a,b, ans = 0; cin >> a >> b;
	if(b>a) swap(a,b);
	ans += a;
	--a;
	if(b>a) swap(a,b);
	ans += a;
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3604
#121 b
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[]
for i in range(n):
    x=list(map(int,input().split()))
    a.append(x)
ans=0
for i in range(n):
    s=0
    for j in range(m):
        s+=a[i][j]*b[j]
    s+=c
    if s>0:
        ans+=1
print(ans)

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

namespace TEST
{
    class Program
    {
        static void Main(string[] args)
        {

            int a = int.Parse(Console.ReadLine());
            //string[] bc = Console.ReadLine().Split(' ');
            string s = Console.ReadLine();

            string ans = "red";
            if (a >= 3200)
            {
                ans = s;
            }

            // メッセージの出力
            Console.WriteLine(ans);
        }
    }
}


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


using namespace std;
vector<int>v[100005];
int get_sg(int u, int pre)
{
    int ret = 0;
    for(int i = 0; i < v[u].size(); i++)
    {
        if(v[u][i] != pre)
            ret ^= (1 + get_sg(v[u][i], u));
    }
    return ret;
}
int main()
{
    int  n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        v[i].clear();
    for(int i = 1; i < n; i++)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    if(get_sg(1, -1))
        puts("Alice");
    else
        puts("Bob");
    return 0;
}


Measured memory_bytes: 11904
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;

ll X;

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

  ll n = 0, sum = 0;

  while( sum < X )
  {
    ++n;
    sum += n;
  }

  std::cout << n << std::endl;

  return 0;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

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

void solve() {
  string S;
  cin >> S;
  int N = S.size();
  vi A(N + 1, 0), B(N + 1, 0);
  for (int i = 0; i < N; i++) {
    if (S[i] == '<') {
      A[i + 1] = A[i] + 1;
    }
  }
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '>') {
      B[i] = B[i + 1] + 1;
    }
  }
  ll ans = 0;
  for (int i = 0; i < N + 1; i++) {
    ans += max(A[i], B[i]);
  }
  cout << ans << endl;
}

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

  solve();

  return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  string s;cin>>s;
  map<char,ll>mp;
  ll n=s.size();
  each(e,s){
    mp[e]++;
  }

  ll ma=0,mi=INF;
  each(e,mp){
    chmax(ma,e.second);
    chmin(mi,e.second);
  }

  if(ma-mi<=1){
    if(mp.size()>=3||(mp.size()==1&&s.size()==1)||(mp.size()==2&&ma==1))out("YES");
    // if(mp.size()>=ma)out("YES");
    else out("NO");
  }else out("NO");


  // priority_queue<pair<ll,char> >pq;
  // each(e,mp){
  //   out(e.first<<":"<<e.second);
  //   pq.push(P(e.second,e.first));
  // }
  // string t="";
  // while(!pq.empty()){
  //   pair<ll,char>p=pq.top();pq.pop();
  //   t.insert(t.end(),p.second);
  //   if(p.first-1!=0)pq.push(P(p.first-1,p.second));
  //   else{
  //     if(pq.size())
  //   }
  // }
  // out(t);
  // each(e,mp)out(e.first<<":"<<e.second);

  // if()out("YES");
  // else out("NO");


  return 0;
}


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

ll solve( vector<int> &weights, vector<int> &values, int ind, int W, vector<vector<ll> > &memo ) {

    if( W < 0 )
        return INT_MIN;

    if( ind == weights.size() || W == 0 )
        return 0;

    if( memo[ind][W] != -1 )
        return memo[ind][W];

    ll ret = 0;
    ret = max( ret, values[ind]+solve(weights, values, ind+1, W-weights[ind], memo) );
    ret = max( ret, solve(weights, values, ind+1, W, memo) );
    
    return memo[ind][W] = ret;
}

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

    int N, W;
    cin>>N>>W;

    vector<int> weights(N,0);
    vector<int> values(N,0);
    for( int i=0;i<N; i++ ) {
        cin>>weights[i]>>values[i];
    }

    vector<vector<ll> > memo(N, vector<ll> (W+1, -1));

    cout<<solve(weights, values, 0, W, memo)<<endl;
    
    
}

Measured memory_bytes: 79488
# ARC095C - Many Medians (ABC094C)
def main():
    n = int(input())
    x = list(map(int, input().rstrip().split()))
    sort_x = sorted(x)
    l, h = sort_x[n // 2 - 1], sort_x[n // 2]
    for i in x:
        if i <= l:
            print(h)
        else:
            print(l)


if __name__ == "__main__":
    main()

Measured memory_bytes: 25620
ss1, ss2, ss3 = map(str, input().split())

s1 = ss1[0]
s2 = ss2[0]
s3 = ss3[0]

t1 = s1.upper()
t2 = s2.upper()
t3 = s3.upper()

print(t1 + t2 + t3)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n,k;cin>>n>>k;
    int x[n];
    rep(i,0,n)cin>>x[i];
    int ans=1000000000;
    rep(i,0,n-k+1){
        Min(ans,min(abs(x[i]),abs(x[i+k-1]))+x[i+k-1]-x[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
import java.util.*;
import java.math.*;
class Main{
    int w,h;
    char[][] map;
    String[][] dp;
    void run(){
	Scanner sc= new Scanner(System.in);
	while(true){
	    w=sc.nextInt();
	    h=sc.nextInt();
	    if((w|h)==0)break;
	    map=new char[h+1][w+1];
	    dp=new String[h+1][w+1];	   
	    
	    for(int i=0;i<h+1;i++){
		Arrays.fill(dp[i],"");
	    }
	    BigInteger max=new BigInteger("0");
	    for(int i=0;i<h;i++){
		map[i]=(sc.next()+"A").toCharArray();
	    }
	    for(int i=h-1;i>=0;i--){
		for(int j=w-1;j>=0;j--){
		    if(Character.isDigit(map[i][j])){
			dp[i][j]=(map[i][j]+compare(dp[i+1][j],dp[i][j+1]));
			BigInteger temp=new BigInteger(dp[i][j]);
			if(temp.compareTo(max)>0)max=temp;
		    }
		}
	    }
	    
	    System.out.println(max);
	}
    }
    String compare(String a,String b){
	if(a.length()>b.length())return a;
	else if(a.length()<b.length())return b;
	else {
	    if(a.compareTo(b)>0)return a;
	    else return b;
	}
    }
    public static void main(String[] args){
	new Main().run();
    }
}

Measured memory_bytes: 13000
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N, C;
    cin >> N >> C;
    ll d[C][C];
    ll c[N][N];
    for(ll i = 0; i < C; i++) for(ll j = 0; j < C; j++) cin >> d[i][j];
    for(ll i = 0; i < N; i++) for(ll j = 0; j < N; j++) cin >> c[i][j];
    ll sum[C][3];
    for(ll i = 0; i < C; i++) for(ll j = 0; j < 3; j++) sum[i][j] = 0;
    for(ll i = 0; i < N; i++){
        for(ll j = 0; j < N; j++){
            ll po = (i + j + 2) % 3;
            for(ll k = 0; k < C; k++) sum[k][po] += d[c[i][j] - 1][k];
        }
    }
    ll ans = 1145148931919810;
    for(ll i = 0; i < C; i++) for(ll j = 0; j < C; j++) for(ll k = 0; k < C; k++){
        if(i == j || j == k || k == i) continue;
        ans = min(sum[i][0] + sum[j][1] + sum[k][2], ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
ull a,b;
cin>>a>>b;
int ans=0;

while(1)
{
	if(a>b)
	break;
	ans++;
	a*=2;
}
ol(ans);
return 0;
}



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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;

int dp[101];
int main() {
  ll K,S; cin >> K >> S;
  int cnt,z;
  rep(x, K+1) {
    rep(y, K+1) {
      z = S - x - y;
      if (z >= 0 && z <=K) cnt++;
    }
  }
  dump(cnt);
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>

using namespace std;
const long long int MOD=1e9+7;

long long int n, m;
priority_queue<long long> Q;

int main(){
  cin >> n >> m;
  for(int i=0;i<n;i++){
    long long int a;
    cin >> a;
    Q.push(a);
  }
  for(int i=0;i<m;i++){
    long long tp = Q.top();Q.pop();
    Q.push(tp/2);
  }
  long long sm=0;
  while(!Q.empty()){
    sm+=Q.top();Q.pop();
  }
  cout << sm << endl;
}


Measured memory_bytes: 1528
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit

void solve() {
    ll N, K;
    cin >> N >> K;

    vector<int> A(N), B(N);
    REP(i, N){
        cin >> A[i];
        A[i]--;
        B[i] = A[i];
    }
    
    int tapi = 0;
    while(K > 0){
        if(K % 2){
            tapi = B[tapi];
        }
        vector<int> C = B;
        for(int i = 0; i < N; ++i){
            B[i] = C[C[i]];
        }
        
        K >>= 1;
    }
    
    cout << tapi + 1 << endl;

}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a+b>c+d)
  {
    cout << "Left" << endl;
  }
  else if(a+b<c+d)
  {
    cout << "Right" << endl;
  }
  else
  {
    cout << "Balanced" << endl;
  }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=1;i<n;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) REP(i,v.size())cout<<#v<<"["<<i<<"]: "<<v[i]<<endl
#define ALL(a) (a).begin(),(a).end()

ll gcd(ll a,ll b){
  ll c;
  while(a!=0){
    c=a;
    a=b%a;
    b=c;
  }
  return b;
}

int main(){
  ll T;
  cin>>T;
  REP(_t,T){
    ll h,w;
    cin>>h>>w;
    if(h==w){
      cout << "1 0" << endl;
      continue;
    }
    if(h%2==0 || w%2==0){
      cout << "1 1" << endl;
      continue;
    }
    ll g = gcd(h,w);
    h /= g;
    w /= g;
    ll tot = h*w;
    ll first = tot/2;
    first += 1;
    ll second = tot-first;
    cout << first << " " << second << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
constexpr int INF = (numeric_limits<int>::max() == INT_MAX ? (int)1e9 : (long long)1e18);
constexpr long double eps = 1e-6;
const string el = "\n";
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;using pii = pair<int,int>;using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void fast_io(){ios::sync_with_stdio(false); cin.tie(nullptr);}
int out(int a){cout << a << el; return 0;}
int out(string s = "NO"){cout << s << el; return 0;}
template <class T>
inline int out(vector<T>&v,string c = " "){
    for(int i = 0; i < v.size(); ++i){
        if(i) cout << c; cout << v[i];
    } cout << el;return 0;
}
signed main(){
    fast_io();
    int N; cin >> N;
    string s,t;
    cin >> s >> t;
    int l = s.size() + t.size();
    for(int i = 1; i <= t.size(); ++i){
        auto tt = t.substr(i);
        auto st = s + tt;
        if(st.find(s) != string::npos and st.find(t) != string::npos and st.size() >= N)
            cmin(l,(int)st.size());
    }
    out(l);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 60;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }

int main() {
  int n, m; cin>>n>>m;
  vector<vector<long long>> dp(1010, vector<long long>(1<<n, LLINF));
  dp[0][0] = 0;
  REP(i, 1, m+1) {
    int a, b; cin>>a>>b;
    int bit = 0;
    rep(j, b) {
      int c; cin>>c;
      --c;
      bit += 1<<c;
    }
    rep(j, 1<<n) {
      dp[i][j] = min(dp[i][j], dp[i-1][j]);
      if (dp[i-1][j] != LLINF) {
        dp[i][j|bit] = min(dp[i][j|bit], dp[i-1][j] + a);
      }
    }
  }
  long long ans = dp[m][(1<<n)-1];
  if (ans == LLINF) print(-1);
  else print(ans);

  return 0;
}


Measured memory_bytes: 32640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int L,R,d;
    int ans = 0;
    cin >> L >> R >> d;
    reps(i,L,R+1){
        if(i%d==0) ans++;
    }
    cout << ans << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 3005;
const int MOD = 998244353;

int a, b, c, d, i, j, res[N][N], sub;

int main() {
scanf("%d %d %d %d", &a, &b, &c, &d);
res[a][b] = 1;
for (i=a+1;i<=c;i++) res[i][b] = (res[i - 1][b] * 1LL * b) % MOD;
for (j=b+1;j<=d;j++) res[a][j] = (res[a][j - 1] * 1LL * a) % MOD;
for (i=a+1;i<=c;i++) for (j=b+1;j<=d;j++) {
	res[i][j] = (res[i - 1][j] * 1LL * j) % MOD;
	res[i][j] = (res[i][j - 1] * 1LL * i + res[i][j]) % MOD;
	sub = (res[i - 1][j - 1] * 1LL * (i - 1)) % MOD;
	sub = (sub * 1LL * (j - 1)) % MOD;
	res[i][j] = (res[i][j] + MOD - sub) % MOD;
}
printf("%d\n", res[c][d]);
return 0;
}

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


int main()
{
    int n;
    int count=1;
    int pc,qc;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    vector<int> o(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    rep(i,n) o[i]=i+1;
    do{
        if(o==p) pc=count;
        if(o==q) qc=count;
        count++;
    }while (next_permutation(o.begin(),o.end()));
    cout << abs(pc-qc) << endl;
    return 0;
}

    

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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    rep(i, N / 7 + 1) {
        if ((N - i * 7) % 4 == 0) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
using namespace std;
int main(){
      string want,i;
      cin >> want;
      int n,m,l=0;
      cin >> n;
        for(int a=0;a<n;a++){
         i="0";
         cin >> i;
         i=i+i;
         m=i.find(want);
         if(m>=0)
             l++;
      }
     cout << l << endl;
     return 0;
}
          

Measured memory_bytes: 1212
N = int(input())
T,X,Y = [0],[0],[0]
a = 1
for n in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

for m in range(N):
    dt = T[m+1]-T[m]
    ds = abs(X[m+1]-X[m]) + abs(Y[m+1]-Y[m])
    if dt < ds:
        a = 0
    if dt%2 != ds%2:
        a = 0

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

Measured memory_bytes: 11764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  ll a,b,k;cin>>a>>b>>k;
  ll t = min(a,k);
  a -=t;
  k-=t;
  t=min(b,k);
  b-=t;
  cout<<a<<' '<<b<<endl;

  
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll n,m; cin >> n >> m;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	map<int,int> mp;
	ll ans=0,res=0;
	mp[0]++;
	for(int i=0;i<n;i++){
		(res+=a[i])%=m;
		ans+=mp[res];
		mp[res]++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//int cnt[100];
//int cnt1[100];
int main () {
//ll t; cin>>t; while(t--)
int n; cin>>n;
if(n==1) cout<<0<<endl;
else cout<<1<<endl;

return 0;
}


Measured memory_bytes: 3628
#input
N = int(input())

#output
#ある整数nの素因数を列挙
import math
from collections import Counter
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def sub_div(n, k):
    if k == 1:
        return n
    while n >= k:
        if n % k == 0:
            n = n//k
        else:
            n = n % k
    return n

a = Counter(prime_factors(N))
b = Counter(prime_factors(N-1))
c = make_divisors(N)

answer = 1
for value in b.values():
    answer *= (value+1)

answer -= 1

for x in c:
    if sub_div(N, x) == 1:
        answer += 1

print(answer)

Measured memory_bytes: 3696
import java.io.PrintWriter
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.floor

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = sc.nextLong()
    var a: Long = 0L
    var b: Long = 0L
    for(i in -150L until 150L){
        for(j in -150L until 150L){
            if(i*i*i*i*i - j*j*j*j*j == x) {
                a=i
                b=j
            }
        }
    }

    println("$a $b")
}

fun abc000a(n:String) {
}


fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



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

int main() {
    int X;
    cin >> X;

    int K = 0;
    int rad = 0;

    while (1) {
        rad += X;
        rad %= 360;
        K++;
        if (rad == 0) {
            break;
        }
    }

    cout << K << endl;

    return 0;
}


Measured memory_bytes: 3632
def main():
  s1 =input()
  s2 =input()
    
  cnt = 0
      
  if s1 == s2:
    print('0')
  else:
    for c1,c2 in zip(s1, s2):
      if c1 != c2:
        cnt += 1
                  
    print(cnt)
                  
if __name__ == '__main__':
    main()

Measured memory_bytes: 9284
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n, n){
    vi a(n);
    int ans = -INF;
    REP(i, n) cin >> a[i];
    REP(i, n){
      int sum = 0;
      REPS(j, i, n){
        sum += a[j];
        ans = max(ans, sum);
      }
    }
    print(ans);
  }

  return (0);
}

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

int main() {
  map<int, int> mp;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    mp[a]++;
  }
  int ans = 0;
  for (auto it : mp) {
    if (it.first > it.second) {
      ans += it.second;
    } else if (it.first < it.second) {
      ans += it.second - it.first;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4736
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", function (chunk) {
    var input = chunk.trim().split(/\s+/).map(Number);

    var k = input[0];
    var l = input[1];
    var r = input[2];
    p = input[3];
    e = input[4];
    t = input[5];

    console.log(solve(k, r, l).toFixed(6));
});

var p, e, t;

function solve(k, r, l) {
    var h = (r + l) / 2.0;

    if (k == 0) {
        if (Math.abs(t - h) < e)
            return 1.0;
        else
            return 0.0;
    }

    if (r < t - e || t + e < l)
        return 0.0;
    else if (t - e <= l && r <= t + e)
        return 1.0;

    if (h <= t)
        return p * solve(k - 1, h, l) + (1.0 - p) * solve(k - 1, r, h);
    else
        return p * solve(k - 1, r, h) + (1.0 - p) * solve(k - 1, h, l);
}

Measured memory_bytes: 15580
#include <iostream>

using namespace std;

int main()
{
    double a,b,c;
    scanf("%lf%lf%lf",&a,&b,&c);
    double time = a/c;
    if(time > b) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int a,b,c;
  cin >> a >> b>>c;
  int m = min({abs(a - b) + abs(b - c),
              abs(a - c) + abs(b - c),
              abs(b - a) + abs(a - c)});
  cout << m << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
    long long a,b,x;
    cin >> a >> b >> x;

    b /= x;
    b++;
   
    if(a == 0)a = 0;
    else if(a < x)a = 1;
    else {
        a--;
        a /= x;
        a++;
    }

    cout << b - a << endl;
    
     
    return 0;
}

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

int main(void){
	char N[101];
	int n = 0;
	int i,j;
	
	char Roma[7] = {'I','V','X','L','C','D','M'};
	
	while(scanf("%s",N) != EOF){
		n = 0;
		for(i = 0;i < strlen(N);i++){
			int flag = -1;
			switch(N[i]){
				case 'I':
					for(j = 0;j <= 0;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*1;
					break;
				case 'V':
					for(j = 0;j <= 1;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*5;
					break;
				case 'X':
				
					for(j = 0;j <= 2;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*10;
					break;
				case 'L':
				
					for(j = 0;j <= 3;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*50;
					break;
				case 'C':
				
					for(j = 0;j <= 4;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*100;
					break;
				case 'D':
				
					for(j = 0;j <= 5;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*500;
					break;
				case 'M':
				
					for(j = 0;j <= 6;j++){
						if(N[i+1] == Roma[j]||N[i+1]=='\0'){
							flag = 1;
							break;
						}
					}
					n += flag*1000;
					break;
			}
		}
		
					printf("%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 536
#include <cstdio>

int alphabetnuical_merical_order(char);

int main(){
    int N;
    scanf("%d",&N);
    char S[N];
    scanf("%s",S);

    int max = 0;
    bool used[2][26];
    for(int i = 0; i <= N - 2; i++){
        for(int p = 0; p < 2; p++){
            for(int q = 0; q < 26; q++){
                used[p][q] = false;
            }
        }
        for(int j = 0; j <= i; j++){
            used[0][alphabetnuical_merical_order(S[j])] = true;
        }
        for(int j = N - 1; j > i; j--){
            used[1][alphabetnuical_merical_order(S[j])] = true;
        }
        
        int pmax = 0;
        for(int j = 0; j < 26; j++){
            if(used[0][j] == true && used[1][j] == true){
                pmax++;
            }
        }
        if(pmax > max){
            max = pmax;
        }
    }
    printf("%d\n",max);

    return 0;
}

int alphabetnuical_merical_order(char c){
    
    return (c - 'a');
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())

    if n == 0:
        print('0')
        exit()

    a = 0
    for i in range(1, 40, 2):
        a -= 2**i
    b = n - a
    res = []
    for i in range(40):
        if i%2 == 0:
            if (b>>i) & 1:
                res.append('1')
            else:
                res.append('0')
        else:
            if (b>>i) & 1:
                res.append('0')
            else:
                res.append('1')

    res = res[::-1]
    for i in range(40):
        if res[i] == '1':
            print(''.join(res[i:]))
            exit()

if __name__ == '__main__':
    main()

Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,l;
    string s;
    cin>>n>>l;
    vector<string>v;
    for(i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
    }
    sort(v.begin(),v.end());
    for(i=0;i<n;i++)
        cout<<v[i];
    cout<<endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9

ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

int main(){
    IOS;
    ll n,k;cin>>n>>k;
    ll a[n];f(i,0,n)cin>>a[i];
    ll ans[n];
    ans[0]=0;
    f(i,1,n){
        if(i==1)ans[i]=abs(a[i]-a[0]);
        else{ll x=INT_MAX;
            f(j,1,k+1){if(i-j>=0)x=min(ans[i-j]+abs(a[i]-a[i-j]),x);else break;}
            ans[i]=x;
            }
    }
  // f(i,0,n)cout<<ans[i]<<" ";cout<<endl;
    cout<<ans[n-1];
    return 0;
}   


Measured memory_bytes: 1792
import sys

input = sys.stdin.readline

INF = float("inf")


def warshall_floyd(n, d):
    for k in range(n):
        for i in range(n):
            d_ik = d[i][k]
            if d_ik == INF:
                continue
            for j in range(n):
                if d[i][j] > d_ik + d[k][j]:
                    d[i][j] = d_ik + d[k][j]


def main():
    H, W = map(int, input().split())
    c = [None] * 10
    for i in range(10):
        c[i] = list(map(int, input().split()))
    A = [None] * H
    for i in range(H):
        A[i] = list(map(int, input().split()))

    warshall_floyd(10, c)

    ans = 0
    for i in range(H):
        for j in range(W):
            if A[i][j] == -1:
                continue
            ans += c[A[i][j]][1]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3444
K,N = map(int, input().split())
A = list(map(int, input().split()))

max_a = 0
before_a = A[0]
for i in range(1, N):
    if A[i]-before_a > max_a:
        max_a = A[i]-before_a
    before_a = A[i]

if (K-A[N-1]+A[0]) > max_a:
    print(A[N-1]-A[0])
else:
    print(K-max_a)

Measured memory_bytes: 26420
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m,a,b,c;

	cin >> a >> b >> c >> k;
	x=0;
	x+=min(k,a),k-=min(k,a);
	k-=min(k,b);
	x-=k;
	cout<<x<<endl;
}

Measured memory_bytes: 3652