akhauriyash/Code-Regression huggingface dataset:
// ALDS1_4_B Binary Search

#include <iostream>
#include <vector>

int main(int argc, char *argv[]){
	std::vector<int> S, T;
	int n, q, v;
	int c = 0;

	std::cin >> n;
	for(int i=0 ; i<n ; i++){
		std::cin >> v;
		S.push_back(v);
	}

	std::cin >> q;
	for(int i=0 ; i<q ; i++){
		std::cin >> v;
		T.push_back(v);
	}

	for(auto itr_t=T.begin() ; itr_t!=T.end() ; itr_t++){
		int begin = 0;
		int end = n-1;
		while(begin <= end){
			int center = (begin + end) / 2;
			if(S[center] == *itr_t){
				c++;
				break;
			}
			else if(S[center] <= *itr_t){
				begin = center + 1;
			}
			else{
				end = center - 1;
			}
		}
	}

	std::cout << c << std::endl;

	return 0;
}



Measured memory_bytes: 3552
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      int n,m;
      cin>>n>>m;
      int a[n];
      double sum=0.0;
      REP(i,n)
      {
          cin>>a[i];
          sum+=a[i];
      }
      sum/=4*m;
      int count=0;
      REP(i,n)
      {
          if(a[i]>=sum)
          count++;
      }
      if(count>=m)cout<<"Yes";
      else cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 256
main = readLn >>= putStrLn . unwords . map show . solve
-- https://ja.wolframalpha.com/input/?i=4%2Fn+%3D+1%2Fa%2B1%2Fb%2B1%2Fc+%E3%82%92+c%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E8%A7%A3%E3%81%8F
solve n = head $
  [ [a, b, c]
  | a <- [1..3500], b <- [1..3500]
  , a*b*n <= 3500 * (4*a*b-a*n-b*n)
  , 4*a*b /= n*(a+b)
  , mod (a*b*n) (4*a*b-a*n-b*n) == 0
  , let c = div (a*b*n) (4*a*b-a*n-b*n)
  , 1 <= c
  ]

Measured memory_bytes: 1148
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main()
{
        //input->compute->output//
        int N,i;
        cin>>N>>i;

        if(N==1&&i==1){
                cout<<i<<endl;
        } else{
                cout<<N-i+1<<endl;
        }
        

        return 0;
}


Measured memory_bytes: 256
def main():
	n, x = map(int, input().split())
	a, p = [1], [1]
	for i in range(n):
		a.append(a[i]*2 + 3)
		p.append(p[i]*2 + 1)

	def f(n, x):
		if n == 0:
			return 0 if x <= 0 else 1
		elif x <= 1+a[n-1]:
			return f(n-1, x-1)
		else:
			return p[n-1] + 1 + f(n-1, x-2-a[n-1])

	print(f(n, x))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
B = readInts()
num = 0
minus = 0
box = []
for i in range(n):
    diff = A[i] - B[i]
    if diff < 0:
        minus -= diff
        num += 1
    else:
        box.append(diff)
box = sorted(box, reverse = True)
if num == 0:
    print(0)
else:
    plus = 0
    for a in box:
        plus += a
        num += 1
        if plus >= minus:
            break
    if plus >= minus:
        print(num)
    else:
        print(-1)


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

int main(){
    int a, b;
    cin >> a >> b;
    if(a == b){
        cout << "Draw\n";
    } else if(a == 1){
        cout << "Alice\n";
    } else if(b == 1){
        cout << "Bob\n";
    } else {
        if(a > b){
            cout << "Alice\n";
        } else {
            cout << "Bob\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

from collections import defaultdict


def find(parent, x):
    if parent[x] == x:
        return x
    else:
        parent[x] = find(parent, parent[x])
        return parent[x]


def union(parent, rank, x, y):
    x = find(parent, x)
    y = find(parent, y)
    if x == y:
        return
    if rank[x] < rank[y]:
        parent[x] = y
    elif rank[x] > rank[y]:
        parent[y] = x
    else:
        parent[y] = x
        rank[x] += 1


def main():
    n, k, l = [int(i) for i in raw_input().split()]
    road_parent = range(n)
    road_rank = [0 for _ in xrange(n)]
    train_parent = range(n)
    train_rank = [0 for _ in xrange(n)]

    for i in range(k):
        p, q = [int(i)-1 for i in raw_input().split()]
        union(road_parent, road_rank, p, q)
    for i in range(l):
        r, s = [int(i)-1 for i in raw_input().split()]
        union(train_parent, road_rank, r, s)
    counter = defaultdict(int)
    for i in range(n):
        counter[(find(road_parent, i), find(train_parent, i))] += 1
    ans_list = [counter[(find(road_parent, i), find(train_parent, i))] for i in xrange(n)]
    print ' '.join(map(str, ans_list))


if __name__ == "__main__":
    main()


Measured memory_bytes: 55536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;


    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        string S = cin.next();
        int K = cin.nextInt();
        char c=S[K-1];
        string ans="";
        for(int i=0;i<N;i++)
        {
          if(S[i]!=c)ans+="*";
          else ans+=S[i];
        }
        Console.WriteLine(ans);
    }


}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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

int main()
{
    string s,ret; cin>>s;
    int len = s.length();
    char last = s[len-1];
    if(last=='s'){
        s+="es";
    }
    else s+="s";
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 3624
from fractions import gcd
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    t, a = map(int, input().split())
    H = list(map(int, input().split()))

    d_min = float('inf')
    ans = 0
    for i in range(n):
        d = abs(a - (t - H[i]*0.006))
        if d<d_min:
            d_min = d
            ans = i+1
    
    print(ans)
    

 
if __name__ == '__main__':
    main()


Measured memory_bytes: 5088
#include <array>
#include <iostream>
#include <map>
#include <vector>

template <typename Map, typename Value = typename Map::mapped_type>
Value &
MapIncrementCount(Map &map, typename Map::key_type key, Value value)
{
    auto [it, flag] = map.try_emplace(key, 0);
    (void)flag;
    auto &v = it->second;
    v += value;
    return v;
}

int
main()
{
    std::ios::sync_with_stdio(false);
    std::size_t n;
    std::cin >> n;
    std::vector<int> inputs;
    inputs.reserve(n);
    for (std::size_t i = 0; i<n; ++i)
    {
        int input;
        std::cin >> input;
        inputs.emplace_back(input);
    }

    std::size_t operationCount;
    std::cin >> operationCount;
    std::vector<std::pair<int, int>> operations;
    operations.reserve(operationCount);
    for (std::size_t i = 0; i<operationCount; ++i)
    {
        int b, c;
        std::cin >> b >> c;
        operations.emplace_back(b, c);
    }

    long long sum = 0;
    std::map<int, int> valueCounts;
    for (auto &input : inputs)
    {
        MapIncrementCount(valueCounts, input, 1);
        sum += input;
    }

    for (std::size_t i = 0; i<operationCount; ++i)
    {
        auto &[b, c] = operations[i];

        auto findB = valueCounts.find(b);
        if (findB==valueCounts.end())
        {
            std::cout << sum << "\n";
            continue;
        }

        sum -= static_cast<long long>(b)*findB->second;
        sum += static_cast<long long>(c)*findB->second;

        MapIncrementCount(valueCounts, c, findB->second);
        valueCounts.erase(b);
        std::cout << sum << "\n";
    }
}


Measured memory_bytes: 7324
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B&&B == C&&C == A) {
		if (A % 2 == 0) cout << -1 << endl;
		else cout << 0 << endl;
		return 0;
	}
	int ans = 0;
	while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
		int a = B / 2 + C / 2;
		int b = A / 2 + C / 2;
		int c = A / 2 + B / 2;
		A = a;
		B = b;
		C = c;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
// typedef std::vector<int > vecint ;
// typedef std::vector<std::string > vecstr ;
typedef vector<int > vecint ;
typedef vector<string > vecstr ;

int main()
{
  int x, a, b;
  cin >> x >> a >>b ;
  if(abs(x - a) > abs(x - b)){
    cout << "B"<< endl;
  }else{
  cout << "A" << endl;
  }

}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

#define maxn 300005
#define INF 2000000000
#define alpha 26

int a[maxn] , b[maxn] ;

bool f(int x , int n)
{
    for(int i=1 ; i<=n ; i++)
    {
        if(a[i]<x) b[i] = 0 ;
        else b[i] = 1 ;
    }

    int m = (n+1)/2 ;

    if(b[m] == b[m+1] || b[m] == b[m-1]) return b[m] ;

    bool fl = 0 ;
    for(int i=1 ; i<n ; i++)
    {
        if(b[i] == b[i+1]) fl = 1 ;
    }

    if(fl==0)
    {
        if( (m-1)%2==1 ) return (b[m]^1) ;
        else return b[m] ;
    }

    int r = 2*n , l = 2*n ;

    for(int i=m+1 , j=1 ; i<n ; i++,j++)
    {
        if( b[i]==b[i+1] )
        {
            r = j ;
            break ;
        }
    }

    for(int i=m-1,j=1 ; i>1 ; i--,j++)
    {
        if(b[i] == b[i-1] )
        {
            l = j ;
            break ;
        }
    }

    if(l<r) return b[m-l] ;
    else return b[m+r] ;
}

int main()
{
    int n ;

    scanf("%d",&n) ;

    n = 2*n - 1 ;

    for(int i=1; i<=n ; i++) scanf("%d",&a[i]) ;

    int lo = 1 , hi = n ;

    while( lo < hi )
    {
        int mid = (lo+hi+1)/2 ;

        int ret = f(mid,n) ;

  //      printf("%d %d\n",mid,ret) ;

        if( ret ) lo = mid ;
        else hi = mid - 1 ;
    }

    printf("%d\n",lo) ;

    return 0 ;
}


Measured memory_bytes: 1920
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         char val = st.nextToken().charAt(0);
         if(val >= 'A' && val <= 'Z')
            System.out.println('A');
         else
            System.out.println('a');
      }
   }

Measured memory_bytes: 32576
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n; long long k;
  cin>>n>>k;
  long long a[n];
  REP(i, n) cin>>a[i];
  
  long long d[n];
  REP(i, n){
    if(i == 0){
      d[i] = a[i];
    }else{
      d[i] = a[i] + d[i - 1];
    }
  }
  REP(i, n){
    d[i] -= i;
    d[i] = (d[i] % k + k) % k;
  }
  queue<long long> q;
  map<long long, long long> cnt;
  long long ans = 0;
  REP(i, n){
    if(i < k - 1) if(d[i] == 1) ans++;
    if((long long)q.size() >= k){
      long long val = q.front();
      q.pop();
      cnt[val]--;
    }
    ans += cnt[d[i]];
    q.push(d[i]);
    cnt[d[i]]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 20880
#include<bits/stdc++.h>
using namespace std;
long long f[10009];
main(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        f[s[i]]++;
    }
    long long ans = (long long)s.size() * ((int)s.size() - 1) / 2 + 1;
    for(int i = 0; i < 400; i++){
        ans -= f[i] * (f[i] - 1) / 2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>

int main() {
  string S;
  cin >> S;
  
  int tmp = 0;
  int max_ans = 0;
  rep(i,S.size()){
    char p = S.at(i);
    if((p == 'A') || (p == 'C') || (p == 'G') || (p == 'T')){
      tmp++;
    }else{
      tmp = 0;
    }
    max_ans = max(max_ans,tmp);
  }

  cout << max_ans << endl;
  return 0;
}


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

int main() {

  int a, b, c;
  cin >> a >> b >> c;

  int ans = 0;
  while(b >= 0) {
    if(a <= b && ans < c) {
      b -= a;
      ans++;
    }else{
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int H[100000];

int main(void) {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N;++i) {
    scanf("%d", H + i);
  }

  int ans = 0;
  int cnt = 0;
  for (int i = 0; i < N - 1; ++i) {
    if (H[i] >= H[i + 1]) {
      cnt++;
      if (ans < cnt)
        ans = cnt;
    } else {
      cnt = 0;
    }
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 2460
// Problem : B - 1%
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#define ff first
#define fs second
#define lb lower_bound
#define ub upper_bound

#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector< vi >
#define vpii vector< pii >
#define vb vector<bool>
#define si set<int>
#define mii map<int, int>
#define mci map<char, int>
#define md 1000000007
#define pb push_back
#define eb emplace_back
#define fio ios_base::sync_with_stdio (false); cin.tie (NULL);  cout.tie (NULL);
#define qw1(x) cerr<<#x<<": "<<x<<" "<<endl
#define qw2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define qw3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define qw4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl


#define f(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define rl(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define all(x) x.begin(),x.end()
#define endl '\n'
void printv(vector<int>  v){ for(int i=0;i<v.size();i++) cout<<v[i]<<' '; cout<<endl;   }
int bem(int m , int n, int mod) { int res=1; while(n){
	     			        if(n%2!=0) { res*=m; res%=mod; }
	    			        m*=m;   m%=mod;   n/=2;
			                          }
				return res;	}
int be(int a, int b) { int res=1; 	while(b){
				if(b%2!=0) res*=a;
				a*=a; b/=2;
				}
			return res;	}
void sieve(int n, vb &prime){
    prime[0]=false;     prime[1]=false;
    for(int i=2;i*i<=n;i++){
         if(prime[i]==true){
              for(int j=i*i;j<=n;j+=i)    prime[j]=false;
             	  }
    	 }
	}

void solve()
  {
int z=100;
int x; cin>>x;
int cnt=0;
while(z<x)
{
	z= z + (z/100);
	cnt++;
}
cout<<cnt<<endl;

  }

int32_t main ()
{
//fio
int t=1; 
//cin>>t; 
while(t--){
	solve();
}
 
}








Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
//----
const int N=101010;
int H, W, n;
map<pii, int> F;
vector<pii> v;
bool vis[N][9];
ll cnt[10];
const int dx[9]={-1, -1, -1, 0, 0, 0, 1, 1, 1};
const int dy[9]={-1, 0, 1, -1, 0, 1, -1, 0, 1};
const int sx[9]={1, 1, 1, 0, 0, 0, -1, -1, -1};
const int sy[9]={1, 0, -1, 1, 0, -1, 1, 0, -1};
int main(){
	scanf("%d%d%d", &H, &W, &n);
	rep(i, 0, n){
		int x, y;
		scanf("%d%d", &x, &y);
		F[mp(x, y)]=i;
		v.pb(mp(x, y));
	}
	rep(i, 0, n){
		rep(j, 0, 9){
			if(vis[i][j])continue;
			vis[i][j]=1;
			int x, y;
			x=v[i].fi+sx[j];
			y=v[i].se+sy[j];
			int c=0;
			bool ok=1;
			rep(k, 0, 9){
				int nx=x+dx[k], ny=y+dy[k];
				if(nx<=0||nx>H||ny<=0||ny>W){
					ok=0;
					continue;
				}
				if(F.count(mp(nx, ny))){
					c++;
					vis[F[mp(nx, ny)]][k]=1;
				}
			}
			if(ok)cnt[c]++;
		}
	}
	cnt[0]=1ll*(W-2)*(H-2);
	rep(i, 1, 10)cnt[0]-=cnt[i];
	rep(i, 0, 10)printf("%lld\n", cnt[i]);
	return 0;
}


Measured memory_bytes: 10100
#include <iostream>
#include <stdio.h>
#include<algorithm>
#include <math.h>
#include <string.h>
#define eps 1e-9
typedef long long int ll;
#define p1 3.1415926535898
using namespace std;
char  a[1000005];
int main()
{
    cin>>a;
    int sum=0;
    int t=0;
    int n=strlen(a);
    for(int i=n-1; i>=0; i--)
    {
        int k,m;
        k=(a[i]-'0'+t);
        m=10-k;
        if(k>m)
        {
            t=1;
            sum+=m;
        }
        else if(k==m)
        {
            if(a[i-1]-'0'>=5)
            {
                t=1;
                sum+=m;
            }
            else
            {
                t=0;
                sum+=k;
            }
        }
        else
        {
            t=0;
            sum+=k;
        }
    }
    if(t!=0)
    {
        sum+=t;
    }
    cout<<sum;
    return 0;
}



Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long llong;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
 
struct X{
    int x;
    string s;
};
 
int main(){
    int n, m;
    cin >> n >> m;
 
    X v[m];
    REP(i, m){
        cin >> v[i].x >> v[i].s;
    }
 
    int cntw[n + 1];
    int cnta[n + 1];
    REP(i, n + 1){
        cntw[i] = 0;
        cnta[i] = 0;
    }
    llong wa = 0;
    llong ac = 0;
    REP(i, m){
        if (v[i].s == "AC"){
            cnta[v[i].x] += 1;
            if (cnta[v[i].x] == 1){
                ac++;
                wa += cntw[v[i].x];
            }
        }else{
            cntw[v[i].x] += 1;
        }
    }
 
    cout << ac << " " << wa << endl;
    return 0;
}

Measured memory_bytes: 7296
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x);
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };


int main(void)
{

	string answer = "AKIHABARA";

	//状態機械による遷移を考える。
	string input;
	cin >> input;
	int n = input.size(), j = 0;

	for (int i = 0; i < n; i++) {

		if (j >= answer.size()) {
			j = 0;
			break;
		}

		cerr << i << " " << j << endl;

		if (answer[j] != input[i]) {
			if (answer[j] == 'A') {
				i--;
			}
			else {
				j = 0;
				break;
			}
		}
		j++;
	}

	if(8 <= j && j <= 9)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

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

#define ll long long

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n =(int)s.size();
    vector<int> l(n), r(n);
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == 'R') {
            r[i] = (i < n - 1 ? r[i + 1] : 0)+ 1;
        } else {
            r[i] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            l[i] = (i ? l[i - 1] : 0) + 1;
        } else {
            l[i] = 0;
        }
    }
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        int cnt;
        if (s[i] == 'L') {
            cnt = l[i];
            if (cnt % 2 == 0) {
                ans[i - cnt]++;
            } else{
                ans[i - cnt + 1]++;
            }
        } else {
            cnt = r[i];
            if (cnt % 2 == 0) {
                ans[i + cnt]++;
            } else {
                ans[i + cnt - 1]++;
            }
        }
    }
    for (int i = 0; i < n; i++){
       cout << ans[i] << (i < n - 1 ? ' ' : '\n');
    }
    return 0;
}



Measured memory_bytes: 1872
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int main()
{
	int a, b, m, mi = 100000000, ami = 100000000, bmi = 100000000, ai[100001], bi[100000];
	scanf("%d%d%d", &a, &b, &m);
	for(int i = 0; i < a; ++i)
	{
		scanf("%d", &ai[i]);
		ami = min(ami, ai[i]);
	}
	for(int i = 0; i < b; ++i)
	{
		scanf("%d", &bi[i]);
		bmi = min(bmi, bi[i]);
	}
	mi = min(mi, ami + bmi);
	for(int i = 0, x, y, c; i < m; ++i)
	{
		scanf("%d%d%d", &x, &y, &c);
		mi = min(mi, ai[x - 1] + bi[y - 1] - c);
	}
	printf("%d\n", mi);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

static const int MAX_V = 1e5+10;
const int MAX_LOG_V = 110;

vector<int> G[MAX_V];
int V, root;

int parent[MAX_LOG_V][MAX_V];
int depth[MAX_V];

void add_edge(int s, int t){
	G[s].push_back(t);
}

void dfs(int v, int p, int d){
	parent[0][v] = p;
	depth[v] = d;
	for (int i = 0; i < G[v].size(); ++i) {
		if (G[v][i] != p) dfs(G[v][i], v, d+1);
	}
}

void init() {
	dfs(root, -1, 0);
	for (int k = 0; k+1 < MAX_LOG_V; ++k)
	{
		for (int v = 0; v < V; ++v)
		{
			if (parent[k][v] < 0) parent[k+1][v] = -1;
			else parent[k+1][v] = parent[k][parent[k][v]];
		}
	}
}

int lca(int u, int v) {
	if (depth[u] > depth[v]) swap(u, v);
	for (int k = 0; k < MAX_LOG_V; ++k) {
		if ((depth[v] - depth[u]) >> k & 1) v = parent[k][v];
	}
	if (u == v) return u;

	for (int k = MAX_LOG_V - 1; k >= 0; k--)
	{
		if (parent[k][u] != parent[k][v])
		{
			u = parent[k][u];
			v = parent[k][v];
		}
	}
	return parent[0][u];
}

int main(int argc, char const *argv[])
{
	cin >> V;
	root = 0;
	for (int i = 0; i < V; ++i)
	{
		int k;
		cin >> k;
		for (int j = 0; j < k; ++j)
		{
			int c;
			cin >> c;
			add_edge(i, c);
		}
	}
	int q;
	cin >> q;
	vector<pair<int, int> > vec;
	for (int i = 0; i < q; ++i)
	{
		int u, v;
		cin >> u >> v;
		vec.push_back(make_pair(u, v));
	}
	init();
	for (int i = 0; i < vec.size(); ++i)
	{
		cout << lca(vec[i].first, vec[i].second) << endl;
	}
	return 0;
}


Measured memory_bytes: 57308
#include <stdio.h>

int main()
{
	int N,K; scanf ("%d %d",&N,&K);
	long long A = 0;
	if (K == 0) A -= N;

	for (int b=K+1;b<=N;b++){
		A += (N + 1) / b * (b - K);
		int s = (N + 1) % b;
		if (s){
			if (s > K) A += s - K;
		}
	}
	printf ("%lld\n",A);

	return 0;
}

Measured memory_bytes: 128
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var result int
	switch next() {
	case "SSS":
		result = 0
	case "SSR", "SRS", "RSS", "RSR":
		result = 1
	case "SRR", "RRS":
		result = 2
	case "RRR":
		result = 3
	}
	fmt.Println(result)
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define M 1000000007
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------
// [gcd]
template<class T> T gcd(T a, T b)
{if (a < b) swap(a,b);return b ? gcd(b, a % b) : a;}
template<class T> T lcm(T a, T b)
{ T k=gcd(a, b);return (a/k) * (b/k) *k;}

void Main(){
  ll n,m;
  cin>>n>>m;
  string s,t;
  cin>>s>>t;
  ll st = gcd(n,m);
  ll nst = n/st;
  ll mst = m/st;
  bool exist = true;
  for(ll i=0;i<st;i++){
    if(s[nst*i]!=t[mst*i]) exist=false;
  }
  cout<<((exist)? lcm(n,m):-1)<<endl;
} int main(int argc,char** argv)
{fastio; myio; Main();}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	double num, i, ans;
	cin >> num;
	num /= 3.0;
	ans = num * num * num;
	printf("%.10lf\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){

int a,b,op;

while(1){

scanf("%d %c %d",&a,&op,&b);

if(op == '?') break;

if(op == '+'){
printf("%d\n",a+b);
}

if(op == '*'){
printf("%d\n",a*b);
}

if(op == '/'){
printf("%d\n",a/b);
}

if(op == '-'){
printf("%d\n",a-b);
}
}

return 0;
}


Measured memory_bytes: 2048
package main

import "fmt"

func main() {
	var n, a, b, c, d int
	var s string
	fmt.Scan(&n, &a, &b, &c, &d, &s)
	a--
	b--
	c--
	d--
	if c < d {
		for {
			if b+1 == d || b+2 == d {
				break
			}
			if s[b+1] == '.' {
				b++
				continue
			}
			if s[b+2] == '.' {
				b += 2
				continue
			}
			fmt.Println("No")
			return
		}
		for {
			if a+1 == c || a+2 == c {
				break
			}
			if s[a+1] == '.' {
				a++
				continue
			}
			if s[a+2] == '.' {
				a += 2
				continue
			}
			fmt.Println("No")
			return
		}
		fmt.Println("Yes")
		return
	}
	for {
		no := true
		for {
			if a == c {
				break
			}
			if s[a+1] == '.' && a+1 != b {
				a++
				no = false
				continue
			}
			if a+1 == c {
				break
			}
			if s[a+2] == '.' && a+2 != b {
				a += 2
				no = false
				continue
			}
			break
		}
		for {
			if b == d {
				if a == c {
					fmt.Println("Yes")
					return
				}
				break
			}
			if s[b+1] == '.' && b+1 != a {
				b++
				no = false
				break
			}
			if b+1 == d {
				break
			}
			if s[b+2] == '.' && b+2 != a {
				b += 2
				no = false
				break
			}
			break
		}
		if no {
			fmt.Println("No")
			return
		}
	}
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{
  string str;
  cin>>str;
  int L = 0, R = str.size() - 1;
  int ANS = 0;
  while(L<R)
  {
    if(str[L] == str[R])
    {
      L++;R--;
      continue;
    }
    else
    {
      if(str[L] =='x' && str[R] != 'x')
      {
        ANS++;
        L++;
      }
      else if(str[L] !='x' && str[R] == 'x')
      {
        ANS++;
        R--;
      }
      else
      {
        cout<<-1<<endl;
        return;
      }
      
    }
    
  }
  cout<<ANS<<endl;
  
  return;
  
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 512
# 入力　文字列1つ
s = input()
ans = []

for i in range(len(s)) :
    if s[i] == "0" :
        ans.append("0")
    elif s[i] == "1" :
        ans.append("1")
    else :
        if ans :
            ans.pop()

name = "".join(ans)

print(name)


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

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

    n,m,s = map(int, input().split())
    s = min(s, 2500)
    # edge[i]:頂点iからの[行先, 必要な銀貨, 時間]
    edge = [[] for _ in range(n)] #頂点数, 場合によって変える
    for _ in range(m):
        a,b,c,d = map(int, input().split())
        edge[a-1].append((b-1, c, d))
        edge[b-1].append((a-1, c, d))

    # 銀貨との交換を自己ループとする
    for i in range(n):
        c, d = map(int, input().split())
        edge[i].append((i, -c, d))

    dp = [[inf]*2501 for _ in range(n)]
    dp[0][s] = 0
    # [時間, 所持金, 頂点]
    hq = [(0, s, 0)]
    heapify(hq)

    while hq:
        t, ginka, v = heappop(hq)
        if dp[v][ginka] < t:
            continue
        for nv, a, b in edge[v]:
            if ginka < a:
                continue
            ng = ginka - a
            if ng > 2500:
                ng = 2500
            f = 0
            for i in range(ng, -1, -1):
                if dp[nv][i] > t+b:
                    dp[nv][i] = t+b
                    f = 1
                else:
                    break
            if f:
                heappush(hq, (t+b, ng, nv))
    
    for i in range(1, n):
        print(min(dp[i]))

if __name__ == '__main__':
    main()



Measured memory_bytes: 72020
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x, a, b;
    cin >> x >> a >> b;

    if (max(x - a, a - x) < max(x - b, b - x)) {
        cout << 'A' << endl;
    } else {
        cout << 'B' << endl;
    }
    return 0;
}

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

int main(int argc, char *argv[]) {
  std::string s, t;
  std::cin >> s >> t;

  int m = 0;
  for (size_t i = 0; i < s.size() - t.size() + 1; ++i) {
    int count = 0;
    for (size_t j = 0; j < t.size(); ++j) {
      if (s.at(i + j) == t.at(j))
        ++count;
    }
    m = std::max(m, count);
  }

  std::cout << t.size() - m << std::endl;
}


Measured memory_bytes: 3160
class UnionFindTree:
    __slots__ = ('__parents', )

    def __init__(self, n):
        self.__parents = [-1] * n

    def find(self, x):
        p = self.__parents
        if p[x] < 0:
            return x
        parent = self.find(p[x])
        p[x] = parent
        return parent

    def union(self, x, y):
        p = self.__parents
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if p[x] > p[y]:
            x, y = y, x
        p[x] += p[y]
        p[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.__parents[self.find(x)]


def spline(func_=int, iter_=None):
    if iter_ is None:
        iter_ = input().split()
    return map(func_, iter_)


def main():
    n, m, k = spline()
    similar = UnionFindTree(n)
    candidates = [-1] * n
    kw = {'func_': lambda x: int(x) - 1}
    for _ in range(m):
        a, b = spline(**kw)
        similar.union(a, b)
        candidates[a] -= 1
        candidates[b] -= 1
    for i in range(n):
        candidates[i] += similar.size(i)
    for _ in range(k):
        c, d = spline(**kw)
        if similar.same(c, d):
            candidates[c] -= 1
            candidates[d] -= 1
    print(*candidates, sep=' ')


if __name__ == "__main__":
    main()


Measured memory_bytes: 13340
import java.util.Scanner;

public class Main {
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int possible = (B/A);
        int numTimesOpt = (C < (possible)) ? C: possible;  

        System.out.println(numTimesOpt);
    }

}


Measured memory_bytes: 22484
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

ll N,W;
ll w[100010];
ll v[100010];
ll dp[100010];

int main ()
{
    cin >> N >> W;
    REP(i,N) cin >> w[i] >> v[i];

    for (int i = 0; i < N; i++) {
        for (int j = 100005; j >= 0; j--) {
            if (j + w[i] > 100005) continue;
            dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
        }
    }

    ll ans = 0;
    REP(i,W + 1) ans = max(ans, dp[i]);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

typedef long double ld;
const ld eps = 1.0e-12; // 許容される誤差


int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  auto mul = (c - a - b) * (c - a - b);
  if (c - a - b < 0) {
    cout << "No" << endl;
  } else if (mul > 4*a*b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main(){
  long long k,n;
  cin >> k >> n;
  vector<long long> h(n);
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  long long sa = 0;
  for(int i = 0; i < n-1; i++){
    sa = max(sa, h[i+1] - h[i]);
  }
  sa = max(sa, h[0] + k - h[n-1]);
  cout << k - sa << endl;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<int> a(N);
  long long l = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    l += a[i] - 1;
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 764
(import (java.time LocalTime ))
(import (java.time.temporal ChronoUnit))
(import (java.time.format DateTimeFormatter))

(def hhmm (DateTimeFormatter/ofPattern "HH:mm"))
(let [h1 (read)
      m1 (read)
      h2 (read)
      m2 (read)
      t1 (LocalTime/parse (format "%02d:%02d" h1 m1) hhmm)
      t2 (LocalTime/parse (format "%02d:%02d" h2 m2) hhmm)
      k (read)
      period (.between ChronoUnit/MINUTES t1 t2)
      ]
  (println (- period k)))


Measured memory_bytes: 95852
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    vector<string> s(n);
    REP(i, n) cin >> s[i];

    for(int i = 0; i < 26; i++) {
        char tmp = 'a' + i;
        int ma = inf;
        for(int i = 0; i < n; i++) {
            int cnt = 0;
            for(int j = 0; j < s[i].size(); j++) {
                if (s[i][j] == tmp) cnt++;
            }
            chmin(ma, cnt);
        }

        REP(i, ma) cout << tmp;
    }

    cout << endl;
    

    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();
	        long[] T = new long[N];
	        long sum = 0;
	        for(int i = 0 ; i < N; i++) {
	            T[i] = sc.nextLong();
	            sum += T[i];
	        }
	        int M = sc.nextInt();
	        for(int i = 0 ; i < M; i++) {
	            int P = sc.nextInt() - 1;
	            long X = sc.nextLong();
	            System.out.println(sum - (T[P] - X));
	        }
	}
}

Measured memory_bytes: 23764
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <utility>
#include <vector>
using namespace std;

constexpr int number_of_hands = 9;
typedef pair<int, char> card;

inline bool same_colors(vector<card>::const_iterator first, vector<card>::const_iterator last) {
	const char color = first->second;
	while(++first != last) {
		if(color != first->second) return false;
	}

	return true;
}
inline bool continues(vector<card>::const_iterator first, vector<card>::const_iterator last) {
	int next = first->first;
	while(++first != last) {
		if(++next != first->first) return false;
	}

	return true;
}
inline bool same_numbers(vector<card>::const_iterator first, vector<card>::const_iterator last) {
	const int number = first->first;
	while(++first != last) {
		if(number != first->first) return false;
	}

	return true;
}

inline bool is_set(vector<card>::const_iterator first, vector<card>::const_iterator last) {
	return same_colors(first, last) && (continues(first, last) || same_numbers(first, last));
}

bool win(const vector<card>& cards) {
	for(int i = 0; i < number_of_hands; i += 3) {
		if(!is_set(cards.begin() + i, cards.begin() + i + 3)) return false;
	}

	return true;
}

int judge(vector<card>& cards) {
	sort(cards.begin(), cards.end());
	do {
		if(win(cards)) return 1;
	} while(next_permutation(cards.begin(), cards.end()));

	return 0;
}

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

	int T;
	cin >> T;

	while(T--) {
		vector<card> cards(number_of_hands);
		for(int i = 0; i < number_of_hands; ++i) {
			cin >> cards[i].first;
		}

		for(int i = 0; i < number_of_hands; ++i) {
			cin >> cards[i].second;
		}

		cout << judge(cards) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1200
k=gets.to_i
l=[0]
r=[]
z=1
while k>0
  if l==[9]*z
    l=[1]+[0]*z
    r=[-1]+[0]*(z-1)
    z+=1
  else
    f=false
    (z-1).times do |i|
      if l[-2-i]==9&&r[-1-i]<0||l[-2-i]!=9&&r[-1-i]<1
        r[-1-i]+=1
        l[-1-i]+=1
        (-i).upto(-1) do |j|
          if l[j-1]==0
            r[j]=0
          else
            r[j]=-1
          end
          l[j]=l[j-1]+r[j]
        end
        f=true
        break
      end
    end
    if !f
      l[0]+=1
      (1-z).upto(-1) do |j|
        if l[j-1]==0
          r[j]=0
        else
          r[j]=-1
        end
        l[j]=l[j-1]+r[j]
      end
    end
  end
  k-=1
end
puts l.join



Measured memory_bytes: 1916