akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const lli mod = 998244353;

lli fm[310000];
lli fact(lli x) {
  if (fm[x] > 0) return fm[x];
  return fm[x] = x * fact(x - 1) % mod;
}

lli ipow(lli a, lli b) {
  lli x = a, y = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) y = y * x % mod;
    x = x * x % mod;
  }
  return y;
}

lli finv(lli x) {
  return ipow(fact(x), mod - 2);
}

lli conb(lli x, lli y) {
  return fact(x) * finv(y) % mod * finv(x-y) % mod;
}

lli n, a, b, k;

int main() {
  fm[0] = 1;

  cin >> n >> a >> b >>k;

  lli ans = 0;
  for (lli i = 0; i <= n; ++i) {
    lli x = a * i, y = k - x, j = (k - x) / b;
    if (y % b != 0 || j > n || x > k || y > k) continue;
    ans = (ans + conb(n, i) * conb(n, j) % mod) % mod;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 7296
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n, m = LI()
sc = LIR(m)
for i in range(10 ** n):
    if len(str(i)) != n:
        continue
    for s, c in sc:
        if str(i)[s - 1] != str(c):
            break
    else:
        print(i)
        exit()
else:
    print(-1)


Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int k;
  cin >> s >> k;
  int n = s.size();
  vector<string> v = {};
  int MAX = min(5, n) + 1;
  for(int i = 1; i < MAX; i++){
    for(int j = 0; j < n - i + 1; j++){
      v.push_back(s.substr(j, i));
    }
  }
  sort(v.begin(), v.end());
  unique(v.begin(), v.end());
  cout << v[k - 1] << endl;
  return 0;
}

Measured memory_bytes: 1660
//coded by: pranonrahman-------------------------------------
//-----------------------------------------------------------
//-----------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define O_O ios_base::sync_with_stdio(0); cin.tie(NULL)
#define endl '\n'
#define PI acos(-1.0)
#define CASE(n) cout << "Case " << n << ": "
#define CASE_(n) cout << "Case " << n << endl
#define FIXED(n) cout << fixed << setprecision(n)
#define testPrint(n) cout << "test" << n << endl;


int main()
{
    O_O;
    long long t=1;
    //cin >> t;
    long long T = t;
    while(t--)
    {
        //write your code here
        long long n;
        cin >> n;
        long long arr[n+5];
        map<long long,long long>mp;
        long long sum=0;
        for(long long i=0;i<n;i++)
        {
            cin >> arr[i];
            mp[arr[i]]++;
            sum+=arr[i];
        }
        long long q;
        cin >> q;
        while(q--)
        {
            long long a,b;
            cin >> a >> b;
            long long cnt = mp[a];
            sum-= a*cnt;
            mp[a]=0;
            mp[b]+=cnt;
            sum+= b*cnt;
            cout << sum << endl;
        }

    }
    return 0;
}





Measured memory_bytes: 10340
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

S = input()
if S=='ABC':
    print('ARC')
else:
    print('ABC')


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


int main()
{
  int x[3],big=-1,i,sum=0,t1,t2;

  for(i=0;i<3;i++)
  {
      cin>>x[i];
  }
  for(i=0;i<2;i++)
  {
      if(x[i]>x[i+1])
      {
          big=i;
      }
      else
      {
          big=i+1;
      }
  }
  if(big==0)
  {
      t1=1;
      t2=2;
  }
  else if(big==1)
  {
      t1=0;
      t2=2;
  }
  else if(big==2)
  {
      t1=0;
      t2=1;
  }

  for(i=0;;i++)
  {
       if(x[big]==x[t1]&& x[big]==x[t2])
      {
          break;
      }
    else  if(x[big]>x[t1]&& x[big]>x[t2])
      {
          x[t1]=x[t1]+1;
          x[t2]=x[t2]+1;
          sum++;
      }
      else if(x[big]>x[t1]&& x[big]<=x[t2])
      {
          x[t1]=x[t1]+2;
          sum++;
      }
      else if(x[big]<=x[t1]&& x[big]>x[t2])
      {
          x[t2]=x[t2]+2;
          sum++;
      }
      else if(x[t1]>x[big])
      {
          x[big]+=1;
          x[t2]+=1;
          sum++;
      }
      else if(x[t2]>x[big])
      {
          x[big]+=1;
          x[t1]+=1;
          sum++;
      }

  }
    cout<<sum;





    return 0;
}


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


using namespace std;
const int maxn = 1e5 + 100;





int main()
{
    int n,k;scanf("%d%d",&n,&k);int a[maxn];
    for(int i = 0 ; i < n;i++){
        scanf("%d",&a[i]);
    }
    int minn = 1e9;
    for(int i = 0 ;i + k - 1 < n;i++){
        int cur_l = a[i];
        int cur_r = a[i-1+k];
        int cur = minn;
        if(cur_l <= 0 && cur_r <= 0){
            cur = -cur_l;
        }else if(cur_l >= 0 && cur_r >= 0){
            cur = cur_r;
        }else{
            cur = cur_r - cur_l + min(-cur_l,cur_r);
        }
        minn = min(cur,minn);
    }
    printf("%d\n",minn);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<vector<ll>> f(n,vector<ll>(10)),p(n,vector<ll>(11));
	rep(i,n){
		rep(j,10){
			cin>>f[i][j];
		}
	}
	rep(i,n){
		rep(j,11){
			cin>>p[i][j];
		}
	}
	ll ans=-inf;
	FOR(i,1,1<<10){
		ll now=0;
		rep(j,n){
			ll c=0;
			rep(k,10){
				if((i & 1<<k) && f[j][k]) c++;
			}
			now+=p[j][c];
		}
		chmax(ans,now);
	}
	cout<<ans<<endl;
}

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

using namespace std;

int main() {
    string str;
    int N;
    cin >> N;
    cin >> str;
    
    for(int s=0; s<str.size(); s++) {
        int c=str[s]-'A';
        c += N;
        c %= 26;
        
        cout << (char)(c+'A');
    }
    cout << endl;

    return 0;
    
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{  
    public static void process()throws IOException
    {
      int i=1;
      int ans=0;
      while(i<=5)
      {
        int x=ni();
        if(x==0)
          ans=i;
        i++;
      }
      pn(ans);
    }     
    
    
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        //if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
       //int T=ni(); while(T-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static String nn()throws IOException{return sc.next();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static int[] iarr(int N)throws IOException{int[]ARR=new int[N];for(int i=0;i<N;i++){ARR[i]=ni();}return ARR;}
    static long[] larr(int N)throws IOException{long[]ARR=new long[N];for(int i=0;i<N;i++){ARR[i]=nl();}return ARR;}
    static boolean multipleTC=false;

/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
    
    
    

    

Measured memory_bytes: 32824
#include <bits/stdc++.h>
using namespace std;
int N, M, X, Y;

int main() {
    cin >> N >> M >> X >> Y;
    vector<int> x(N, 0);
    vector<int> y(M, 0);
    for(int i = 0; i < N; ++i) {
        cin >> x.at(i);
    }
    for(int i = 0; i < M; ++i) {
        cin >> y.at(i);
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    int flag = 0;
    for(int i = x.at(N-1) + 1; i <= y.at(0); ++i) {
        if(X < i && Y >= i) {
            flag = 1;
            break;
        }
    }

    if(flag == 0) {
        cout << "War" << endl;
    }else {
        cout << "No War" << endl;
    }
}

Measured memory_bytes: 256
#N=int(input())
#N,M=map(int, input().split())
#L=list(map(int, input().split()))
L=[]
Check=[]
for n in range(9):
  Check.append(-(n+1))

for i in range(3):
  NL=list(map(int, input().split()))
  L.append(NL[0])
  L.append(NL[1])
  L.append(NL[2])

N=int(input())
for j in range(N):
  I=int(input())
  if I in L:
    Check[L.index(I)]=1
  
for k in range(3):
  if Check[0+3*k]==Check[1+3*k]==Check[2+3*k]:
    print('Yes')
    exit()

for l in range(3):
  if Check[0+l]==Check[3+l]==Check[6+l]:
    print('Yes')
    exit()

if Check[0]==Check[4]==Check[8] or Check[2]==Check[4]==Check[6]:
  print('Yes')
  exit()

print('No')

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

S = []
for n in range(N):
  s = ''.join(sorted(input()))
  S.append(s)
  
ans = 0
d = {}
for s in S:
  if s in d:
    ans += d[s]
  d[s] = d.get(s,0)+1
  
print(ans)

Measured memory_bytes: 19404
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int A,B,K;
    Set<Integer> set = new TreeSet<Integer>();
    A = s.nextInt();
    B = s.nextInt();
    K = s.nextInt();
    if(A + K >= B - K + 1){
      for(int i = A; i <= B ; i++){
        System.out.println(i);
      }
    }
    else{
      for(int i = A; i < A + K && i <= B ; i++){
        System.out.println(i);
      }
      int start;
      if(B - K < A)start = A;
      else start = B - K + 1;
      for(int i = start; i <= B && i >= A ; i++){
        System.out.println(i);
      }
    }
  }
}

Measured memory_bytes: 23892
const val MOD = (1e9+7).toInt()

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.map { it - 'a' }
    val t = readLine()!!.map { it - 'a' }
    //dp[i] = 星iにたどり着く組み合わせ数
    val dp = IntArray(101010)
    dp[0] = 1
    //sm[c] = 入り口の文字がcである星の組み合わせ数の総和
    val sm = IntArray(26)
    sm[s[0]] = 1
    for(i in 1 until n) {
        dp[i] = sm[t[i]] % MOD
        sm[s[i]] += dp[i]
        sm[s[i]] %= MOD
    }
    println(dp[n - 1])
}


Measured memory_bytes: 32756
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    char ch;
    cin>>ch;
    if(ch>='A' && ch<='Z')
    {
        cout<<"A"<<endl;
    }
    else
    {
        cout<<"a"<<endl;
    }
    return 0;

}





































Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int a,b,k;
  cin>>a>>b>>k;
    
  for(int i= min(a,b);i>=1;i--){
    if(a%i==0 && b%i==0){
      k--;
      if(k==0)
        cout<<i<<endl;
    }
  }
  return 0;
}

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

YH = -1
IH = -1
HN = -1
for a in range(n+1):
    for b in range(n+1-a):
        c = n-a-b
        if 10000*a + 5000*b + 1000*c == y:
            YH = a
            IH = b
            HN = c

print(YH, IH, HN)


Measured memory_bytes: 2940
///Code by: Luis Alejandro
///Handle: Sekai
///Country: Cuba

#include <bits/stdc++.h>
#define endl '\n'
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")

using namespace std;

typedef unsigned long long ull;
typedef long long lld;
typedef long double ld;
typedef pair<int,int> pii;

const int MAXN=1e5+5;
const int MOD=1e9+7;
const int INF=1e9;
const ld PI=acos(-1);
const ld EPS=1e-9;

#define lg2(x) 31-__builtin_clz(x)
#define logx(a,b) (log(a)/log(b))
#define pow2(a) a*a
#define pow3(a) a*a*a
#define lcm(a,b) (a*b)/__gcd(a,b)

pii mkp(int a, int b){
    if(a>b)swap(a,b);
    return make_pair(a,b);
}

int mod_pow(int a, int b){
    if(!b)return 1;
    if(b&1)return mod_pow(a,b-1)*a%MOD;
    int power=mod_pow(a,b>>1);
    return power*power%MOD;
}

int modular_inverse(int a){
    return mod_pow(a,MOD-2);
}

vector<int> movy={0,0,1,-1};
vector<int> movx={1,-1,0,0};

void solve(){
    lld n, ans=0;
    cin>>n;
    vector<lld> a(n+1,0);
    for(lld i=1;i<=n;i++){
        cin>>a[i];
        if(a[i-1]>a[i]){
            ans+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<ans<<endl;
}

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("IN.txt","r",stdin);
        //freopen("OUT.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 4780
#include <iostream>
using namespace std;
int main(void){
    int64_t k;
    string s;
    
    cin >> s>>k;
    for(int i=0;i<k;i++){
        
        if(s[i] != '1'){
            cout << s[i];
            return 0;
        }
    }
    cout << 1;
    return 0;
    
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
H = np.array(list(map(int,input().split())),dtype=np.int)

def grandgarden(h):
#    print("h",h)
    m = h.min()
#    print("m",m)
    h -= m
    hills = np.where(h>0)[0]
#    print("hills",hills)

    mountains = [[]]
    i = 0
    for i in range(len(hills)):
        mt = mountains[-1]
        if len(mt)==0 or hills[i]==mt[-1]+1:
            mt.append(hills[i])
        else:
            mountains.append([hills[i]])
    if len(mountains[-1]) == 0:
        mountains.pop()
#    print("mountains",mountains)
    ret = m + sum([ grandgarden(h[np.array(mt,dtype=np.int)]) for mt in mountains])
    return ret

print(grandgarden(H))

Measured memory_bytes: 12688
def c171(n):

    ans = ""
    while n > 0:
        n -= 1
        ans += chr(ord('a') + n % 26)
        n //= 26

    return ans[::-1]

def main():
    n = int(input())
    print(c171(n))

if __name__ == '__main__':
    main()

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

int main(void) {
    int64_t X,Y,Z;
    int64_t ans;

    cin >> X >> Y >> Z;
    ans = X/(Y+Z);
    if((X % (Y+Z)) < Z)
        ans--;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    int res = 1;
    string s;
    cin>>s;
    FOR(i,1,n)if(s[i-1] != s[i])res++;
    cout<<res<<endl;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        int M = input.nextInt();
        int T = 1;
        for(int i=0; i < M; i++){
            T = T*2;
        }
        int t = 100*(N-M)+1900*M;
        System.out.println(t*T);
    }
}

Measured memory_bytes: 23764
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

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


int main(){
    double W,H,x,y;
    cin >> W >> H >> x >> y;
    double num_max=W*H/2;
    int num=0;
    if(x*2==W && y*2==H) num=1;
    cout << fixed << setprecision(10) << num_max;
    cout << " " << num;
    }


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

struct edge {
    int to;
    long long cost;
};

vector<vector<edge>> prim(vector<vector<edge>> graph) {
    vector<vector<edge>> minimum_spanning_tree(graph.size());
    vector<bool> used(graph.size(), false);
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> minimum_edge_que;
    minimum_edge_que.push(make_pair(0, 0));
    int count_used = 0;
    int before_vertex = -1;

    while(true) {
        pair<long long, int> add_vertex;
        while(!minimum_edge_que.empty()) {
            add_vertex = minimum_edge_que.top();
            minimum_edge_que.pop();
            if (!used[add_vertex.second]) {
                //cout << before_vertex << " " << add_vertex.second << " " << add_vertex.first << endl;
                used[add_vertex.second] = true;
                count_used++;
                if (before_vertex != -1) {
                    edge e = {add_vertex.second, add_vertex.first};
                    minimum_spanning_tree[before_vertex].push_back(e);
                    e.to = before_vertex;
                    minimum_spanning_tree[add_vertex.second].push_back(e);
                }
                before_vertex = add_vertex.second;
                break;
            }
        }

        if (count_used == graph.size())
            break;

        for (int i = 0; i < graph[add_vertex.second].size(); i++) {
            edge e = graph[add_vertex.second][i];
            if (!used[e.to])
                minimum_edge_que.push(make_pair(e.cost, e.to));
        }
    }
    return minimum_spanning_tree;
}

int main() {
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    for (int i = 0; i < N; i++)
        cin >> x[i] >> y[i];
    
    vector<vector<edge>> graph(N);
    vector<int> idx(N);
    for (int i = 0; i < N; i++)
        idx[i] = i;
    sort(idx.begin(), idx.end(), [&x](size_t i1, size_t i2) {
        return x[i1] < x[i2];
    });
    for (int i = 0; i < N-1; i++) {
        edge e = {idx[i+1], abs(x[idx[i]]-x[idx[i+1]])};
        graph[idx[i]].push_back(e);
        e.to = idx[i];
        graph[idx[i+1]].push_back(e);
    }
    
    sort(idx.begin(), idx.end(), [&y](size_t i1, size_t i2) {
        return y[i1] < y[i2];
    });
    for (int i = 0; i < N-1; i++) {
        edge e = {idx[i+1], abs(y[idx[i]]-y[idx[i+1]])};
        graph[idx[i]].push_back(e);
        e.to = idx[i];
        graph[idx[i+1]].push_back(e);
    }
    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < graph[i].size(); j++) {
            cout << "graph:" << i << " " << graph[i][j].to << " " << graph[i][j].cost << endl; 
        }
    }
    */
    
    vector<vector<edge>> minimum_spanning_tree = prim(graph);
    long long ans = 0;
    for (int i = 0; i < minimum_spanning_tree.size(); i++) {
        for (int j = 0; j < minimum_spanning_tree[i].size(); j++) {
            if (i < minimum_spanning_tree[i][j].to) {
                ans += minimum_spanning_tree[i][j].cost;
                //cout << minimum_spanning_tree[i][j].cost << endl;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 30836
if __name__ == '__main__':
    while 1:
        n = int(input())
        if n ==0 :break
        line = list(map(int,input().strip().split()))
        diff = 1000000
        for i in range(n-1):
            for j in range(i+1,n):
                if diff > abs(line[i] - line[j]):diff = abs(line[i]-line[j])
        print(diff)

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

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

    
    if(n%2!=0){
        for(ll i=1;i<m+1;i++){
            cout << i << " " << n-i <<endl;
        }
    }else if(n==4){
        cout << "1 4" << endl;
    }else if(n%4!=0){
        for(ll i=1;i<m+1;i++){
            if(i<=m/2){
                cout << i << " " << n-i+1 << endl;
            }else{
                cout << i << " " << n-i <<endl;
            }
        }
    }else{
        for(ll i=1;i<m+1;i++){
            if(i<=m/2+1){
                cout << i << " " << n-i+1 << endl;
            }else{
                cout << i << " " << n-i <<endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
#define ULL unsigned long long
ULL base=233;
char ch[MAXN][15];
bool cmp(char c1,char c2){return c1-'a'<c2-'a';}
ULL ci[MAXN];
map<ULL,int> mp;
int main()
{
	int n;
	n=read();
	for(int i=1;i<=n;i++)
	{
		scanf("%s",ch[i]+1);int len=strlen(ch[i]+1);
		sort(ch[i]+1,ch[i]+1+len,cmp);
		ULL temp=0;
		for(int j=1;j<=len;j++)temp=temp*base+ch[i][j]-'a'+1;
		ci[i]=temp;mp[temp]++;
	}
	LL ans=0;
	for(int i=1;i<=n;i++)ans+=1LL*(mp[ci[i]]-1)*(mp[ci[i]])/2,mp[ci[i]]=0;
	pr2(ans);
	return 0;
}


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	V a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ans = upper;
	rep(i, a[0] + 1) rep(j, a[n - 1] + 1) {
		int tmp = i + j;
		V b = a;
		b[0] -= i; b[n - 1] -= j;
		rep(i, n - 1) {
			int x = max(b[i], 0);
			tmp += x * 2;
			b[i] -= x; b[i + 1] -= x;
		}
		tmp += max(b[n - 1], 0);
		chmin(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3184
#include <algorithm>
#include <iostream>
#include <numeric>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

struct UF
{
    vi v, p;
    UF(int n) : v(n, 1), p(n, 0)
    {
        iota(p.begin(), p.end(), 0);
    }

    int f(int x)
    {
        if (p[x] == x)
        {
            return x;
        }
        return (p[x] = f(p[x]));
    }

    void u(int i, int j)
    {
        int x = f(i);
        int y = f(j);

        if (x == y)
            return;

        p[y] = x;
        v[x] += v[y];
    }

    bool s(int i, int j)
    {
        return f(i) == f(j);
    }
};

int main()
{
    int n, m;

    cin >> n >> m;

    ll combos = (1LL * n * (n - 1)) / 2;
    UF uf(n);

    vii ps;
    vector<ll> outs(m);

    for (int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        ps.push_back({u - 1, v - 1});
    }

    for (int i = m - 1; i >= 0; i--)
    {
        outs[i] = combos;
        if (!uf.s(ps[i].first, ps[i].second))
        {
            ll r = 1LL * uf.v[uf.f(ps[i].first)] * uf.v[uf.f(ps[i].second)];
            uf.u(ps[i].first, ps[i].second);
            combos -= r;
        }
    }

    for (int i = 0; i < m; i++)
    {
        cout << outs[i] << endl;
    }
}

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

int main() {
  string s,t,u;
  cin >> s >> t >> u;
  char s1,t1,u1;
  s1=s.at(0);
  t1=t.at(0);
  u1=u.at(0);
  cout << s1 << t1 << u1 << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(void)
{
	int n, a, i, min = 1000000000, max = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a);
		if (min > a) min = a;
		if (a > max) max = a;
	}
	printf("%d", max - min);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)

int main(void){
    int N;
    cin>>N;
    vector<long long> x(N);
    vector<long long> y(N);
    rep(i,N){
        cin>>x[i]>>y[i];
    }

    vector<pair<double,int>> r(N);
    rep(i,N){
        r[i].first=atan2(y[i],x[i]);
        r[i].second=i;
    }
    sort(r.begin(),r.end());

    double ans=0.0;

    for(int i=0;i<N;i++){
        double temp_ans=0.0;
        pair<long long,long long> pos=make_pair(0,0);
        int k=i;
        do
        {
            int rs=r[k].second;
            pos.first+=x[rs];
            pos.second+=y[rs];
            double dis=sqrt(pos.first*pos.first+pos.second*pos.second);
            if(temp_ans<dis){temp_ans=dis;}

            k++;
            if(k>=N){k=0;}
        } while(k!=i);
        
        if(ans<temp_ans){ans=temp_ans;}
    }

    printf("%.12f\n",ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.ArrayList;

import java.util.Scanner;
class Main{
    static public void  main(String[] av){
        int sum=0;

        Scanner sc =new Scanner(System.in);
       // int n =sc.nextInt();
int ch =1;
int[] a= new int[100];

    //String s= sc.next();
    int n = sc.nextInt();
    int q =sc.nextInt();
    List<String> list = new ArrayList<String>();
    List<Integer> intlist = new ArrayList<Integer>();
    List<String> sl = new ArrayList<String>();
    List<Integer> il = new ArrayList<Integer>();
for(int k=0;k<n;k++){
    list.add(sc.next());
    intlist.add(sc.nextInt());
}     
int q2= q;
int t=0;
    while ( list.size() !=0){
   if (q2==0){
       q2=q;
   }
        if ( intlist.get(0) <=q2){
            t+=intlist.get(0);
q2=q2-intlist.get(0);
sl.add(list.get(0));
il.add(t);

intlist.remove(0);
list.remove(0);
q2=q;
        }
        else{
       t+=q2;     
intlist.set(0,intlist.get(0)-q2);
q2=0;
int x=intlist.get(0);
String y=list.get(0);
intlist.remove(0);
list.remove(0);
intlist.add(x);
list.add(y);
        }

    }
    for (int i=0;i<n;i++){
        System.out.println(sl.get(i)+ " "+ il.get(i));
    }
}
    }



Measured memory_bytes: 77992
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n, m int
	Fscan(in, &n, &m)
	used := make([]bool, n)
	for i := 1; i <= m; i++ {
		if 2*(n+1-2*i) != n && !used[2*i-1] {
			used[n+1-2*i] = true
			Fprintln(out, i, n+1-i)
		} else {
			used[n-2*i] = true
			Fprintln(out, i, n-i)
		}
	}
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 3468
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	if strings.Contains(stdin.Text(), "AC") {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
/*
    CP Submission
*/

#include<bits/stdc++.h>

using namespace std;

/* Shortcuts */
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define val(x) cout << #x << ": " << (x) << endl;
#define log(x) cout << (x) << endl;
#define sz(x) (int)(x.size())

/* typedefs */
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <string,string> mss;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;

    for(int d = 0; d * 7 <= n; d++){
        if((n - d * 7) % 4 == 0){
            log("Yes"); return 0;
        }
    }

    log("No");

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){
    ll n;cin >> n;
    vpl edge(n-1);rep(i,n-1){
        ll a,b;cin >> a >> b;a--;b--;
        edge[i]={a,b};
    }
    vector<vector<ll>> es(n,vector<ll>(n,0));
    rep(i,n-1){
        UnionFind uf(n);
        rep(j,n-1){
            if(j==i)continue;
            uf.merge(edge[j].fi,edge[j].se);
        }
        rep(j,n){
            rep(k,n){
                if(!uf.same(j,k)){
                    es[j][k]|=(1LL<<i);
                }
            }
        }
    }
    /*rep(i,n){
        rep(j,n){
            cout << i <<" " << j <<endl;
            for(auto p:es[i][j]){
                cout << p.fi <<" " << p.se <<endl;
            }
        }
    }*/
    ll m;cin >> m;
    vpl res(m);rep(i,m){
        ll a,b;cin >> a >> b;a--;b--;
        res[i]={a,b};
    }
    ll ans=0;
    rep(bit,1<<m){
        ll sum=0;
        rep(i,m){
            if(bit&(1<<i)){
                sum|=es[res[i].fi][res[i].se];
            }
        }
        ll c=__builtin_popcountl(sum);
        ll p=(pow(2,c)-1)*(pow(2,n-1-c));
        if(__builtin_popcount(bit)&1)p*=-1;
        ans+=p;
    }
    cout << -ans <<endl;
}

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

using namespace std;

int main (void) {
    long long N, M, K;
    cin >> N >> M >> K;
    long long a, b;
    long long a_idx = N-1;
    vector<long long> asum(N), bsum(M);
    for ( long long i = 0; i < N; i++ ) {
        if ( i == 0 ) {
            cin >> asum.at(i);
        }
        else {
            cin >> a;
            asum.at(i) = asum.at(i-1) + a;
            if ( a_idx == N-1 && asum.at(i) > K ) {
                a_idx = i-1;
            }
        }
    }
    long long rest = K - asum.at(a_idx);
    long long pre_b_idx = 0;
    for ( long long i = 0; i < M; i++ ) {
        if ( i == 0 ) {
            cin >> bsum.at(i);
        }
        else {
            cin >> b;
            bsum.at(i) = bsum.at(i-1) + b;
            if ( rest >= bsum.at(i) ) {
                pre_b_idx = i;
            }
        }
    }

    int i, j;
    long long ans = 0;
    for ( i = a_idx; i >= -1; i-- ) {
        if ( i >= 0 )
            rest = K - asum.at(i);
        else
            rest = K;
        if ( rest < 0 )
            continue;
        for ( j = pre_b_idx; j < M; j++ ) {
            if ( rest < bsum.at(j) ) {
                pre_b_idx= j;
                break;
            }
        }
        j--;
        ans = max(ans, (long long)(i+1)+(j+1));
    }

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


Measured memory_bytes: 6408
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val ans = readIntegerList().filterIndexed { index, i -> index % 2 == 0 && i % 2 == 1 }.count()
    out.println(ans)
}


fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

int n, q;
char c[500001];
set<int> ct[26];

int main()
{
	cin >> n >> c;
	
	for (int i = 0; i < n; i++) {
		int p = c[i] - 'a';

		ct[p].insert(i);
	}

	cin >> q;

	for (int j = 0; j < q; j++) {
		int w;

		cin >> w;

		if (w == 1) {
			int i;
			string c;

			cin >> i >> c;

			for (int k = 0; k < 26; k++) {
				if (ct[k].find(i - 1) != ct[k].end())
					ct[k].erase(i - 1);

				if (k == c[0] - 'a')
					ct[k].insert(i - 1);
			}
		}
		else if (w == 2) {
			int l, r, m = 0;
			
			cin >> l >> r;

			for (int u = 0; u < 26; u++) {
				if (ct[u].lower_bound(l - 1) != ct[u].end() 
					&& *ct[u].lower_bound(l - 1) < r)
					m++;
			}

			cout << m << endl;
		}
	}
}


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

int a, b, c, d;

int main()
{
    cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) { printf("Yes\n"); return 0; }
        a -= d;
        if (a <= 0) { printf("No\n"); return 0; }
    }
    return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

string s;

int main() {
  cin >> s;
  s[5] = ' ';
  s[13] = ' ';
  cout << s;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n ;
  ans=(1000-n%1000)%1000;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 2 * 105000;

int n, d, a;
pair<long long, long long> m[MAXN];
long long add[MAXN];
long long dmg;
long long ans;

int main() { 

  scanf("%d %d %d", &n, &d, &a);
  for (int i = 0; i < n; i++) {
    scanf("%lld %lld", &m[i].first, &m[i].second);
  }

  sort(m, m + n);

  int r = 0;
  for (int i = 0; i < n; i++) {
    dmg += add[i];
    // cerr << "I" << i << " " << dmg << endl;
    if (r < i) {
      r = i;
    }
    m[i].second -= dmg;
    if (m[i].second <= 0) {
      continue;
    }
    while (r + 1 < n && m[i].first + 1ll * 2 * d >= m[r + 1].first) {
      r++;
    }
    // cerr << r << endl;
    long long need = (m[i].second + a - 1) / a;
    ans += need;
    dmg += need * a;
    add[r + 1] -= need * a;
    // cerr << ans << endl;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4992
#!/usr/bin/env python3
import sys


def solve(H: int):
    layer = 0
    h = H
    while True:
        h //= 2
        layer += 1
        if h == 0:
            break
    answer = 0 
    for i in range(layer):
        answer += 2**i
    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    solve(H)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064