akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        UnionFind uf = new UnionFind();
        for (int ai : a) {
            int value = ai;
            for (int i = 2; i * i <= ai; i++) {
                if (value % i == 0) {
                    uf.unite(ai, i);
                    while (value % i == 0) value /= i;
                }
            }
            if(value != 1) {
                uf.unite(ai, value);
            }
        }
        int[] asorted = a.clone();
        Arrays.sort(asorted);
        for (int i = 0; i < n; i++) {
            if(!uf.isSameRoot(a[i], asorted[i])) {
                System.out.println(0);
                return;
            }
        }
        System.out.println(1);
    }
}

class UnionFind {
    int[] data = new int[100010];

    UnionFind() {
        for (int i = 0; i < 100010; i++) {
            data[i] = i;
        }
    }

    void unite(int left, int right) {
        data[root(left)] = root(right);
    }

    int root(int i) {
        if (data[i] == i) return i;
        else return data[i] = root(data[i]);
    }

    boolean isSameRoot(int x, int y) {
        return root(x) == root(y);
    }
}


Measured memory_bytes: 70648
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main()
{
	int a[4][14] = {};
	cin >> n;
	map<ll, char> map1;
	map1[0] = 'S';
	map1[1] = 'H';
	map1[2] = 'C';
	map1[3] = 'D';
	REP(i,n)
	{
		char t;
		cin >> t >> k;
		if (t == 'S') a[0][k] = 1;
		if (t == 'H') a[1][k] = 1;
		if (t == 'C') a[2][k] = 1;
		if (t == 'D') a[3][k] = 1;
	}
	REP(i,4)
	{
		REP1(j,13)
		{
			if (a[i][j] == 0) cout << map1[i] << ' ' << j << endl;
		}
	}
}

Measured memory_bytes: 3124
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int dx1[] = {0, 0};
const int dy1[] = {-1, 1};  // 上、下

const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

int H, W, K;
char cake[333][333];
int ans[333][333];
bool used[333];

void bfs1(int x, int y, int num) {
  queue<P> que;
  que.push(P(x, y));  // start
  while (!que.empty()) {
    P p = que.front();
    que.pop();
    for (int i = 0; i < 2; i++) {
      int nx = p.first + dx1[i];
      int ny = p.second + dy1[i];
      if (nx < 0 || ny < 0 || W <= nx || H <= ny) continue;
      if (cake[ny][nx] == '#') continue;
      if (ans[ny][nx] != 0) continue;
      ans[ny][nx] = num;
      if (nx + 1 < W && used[nx + 1] == false) {
        ans[ny][nx + 1] = num;
      }
      if (0 <= nx - 1 && used[nx - 1] == false) {
        ans[ny][nx - 1] = num;
      }
      que.push(P(nx, ny));
    }
  }
}

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

  cin >> H >> W >> K;
  rep(y, H) {
    rep(x, W) {
      cin >> cake[y][x];
      if (cake[y][x] == '#') {
        used[x] = true;
      }
    }
  }

  int num = 1;
  rep(x, W) {
    bool r = false, l = false;
    rep(y, H) {
      if (cake[y][x] == '#') {
        ans[y][x] = num;

        if (0 <= x - 1 && used[x - 1] == false) {
          ans[y][x - 1] = num;
          l = true;
        }
        if (x + 1 < W && used[x + 1] == false) {
          ans[y][x + 1] = num;
          r = true;
        }
        bfs1(x, y, num);
        num++;
      }
    }
    if (l) used[x - 1] = true;
    if (r) used[x + 1] = true;
  }

  rep(y, H) {
    rep(x, W - 1) {
      if (ans[y][x + 1] == 0) {
        ans[y][x + 1] = ans[y][x];
      }
    }
  }

  rep(y, H) {
    for (int x = W - 1; 0 < x; x--) {
      if (ans[y][x - 1] == 0) {
        ans[y][x - 1] = ans[y][x];
      }
    }
  }

  rep(y, H) {
    rep(x, W) { cout << ans[y][x] << (x != W - 1 ? " " : ""); }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")

//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

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=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main() {
  // 高速化
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);


    int N, M;
    cin >> N;
    cin >> M;
    int A[N];
    int count=0;
    REP(i, N){
      cin >> A[i];
      count+= A[i];
    }

    int OK=0;
    REP(i, N){
      if(A[i] * 4 * M >= count){
        OK++;

     //   cout << i << ":" << A[i] << "\n";
      }
    }

    if(OK>=M){
      cout << "Yes"  << "\n"; 
    }else{
      cout << "No"  << "\n"; 
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
//  cout << N <<endl;
  vector<string> s(N);
  for(int i=0; i<N; ++i) {
    cin >> s.at(i);
//    cout << s.at(i) << endl;
  }
  int M;
  cin >> M;
//  cout << M <<endl;
  vector<string> t(M);
  for(int i=0; i<M; ++i) {
    cin >> t.at(i);
//    cout << t.at(i) << endl;
  }
  
  vector<string> s2;
  vector<int>    s3;
  for(int i=0; i<N; ++i) {
    bool flg=0;
    for(int j=0; j<s2.size(); ++j) {
      if (s2.at(j) == s.at(i)) {
        flg=1;
        s3.at(j) += 1;
      }
    }
    if (flg==0) {
      s2.push_back(s.at(i));
      s3.push_back(1);
    }
  }
/*  
  for(int i=0; i< s2.size(); ++i) {
    cout << s2.at(i) << ' ' << s3.at(i) << endl;
  }
  cout << endl;
*/  
  for(int i=0; i<M; ++i) {
    bool flg=0;
    for(int j=0; j<s2.size(); ++j) {
      if (s2.at(j) == t.at(i)) {
        flg=1;
        s3.at(j) -= 1;
      }
    }
  }
/* 
  for(int i=0; i<s2.size(); ++i) {
    cout << s2.at(i) << ' ' << s3.at(i) << endl;
  }
*/  
  int result = 0;
  for(int i=0; i<s3.size(); ++i) {
    if (result < s3.at(i))
      result = s3.at(i);
  }
  
  cout << result <<endl;

  return 0;
}

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

int main(void) {
    char data[100];
    int num;
    int i,len;
    num = 0;
    while(1) {
        if(scanf("%s",data)== EOF)break;
        len = strlen(data);
        for(i=0;i<len;i++) {
            if(data[i]<'0' || data[i]>'9')data[i]=0;
        }
        for(i=0;i<len;i++) {
            if(data[i]!=0) {
                num = num +atoi(&data[i]);
                i = i + strlen(&data[i]);
            }
        }
    }
    printf("%d\n",num);
    return 0;
}

Measured memory_bytes: 544
#include <bits/stdc++.h>
using namespace std;
#pragma optimize("-O3")
#define int long long int
#define f first
#define s second
#define pb push_back
#define endl '\n'

main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int ans=0;
	for(int i=1; i<n; i++){
		for(int j=1; j*i<=n; j++){
			if(i*j<n){
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    string S; cin >> S;
    set<char> s;
    for(int i = 0; i < S.size(); i++) {
        s.insert(S[i]);
    }
    string ans = "None";
    for(char c = 'a'; c <= 'z'; c++) {
        if(!s.count(c)) {
            ans = c;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main(){
 int len,i;
 string str;
 cin >> str;
len=str.length();
char a='a';
for(i=0;i<len;i++){
if(a=='z'+1)break;
if(str[i]==a){
a++;
i=0;
}
}
if(a>'z'){printf("None");}else{
printf("%c",a);}
return 0;
}

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

using namespace std;

const int inf = 1e9 + 7;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector <int> w(n);
    for(int i = 0; i < n; i++) {
        cin >> w[i];
    }
    vector <int> dp(n, inf);
    dp[0] = 0;
    for(int i = 1; i < n; i++) {
        for(int j = 1; j <= k; j++) {
            if(i - j >= 0) {
                dp[i] = min(dp[i], dp[i - j] + abs(w[i] - w[i - j]));
            }
        }
    }
    cout << dp[n - 1] << '\n';
    return 0;
}


Measured memory_bytes: 1024
class Dice():
 
    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'
 
    def set(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5
 
 
    def kaiten(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]
 
        if loc == 'E':
            self.set(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.set(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.set(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.set(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])
 
 
    def tansaku(self,top_num,front_num):
 
        self.save = [i for i in range(6)]
        for i in range(len(self.number)):
            self.save[i] = self.number[i]
 
        ret = -1;
 
        for i in range(len(self.order)):
            self.kaiten(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break
        
        for i in range(len(self.number)):
            self.number[i] = self.save[i]
 
        return ret;
 
    def hyouka(self,b):
        for i in range(len(self.order)):
            self.kaiten(self.order[i])
            FLG = True
            for k in range(6):
                if self.number[k] != b.number[k]: 
                    FLG = False
                    break
            if FLG == True:
                return True
        
        return False
        
 
 
A = Dice()
B = Dice()

table = list(map(int,input().split()))
A.set(table[0], table[1], table[2], table[3], table[4], table[5])

table = list(map(int,input().split()))
B.set(table[0], table[1], table[2], table[3], table[4], table[5])

if A.hyouka(B):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define M 100005
using namespace std;
vector<int> a[M];
bool vis[M];
int dp[M];
int dfs(int u){
    vis[u] = 1;
    int maxi = 0;
    for(int v : a[u])
        if(!vis[v])
            maxi = max(maxi, dfs(v) + 1);
        else 
            maxi = max(maxi, dp[v] + 1);
    dp[u] = maxi;
    return dp[u];
}
int main(){
    //freopen("data.inp", "r", stdin);
    //freopen("data.out", "w", stdout);
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; ++i){
        int u, v;
        scanf("%d%d", &u, &v);
        a[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if(!vis[i])
            dfs(i);
    int ans = 0;
    for(int i = 1; i <= n; ++i)
        ans = max(ans, dp[i]);
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 12408
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

  LL K, A, B;
  cin >> K >> A >> B;

  if(B-A>2){
    LL KK = K - A + 1;

    if(KK<0){
      cout << K + 1 << endl;
    }
    else if (KK % 2 == 0)
    {
      cout << A + (B - A) * (KK / 2) << endl;
    }
    else
    {
      cout << A + 1+(B - A) * (KK / 2) << endl;
    }
  }
  else
  {
    cout << K + 1 << endl;
  }
}


Measured memory_bytes: 256
function bomb(y,x,z){
   if(yx[y][x]!="+")return;
   var dy=[-1,0,1,0];
   var dx=[0,1,0,-1];
   var Y=y+dy[z];
   var X=x+dx[z];
   if(Y<0 || X<0 || Y>=n || X>=n){
      z=(z+1)%4;
      bomb(y,x,z);
   }else{
      if(yx[Y][X]=="#"){
         yx[Y-dy[z]][X-dx[z]]="+";
         if(z==3)bomb(Y-2*dy[z]-1,X-2*dx[z],0);
         else if(z==0)bomb(Y-2*dy[z],X-2*dx[z]+1,1);
         else if(z==1)bomb(Y-2*dy[z]+1,X-2*dx[z],2);
         else if(z==2)bomb(Y-2*dy[z],X-2*dx[z]-1,3);
      }else{
         yx[y][x]="#";
         last=[y,x];
         bomb(Y,X,z);
      }
   }
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n").map(Number);
var d=arr.shift();
var str="";
for(var k=0;k<d;k++){
   if(k!=0)str+="\n\n";
   var n=arr.shift();
   if(n==0){
      str+="";
      continue;
   }
   if(n==1){
      str+="#";
      continue;
   }
   if(n==2){
      str+="##\n# ";
      continue;
   }
   var yx=[];
   for(var i=0;i<n;i++){
      yx[i]=[];
      for(var j=0;j<n;j++){
         yx[i][j]="+";
      }
   }
   var last=[];
   bomb(n-1,0,0);
   if(n%2==0)yx[last[0]][last[1]]="+";
   str+=yx.join("\n").replace(/\,/g,"").replace(/\+/g," ");
}
console.log(str);

Measured memory_bytes: 18572
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    string s;
    cin >> s;
    vector<string> t;
    int n = s.size();
    rep(i, n) {
        string a;
        int st = i;
        while(!(s[i] == 'R' && s[i + 1] == 'L') && i + 1 < n) {
            i++;
        }
        while(s[i + 1] == 'L' && i + 1 < n) {
            i++;
        }
        a = s.substr(st, i - st + 1);
        t.push_back(a);
    }
    
    int m = t.size();
    vector<vector<int>> ans(m);
    rep(i, m) {
        int pt;
        rep(j, t[i].size() - 1) {
            if(t[i][j] == 'R' && t[i][j + 1] == 'L') pt = j;
        }
        int r = (pt + 2) / 2 + (t[i].size() - pt - 1) / 2;
        rep(j, t[i].size()) {
            if(j == pt) ans[i].push_back(r);
            else if(j == pt + 1) ans[i].push_back(t[i].size() - r);
            else ans[i].push_back(0);
        }
    }
    rep(i, m) {
        for(auto x : ans[i]) cout << x << " ";
    }
    cout << '\n';

    return 0;
}

Measured memory_bytes: 7480
# L = x + y + z
# S = x*y*z
#これをSが最大となるようにyとLの式で表すと
# S_max = 1/2 * (L - y) * y * 1/2 * (L - y) = 1/4 * (y**3 - 2*L*y**2 +L**2 * y)

L = int(input())
S_list = []
for y in range(L*10**3):
    y_cal = y / 10**3
    s  = 1/4 * (y_cal**3 - 2*L*y_cal**2 +L**2 * y_cal)
    S_list.append(s)

S_max = max(S_list)
print(S_max)

Measured memory_bytes: 34712
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int maxn = 200006;
int n;
string arr[105];
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 0; i < n; i ++){
        cin >> arr[i];
    }
    string last = arr[0];
    string curr;
    map<string, bool> visited;
    visited[last] = true;
    for(int i = 1; i < n; i ++){
        curr = arr[i];
        if(visited[curr]){
            return 0 * printf("No\n");
        }
        visited[curr] = true;
        if(curr[0] != last[(int)last.size() - 1]){
            return 0 * printf("No\n");
        }
        last = curr;
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n+1),b(n);
  for(int i=0;i<=n;i++)cin >> a[i];
  for(int i=0;i<n;i++)cin >> b[i];
  long long ans=0;
  for(int i=0;i<n;i++){
    if(a[i]<b[i]){
      ans+=a[i];
      b[i]-=a[i];
      ans+=min(b[i],a[i+1]);
      a[i+1]-=min(b[i],a[i+1]);
    }else {
      ans+=b[i];
      a[i]-=b[i];
      b[i]=0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int N,M;
  cin >> N >> M;
  vector<int> count(M);
  for (int i=0; i<N ; i++){
    int K;
    cin >> K;
    for (int j=0; j<K; j++){
      int A;
      cin >> A;
      A--;
      count.at(A)++;
    }
  }
  
  int ans = 0;
  for (int i = 0; i < M; i++){
    if(count.at(i) == N){ans++;}
  }
  
  
 
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long N=23333333333333333;
int main()
{
	int i;
	long long  sum=100;
	long long x;
	scanf("%lld",&x);
	for(i=1;sum<x;i++)
	{
		sum=sum+sum*0.01;
	}
	printf("%d",i-1);
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    if (i == N - 1){
      cout << "Three" << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
S = list(input())

cnt = 0

if len(S) == 1 or (S[0] != S[1] and len(S) == 2):
  print(0)
  exit()
elif len(S) == 2 and S[0] == S[1]:
  print(1)
  exit()

for i in range(1,len(S)):
  if S[i-1] == S[i] == '1':
    cnt += 1
    S[i] = '0'
  elif S[i-1] == S[i] == '0':
    cnt += 1
    S[i] = '1'

# TLE
print(cnt)

Measured memory_bytes: 3956
#include <iostream>
 
using namespace std;
 
int main(){
    int a, b;
    char op;
    while (cin >> a >> op >> b)
        switch (op) {
            case '+': cout << a+b << endl; break;
            case '-': cout << a-b << endl; break;
            case '*': cout << a*b << endl; break;
            case '/': cout << a/b << endl; break;
        }
    return 0;
}


Measured memory_bytes: 3080
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

std::string s, t;
std::vector<std::vector<ll>> is(26);

int main()
{
  std::cin >> s >> t;

  ll n = s.size();
  ll m = t.size();

  rep( i, n )
    is[s[i]-'a'].emplace_back(i);
  rep( i, n )
    is[s[i]-'a'].emplace_back(i+n);

  ll ans = 0, p = 0;

  rep( i, m ) {
    ll c = t[i]-'a';

    if( is[c].empty() ) {
      puts("-1");

      return 0;
    }

    p = *std::lower_bound( all(is[c]), p )+1;

    if( p >= n ) {
      p -= n;
      ans += n;
    }
  }

  ans += p;

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 5668
mod utils {
    use std::error::Error;
    use std::io::stdin;
    use std::str::FromStr;

    #[allow(dead_code)]
    pub fn read_line<T>() -> Result<Vec<T>, Box<Error>>
    where
        T: FromStr,
        T::Err: 'static + Error,
    {
        let mut line = String::new();
        let _ = stdin().read_line(&mut line)?;
        let parsed_line = line.split_whitespace()
            .map(|x| x.parse::<T>())
            .collect::<Result<Vec<T>, T::Err>>()?;

        Ok(parsed_line)
    }

    #[allow(dead_code)]
    pub fn read_lines<T>(n: usize) -> Result<Vec<Vec<T>>, Box<Error>>
    where
        T: FromStr,
        T::Err: 'static + Error,
    {
        (0..n).map(|_| read_line()).collect()
    }
}

fn solve() -> Result<(), Box<std::error::Error>> {
    let header = utils::read_line::<usize>()?;
    let n_nodes = header[0];
    let n_edges = header[1];
    let edges = utils::read_lines::<i32>(n_edges)?;
    let mut distances = vec![vec![None as Option<i32>; n_nodes]; n_nodes];

    for i in 0..n_nodes {
        distances[i][i] = Some(0);
    }

    // initial distance
    for edge in edges {
        distances[edge[0] as usize][edge[1] as usize] = Some(edge[2]);
    }

    // update distances
    for k in 0..n_nodes {
        for i in 0..n_nodes {
            for j in 0..n_nodes {
                let d_ij = distances[i][j];
                let d_ikj = if let (Some(d_ik), Some(d_kj)) = (distances[i][k], distances[k][j]) {
                    Some(d_ik + d_kj)
                } else {
                    None
                };

                distances[i][j] = if d_ij.is_some() {
                    if let (Some(d_ij), Some(d_ikj)) = (d_ij, d_ikj) {
                        Some(std::cmp::min(d_ij, d_ikj))
                    } else {
                        d_ij
                    }
                } else {
                    d_ikj
                };
            }
        }
    }

    let has_negative_cycle = distances
        .iter()
        .enumerate()
        .find(|&(i, row)| (*row)[i].unwrap_or(0) < 0)
        .is_some();

    if has_negative_cycle {
        println!("NEGATIVE CYCLE");
        return Ok(());
    }

    for row in distances {
        let row_string: String = row.iter()
            .map(|d_opt| match *d_opt {
                Some(d) => d.to_string(),
                None => "INF".to_string(),
            })
            .collect::<Vec<String>>()
            .join(" ");
        println!("{}", row_string);
    }
    Ok(())
}

fn main() {
    match solve() {
        Err(err) => panic!("{}", err),
        _ => (),
    };
}



Measured memory_bytes: 5056
#include<iostream>
#include<algorithm>
using namespace std;
int list[100000];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> list[i];
	
	sort(list, list + n);

	cout << list[n / 2] - list[n / 2 - 1] << '\n';
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            if (!(i % 3 == 0 || i % 5 == 0)) {
                sum += i;
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 35664
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

typedef long long ll;

string replace_str(const string& s, char from, char to) {
	string result(s);
	for (int i = 0; i < result.size(); i++) {
		if (result[i] == from) {
			result[i] = to;
		} else if (result[i] == to) {
			result[i] = from;
		}
	}
	return result;
}

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

	unordered_set<string> visited;
	string current = s;
	while (true) {
		for (int i = 0; i < s.size(); i++) {
			if (current[i] != t[i]) {
				current = replace_str(current, current[i], t[i]);
				break;
			}
		}
		if (current == t) {
			cout << "Yes" << endl;
			return 0;
		}
		if (visited.count(current) > 0) {
			break;
		}
		visited.insert(current);
	}
	cout << "No" << endl;
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	if(s=="ABC"){
		cout<<"ARC"<<endl;
	}else{
		cout<<"ABC"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long int
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            int t; cin>>t; while(t--)
const int mod = 1000000007;
bool comp(pair<ll,ll>& a, pair<ll,ll>& b)
{
    if(a.second == b.second)
    return a.first > b.first;
    else
    return b.second < a.second;
}
int main()
{
    fast

        int n;
        cin>>n;
        int k = n/1000;
        if(n==(1000*k))
        {
            cout<<"0"<<endl;
        }
        else if(n>(1000*k))
        {
            cout<<(1000*(k+1))-n<<endl;
        }
        else
        {
            cout<<(1000-n)<<endl;
        }


    return 0;
}


Measured memory_bytes: 3648
import math
import itertools
n=int(input())
L=[list(map(int,input().split())) for _ in range(n)]

perm= math.factorial(n)
s = 0

M=[]
for v in itertools.permutations(L, n):
    M.append(list(v))


for i in range(perm):
    for j in range(n-1):
        s += math.sqrt((M[i][j][0] - M[i][j+1][0])**2 +(M[i][j][1] - M[i][j+1][1])**2)
print(s/perm)


Measured memory_bytes: 14528
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Integer[] a = new Integer[n];
        int total = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            total += a[i];
        }
        int ans = 0;
        double flag = (double) total / (4 * m);
        for (int i = 0; i < n; i++) {
            if (a[i] >= flag)
                ans++;
        }

        System.out.println(ans >= m ? "Yes" : "No");
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vi vec[200001];
int x[200001]={};
int dp[200001];

int main() {
	int a,b;
	cin>>a>>b;
	if(a<10&&b<10){
		cout<<a*b<<endl;
	}else{
		cout<<"-1"<<endl;
	}
	return 0;
}


Measured memory_bytes: 4992
n = int(input())
a = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]
c = min(a[0], b[0])
d = max(0, b[0]-a[0])
for i in range(n-1):
    c += min(a[i+1], d)
    d = max(0, a[i+1]-d)
    c += min(b[i+1], d)
    d = max(0, b[i+1]-d)
c += min(a[n], d)
print(c)

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

int main(){
    int N, K;
    cin >> N >> K;
    double ans = 0;
    for(int i = K; i <= N; i++){
        ans += 1.0/N;
    }
    for(int i = 1; i < K && i<=N; i++){
        int ni = 1;
        while(i*(1<<ni)< K) ni++;
        ans += 1.0/(N*(1<<ni));
    }
    cout << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi   = vector<int>;
using vll  = vector<ll>;
using vc   = vector<char>;
using vvll  = vector<vll>;
using vvi  = vector<vi>;
using vvc  = vector<vc>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;
using posteriority_queue = priority_queue<int, vi, greater<int>>;


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

    for (int i = 0; i <= X; i++) {
        int tmp;
        tmp = 2 * i + 4 * (X - i);
        if (tmp == Y) {
            cout << "Yes";
            break;
        } else if (i == X) {
            cout << "No";
        }
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;


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

  cout << n/3 << endl;
  return 0;
}


Measured memory_bytes: 256
from math import ceil
def solve():
    ans = 0
    N, M = map(int, input().split())
    A = [list(map(int, input().split())) for _ in range(N)]
    A.sort()
    for i in range(N):
        if M<=A[i][1]:
            ans += M*A[i][0]
            break
        else:
            ans += A[i][0]*A[i][1]
            M -= A[i][1]
    return ans
print(solve())

Measured memory_bytes: 27480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    ll N;
    cin>>N;
    VVL A(10,VL (10,0));
    rep(i,1,10){
        rep(j,1,10){
            A[i][j]=i*j;
        }
    }
    rep(i,1,10){
        rep(j,1,10){
            if(A[i][j]==N){cout<<"Yes"<<endl;return 0;}
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 2e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

ll fastPow(ll a, ll b) {
	ll ret = 1;
	while(b) {
		if(b & 1) ret = ret * a % MOD;
		b >>= 1, a = a * a % MOD;
	}
	return ret;
}

ll inve(ll x) {
	return fastPow(x, MOD - 2);
}

ll fac[maxN][2], n, ans[maxN];
vector<int> adj[maxN];

ll ncr(int n, int k) {
	if(k > n) return 0;
	return fac[n][0] * fac[n - k][1] % MOD * fac[k][1] % MOD;
}

struct Node {
	ll ways, sz;
} kv[maxN];

Node multip(Node a, Node b) {
	return {a.ways * b.ways % MOD * ncr(a.sz + b.sz, a.sz) % MOD, a.sz + b.sz};
}

Node divid(Node a, Node b) {
	Node ret;
	ret.sz = a.sz - b.sz;
	ret.ways = a.ways * inve(b.ways) % MOD * inve(ncr(a.sz, b.sz)) % MOD;
	return ret;
}

void prec(int nd, int an) {
	kv[nd] = {1, 0};
	for(int sn: adj[nd]) {
		if(sn == an) continue;
		if(nd == 1) LOG << "mira " << sn << '\n';
		prec(sn, nd);
		kv[nd] = multip(kv[nd], kv[sn]);
	}
	kv[nd].sz++;
}

void dfs(int nd, int an) {
	ans[nd] = kv[nd].ways;
	kv[nd].sz--;
	for(auto sn: adj[nd]) {
		if(sn == an) continue;
		Node cr = divid(kv[nd], kv[sn]);
		cr.sz++;
		kv[sn].sz--;
		kv[sn] = multip(kv[sn], cr);
		kv[sn].sz++;
		dfs(sn, nd);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	fac[0][0] = fac[0][1] = 1;
	cin >> n;
	for(int i = 1; i <= n; i++) fac[i][0] = fac[i - 1][0] * i % MOD;
	fac[n][1] = fastPow(fac[n][0], MOD - 2);
	for(int i = n - 1; i >= 1; i--) fac[i][1] = fac[i + 1][1] * (i + 1) % MOD;

	for(int i = 1, u, v; i < n; i++) {
		cin >> u >> v;
		u--, v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	LOG << ncr(2, 1) << '\n';
	prec(0, -1);
	for(int i = 0; i < n; i++) LOG << i + 1 << ' ' << kv[i].sz << ' ' << kv[i].ways << '\n';
	dfs(0, -1);
	for(int i = 0; i < n; i++) cout << ans[i] << '\n';
}


Measured memory_bytes: 21748
#include<queue>
#include<iostream>
#include<string>
using namespace std;
struct NODE{
	string name;
	int time;
};
queue<NODE> q;
int main(){
	int n,Q;
	cin>>n>>Q;
	for(int i=0;i<n;i++){
		NODE node;
		cin>>node.name>>node.time;
		q.push(node);
	}
	int time=0;
	while(!q.empty()){
		NODE cur=q.front();
		q.pop();
		if(cur.time<=Q){
			time+=cur.time;
			cout<<cur.name<<" "<<time<<endl;
		}else{
			time+=Q;cur.time-=Q;
			q.push(cur);
		}
	}
	return 0;
}


Measured memory_bytes: 6232
import sys
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("B_input.txt")
else:
    f=sys.stdin
num=0
N,D=map(int,f.readline().split())
coord=[list(map(int,f.readline().split())) for _ in range(N)]
for _ in range(N):
    x,y=coord[_]
    if x**2+y**2<=D**2:
        num+=1
print(num)
f.close()

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

int n;
long h, hp, m, t;

int main(){
	cin >> n;
	m = 0;
	t = 0;
	cin >> hp;
	for (int i = 0; i < n-1; ++i){
		cin >> h;
		if (h <= hp) t++;
		else{
			if (m < t) m = t;
			t = 0;
		}
		hp = h;
	}
	if (m < t) m = t;
	printf("%d\n", m);
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
  int A,B,C,D,x;
  x=scanf("%d %d %d %d",&A,&B,&C,&D);
  while(!0)
  {
    C-=B;if(C<=0)return printf("Yes"),0;
    A-=D;if((A<=0))return printf("No"),0;
  }
}

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

int main(){
    ll s,x1,x2,y1,y2;
    cin >> s;
    // s = x1y2 - x2y1 = 1e9*y2 - y1
    x1 = 1e9;
    x2 = 1;
    y2 = s/x1 + 1;
    y1 = x1 - s%x1;
    if(s==1e18) y2 = 1e9,y1 = 0;
    cout    << 0  <<" "<< 0  << " "
            << x1 <<" "<< y1 << " "
            << x2 <<" "<< y2 << endl;
    return 0;
}

Measured memory_bytes: 256
//============================================================================
// Author       : Sun YaoFeng
//============================================================================

//#pragma 	comment(linker, "/STACK:100240000,100240000")
//#include	<cstdio>
//#include	<cstdlib>
//#include	<cstring>
//#include	<algorithm>

#include	<bits/stdc++.h>

using	namespace	std;

#define DB		double
#define	lf		else if
#define I64		long long
#define unt		unsigned int
#define	Rd()	(rand()<<15|rand())
#define For(i,a,b)	for(int i=(int)(a);i<=(int)(b);i++)
#define Rep(i,a,b)	for(int i=(int)(a);i>=(int)(b);i--)

#define	fi	first
#define se	second
#define MK	make_pair
#define pb	push_back
#define PA	pair<int, int>

//#define	min(a,b)	((a)<(b)?(a):(b))
//#define	max(a,b)	((a)<(b)?(b):(a))

#define	CH	(ch=getchar())
int		IN()	{
		int x= 0, f= 0, ch;
		for	(; CH < '0' || ch > '9';)	f= (ch == '-');
		for	(; ch >= '0' && ch <= '9'; CH)	x= x*10 + ch -'0';
		return	f? -x : x;
}

#define n	300005

int		N, A[n];

int		main(int argc, char* argv[]){
		N= IN();
		For(i, 1, 3*N)	A[i]= IN();
		
		sort(A+1, A+3*N+1);
		
		I64	Ans= 0;
		For(i, 1, N)	Ans+= A[3*N-2*i+1];
		
		cout << Ans << endl;
		
		return	0;
}

Measured memory_bytes: 1408
#include <cstdio>

const int MAXN = 105;
const int MAXK = 100005;

int a[MAXN];
bool f[MAXK];

int main() {
    int n, K;
    scanf("%d %d", &n, &K);

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

    for (int i = 1; i <= K; i++) {
        bool flag = false;
        for (int j = 0; j < n; j++) if (i >= a[j] && !f[i - a[j]]) {
            flag = true;
            break;
        }
        f[i] = flag;
    }

    puts(f[K] ? "First" : "Second");
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	int ans = 0;
	int n;
	cin >> n;
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) {
			int g = __gcd(i, j);
			for(int k=1;k<=n;k++)
				ans += __gcd(g, k);
		}
	}
	cout << ans << endl;
	
}





Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<ll> as(N), bs(N), cs(N);
  for(int i = 0; i < N; ++i) {
    cin >> as[i];
  }
  sort(as.begin(), as.end());
  for(int i = 0; i < N; ++i) {
    cin >> bs[i];
  }
  sort(bs.begin(), bs.end());
  for(int i = 0; i < N; ++i) {
    cin >> cs[i];
  }
  sort(cs.begin(), cs.end());
  vector<ll> bscs(N + 1);
  // b[i]より真に大きいcがいくつあるか？を末尾から累積和にした配列
  bscs[N] = 0;
  for(int i = N - 1; i >= 0; --i) {
    auto b = bs[i];
    auto ub = upper_bound(cs.begin(), cs.end(), b);
    bscs[i] = cs.end() - ub + bscs[i + 1];
  }
  ll ans = 0;
  for(int i = 0; i < N; ++i) {
    auto a = as[i];
    auto ub = upper_bound(bs.begin(), bs.end(), a);
    ans += bscs[ub - bs.begin()];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
import numpy as np
import math
N, H = map(int, input().split())
a, b = [0]*N, [0]*N
max_a = 0
diff, diff_idx, diff_a, diff_b = np.float('inf'), -1, -1, -1
for i in range(N):
    a[i], b[i] = map(int, input().split())
    max_a = max(a[i], max_a)
count = 0
damage = 0
for bi in sorted(b, reverse=True):
    if bi < max_a:
        break
    damage += bi
    count += 1
    if damage >= H:
        print(count)
        exit()

count += math.ceil((H - damage) / max_a)

print(count)



Measured memory_bytes: 21192
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;
long long ans=0,tmp[10]={};
string s;
void saiki(int n,int fir,int len,long long sum){
	//cout<<n<<" "<<fir<<" "<<len<<"\n";
	//cout<<s.substr(fir,len)<<"\n";
	//cout<<stoll(s.substr(fir,len))<<"\n";
	tmp[n]=stoll(s.substr(fir,len));

	if(n==0){
		//cout<<"a\n";
		sum+=tmp[n];
		ans+=sum;
		//cout<<ans<<":"<<sum<<":"<<tmp[n]<<"\n\n";
		return;
	}
	//cout<<ans<<":"<<sum<<":"<<tmp[n]<<"\n\n";
	saiki(n-1,fir-1,len+1,sum);
	saiki(n-1,fir-1,1,sum+tmp[n]);
}

int main(void) {
	cin>>s;
	long long k=s.size();
	saiki(k-1,k-1,1,0);
	cout<<ans<<"\n";

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

char s[1000];

int main() {
  scanf("%s", s);
  int cnt = 0;
  for (int i = 0; s[i]; ++i) {
    if (cnt == 0) {
      if (s[i] == 'C') {
        ++cnt;
      }
    } else if (cnt == 1) {
      if (s[i] == 'F') {
        ++cnt;
      }
    } else {
      break;
    }
  }
  puts(cnt == 2 ? "Yes" : "No");

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#include <algorithm>

int main(){
  int n;
  cin >> n;
  
  vector<pair<string, pair<int, int>>> rest(n);
  for(int i = 0; i < n; i++){
    cin >> rest[i].first >> rest[i].second.first;
    rest[i].second.second = i + 1;
    // sorting greater than
    rest[i].second.first *= -1;
  }
  
  sort(rest.begin(), rest.end());
  for(auto r: rest)
    cout << r.second.second << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int BIG = 1000000007;
  int X;
  int Y;
  cin >> X >> Y;
  if((X + Y) % 3 != 0){
    cout << 0 << endl;
    return 0;
  }
  int a = (2 * X - Y);
  int b = (2 * Y - X);
  a /= 3;
  b /= 3;
  if(a < 0 || b < 0){
    cout << 0 << endl;
    return 0;
  }
  long long int power1 = 1;
  long long int quotient1 = 1;
  for(int i = (a+1); i <= a+b; i++){
    power1 *= i;
    quotient1 *= (i-a);
    power1 %= BIG;
    quotient1 %= BIG;
  }
  for(int i = 0; i < 1000000007; i++){
    if(i * quotient1 % BIG == power1){
      cout << i << endl;
      return 0;
    }
  }


}

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

const int MAXN = 1e6 + 100 ;


long long dp[MAXN] , tmp[MAXN] , nx[MAXN] , a[MAXN] ; 

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

	int n ; cin >> n ; 
	int e , t ; cin >> e >> t ; 
	for(int i = 0 ; i < n ; i ++)
		cin >> a[i] ; 
	int l = n - 1 ; 
	//cout << "Hir" << endl ; 
	for(int i = n - 1 ; i >= 0 ; i --){
		while(l > 0 && 2 * (a[i] - a[l - 1]) <= t)
			l -- ; 
		nx[i] = l ; 
	}
	//cout << "Hir" << endl ; 
	memset(dp , 63 , sizeof dp) ; 
	memset(tmp , 63 , sizeof tmp) ; 
	dp[0] = 0 ; 
	tmp[0] = -2 * a[0] ;
	//cout << 0 << ' ' << dp[0]<< ' '  << tmp[0]<< ' ' << '\n' ; 
	for(int i = 1 ; i <= n ; i ++){
		dp[i] = t + dp[nx[i - 1]] ;
		if(nx[i - 1]) dp[i] = min(dp[i] , 2 * a[i - 1] + tmp[nx[i - 1] - 1]) ;
		tmp[i] = min(tmp[i - 1] , dp[i] - 2 * a[i]) ; 
		//cout << i << ' ' << dp[i] << ' ' << tmp[i] << '\n' ; 
	}
	cout << dp[n] + e ; 

}

Measured memory_bytes: 22144
N = int(input())
A = [int(l) for l in input().split()]


count = 0
k = 0
while True:
    for i in range(N):
        if A[i]/2** k % 2 !=0:
            break
    else:
        count += 1    
        k += 1
        continue
    break

print(count)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int s, h, m;
	scanf("%d", &s);
	h = s / 3600;
	s %= 3600;
	m = s / 60;
	s %= 60;
	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 1840