akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int d, n; //D次元配列上にN個の点
    cin >> n >> d;
    int x[n][d];
    int a[n][n] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> x[i][j];
        }
    }
    int count = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) {
                continue;
            }
            //x[i][k]とx[j][k]の比較
            for (int k = 0; k < d; k++) {
                a[i][j] += pow(x[i][k] - x[j][k], 2);
            }
            if ((int)sqrt(a[i][j]) == sqrt(a[i][j])) {
                count++;
            }
        }
    }
    cout << count / 2;
}

Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  Vi v(3);
  VIN(v)
  SORT(v);
  OUT((v[2]-v[1])+(v[1]-v[0]));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}

signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n;
    cin>>n;
    int a[n] , b[n];
    bool ok = true;
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
        b[i] = a[i];
        if(!a[i])
            ok = false;
    }
    for(int i = 1 ; i < n ; i++)
        a[i]+=a[i-1];
    int ans(0);
    for(int i = 0 ; i < n; i++)
    {
        int temp = a[n-1]-a[i];
        temp%=MOD;
        temp*=b[i];
        temp%=MOD;
        ans+=temp;
        ans%=MOD;
    }
    cout<<ans;



    printclock;
    return 0;
}


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

int main() {
	int N,ans = 0,sea = 0 ; cin >> N;
	for(int i = 0 ; i < N ; i++){
		int k; cin >> k;
		if(k >= sea){
			ans++;
			sea = k;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    int count = 0;
      
    for(int i = 0; i < N - 2; i++){
    if(S.charAt(i) == 'A' && S.charAt(i + 1) == 'B' && S.charAt(i + 2) == 'C')
      count++;
    }
     System.out.println(count);
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo for(int i=0;i<n;i++)
#define clear cin.clear();cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define loopSolve int t; cin>>t; while(t--){solve();}
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//INT_MAX         2,147,483,647                       <10^10
//U_INT_MAX       4,294,967,295                       <10^10
//LONG_LONG_MAX   9,223,372,036,854,775,807           <10^18
//U_LONG_LONG_MAX 18,446,744,073,709,551,615          <10^18
//ll power(int a, int b){
//    return (ll)(pow(a,b)+0.5);
//}

vector<int> gV(int n){
    vector<int> v(n);
    fo { cin>>v[i];  }
    return v;
}

int* gA(int n){
    int* arr = new int[n];
    fo cin>>arr[i];
    return arr;
}


void solve(){
    int n;
    ll elt;
    cin>>n;
    vector<ll> arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }


    int ans=0;

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

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(arr[i]==arr[j])
                continue;
            for(int k=j+1;k<n;k++){
                if(arr[i]==arr[k]|| arr[j]==arr[k])
                    continue;
                if(arr[i]+arr[j]>arr[k])
                    ans++;
            }
        }
    }
    cout<<ans<<endl;

}


int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    //loopSolve;

	return 0;
}


Measured memory_bytes: 3648
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VB vector<bool>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVL vector<VL>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    VS a(n), b(m);
    rep(i, n){
        cin >> a[i];
    }
    rep(i, m){
        cin >> b[i];
    }
    bool ans;
    rep(i, n-m+1){
        rep(j, n-m+1){
            ans = true;
            rep(k, m){
                if(b[k] != a[j+k].substr(i, m)){
                    ans = false;
                    break;
                }
            }
            if(ans){
                break;
            }
        }
        if(ans){
            break;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);

    println!("{}", (N * (N - 1)) / 2);
}


Measured memory_bytes: 4352
import itertools

def initBingoCard():
    bingoCard = []
    for i in range(3):
        row = [int(i) for i in input().split()]
        bingoCard.append(row)
    return bingoCard

def generateBingoPatterns(bingo_card):
    bingo_patterns = []
    for row in bingo_card:
        bingo_patterns.append(row)
        
    for column in range(3):
        column_pattern = []
        for row in range(3):
            column_pattern.append(bingo_card[row][column])
            
        bingo_patterns.append(column_pattern)
        
    bingo_patterns.append([bingo_card[0][0],bingo_card[1][1],bingo_card[2][2]])
    bingo_patterns.append([bingo_card[2][0],bingo_card[1][1],bingo_card[0][2]])
    
    return bingo_patterns

bingo_card = initBingoCard()

bingo_patterns = generateBingoPatterns(bingo_card)
    
N = int(input())

nums = [int(input()) for i in range(N)]

combi = itertools.combinations(nums, 3)

flag = False
for c in combi:
    c = sorted(c)
    for pattern in bingo_patterns:
        if c == sorted(pattern):
            flag = True
            break
if flag :
    print('Yes')
else :
    print('No')

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

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    long long ans = 0;
    ans = 0;
    if (k == 0)
    {
        ans = pow(n, 2);
    }
    else
    {
        for (int b = k + 1; b <= n; b++)
        {
            ans += (b - k) * (n / b) + max(0, n % b - (k - 1));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
vector<int> hoge[200000];
vector<int> segments[200000];
bool arrived[2][200000] = {};
int main() {
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for (int i = 0;i < n;++i) {
		int k;
		cin >> k;
		for (int q = 0;q < k;++q) {
			int a;
			cin >> a;
			hoge[i].push_back(a);
			segments[a].push_back(i);
		}
	}
	queue<int> poor;
	poor.push(0);
	arrived[0][0] = true;
	while (poor.empty() == false) {
		int wow = poor.front();
		poor.pop();
		for (int i = 0;i < hoge[wow].size();++i) {
			if (arrived[1][hoge[wow][i]] == false) {
				arrived[1][hoge[wow][i]] = true;
				for (int q = 0;q < segments[hoge[wow][i]].size();++q) {
					if (arrived[0][segments[hoge[wow][i]][q]] == false) {
						arrived[0][segments[hoge[wow][i]][q]] = true;
						poor.push(segments[hoge[wow][i]][q]);
					}
				}
			}
		}
	}
	for (int i = 0;i < n;++i) {
		if (arrived[0][i] == false) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

#define ll long long
#define mod 1000000007
#define pi 2.0*acos(0.0)

int main() {
   string s;
   cin >> s;

   cout << 2018;
   for (int i = 4; i < s.size(); i++) cout << s[i];
   cout << endl;
}


Measured memory_bytes: 256
def is_valid(A, D):
    while A > 0:
        if (A%10) in D:
            return False
        else:
            A = A//10
    return True
    
N, K = map(int, input().split())
D = list(map(int, input().split()))

while is_valid(N, D) == False:
    N += 1

print(N)


Measured memory_bytes: 2940
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>


int main() {
	int H, W;
	cin >> H >> W;

	vector<vector<char>> a(H, vector<char>(W));
	rep(i, H) {
		rep(j, W) {
			cin >> a.at(i).at(j);
		}	
	}

	vector<bool> existH(H);
	vector<bool> existW(W);

	rep(i, H) {
		rep(j, W) {
			if (a.at(i).at(j) == '#') {
				existH.at(i) = true;
				existW.at(j) = true;
			}
		}
	}

	rep(i, H) {
		if (existH.at(i) == true) {
			rep(j, W) {
				if (existW.at(j) == true) {
					cout << a.at(i).at(j);
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<long long> X(N), Y(N), Z(N);

	vector<int[3]> signs(8);
	for (size_t i = 0; i <= 1; i++) {
		for (size_t j = 0; j <= 1; j++) {
			for (size_t k = 0; k <= 1; k++) {
				signs[i*4 + j*2 + k][0] = i*2-1;
				signs[i*4 + j*2 + k][1] = j*2-1;
				signs[i*4 + j*2 + k][2] = k*2-1;
			}
		}
	}

	vector<long long> sums(8);

	for (size_t i = 0; i < N; i++) {
		cin >> X[i] >> Y[i] >> Z[i];
	}
	
	for (size_t i = 0; i < 8; i++) {
		vector<long long> totals(0);
		totals.reserve(N);
		for (size_t j = 0; j < N; j++){
			totals.push_back(X[j]*signs[i][0] + Y[j]*signs[i][1] + Z[j]*signs[i][2]);
		}
		sort(begin(totals), end(totals));
		sums[i] = 0;
		for (int j = M-1; j >= 0; j--) {
			sums[i] += totals[j];
		}
	}

	long long maxSum = 0;
	for (size_t i = 0; i < 8; i++) {
		if (maxSum < abs(sums[i])) maxSum = abs(sums[i]);
		//cout << sums[i] << " ";
	}
	//cout << endl;

	cout << maxSum << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		    int a = sc.nextInt();
		    int b = sc.nextInt();
		    
		    if(a % 3 == 0|| b % 3 == 0|| (a+b) % 3 == 0) {
		    	System.out.println("Possible");
		    }
		    else {
		    	System.out.println("Impossible");
		    }
		    sc.close(); }
}

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

const long long INF=1000000000000000ll;

int main()
{
  int n,K;
  scanf("%d%d",&n,&K);
  vector<int> C(n);
  vector<long long> V(n);
  for(int i=0;i<n;i++){
    scanf("%d%lld",&C[i],&V[i]);
    C[i]--;
  }
  vector<vector<long long> > CV(K);
  for(int i=0;i<n;i++){
    CV[C[i]].push_back(V[i]);
  }
  vector<pair<long long,int> > V2(K+1);
  multiset<long long> V3;
  for(int j=0;j<K;j++){
    sort(CV[j].begin(),CV[j].end(),greater<long long>());
    V2[j]=make_pair(CV[j][0]+CV[j][1],j);
    if(CV[j].size()>=3){
      V3.insert(CV[j][0]+CV[j][1]+CV[j][2]);
    }
  }
  V2[K]=make_pair(-INF,-1);
  V3.insert(-INF);
  sort(V2.begin(),V2.end(),greater<pair<long long,int> >());
  multiset<long long> S;
  S.insert(-INF);
  long long S1=INF,S2=INF;
  vector<long long> ans(n+1);
  ans[0]=0;
  for(int i=0,j=0;i<n;){
    int k=V2[j].second;
    long long s1=*S.rbegin(),s2=V2[j].first;
    //printf("%d %lld %lld\n",k,s1,s2);
    if(2*s1>=s2){
      ans[i+1]=ans[i]+s1;
      S1=s1;
      S.erase(S.find(s1));
      i++;
    }
    else{
      ans[i+1]=max(-1ll,max(ans[i]+s1,max(ans[i]-S1+s2,ans[i]-S2+*V3.rbegin())));
      ans[i+2]=ans[i]+s2;
      S2=s2;
      for(int t=2;t<CV[k].size();t++){
	S.insert(CV[k][t]);
      }
      if(CV[k].size()>=3){
	V3.erase(V3.find(CV[k][0]+CV[k][1]+CV[k][2]));
      }
      i+=2;
      j++;
    }
  }
  for(int i=1;i<=n;i++){
    printf("%lld\n",ans[i]);
  }
  return 0;
}


Measured memory_bytes: 18688
// https://atcoder.jp/contests/

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int a, b, r;
  char op;

  cin >> a >> op >> b;

  r = op == '+' ? a + b : a - b;

  cout << r << "\n";

  return 0;
}


Measured memory_bytes: 256
def solve():
  n = int(input())
  query = [0]*n
  for i in range(n):
    a = int(input())
    tmp = []
    for j in range(a):
       x,y = (int(_) for _ in input().split())
       tmp.append((x-1,y))
    query[i] = tmp

  ans = 0
  for bit in range(1,2**n):
    bitsum = 0
    tmp = [0]*n
    for j in range(n):
      if bit>>j&1 == 1:
        bitsum += 1
        tmp[j] = 1
    ispossible = True
    for j in range(n):
      if tmp[j] == 1:
        check = query[j]
        
        for x,y in check:
          if tmp[x] == y:
            continue
          else:
            ispossible = False
    if ispossible:
      ans = max(ans,bitsum)
  print(ans)
        
        
solve()

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

using ll = long long;

int MOD;

struct modnum {
private:
	int v;
public:

	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int () const { return v; }
	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}

	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
};

using num = modnum;


int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n >> MOD;
	num ans = 0;
	vector<int> small;
	vector<pair<int,int> > big;
	for(int a = 0; a < 2*n; a++){
		int minv = 0;
		int maxv = 2*n-1;
		while(a * a + minv * minv < n*n) minv += 1;
		while(a * a + maxv * maxv > 4*n*n) maxv -= 1;
		assert(minv <= maxv);
		if(minv == 0){
			small.push_back(maxv + 1);
		} else {
			big.push_back({minv, maxv+1});
		}
	}
	for(int k = 0; k <= (int)big.size(); k++){
		vector<num> dp(k+1, 0);
		dp[0] = 1;
		int cur = 0;
		int cur_offset = (int)small.size() + k;
		int big_offset = 2*n;
		for(pair<int,int> q : big){
			while(cur < (int)small.size() && small[cur] >= q.first){
				cur_offset -= 1;
				for(int a = 0; a <= k; a++){
					dp[a] *= (small[cur] - (cur_offset - a));
				}
				cur += 1;
			}
			big_offset -= 1;
			vector<num> newdp(k+1, 0);
			for(int i = 0; i <= k; i++){
				newdp[i] += dp[i] * (q.second - (big_offset + i));
				if(i < k){
					newdp[i+1] += dp[i] * (q.first - (cur_offset - (i+1)));
				}
			}
			dp = newdp;
		}
		assert(cur == (int)small.size());
		if(k & 1) dp[k] *= -1;
		ans += dp[k];
	}
	cout << (int)ans << '\n';
}

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

int main( ) {
  vector<int> v(3);
  cin >> v.at(0) >> v.at(1) >> v.at(2);
  
  sort(v.begin(),v.end());
  // v = {1,3,6}
  cout << (v.at(2) - v.at(1)) + (v.at(1) - v.at(0)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, Q;
	string S;
	cin >> N >> S >> Q;
	vector<set<int>>is(26);
	REP(i, N)is[S[i] - 'a'].insert(i);

	REP(q, Q) {
		int ty; cin >> ty;
		if (ty == 1) {
			int i; char c;
			cin >> i >> c;
			i--;
			is[S[i] - 'a'].erase(i);
			S[i] = c;
			is[S[i] - 'a'].insert(i);
		}
		else {
			int l, r; cin >> l >> r;
			l--;
			int ans = 0;
			REP(i, 26) {
				auto it = is[i].lower_bound(l);
				if (it != is[i].end() && *it < r)ans++;
			}
			cout << ans << endl;
		}
	}
	return 0;
}



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

void solve(int A, int B){
    int C = A + B;
    int D = A - B;
    int E = A * B;
    if(C>=D && C>=E){
        printf("%d\n",C);
    }
    else if(D>=C && D>=E){
        printf("%d\n",D);
    }
    else if(E>=C && E>=D){
        printf("%d\n",E);
    }
    return (void)0;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int A;
    scanf("%d",&A);
    int B;
    scanf("%d",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

bool hoge(l_l x,l_l y){
    return x.second<y.second;
}
int main(){
    ll n;cin>>n;
    ll a[n],bb[n],c[n],d[n];
    vector<l_l> r,b;
    rep(i,0,n-1){
        cin>>a[i]>>bb[i];
        r.pb(make_pair(a[i],bb[i]));
    }
    rep(i,0,n-1){
        cin>>c[i]>>d[i];
        b.pb(make_pair(c[i],d[i]));
    }
    sort(b.begin(),b.end());
    sort(r.begin(),r.end());
    ll ans=0;
    vector<l_l> v;
    ll cc=-1;
    ll k=inf;
    rep(i,0,n-1){
        while(cc+1<=n-1 && r[cc+1].first<=b[i].first){
            cc++;
            v.pb(r[cc]);
        }
        sort(v.begin(),v.end(),hoge);
        k=inf;
        for(ll j=v.size()-1;j>=0;j--){
            if(v[j].second<b[i].second){
                k=j;
                break;
            }
        }
        /*
        for(ll j=0;j<v.size();j++){
            cout<<v[j].first<<' '<<v[j].second<<endl;
        }
        cout<<endl;*/
        if(k!=inf){
            ans++;
            v.erase(v.begin()+k);
        }/*
        for(ll j=0;j<v.size();j++){
            cout<<v[j].first<<' '<<v[j].second<<endl;
        }
        cout<<endl;*/
        
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
main(){
  char str[10000];
  int i,l,j,sum;
  while(1){
    fgets(str,9999,stdin);
    l=strlen(str);
    str[l-1]='\0';
    if(strcmp(str,"END OF INPUT")==0)return 0;

    for(i=0,j=0;i<l;i++){
      if(str[i]==' '||i==l-1){
	printf("%d",j);
	j=0;
      }else{
	j++;
      }
    }
    puts("");
  }
  return 0;
}

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

int main(){
    int N; cin >> N;
    bool jdg = false;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i * j == N) jdg = true;
        }
    }
    cout << ((jdg) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
constexpr int MX = 200005;
int n, a[MX], u, v, nw[MX], e, ans[MX];
vector<int> G[MX];
void rec(int t, int p){
	int* pos = lower_bound(nw, nw+e, a[t]);
	int pre = *pos;
	*pos = a[t];
	if(pos - nw == e) e++;
	ans[t] = e;
	for(int nx: G[t]) if(nx != p) rec(nx, t);
	*pos = pre;
	if(pre == 0) e--;
}
int main(){
	scanf("%d", &n);
	rep(i,n) scanf("%d", a+i);
	rep(i,n-1){
		scanf("%d%d", &v, &u);
		v--; u--;
		G[v].push_back(u);
		G[u].push_back(v);
	}
	rec(0, 0);
	rep(i,n) printf("%d\n", ans[i]);
}

Measured memory_bytes: 27608
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
from collections import Counter

# O(sqrt(n))
def prime_factorize(n, unique=False):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    if unique:
        return set(fct)
    else:
        return fct

n = int(input())
fct = prime_factorize(n)
cnt = Counter(fct)
ans = 0
for key, val in cnt.items():
    cumsum = 0
    for i in range(1, 20):
        cumsum += i
        if cumsum <= val:
            ans += 1
        else:
            break
print(ans)

Measured memory_bytes: 9488
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int N,M,X;
	long long int i,j,k,m=0,n=0,count=0,sum=0;
	cin>>N>>M>>X;
	double w=N;
	long long int A[N][M+1];
	long long int sum1[M];
	for(i=0;i<N;i++)
	{
		for(j=0;j<=M;j++)
		cin>>A[i][j];
	}
	long long int sum2=9099999999999999999;
	for(i=1;i<pow(2,w);i++)
	{
		for(k=0;k<M;k++)
		sum1[k]=0;
		k=i;
		count=0;
		while(k>0)
		{
			k=k/2;
			count++;
		}
		k=1;
		while(k<=count)
		{
			if(i&(1<<(k-1)))
			{
				sum=sum+A[k-1][0];
				for(j=0;j<M;j++)
				{
					sum1[j]=sum1[j]+A[k-1][j+1];
				}
			}
			k++;
		}
		for(j=0;j<M;j++)
		{
			if(sum1[j]<X)
			break;
		}		
		if(j==M)
		{
			if(sum<sum2)
			{
				sum2=sum;
				m=1;
			}
		}
		sum=0;
	}
	if(m==1)
	cout<<sum2;
	else
	cout<<"-1";
	return 0;
}

Measured memory_bytes: 4064
#define true 39
#define false 0
#pragma warning(disable:4996)
#include <stdio.h>




int main()
{
    int h1, m1, h2, m2, k;
    scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
    
    for (k; k;) 
    {
        if (k > m2) 
        {
            h2--;
            m2 += 60;
        }
        else 
        {
            m2 -= k;
            k = 0;
        }
    }

    int h = h2 - h1;
    int m;
    if (m1 > m2) 
    {
        h--;
        m2 += 60;
        m = m2 - m1;
    }
    else 
    {
        m = m2 - m1;
    }

    m += h * 60;

    printf("%d", m);
    return 0;
}


Measured memory_bytes: 1728
# -*- coding: utf-8 -*-
def cmp2(n):
    return n * (n-1) // 2

n = int(input())
s = {}

for i in range(n):
    si = input()
    anagram = "".join(sorted(si))
    if anagram in s:
        s[anagram] += 1
    else:
        s[anagram] = 1

cnt = 0
for c in s.values():
    cnt += cmp2(c)

print(cnt)


Measured memory_bytes: 17888
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
using namespace std;


int main(){

  string s,t; cin >> s >> t;
  int ans=0;
  for (int i=0; i<3; i++) if (s[i]==t[i]) ans++;

  cout << ans;
 
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

#include <stack>
#include <cstdlib>
using namespace std;

int main()
{
    stack<int> stc;
    string s;
    int a,b;
    while(cin>>s){
        if(s[0]=='+'){
            a=stc.top();stc.pop();
            b=stc.top();stc.pop();
            stc.push(a+b);
        }
        else if(s[0]=='-'){
            b=stc.top();stc.pop();
            a=stc.top();stc.pop();
            stc.push(a-b);
        }
        else if(s[0]=='*'){
            a=stc.top();stc.pop();
            b=stc.top();stc.pop();
            stc.push(a*b);
        }
        else stc.push(atoi(s.c_str()));
    }
    cout<<stc.top()<<endl;
}



Measured memory_bytes: 3156
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[200009], b[200009];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	int ret = 0;
	for (int i = 28; i >= 0; i--) {
		for (int j = 0; j < n; j++) {
			a[j] &= (1 << (i + 1)) - 1;
			b[j] &= (1 << (i + 1)) - 1;
		}
		sort(a, a + n);
		sort(b, b + n);
		int pl = 0, pm = 0, pr = 0;
		for (int j = n - 1; j >= 0; j--) {
			while (pl != n && a[j] + b[pl] < 1 << i) pl++;
			while (pm != n && a[j] + b[pm] < 2 << i) pm++;
			while (pr != n && a[j] + b[pr] < 3 << i) pr++;
			if ((n - pr + pm - pl) & 1) ret ^= 1 << i;
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long int gcd(long int a, long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
  return a * b / gcd(a, b);
}

// 30min
int main(void){
  int n, l;
  long int sum = 0;
  int a = 0;
  scanf("%d%d", &n, &l);

  // N個の総和を求める
  for(int i = 0; i < n; i++){
    sum += (l + i);
  }

  // 絶対値が小さい数を求める
  // Lが正ならりんご1つ目の時
  if(l >= 0){
    a = l + 1 - 1;
  }else{
    // L が負ならNの最大の時
    if(l + n <= 0){ // *ここを間違えてた。＝も必要。0の時はまだ、a=0出ない　a = -1となるはず
      a = l + n - 1;
    }else{ // もしくは、0の時
      a = 0;
    }
  }

  printf("%ld\n", sum - a);

  return 0;
}


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

int main() {
    vector<int> prime;
    prime.push_back(2);
    bool flag;
    for (int i = 3; i <= 100000; i++) {
        flag = true;
        for (int j = 0; j < prime.size(); j++) {
            if (prime[j] * prime[j] > i) break;
            else if (i % prime[j] == 0) {
                flag = false;
                break;
            }
        }
        if (flag) prime.push_back(i);
    }

    vector<int> prime2;
    for (int i = 0; i < prime.size(); i++) {
        if (binary_search(prime.begin(), prime.end(), (prime[i]+1)/2)) prime2.push_back(prime[i]);
    }
    
    int Q; cin >> Q;
    int l, r;
    for (int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << upper_bound(prime2.begin(), prime2.end(), r) - lower_bound(prime2.begin(), prime2.end(), l) << endl;
    }

}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    string s;
  cin >> s;
    if(s[k-1]=='A') s[k-1]='a';
    if(s[k-1]=='B') s[k-1]='b';
    if(s[k-1]=='C') s[k-1]='c';
    cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,s1,s2;
    cin>>s>>s1;
    int a,b;
    cin>>a>>b;;
    cin>>s2;
    if(s2==s)
        a--;
    else
        b--;
    cout<<a<<" "<<b<<endl;

}



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

int N;
int A[100010];

int main() {
    cin >> N;
    int c = 0, t;
    for (int i = 0; i < N; i++) {
        cin >> t;
        if (A[t] != t) {
            c++;
            A[t] = t;
        }
    }
    if ((c & 1) == 0) c--;
    cout << c << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final int H = s.nextInt();
			final int W = s.nextInt();

			char[][] map = new char[H][];
			for (int h = 0; h < H; h++) {
				map[h] = s.next().toCharArray();
			}

			int[][] counter = new int[H][W];
			for (int h = 0; h < H; h++) {
				int from = 0;
				int straight = 0;
				for (int w = 0; w < W; w++) {
					if (map[h][w] == '#') {
						for (int i = from; i < w; i++) {
							counter[h][i] = straight;
						}
						from = w + 1;
						straight = 0;
						continue;
					}
					straight++;
				}
				for (int i = from; i < W; i++) {
					counter[h][i] = straight;
				}
			}

			int max = 0;
			for (int w = 0; w < W; w++) {
				int from = 0;
				int straight = 0;
				for (int h = 0; h < H; h++) {
					if (map[h][w] == '#') {
						for (int i = from; i < h; i++) {
							max = Math.max(max, counter[i][w] + straight - 1);
						}
						from = h + 1;
						straight = 0;
						continue;
					}
					straight++;
				}
				for (int i = from; i < H; i++) {
					max = Math.max(max, counter[i][w] + straight - 1);
				}
			}
			System.out.println(max);
		}
	}
}


Measured memory_bytes: 60456
import java.util.*;
import java.io.*;

public class Main {
    static void answer(long n){
        System.out.println(n);
        System.exit(0);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        if(R-L>2100) answer(0);

        long ans = 2500;
        for(long i=L; i<=R; i++)for(long j=i+1; j<=R; j++){
            ans = Math.min(ans, (i*j)%2019);
        }
        answer(ans);

    }
}

Measured memory_bytes: 21840
#include <stdio.h>

int main(void) {
	int r,c,i,j,cnt,cnt1,flag;
	char s[500][500];
	scanf("%d%d\n",&r,&c);
	for(i=0;i<r;i++){
		scanf("%s",s[i]);
	}
	for(i=0;i<r;i++){
		cnt=0;
		for(j=0;j<c;j++){
			if(s[i][j]=='.')cnt++;
		}
		if(cnt==c){
			for(j=0;j<c;j++){
				s[i][j]='x';
			}
		}
	}
	for(j=0;j<c;j++){
		cnt1=0;
		for(i=0;i<r;i++){
			if(s[i][j]=='.' || s[i][j]=='x')cnt1++;
		}
		if(cnt1==r){
			for(i=0;i<r;i++){
				s[i][j]='x';
			}
		}
	}
	for(i=0;i<r;i++){
		flag=0;
		for(j=0;j<c;j++){
			if(s[i][j]!='x'){
				printf("%c",s[i][j]);
				flag=1;
			}
		} 
		if(flag==1)printf("\n");
		
	}
	return 0;
}


Measured memory_bytes: 256
s = input()
len_s = len(s)
for i in range(len_s):
    if s[i] != s[len_s - i - 1]:
        print('No')
        exit()
for i in range((len_s - 1) // 2):
    if s[i] != s[(len_s - 1) // 2 - 1 - i] or s[(len_s + 2) // 2 + i] != s[(len_s - 1) - i]:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 3060
using System;

namespace ABC_082_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');
            double a = double.Parse(word[0]);
            double b = double.Parse(word[1]);
            double x = (a + b) / 2;
            Console.WriteLine(Math.Ceiling(x));
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main() {
    /* ----- 入力 ----- */
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto& a : A) cin >> a;
    sort(A.begin(), A.end());

    /* ----- 最大値を求める ----- */
    int sum = 0;
    for (auto& a : A) sum += abs(a);
    if (A.front() > 0) sum -= A.front() * 2;  // 全て正の場合
    if (A.back() < 0) sum += A.back() * 2;    // 全て負の場合
    cout << sum << endl;

    /* ----- 操作列の構成 ----- */
    int acc = A.front();

    // 正の要素を引く
    for (int i = 1; i < N - 1; ++i) {
        if (A[i] >= 0) {
            cout << acc << " " << A[i] << endl;
            acc -= A[i];
        }
    }

    // 正負逆転
    cout << A.back() << " " << acc << endl;
    acc = A.back() - acc;

    // 負の要素を引く
    for (int i = 1; i < N - 1; ++i) {
        if (A[i] < 0) {
            cout << acc << " " << A[i] << endl;
            acc -= A[i];
        }
    }
    return 0;
}


Measured memory_bytes: 2304
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
using namespace std;
typedef long long ll;

const int MAX_N = 1e6;

int N, Q;
ll s[MAX_N], latte[MAX_N], a;
string t;
set<int> leader;

bool Check(int r, int x)
{
	ll sum = 0, l = -1;
	vector<ll> leaderV;
	for(set<int>::iterator itr = leader.begin(); itr != leader.end(); itr++)
	{
		leaderV.push_back(s[*itr]);
	}
	sort(leaderV.begin(), leaderV.end());
	for(int i = 0; i < leaderV.size(); i++)
	{
		sum += upper_bound(latte, latte + N, leaderV[i]) - lower_bound(latte, latte + N, max(l + 1, leaderV[i] - r));
		l = leaderV[i];
	}
	return (N - sum) <= x;
}

int main()
{
	cin >> N >> Q;
	for(int i = 0; i < N; i++)
	{
		cin >> s[i];
		latte[i] = s[i];
	}
	sort(latte, latte + N);
		
	for(int i = 0; i < Q; i++)
	{
		cin >> t >> a;
		if(t == "CHECK")
		{
			int l = -1, r = 1e9;
			while(r - l > 1)
			{
				int piv = (l + r) / 2;
				if(Check(piv, a)) r = piv;
				else l = piv;
			}
			if(Check(r, a)) printf("%d\n", r);
			else puts("NA");
		}
		else
		{
			a--;
			if(t == "ADD") leader.insert(a);
			else if(t == "REMOVE") leader.erase(a);
		}
	}
	return 0;
}

Measured memory_bytes: 16880
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
    ll N, X; cin >> N >> X;
    ll res = N;
    ll a = max(N - X, X), b = min(N - X, X);

    while (b) {
        ll q = a/b;
        ll r = a % b;
        res += (b * 2) * q;
        if (r == 0) res -= b;
        a = b, b = r;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lli = unsigned long long;
using pii = pair<int, int>;

#define rep(i,k,n) for(int i=(k); i != int(n); ++i)
#define sz(x) x.size()
#define all(x) x.begin(), x.end()

#define dbg(x) cout << #x << '=' << x << '\n'
#define dbg2(x, y) cout << #x << '=' << x << ' ' << #y << '=' << y << '\n' 

#define input() (*istream_iterator<lli>(cin))
#define strin() (*istream_iterator<string>(cin))
#define output(x) cout << x << '\n' 

int main(){
    ios::sync_with_stdio(false);
    lli x = input(), cur = 100, cnt = 0;
    while(cur < x){
        cur += (lli)cur*0.01;
        cnt ++;
    }
    cout << cnt;
}

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

int calc(int x) {
	int cnt = 0;
	while (x) {
		x /= 10;
		cnt++;
	}
	return cnt;
}

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

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int tmp = calc(i);
		if (tmp % 2 != 0)ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    cout << (1000 - n%1000) % 1000 << endl;
    return 0;
}


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

int main(){
  int n, ans=0, k;
  string s;
  cin >> n >> s;
  for(int i=1; i<n; i++){
    k=0;
    for(char t='a'; t<='z'; t++)
      if(s.substr(0,i).find(t)!=string::npos && s.substr(i).find(t)!=string::npos)
        k++;
    if(ans<k) ans = k;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define FORR(I,A,B) for(int I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
int gcd(int a,int b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl
string xx[]={"7","5","3"};
string k;
int n;
int ans;
int x3,x5,x7;
void dfs(){
	if(k.size()==9)return;
	if(x3&&x5)if(n>=stoi(k+xx[0]))ans++;
	if(x3&&x7)if(n>=stoi(k+xx[1]))ans++;
	if(x7&&x5)if(n>=stoi(k+xx[2]))ans++;
	k += xx[0];
	x7++;
	dfs();
	k = k.substr(0,k.size()-1) + xx[1];
	x7--;x5++;
	dfs();
	k = k.substr(0,k.size()-1) + xx[2];
	x5--;x3++;
	dfs();
	x3--;
	k = k.substr(0,k.size()-1);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	dfs();
	cout << ans << endl;
}


Measured memory_bytes: 256
import numpy as np
import sys

def main():
    N,M=map(int,input().split())
    A=list(map(int,input().split()))
    A_double=list(map(lambda x:x//2,A))

    mini_multi=int(np.lcm.reduce(A_double))

    res=M//mini_multi
    
    for i in A_double:
        if (mini_multi//i)%2==0:
            print(0)
            sys.exit()

    if res%2!=0:
        res+=1


    print(res//2)





if __name__=="__main__":
    main()


Measured memory_bytes: 38412
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 ll a,b,n;
  cin >> a >> b >> n;
  
  ll x=min(b-1,n);
  cout << floor(a*x/b)-a*floor(x/b) << endl;  
}

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

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int c1=0,c2=0,c3=0,c4=0;
    for(int i=0;i<n;i++)
    {
        string ch;
        cin>>ch;
        if(ch.compare("AC")==0)
        {
            c1++;
        }
        else if(ch.compare("WA")==0)
        {
            c2++;
        }
        else if(ch.compare("TLE")==0)
        {
            c3++;
        }
        else
        {
            c4++;
        }
        
    }
    cout<<"AC "<<"x "<<c1<<endl;
    cout<<"WA "<<"x "<<c2<<endl;
    cout<<"TLE "<<"x "<<c3<<endl;
    cout<<"RE "<<"x "<<c4<<endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  string ret = "No";
  for (int i = 2; i<10; i++) {
    if (n == 1) { ret = "Yes"; break; }
    if (n / i < 10 && n % i == 0)  { ret = "Yes"; break; }
  }
  cout << ret << endl;
}


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

int main() {
  // n: people, m: food
  int n, m, k, a, i, j;
  cin >> n >> m;
  int foods[m];
  for (i = 0; i < m; i++) foods[i] = 0;
  
  for (i = 0; i < n; i++) {
    basic_istream<char, char_traits<char>> &cin2 = cin >> k;
    for (j = 0; j < k; j++) {
      cin2 >> a;
      foods[a - 1]++;
    }
  }

//  for (int f: foods) {
//    cout << f << " ";
//  }
//  cout << endl;

  int cnt = 0;
  for (i = 0; i < m; i++) {
    if (foods[i] == n) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
//ll arr[1000002];
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/

int main()
{
    cout.precision(9);
    cout.setf(ios::fixed,ios::floatfield);
double n,k,r=0;
cin>>n>>k;
if(n>=k)
{
    r=r+(n-k+1)/n;
}
for(ll i=1;i<=min((ll)n,(ll)(k-1));i++)
{
    ll a=i,b=1,c=0;
    while(a<(ll)k)
    {
        a=a*2;
        b=b*2;
       // c++;
    }
    r=r+(1/n)*(1/(double)b);
}
cout<<r<<endl;
}



Measured memory_bytes: 256
public class Main {
  public static void main(String[] args) {
    java.util.Scanner scanner = new java.util.Scanner(System.in);
    String s = scanner.next();
    StringBuilder builder = new StringBuilder(s.length() / 2);
    for (int i  = 0; i < s.length(); i++) {
          if (i % 2 == 0) { builder.append(s.charAt(i)); }
    }
    System.out.println( builder.toString());
 }
}

Measured memory_bytes: 26696
//#pragma GCC optimize(\"Ofast,no-stack-protector\")
//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx\")
//#pragma GCC target(\"avx,tune=native\")
// Neil

#include<bits/stdc++.h>

using namespace std;

typedef complex<double> base;
typedef long double ld;
typedef long long ll;

#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define pll pair< ll , ll >
#define vi vector<int>
#define vvi vector< vi >
const int MAXN=(int)(2e5+5);
const ll MOD=(ll)(1e9+7);
int t;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a, b;
  cin>>a>>b;
  cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

int main(){
    ll l,N;
    cin>>N>>l;
    string s[105];
    for(int i=0;i<N;i++){
        cin>>s[i];
    }
    sort(s,s+N);
    for(auto c:s){
        cout<<c;
    }cout<<endl;
    return 0;
}

Measured memory_bytes: 256