akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,m,c;
    cin >> n >> m >> c;
    int B[m], A[n][m];
    for(int i = 0; i < m; i++){
        cin >> B[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> A[i][j];
        }
    }
    int innpro = c;
    int count = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            innpro += A[i][j] * B[j];
        }
        if(innpro > 0){
            count += 1;
        }
        innpro = c;
    }
    cout << count << endl;
    return 0;
}



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

int main()
{
    int N, p[100], tz, j, k, max, s=0, m;
    scanf("%d", &N);
    for(int i=1;i<=N;i++)
        scanf("%d", &p[i]);
   for(int f=1;f<N;f++)
       { for(j=1;j<N;j++)
        if(p[j]>p[j+1])
       {

        tz=p[j];
        p[j]=p[j+1];
        p[j+1]=tz;
        }}

    for(m=1;m<N;m++)
    {
     s=s+p[m];
    }
     s=s+(p[N]/2);
     printf("%d", s);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i=0;i<(int)(n);++i)
template <typename T> ll gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> ll lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b)a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b)a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, l, a, b, c, d, e, f, r;
  string s, t;
  cin >> n;
  cout << ((n + 1) / 2) << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <cstring>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int common(const string &a, const string &b){
	int size = min(a.size(), b.size());
	int res = 0, cnt = 0;
	rep(i, size){
		if(a[i]==b[i]) cnt++;
		else{
			res = max(res, cnt);
			cnt = 0;
		}
	}
	return max(res, cnt);
}

int check(const string &a, const string &b){
	int res = 0;
	rep(i, a.size()){
		res = max(res, common(a.substr(i), b));
	}
	return res;
}

int main(){
	string a, b;
	while(cin >> a >> b){
		cout << max(check(a, b), check(b, a)) << endl;
	}


    return 0;
}

Measured memory_bytes: 1212
from operator import mul

n = int(input())
cof = [1 << x for x in range(10)]
fs = [sum(map(mul, map(int, input().split()), cof)) for _ in range(n)]
ps = [list(map(int, input().split())) for _ in range(n)]
ans = float('-inf')
for g in range(1, 1024):
    ans = max(ans, sum(p[bin(f & g).count('1')] for f, p in zip(fs, ps)))
print(ans)


Measured memory_bytes: 3188
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
class union_find{
  int n;
  vector<int> par,rk,size;
  public:
  union_find(int max_n){
    n = max_n+1;
    for(int i=0;i<=n;i++){
      par.emplace_back(i);
      rk.emplace_back(0);
      size.emplace_back(1);
    }
  }
  int root(int x){
    vector<int> nodes;
    while(x!=par[x]){
      nodes.emplace_back(x);
      x = par[x];
    }
    for(auto v:nodes){
      par[v] = x;
    }
    return x;
  }
  void unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x==y) return;
    if(rk[x]<rk[y]){
      par[x] = y;
      size[y] += size[x];
    }else{
      par[y] = x;
      if(rk[x]==rk[y]) rk[x]++;
      size[x] += size[y];
    }
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int treesize(int x){
    return size[root(x)];
  }
};
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll n,m,x,y,z,ans=0;
  cin >> n >> m;
  union_find uf(n);
  vector<bool> mark(n,false);
  for(int i=0;i<m;i++){
    cin >> x >> y >> z;
    x--;
    y--;
    uf.unite(x,y);
  }
  for(int i=0;i<n;i++){
    ll p = uf.root(i);
    if(!mark[p]){
      ans++;
      mark[p] = true;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1644
import collections


def eratosthenes(n):
    sieve = [True for _ in range(n + 1)]
    sieve[0] = False
    sieve[1] = False

    def _update(p):
        if sieve[p]:
            for i in range(p * 2, n + 1, p):
                sieve[i] = False
    if n > 1:
        _update(2)
    p = 3
    while p * p <= n:
        _update(p)
        p += 2
    return sieve


n = int(input())
sieve = eratosthenes(n)
primes = [i for i in range(n + 1) if sieve[i]]
counter = collections.Counter()
for i in range(2, n + 1):
    for p in primes:
        while i % p == 0:
            counter[p] += 1
            i //= p
        if i == 1:
            break

counter2 = collections.Counter()
for i in [2, 4, 14, 24, 74]:
    for p in primes:
        if counter[p] >= i:
            counter2[i] += 1

c0 = counter2[74]
c1 = counter2[24] * (counter2[2] - 1)
c2 = counter2[14] * (counter2[4] - 1)
c3 = (counter2[4] * (counter2[4] - 1) * (counter2[2] - 2)) // 2
print(c0 + c1 + c2 + c3)

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

if a == 1 and b != 1:    
    print("Alice")
if b == 1 and a != 1:
    print("Bob")
elif a > b and b != 1:
    print("Alice")
elif b > a and a != 1:
    print("Bob")
elif a == b:
    print("Draw")
        

Measured memory_bytes: 2940
//https://atcoder.jp/contests/agc034/tasks/agc034_b
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    string s; cin>>s;
    string s2;
    REP(i,s.size()){
        auto c0 = s.at(i);
        auto c1 = i+1<s.size()?s.at(i+1):'!';
       if (c0=='B'&&c1=='C') { //BCをまとめて'@'とする
            s2.push_back('@');
            ++i; //進める
        } else {
            s2.push_back(c0);
        }
    }
    //cout<<s2<<endl;
    ll ans=0;
    ll mrk=0;
    for(ll i=s2.size()-1;i>=0;--i){
        auto c = s2.at(i);
        if(c=='A') {
            ans += mrk;
        }else if(c=='@'){
            ++mrk;
        }else {
            mrk=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ma = a[n - 1];
	int left = a[0];
	int right = a[n - 2];
	for (int i = 0;i < n - 1&&ma/2>=a[i];i++) {
		left = a[i];
	}
	for (int i = n - 2;i >= 0 && ma / 2 < a[i];i--) {
		right = a[i];
	}
	double half = (double)ma / 2;
	if (half - left > right - half) {
		cout << ma << ' ' << right << endl;
	}
	else {
		cout << ma << ' ' << left << endl;
	}

	return 0;
}

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

int main(){
  int n,ans=0,x=0;string s;cin>>n>>s;

  REP(i,n){
    if(s.at(i)=='I') x++;
    else x--;
    ans=max(ans,x);
  }

  cout<<ans;
}

Measured memory_bytes: 256
import sys
N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]
ans = 0
for i in range(1, N):
    ans += (A[i - 1] + A[i]) // 2
    if A[i]:
        A[i] = (A[i - 1] + A[i]) % 2
print(A[0] // 2 if N == 1 else ans)

Measured memory_bytes: 44252
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        a//=2
        b+=a
    else:
        b//=2
        a+=b
print(a,b)


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

using namespace std;

int main() {
  int n, k;
  cin >> n;
  string t;
  vector<string> titles;
  vector<int> dur;
  for (int i = 0; i < n; i++)
  {
    cin >> t >> k;
    titles.push_back(t);
    dur.push_back(k);
  }
  string look;
  cin >> look;
  bool found = false;
  int sum = 0;
  for (int i = 0; i < n; i++)
  {
    if(found)
      sum+= dur[i];
    if(titles[i] == look)
      found = true;
  }
  cout << sum << endl;
  
	return 0;
}

/*#include <bits/stdc++.h>

using namespace std;

int main() {
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	return 0;
}*/

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline

h,w,g = map(int,readline().split())

maze = []
for i in range(h):
    s = readline().rstrip().decode('utf-8')
    maze.append(s)

#ビット全探索
def bit_list(dig): #引数に何桁かを入れる
    lst = []
    for i in range(2**dig):
        lst.append(list(format(i,"b").zfill(dig)))
    return lst
#帰ってくるのは[[0,0,1],[0,1,0],[0,1,1],[1,0,0]...[1,1,1]]のようなリスト

blst = bit_list(h-1)
ans = 10**9
for i in range(len(blst)):
    res = []
    lst1 = [0]*w

    for k in range(w): #分割数はn-1なので、最初の1行目は手動で
                lst1[k] += 1 if maze[0][k] == "1" else 0
    
    for index,j in enumerate(blst[i],1):
        if j== "0": #分割しない
            for k in range(w):
                lst1[k] += 1 if maze[index][k] == "1" else 0
        else:
            res.append(lst1)
            lst1 = [0]*w
            for k in range(w):
                lst1[k] += 1 if maze[index][k] == "1" else 0
    
    res.append(lst1)
    flag = 0
    #横分割しなかった部分について、縦分割することで必ず条件を満たせる必要がある。
    for j in res:
        if any(k > g for k in j):
            flag = 1
            break
    if flag:
        continue

    w_cut = 0
    count = [0]*len(res)
    for j in range(w):
        now_count = [0]*len(res)
        for index,k in enumerate(res):
            count[index] += k[j]
            now_count[index] += k[j]
        if any(l > g for l in count):
            count = now_count
            w_cut += 1


    ans = min(ans,blst[i].count("1")+w_cut)

print(ans)

Measured memory_bytes: 52956
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int A,B,K;
  cin >> A >> B >> K;
  int r,l;
  l = A+K-1;
  r = B-K+1;
  if(l < r){
    for(int i = A; i <= l; ++i){
      cout << i << endl;
    }
    for(int i = r; i <= B; ++i){
      cout << i << endl;
    }
  }else{
    for(int i = A; i <= B; ++i){
      cout << i << endl;
    }
  }
  
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
  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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
            }
            int ans = 0;

            boolean ok = false;
            int index = 0;
            for (int i = 0; i < n; i++) {
                if (a[index] == 2) {
                    ans++;
                    ok = true;
                    break;
                }
                ans++;
                index = a[index] - 1;
            }

            // 出力
            if (ans != 0 && ok) {
                out.println(ans);
            } else {
                out.println(-1);
            }

        }

    }
}



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

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

  int cnt = 0;
  rep(i, n){
    int h;
    cin >> h;
    if(h >= k) cnt++;
  }

  cout << cnt << endl;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def calc(N):
    return sum(int(x) for x in str(N))


def main():
    # sys.stdin = open("sample.txt")
    A, B, C, K = Scanner.map_int()
    if K % 2 == 0:
        print(A-B)
    else:
        print(B-A)
    return


if __name__ == "__main__":
    main()


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

//long long型(64bit整数)
typedef long long ll;

int main(){
    ll x;
    cin >> x;
    if(x % 11ll == 0){
        cout << x/11ll*2ll << endl;
    }else if(x % 11ll >=1  &&  x % 11ll <=6){
        cout << x/11ll*2ll + 1ll << endl;
    }else{
        cout << x/11ll*2ll + 2ll << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
  
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    lol r[n + 5] = {};
    r[0] ++;
    bool isbroken[n + 5] = {false};
    rep(i,m){
      int a;
      cin >> a;
      isbroken[a] = true;
    }
    rep(i,n){
      if( !isbroken[i] ){
	r[i + 1] += r[i];
	r[i + 1] %= MOD;
	r[i + 2] += r[i];
	r[i + 2] %= MOD;
      }
      // cout << r[i] << '\n';
    }
    cout << r[n] << '\n';
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int main()
{
    int a;
    int b;
    int c=0;
    cin >>a;
    cin >>b;
    if(a>b){
        while(c<a){
            cout << b;
            c++
        ;}
    }else{
        while(c<b){
            cout << a;
            c++
        ;}
    }
    return 0;
    }


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>

namespace IO{
    const int insiz = 1 << 12, outsiz = 1 << 18;
    char in[insiz], *A(in), *B(in); char out[outsiz], *ptr(out);
    inline char getc(){
    	#ifndef LOCAL
        return (A == B) && (B = (A = in) + fread(in, 1, insiz, stdin), A == B) ? EOF : *A++;
        #endif
        return getchar();
    }
    template <typename T> inline T read(){
        T ret(0), p(1); char ch(getc());
        while(ch < '0' || ch > '9'){
            if(ch == '-') p = -1; ch = getc();
        }
        while(ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = getc();
        return ret*p;
    }
    inline void flush(){ fwrite(out, 1, ptr - out, stdout); ptr = out; }
    template <typename T> inline void write(T x, char cmd = '\n'){
        if(x < 0) *ptr++ = '-', x = -x;
        if(x == 0) *ptr++ = '0';
        static char s[123]; int cnt = 0;
        for(; x; x /= 10) s[++cnt] = x % 10 + '0';
        for(; cnt; --cnt) *ptr++ = s[cnt];
        *ptr++ = cmd;
        if((outsiz >> 1) > ptr - out) flush();
    }
} using IO::getc; using IO::read; using IO::write; using IO::flush;

int main(){
	int n = read<int>(),m = read<int>();
	if(m == 1){
		write(0);
	}
	else{
		write(n - m);
	}
	flush(); return 0;
}



Measured memory_bytes: 128
W,H,x,y,r=map(int,input().split())
if x<0 or y<0:
    print("No")
else:
    if x>=W or y>=H:
        print("No")
    else:
        if x+r<=W and x-r>=0 and y+r<=H and y-r>=0:
            print("Yes")
        else:print("No")


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
//#define x real()
//#define y imag()
#define length(a) (hypot((a).imag() , (a).real()))
#define point complex<ld>
#define perp(a) point((-(a).Y,(a).X))
#define dot(a,b) ( (conj(a)*(b)).real() )
#define cross(a,b) ( (conj(a)*(b)).imag() )
#define rotate0(p,ang) (p * exp(point(0,ang)) )

const int N = 5e5+5;

ll n , q , seg[4*N] , a[N] , ans[N];
vector< pair< pair<ll,ll> , ll> > v;
map<ll,ll> mp;

void update(int node , int st , int en , int idx , int val)
{
    if (st==en)
    {
        seg[node] += val;
        return;
    }

    int mid = (st+en)/2;
    if (idx >= st && idx <= mid) update(2*node , st , mid , idx , val);
    else update(2*node+1 , mid+1 , en , idx , val);
    seg[node] = seg[2*node] + seg[2*node+1];
}

ll query(int node , int st , int en , int l , int r)
{
    if (l>en || r<st) return 0;
    if (st >= l && en <= r) return seg[node];

    int mid = (st+en)/2;
    return query(2*node , st , mid , l , r) + query(2*node+1 , mid+1 , en , l , r);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> q;

    for(int i=1; i<=n; i++)
        cin >> a[i];

    for(int i=1; i<=q; i++)
    {
        int l,r;
        cin >> l >> r;
        v.push_back({{r,l} , i});
    }

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

    int j=1;
    for(int i=0; i<v.size(); i++)
    {
        ll l=v[i].f.s , r=v[i].f.f , idx=v[i].s;
        while(j<=r)
        {
            if (!mp[a[j]])
            {
                mp[a[j]] = j;
                update(1,1,n,j,1);
            }
            else
            {
                update(1,1,n,mp[a[j]],-1);
                update(1,1,n,j,1);
                mp[a[j]] = j;
            }
            j++;
        }

        ans[idx] = query(1,1,n,l,r);
    }

    for(int i=1; i<=q; i++)
        cout << ans[i] << '\n';

    return 0;
}


Measured memory_bytes: 62816
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef int int_;
#define int long long
#define maxn 200010
const int inf=1e9+7;
inline int read(){
	int ret=0,ff=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') ff=-ff;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		ret=ret*10+ch-'0';
		ch=getchar();
	}
	return ret*ff;
}

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
int ksm(int a,int b,int p){
	int ret=1;
	while(b){
		if(b&1) ret=ret*a%p;
		a=a*a%p;
		b>>=1;
	}
	return ret%p;
}
int a[maxn],num[maxn];
int_ main(){
	int n=read(),k=read();
	int ans=0;
	for(int i=1;i<=n;++i) a[i]=read();
	sort(a+1,a+1+n);
	for(int i=1;i<=k;++i) ans+=a[i];
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 1592
import java.util.*;

public class Main {
  
  /*
  BBPPPBPBPPPBB
  123456789
  len 1, 5, 13
  pcount 1, 3, 7
  */
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long X = sc.nextLong();

    // length table
    // p count for level n
    long[] len = new long[N+1];
    long[] pcount = new long[N+1];
    len[0] = 1;
    pcount[0] = 1;
    for (int i = 1; i <= N; i++) {
      len[i] = 2*len[i-1] + 3;
      pcount[i] = 2*pcount[i-1] + 1;
    }
    
    long ans = solve(N, X, len, pcount);
    
    System.out.println(ans);
  }
  
  private static long solve(int n, long x, long[] len, long[] pcount) {
    
    if (n == 0) {
      if (x != 1) throw new IllegalStateException();
      return 1;
    }

    if (x == 1) {
      return 0;
    } else if (2 <= x && x < 2 + len[n-1]) {
      return solve(n-1, x-1, len, pcount);
    } else if (x == 2 + len[n-1]) {
      return pcount[n-1] + 1;
    } else if (3 + len[n-1] <= x && x <= 2 + 2*len[n-1]) {
      return pcount[n-1] + 1 + solve(n-1, x-len[n-1]-2, len, pcount);
    } else if (x == 3 + 2*len[n-1]) {
      return pcount[n];
    }
    throw new IllegalStateException("unexpected !!");
  }
}

Measured memory_bytes: 21716
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

ans = 0
for i in range(N-K+1):
    ans += A[-1-i]*cmb(N-1-i, K-1, mod)
    ans %= mod
    ans -= A[i]*cmb(N-1-i, K-1, mod)
    ans %= mod

print(ans)

Measured memory_bytes: 94748
#include <math.h>
#include <bits/stdc++.h>
#include <deque>
#include <string>
#include <vector>
#include <algorithm>
#define ll long long int
#define l long double
#define pi 3.14159265358979323846
#define mod 1000000007
#define vali 1000000000000000000
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin>>a;
    b=a*a;
    c=b*a;
    ll d=a+b+c;
    cout<<d<<endl;
}


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



vector<bool> IsPrime(int N){
    vector<bool> isprime(N+1, true);

    isprime[1] = false;
    for (int i = 2; i*i <= N; i++)
    {
        if(isprime[i] == true){
            int j = 2;
            while (i*j <= N)
            {
                isprime[i*j] = false;
                j++;
            }
        }
    }
    return isprime;
}

int main(void)
{
    int Q;
    cin >> Q;
    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++)
    {
        cin >> l[i] >> r[i];
    }
    vector<bool> isprime = IsPrime(1e5);
    
    vector<int> counts(1e5+1, 0);

    counts[0] = 0;
    counts[1] = 0;
    for (int i = 2; i <= 1e5; i++)
    {
        bool primself = isprime[i];
        counts[i] = counts[i-1];

        if((i+1) % 2 == 0){
            bool halfPrime = isprime[(i+1)/2];
            if(primself & halfPrime){
                counts[i]++;
            }
        }
    }

    for (int i = 0; i < Q; i++)
    {
        cout << counts[r[i]] - counts[l[i]-1] << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 4564
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    string A,B;
    cin >> A >> B;

    if(A.size() > B.size()){
        cout << "GREATER" << endl;
    }else if(A.size() < B.size()){
        cout << "LESS" << endl;
    }else{
        for(int i = 0;i < A.size();i++){
            if(A.at(i) > B.at(i)){
                cout << "GREATER" << endl;
                break;
            }
            else if(A.at(i) < B.at(i)){
                cout << "LESS" << endl;
                break;
            }
            else if(i == A.size() - 1 and A.at(i) == B.at(i)){
                cout << "EQUAL" << endl;
                break;
            }
        }
    }

}

Measured memory_bytes: 384
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
#define il inline
#define re register
#define pb push_back
#define db double
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define MP make_pair
#define lowbit(x) x&(-x)
#define fi first
#define se second
const int mod = 1e9+7;
il ll read()
{
	char ch = getchar();
	ll p = 1,data = 0;
	while(ch<'0'||ch>'9')
	{
		if(ch == '-')p = -1;
		ch = getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		data = data*10+(ch^48);
		ch = getchar();
	}
	return p*data;
}
il ll qpow(ll a,ll b)
{
	ll r = 1;
	while(b)
	{
		if(b&1)r = a*r;
		a = a*a;
		b>>=1;
	}
	return r;
}
il ll gcd(ll a,ll b)
{
	while(b ^= a ^= b ^= a %= b);
	return a;
}
il ll lcm(ll a,ll b)
{
	return a*b/gcd(a,b);
}
il void exgcd(ll a,ll b,ll &x,ll &y)
{
	if(!b)
	{
		x = 1,y = 0;
		return;
	}
	exgcd(b,a%b,y,x);
	y -= (a/b)*x;
}
il ll inv(ll a,ll p)
{
	return qpow(a,p-2);
}
int main()
{
	int a = read(),b = read(),c = read();
	swap(a,b);
	swap(a,c);
	cout<<a<<" "<<b<<" "<<c;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

int main() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (abs(a - b) <= t * (v - w)) {
        debug(abs(a - b) / (v - w), t);
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var s = consoleReader.String;
            var nokori = 15 - s.Length;
            return s.Count(c => c == 'o') + nokori  >= 8? "YES" : "NO";
        }

        public const int mod = 1000000007;
        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader()).Calc()); static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader { public class SplitLine { string[] splited; public SplitLine(string line) { splited = line.Split(); } public string[] String => splited.ToArray(); public int[] Int => splited.Select(int.Parse).ToArray(); public long[] Long => splited.Select(long.Parse).ToArray(); public ulong[] ULong => splited.Select(ulong.Parse).ToArray(); public double[] Double => splited.Select(double.Parse).ToArray(); } public class RepeatLine { ConsoleReader reader; int num; public RepeatLine(ConsoleReader reader, int num) { this.reader = reader; this.num = num; } public IEnumerable<string> String { get { for (int i = 0; i < num; i++) yield return reader.String; } } public IEnumerable<int> Int { get { for (int i = 0; i < num; i++) yield return reader.Int; } } public IEnumerable<long> Long { get { for (int i = 0; i < num; i++) yield return reader.Long; } } public IEnumerable<string[]> Split { get { for (int i = 0; i < num; i++) yield return reader.Split.String; } } public IEnumerable<int[]> SplitInt32 { get { for (int i = 0; i < num; i++) yield return reader.Split.Int; } } } public virtual string String => Console.ReadLine(); public int Int => int.Parse(String); public long Long => long.Parse(String); public ulong ULong => ulong.Parse(String); public double Double => double.Parse(String); public SplitLine Split => new SplitLine(String); public RepeatLine Repeat(int count) => new RepeatLine(this, count); }
}

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

int main(){
  int n;
  cin >> n;
  map<int,int> mp;

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

  int ans=0;
  for(auto p:mp){
    if (p.second%2==1) ans++;
  }
  cout << ans << endl;  
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define FOR(i,x,y) for(int i = x;i < y;i++)
using namespace std;
int main(){
  string A,B;
  cin >> A >> B;
  if(A.size() > B.size())cout << "GREATER" << endl;
  else if(A.size() < B.size())cout << "LESS" << endl;
  else if(A == B)cout << "EQUAL" << endl;
  else if(A > B)cout << "GREATER" << endl;
  else cout << "LESS" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  string S; cin >> S;
  vector<int> d(4);
  for (int i = 0; i < 4; ++i) {
    d[i] = S[i] - '0';
  }
  for (int i = 0; i < (1 << 3); ++i) {
    int sum = d[0];
    string s = to_string(d[0]);
    bitset<3> b(i);
    for (int j = 0; j < 3; ++j) {
      if (b.test(j)) {
        sum += d[j+1];
        s += "+" + to_string(d[j + 1]);
      } else {
        sum -= d[j+1];
        s += "-" + to_string(d[j + 1]);
      }
    }
    if (sum == 7) {
      cout << s << "=7" << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
def inpl(): return [int(i) for i in input().split()]

N = int(input())
A = inpl()
ans = 1
first = True
for i in range(N-1):
    if first:
        if A[i+1] == A[i]:
            continue
        else:
            c = (A[i+1]-A[i])//abs((A[i+1]-A[i]))
            first = False
            continue
    if c*A[i] > c*A[i+1]:
        ans += 1
        first = True
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin >> n;
    vector<int>v;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        v.pb(a - 1);
    }
    vector<int>res;
    for(int i = 0; i < n; i++)
    {
        vector<int>u;
        bool chk = false;
        for(int j = sz(v) - 1; j >= 0; j--)
        {
            if(!chk && j == v[j])
            {
                res.pb(j + 1);
                chk = true;
            }
            else u.pb(v[j]);
        }
        if(!chk) return cout << "-1\n", 0;
        reverse(all(u));
        v = u;
    }
    reverse(all(res));
    for(int a : res)
        cout << a << "\n";
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt += 1
    elif a[i] % 2 == 0:
        cnt += 0.5
if N % 2 == 0 and cnt*2 >= N:
    print('Yes')
elif N % 2 == 0 and cnt*2 < N:
    print('No')
elif N % 2 == 1 and cnt*2+1 >= N:
    print('Yes')
else:
    print('No')

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

const int M = 3, N = 1e5 + 100;

int n, fen[N], a[M][N];

void input() {
	cin >> n;
	for (int i = 0; i < M; i++)
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
			a[i][j]--;
		}
}

void NO() {
	cout << "No\n";
	exit(0);
}

void check_1() {
	for (int i = 0; i < n; i++)
		if (a[0][i] / 3 != a[1][i] / 3 || a[1][i] / 3 != a[2][i] / 3)
			NO();
}

void check_2() {
	for (int i = 0; i < n; i++)
		if (a[1][i] % 3 != 1)
			NO();
}

void check_3() {
	for (int i = 0; i < M; i++)
		for (int j = 0; j < n; j++)
			if (j % 2 != (a[i][j] / 3) % 2)
				NO();
}

void add(int x) {
	for (++x; x < N; x += x & -x)
		fen[x] ^= 1;
}

int get(int x) {
	int res = 0;
	for (; x; x ^= x & -x)
		res ^= fen[x];
	return res;
}

int inversion(vector<int> vec) {
	memset(fen, 0, sizeof fen);
	int res = 0;
	reverse(vec.begin(), vec.end());
	for (int x: vec) {
		res ^= get(x) & 1;
		add(x);
	}
	return res;
}

void check_4(int X, int Y) {
	vector<int> vec;
	for (int i = Y; i < n; i += 2)
		vec.push_back(a[0][i] / 3);
	int res = inversion(vec) & 1;
	for (int i = X; i < n; i += 2)
		res ^= (a[0][i] > a[2][i]);
	if (res)
		NO();
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	input();
	check_1();
	check_2();
	check_3();
	check_4(0, 1);
	check_4(1, 0);
	cout << "Yes\n";
}


Measured memory_bytes: 2300
// C++ Implementation of the above approach 
#include<bits/stdc++.h> 
using namespace std; 

// Function to find the minimum number 
// character change required 

void change(string s) 
{ 

	// Finding the length of the string 
	int n = s.length(); 

	// To store the number of replacement operations 
	int cc = 0; 

	for(int i=0;i<n/2;i++) 
	{ 
		if(s[i]== s[n-i-1]) 
			continue; 

		// Counting one change operation 
		cc+= 1; 

		// Changing the character with higher 
		// ascii value with lower ascii value 
		if(s[i]<s[n-i-1]) 
			s[n-i-1]= s[i] ; 
		else
			s[i]= s[n-i-1] ; 
	} 
//	printf("Minimum characters to be replaced = %d\n", (cc)) ; 
	//cout<<s<<endl;
	cout<<cc; 
} 
// Driver code 
int main() 
{ 
	
string s ;
cin>>s;
change((s)); 
return 0; 
} 


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
   string s;
   int n = 700;
   cin >> s ;
   
   for (int i = 0; i < 3; i++){
       if (s[i] == 'o')
       n = n + 100;
   }
     cout << n <<endl;
}



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

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

    int n;
    cin >> n;

    vector<int> l, r;
    if (n % 2) {
        REP(i, n) {
            int tmp;
            cin >> tmp;
            if (i % 2) r.push_back(tmp);
            else l.push_back(tmp);
        }
    } else {
        REP(i, n) {
            int tmp;
            cin >> tmp;
            if (i % 2) l.push_back(tmp);
            else r.push_back(tmp);
        }
    }

    reverse(l.begin(), l.end());
    l.insert(l.end(), r.begin(), r.end());
    REP(i, l.size()) {
        cout << l[i];
        if (i != l.size() - 1) cout << ' ';
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 3564
# coding:UTF-8

N, life, Q = map(int, input().split())
points = [0 for i in range(0, N)]

for i in range(0, Q):
    points[int(input()) - 1] += 1
for n in points:
    if n > Q - life:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4708
#include<stdio.h>
#include<iostream>
using namespace std;

int main ()
{
    int N;
    string S;
    cin >> N >> S;
    int flag[125] = {0};
    int ans = 0;
    for(int i=1; i<N-1; i++)
    {
        int cnt = 0;
        for(int j=0; j<i; j++)
        {
            flag[int(S[j])] = 1;
        }

        for(int k=i; k<N; k++)
        {
            if (flag[(int)S[k]] == 1 )
            {
                cnt++;
                flag[(int)S[k]] = 0;
            }
        }

        ans = max(cnt,ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int H,W,K; cin>>H>>W>>K;
	vector<string> grid(H);
	int dist[H][W];
	int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; x1--; y1--; x2--; y2--;
	for (int i=0; i<H; i++) {
		cin>>grid[i];
		for (int j=0; j<W; j++)
			dist[i][j]=(grid[i][j]=='@' ? -1 : INT_MAX);
	}
	ii init={x1,y1}, nd={x2,y2};
	dist[init.first][init.second]=0;
	grid[init.first][init.second]='@';
	queue<ii> q; q.push(init);
	while(!q.empty()) {
		ii cur=q.front(); q.pop();
		for (int i=0; i<4; i++) {
			for (int j=1; j<=K; j++) {
				ii nxt=cur; nxt.first+=dx[i]*j; nxt.second+=dy[i]*j;
				if(nxt.first<0||nxt.first>=H||nxt.second<0||nxt.second>=W||dist[nxt.first][nxt.second]<=dist[cur.first][cur.second]) break;
				if(dist[nxt.first][nxt.second]==INT_MAX)
					q.push(nxt);
				dist[nxt.first][nxt.second]=dist[cur.first][cur.second]+1;
			}
		}
	}
	cout<<(dist[nd.first][nd.second]==INT_MAX ? -1 : dist[nd.first][nd.second])<<"\n";
	return 0;
}

Measured memory_bytes: 9464
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

const int INF = 1e9;
const int NIL = 2e9;

int n, m;
int a[55], b[55];
int as[55], bs[55];

// ???????????????????????????????????????-1?????????????????????
int dp[55][55][55][55][3][2];

int sum(int l, int r, int *a){
    return a[r] - a[l];
}

// x, y: ?¬????????????????????????????
// lx, ly: ?¶???????????°??????????????????????
int rec(int x, int y, int lx, int ly, int p, int t){
    int &res = dp[x][y][lx][ly][p][t];
    if(res != NIL) return res;
    if(t == 0){
        res = -INF;
        if(x != n){
            int cand = rec(x+1, y, lx, (a[x] ? ly : y), 0, !t);
            res = max(res, cand);
        }
        {
            int cand = sum(lx, x, as) - sum(ly, y, bs);
            if(p != 2) cand += rec(x, y, x, y, p+1, !t);
            res = max(res, cand);
        }
    } else {
        res = INF;
        if(y != m){
            int cand = rec(x, y+1, (b[y] ? lx : x), ly, 0, !t);
            res = min(res, cand);
        }
        {
            int cand = sum(lx, x, as) - sum(ly, y, bs);
            if(p != 2) cand += rec(x, y, x, y, p+1, !t);
            res = min(res, cand);
        }
    }
    return res;
}

int main(){
    while(cin >> n >> m){
        rep(i, n){
            cin >> a[i];
            a[i] = max(0, a[i]);
            as[i+1] = as[i] + a[i];
        }
        rep(i, m){
            cin >> b[i];
            b[i] = max(0, b[i]);
            bs[i+1] = bs[i] + b[i];
        }
        fill((int*)begin(dp), (int*)end(dp), NIL);
        cout << rec(0, 0, 0, 0, 0, 0) << endl;
    }
}

Measured memory_bytes: 217568
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n;
    cin >> n;
    int cur = 100, cnt = 0;
    while (cur < n) {
        cur = cur * (1 + 0.01);
        cur = floor(cur);
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void)
{
	int a;
	int b;
	int h;
	int w;

	for (;;)
	{
		
		scanf("%d %d", &h, &w);

		if (w==0 && h==0)
		{
			return 0;
		}
		
		for (a=1;a<=h;a++)
		{
			for (b=1;b<=w;b++)
			{			
				if (a%2==0)
				{
					if (b%2==0)
					{
						printf("#");
					}
					else
						printf(".");
				}
				else
					if (b%2==0)
					{
						printf(".");
					}
					else
						printf("#");
			}
			printf("\n");
		}
		printf("\n");
    }
    return 0;	
}

Measured memory_bytes: 572
import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    String S = sc.next();
    int firstL = -1;
    char prev = 'R';
    int kids[] = new int[S.length()];
    int cntR = 0;
    int cntL = 0;
    for(int i=0; i<S.length(); i++){
      if(S.charAt(i) == 'L'){
        cntL++;
        if(prev == 'R'){
          firstL = i;
          kids[i-1] += (cntR+1) / 2;
          kids[i] += cntR / 2;
          cntR = 0;
        }
        prev = 'L';
      }else{
        cntR++;
        if(prev == 'L'){
          kids[firstL-1] += cntL / 2;
          kids[firstL] += (cntL+1) / 2;
          cntL = 0;
        }
        prev = 'R';
      }
    }
    kids[firstL-1] += cntL / 2;
    kids[firstL] += (cntL+1) / 2;
    for(int i=0; i<S.length(); i++){
      out.print(kids[i] + " ");
    }
  }
}

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

// 
int main() {
    int N;
    cin >> N;
    long long A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    long long nowHigh = A[0];
    long long diff;
    long long ans = 0;
    for (int i = 1; i < N; i++) {
        diff = max((nowHigh - A[i]), (long long)0);
        ans += diff;
        nowHigh = max(A[i], nowHigh);
    }
    cout << ans;
}


Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll N, M; cin >> N >> M;
  map<ll,ll> d;
  ll a[M], b[M];
  for (ll i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 1) d[b[i]]++;
  }
  for (ll i = 0; i < M; i++) {
    if (d[a[i]] == 1 && b[i] == N) {
      cout << "POSSIBLE" << endl; return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N,H,W;
    cin>>N>>H>>W;
    cout <<(N-H+1)*(N-W+1)<<"\n";
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
#define INF 1e9 + 5
#define in scanf
using namespace std;
 
int main() {
	// your code goes here
		int n,k;
		in("%d %d",&n,&k);
		vector<int> a(n), d(n,INF);
		for(int& x : a){
			in("%d",&x);
		}
		d[0] = 0;
		for(int i = 0;i < n;++i)
		for(int j = i+1; j <= i+k; j++){
			if(j<n){
				d[j]  = min(d[i] + abs(a[i]-a[j]) , d[j]);
			}
		}
		cout << d[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#define ll long long 
#define MOD 1000000007
using namespace std;
 
int main(){
  
  int n;
  cin>>n;
  
  vector<ll> input(n);
  ll sum=0;
  
  for(int i=0;i<n;i++){
    cin>>input[i];
   sum= (sum+input[i])%MOD; 
  }
  ll leftsum=0, ans=0;
  for(int i=0;i<n;i++){
    sum-=input[i];
    if(sum<0) sum+=MOD;
    ans= (ans+ (sum*input[i])%MOD)%MOD;
  }
cout<<ans;  
 
}

Measured memory_bytes: 4840