akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define debug(x) cerr << #x << " " << x << endl;
#define debug_p(x) cerr << #x << " [" << x.fi << " " << x.se << "]"<<endl;
#define debug_v(x) {cerr << #x << " "; for (auto ioi : x) cerr << ioi << " "; cerr << endl;}
#define debug_vp(x) {cerr << #x << " "; for (auto ioi : x) cerr << '[' << ioi.fi << " " << ioi.se << ']'; cerr << endl;}
#define debug_v_v(x) {cerr << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cerr << ioi2 << " "; cerr << '\n';} cerr << "*/" << #x << endl;}
#define gen_clock(x) ll x = clock(); cerr << "Clock " << #x << " created" << endl;
#define check_clock(x) cerr << "Time spent in " << #x << ": " << (double)(clock() - x)/CLOCKS_PER_SEC << endl; x = clock();
#define reset_clock(x) x = clock()
 
const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
 
void solve()
{
	ll n;
	cin>>n;
	ll x=400;
	ll ans=8;
	ans-=(n-x)/200;
	cout<<ans;
	
	
}
 
int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = Integer.parseInt(scan.next());
        int b = Integer.parseInt(scan.next());
        int h = Integer.parseInt(scan.next());
        int m = Integer.parseInt(scan.next());
        scan.close();

        double rad = Math.abs((double)(h * 60 + m) / 720 - (double)m / 60) * Math.PI * 2;

        double ans2 = a * a + b * b - 2 * a * b * Math.cos(rad);

            System.out.println(Math.sqrt(ans2));
       
    }

}

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

using namespace std;

typedef long long ll;

const int INF = 1000000009;

void solve() {
    int n;
    cin >> n;
    map<string, int> m;
    m["AC"] = 0;
    m["WA"] = 0;
    m["TLE"] = 0;
    m["RE"] = 0;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ++m[s];
    }
    
    cout << "AC x " << m["AC"] << "\n";
    cout << "WA x " << m["WA"] << "\n";
    cout << "TLE x " << m["TLE"] << "\n";
    cout << "RE x " << m["RE"] << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int t = 1;
    //cin >> t;
    for (int qq = 0; qq < t; ++qq) {
       solve();
    }
   
    return 0;
}

Measured memory_bytes: 3672
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;


int n, m  ;
string s, t, temp = " ";


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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);


cin >> n >> m;

cin >> temp;
s = " ";
s+=temp;
cin >> temp;
t = " ";
t+=temp;


int lc = n*m;
int gc = __gcd(n, m);

lc/=gc;

int k = (lc/n)*(lc/m) / __gcd( lc/n , lc/m )  ;

if(s[1]!=t[1]){
    cout << -1 << endl;
    return 0;
}

n/=gc;
m/=gc;

//cout << n << " " << m << endl;

for(int i = k; i < lc ; i+=k  ){

    if( s[(i/m) + 1] != t[ (i/n) +1 ]  ){
        //cout << s[ (i/n) +1 ]  << " " << t[ (i/m)+1 ]<< endl;
         cout << -1 << endl;
        return 0;
    }

}

cout << lc << endl;

return 0;}
///....


Measured memory_bytes: 640
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d %d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld %lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;
/*ios_base::sync_with_stdio(false);cin.tie(0);*/

int main ( ){
    ios_base::sync_with_stdio(false);cin.tie(0);
    ll a,b;
    cin >>a;
    bool ctr=0;
    if (a <=81 ){
        if (a==1||a==2||a==3){
            cout<<"Yes";
            return 0;
        }
        for (int i = 2; i *i<=a && i <10; ++i) {
            if(a%i==0){
                if((a/i)<10 ){
                    ctr=1;
                }
            }
        }
        if(ctr==1){
            cout<<"Yes";
            return 0;
        }else{
            cout<<"No";
            return 0;
        }
    }else{
        cout <<"No";
    }
    return 0;
}

Measured memory_bytes: 256
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
//不可解すぎるバグは配列外参照（配列の長さ）を検討
#include "bits/stdc++.h"
#define YES "YES"
#define Yes "Yes"
#define NO "NO"
#define No "No"
#define YESNO(x) OUT(three(x,YES,NO))
#define YesNo(x) OUT(three(x,Yes,No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b-1,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB emplace_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int long long
#define zero 0LL
#define all ALL
#define pb PB
using namespace std;
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef LL ll;
typedef double ld;
typedef LL ut;
const LL INF = 1LL << 60;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<ppr, Vppr ,greater<ppr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
int dx[] = { 0,1,0,-1,1,1,-1,-1,0 }, dy[] = { 1,0,-1,0,1,-1,1,-1,0 };
const int SIZE1 =5e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 301;
const int SIZE = SIZE1;
const LL p = 7 + 1e9;const long double EPS = 1e-7;
ut N, M, K, X, L, Y,H,W,Q,D;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE], nums[SIZE], maps[SIZE2][SIZE2], answer = zero;
LL btimes[SIZE];
LL A[SIZE], B[SIZE],I[SIZE];
//LL A, B;
LL ranks[SIZE];
string s, t;
VI v[2];
LL solve() {
	cin >> N >> s;
	REP(i, N) {
		A[s[i]]++;
	}
	LL ans = 1;
	FOR(i, 'a', 'z' + 1) {
		ans *= A[i]+1;
		ans %= p;
	}
	return (ans-1+p)%p;
}
signed main() {
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	cout << solve() << endl;
	//cout << solve() << endl;
	//	cin >> N;
	return 0;
}

Measured memory_bytes: 15952
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(long long x, long long y) {
  ll absX = abs(x);
  ll absY = abs(y);

  if ((x < 0 && 0 < y) || (x >= 0 && y <= 0)) {
    print(1 + abs(absX - absY));
  } else if ((x <= 0 && y <= 0 && absY <= absX) ||
             (x >= 0 && y > 0 && absX <= absY)) {
    print(abs(absX - absY));
  } else {
    print(2 + abs(absX - absY));
  }
}

int main() {
  long long x;
  scanf("%lld", &x);
  long long y;
  scanf("%lld", &y);
  solve(x, y);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
const int maxn = 1e5 + 100;
queue<int> Q;
vector<int> G[maxn];
int f[maxn], col[maxn], in[maxn];
void dfs(int x, int fa){
    f[x] = fa;
    for(auto to : G[x]){
        if(to == fa) continue;
        dfs(to, x);
    }
}
int n, x, y;
int main()
{
    cin>>n;
    for(int i = 0; i < n-1; i++){
        cin>>x>>y;
        in[x]++; in[y]++;
        G[x].pb(y); G[y].pb(x);
    }
    dfs(1, 1);
    for(int i = 1; i <= n; i++){
        if(in[i] == 1) Q.push(i);
    }
    int label = 0;
    f[1] = 0;
    while(!Q.empty()){
        int x = Q.front(); Q.pop();
        if(col[x]) continue;
        if(col[f[x]]) label = 1;
        else{
            col[f[x]] = 1;
            in[f[f[x]]]--;
            if(in[f[f[x]]] == 0) label = 1;
            if(in[f[f[x]]] == 1 && f[f[x]] != 1) Q.push(f[f[x]]);
        }
    }
    cout<<(label ? "First" : "Second")<<endl;
    return 0;
}


Measured memory_bytes: 7168
#36 ABC127D
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc=sorted(bc, key=lambda x:-x[1])

i=0
for b,c in bc:
	while(i<n and a[i]<c and b>0):
		a[i]=c
		b-=1
		i+=1
print(sum(a))

Measured memory_bytes: 82328
n = int(input())

def checkIfDuplicates(listOfElems):
    if len(listOfElems) == len(set(listOfElems)):
        return False
    else:
        return True

listOfElems = list(map(int, input().split()))
result = checkIfDuplicates(listOfElems)
if result:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 26804
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    cout << X * min(K, N) + Y * max(0, N - K) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int x, i, a[9];
	for (i = 0;i < 9;i++) {
		cin >> a[i];
	}
	for (x = 0;x < 101;x++) {
		if (a[0] == x + (a[0] - x) &&
			a[1] == x + (a[1] - x) &&
			a[2] == x + (a[2] - x) &&
			a[3] == (a[0]-x)+(a[3]-(a[0]-x)) &&
			a[4]==(a[1]-x)+(a[3]-(a[0]-x)) &&
			a[5]==(a[2]-x)+(a[3]-(a[0]-x)) &&
			a[6]==(a[0]-x)+(a[6]-(a[0]-x)) &&
			a[7]==(a[1]-x)+(a[6]-(a[0]-x)) &&
			a[8]==(a[2]-x)+(a[6]-(a[0]-x))) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
string s,t;
int main(){
    fast;
    cin>>s>>t;
    int m=s.length();
    int n=t.length();
    vector<vector<int> > dp;
    dp.resize(m+1,vector<int>(n+1,0));
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(s[i] == t[j])
                dp[i+1][j+1] = dp[i][j]+1;
            else
                dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
        }
    }
    int i=m,j=n;
    string str = "";
    while(i>0 && j>0)
    {
        if(dp[i-1][j] == dp[i][j])
        {
            i--;
        }
        else if(dp[i][j-1] == dp[i][j])
        {
            j--;
        }
        else
        {
            str = s[i-1]+str;
            i--;
            j--;
        }
    }
    if(str.length())
        cout<<str;
    else
        cout<<' ';
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
using namespace std;
typedef long long num;
typedef pair<int,int> point;
const int maxn=1e6+10,inf=1e9+10;

int n,A[maxn],ans;
map<int,int> c,val;

int root(int pos){
	if(pos==0) return inf;
	if(val[pos-c[pos]]<ans-1) return c[pos];
	c[pos]=c[pos]+1+root(pos-c[pos]-1);
	return c[pos];
}

bool check(){
	val.clear();
	c.clear();
	rep(i,1,n){
		if(A[i]>A[i-1]){
			continue;
		}
		int pos=root(A[i]);
		if(pos>=inf){
			return 0;
		}
		pos=A[i]-pos;
		val[pos]++;
		while(val.size() && (*val.rbegin()).X>pos){
			val.erase(--val.end());
		}
		while(c.size() && (*c.rbegin()).X>pos){
			c.erase(--c.end());
		}
	}
	return 1;
}

int32_t main(){
	scanf("%d",&n);
	rep(i,0,n){
		scanf("%d",A+i);
	}
	bool ok=1;
	rep(i,1,n){
		ok&=A[i]>A[i-1];
	}
	if(ok){
		printf("1\n");
		return 0;
	}
	int l=1,r=n;
	while(r-l>1){
		ans=(l+r)>>1;
		if(check()){
			r=ans;
		}else{
			l=ans;
		}
	}
	printf("%d\n",r);
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>

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

using namespace std;

int main(){
	int N, M;
	int T[100005];
	cin >> N;
	long long cnt = 0;
	long long work;

	for(int i = 1; i <= N; i++){
		cin >> T[i];
		cnt += T[i];
	}
	cin >> M;
	for(int i = 1; i <= M; i++){
		int x, y;
		cin >> x >> y;

		work = cnt;
		work -= T[x];
		work += y;
		cout << work << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    int a[n];
    for(int i = 0; i < n;i++){
        cin >> a[i];
    }
    int b[n+1];b[0] = 0; b[1] = abs(a[1]-a[0]);
    for(int i = 1;i < n;i++){
        b[i+1] = min(b[i]+abs(a[i]-a[i+1]),b[i-1]+abs(a[i-1]-a[i+1]));
    }
    cout << b[n-1];
}




Measured memory_bytes: 1024
#coding:UTF-8

def MP(n,a):
    minv=a[0]
    maxv=a[1]-a[0]
    for i in range(1,n):
        if maxv<a[i]-minv:
            maxv=a[i]-minv
        if minv>a[i]:
            minv=a[i]    
    print(maxv)
if __name__=="__main__":
    n=int(input())
    a=[]
    for i in range(n):
        a.append(int(input()))
    MP(n,a)

Measured memory_bytes: 15644
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    println!("{}",a/3)
}

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

#define mod 998244353
ll ebob(ll a, ll b){
	if(a == 0) return b;
	return ebob(b%a, a);
}
ll ekok(ll a, ll b){
	return (a*b)/ebob(a,b);
}
int main(){
	int n, m; cin>>n>>m;
	int son = m+n-1;
	int toplam = (n*(n+1))/2 + n*(m-1);
	if(toplam < 0){
		cout<<toplam - (son > 0 ? 1 : son);
	}else if(toplam == 0){
		cout<<0;
	}else{
		cout<<toplam - (m > 0 ? m : 0);
	}
	return 0; 
}

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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(c)     for(bool p=1;p;p=next_permutation(ALL(c)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<typename T>string join(const vector<T>& v, string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(d.length());}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{if(SZ(v))s<<join(v,", ");return s;}

const ll inf = 1e15;
const ll mod = 1e9+7;
const double eps = 1e-10;

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

int main() {
    ll N, K; cin >> N >> K;
    
    if (K == 0) {
        cout << N * N << endl;
        return 0;
    }
    
    ll ans = 0;
    FOR(b, K+1, N+1){
        ll p = N / b;
        ll r = N % b;
        
        ans += p * max(0LL, b - K) ;
        ans += max(0LL, r - K + 1);
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
import bisect
a,b,q = map(int,input().split())

jinjya = []
otera = []

for i in range(a):
    jinjya.append(int(input()))
for i in range(b):
    otera.append(int(input()))

INF = 10**18
jinjya = [-INF] + jinjya + [INF]
otera = [-INF] + otera + [INF]


for i in range(q):
    res = INF
    pos = int(input())
    j,o = bisect.bisect_right(jinjya,pos),bisect.bisect_right(otera,pos)
    for a in [jinjya[j-1],jinjya[j]]:
        for b in [otera[o-1],otera[o]]:
            res = min(res,abs(pos-a)+abs(a-b),abs(pos-b)+abs(a-b))
    print(res)


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int ans = a;
  if(a > b) --ans;
  cout << (ans) << endl;

  return 0;
}


Measured memory_bytes: 256
o = input()
e = input()

odd_count = 0
even_count = 0
result = ''

for i in range(1, len(o)+len(e)+1):
    if i % 2 == 0:
        result += e[even_count]
        even_count += 1
    else:
        result += o[odd_count]
        odd_count += 1
print(result)

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
function main()
	n= parseInt(readline())
	a = map(parseInt, split(readline()))
	countt = 0
	countf = 0
	for i in 1:n
		if a[i]%4==0
			countf += 1
		elseif a[i]%2==0
			countt += 1
		end
	end
	if countf == 0
		if countt == n > 1
			print("Yes")
		else
			print("No")
		end
	elseif countt+(countf*2+1) >=n
		if countt == n-countf*2-1 > 0
			print("No")
		else
			print("Yes")
		end
	else
		print("No")
	end
end
main()

Measured memory_bytes: 123324
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int N, M; cin >> N >> M;
	vector<int> counts(N, 0);
	for (int i = 0; i < M; ++i)
	{
		int ai, bi; cin >> ai >> bi;
		++counts[ai - 1];
		++counts[bi - 1];
	}
	bool isYes = true;
	for (int count : counts)
	{
		if (count % 2 == 1)
		{
			isYes = false;
			break;
		}
	}
	cout << (isYes ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3796
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

char s[200010];
int a[200010];

//嘘貪欲
int main(){
	scanf("%s",s);
	int n=strlen(s);
	for(int i=n-1;i>=0;i--){
		a[i]=a[i+2]+s[i]-'0';
	}
	
	if(a[0]==0&&a[1]==0){
		puts("0");
		return 0;
	}
	
	
	ll ans=a[0];
	ll cnt=0;
	int pos=0;
	repp(i,0,n,2){
		if(s[i]=='0'){
			while(i<n&&s[i]=='0'){
				i++;
				ans+=a[i]+cnt;
			}
		}
		if(s[i]=='1')cnt++;
		pos=i;
	}
	printf("%lld",ans+cnt*(cnt-1)+(pos!=n-1?cnt:0));
}




Measured memory_bytes: 2672
import java.util.Scanner;
import java.util.Arrays;

class Main{
	public static void main(String[] args){
		//出席者の出席番号を、昇順に取得
		Scanner stdIn = new Scanner(System.in);
		int[] attendanceNumbers = new int[30];
		for(int i=0;i<28;i++){
			attendanceNumbers[i] = stdIn.nextInt();
		}
		attendanceNumbers[28] = 31;
		attendanceNumbers[29] = 31;
		Arrays.sort(attendanceNumbers);
		int _1to30=1;
		for(int i:attendanceNumbers){
			if(i!=_1to30){
				System.out.println(_1to30);
				_1to30++;
				if(i!=_1to30){
					System.out.println(_1to30);
					_1to30++;
				}
			}
			_1to30++;
			if(_1to30>=31)break;
		}
	}
}

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

map<char, char> mp;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s,t;cin>>s>>t;

  int len = s.size();

  for(int i=0;i<len;i++){
    if(!mp[s[i]])mp[s[i]] = t[i];
    else{
      if(mp[s[i]] != t[i]){
        cout<<"No"<<endl; return 0;
      }
    }
  }

  set<char> st2;
  for (auto& kv : mp) {
    auto k = kv.first; auto v = kv.second;
    st2.insert(v);
  }
  if(st2.size() != mp.size()){
    cout<<"No"<<endl; return 0;
  }

  cout<<"Yes"<<endl;

  return 0;
}


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


#define debug(x) cerr<< #x << ": "<< x << endl;
#define print(x) cerr<< x << endl;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
#define REP(i,x,y) for(int i=x;i<y;i++)
#define REPIT(it,A) for(typeof(A.begin()) it = (A.begin()); it!=A.end();it++)
#define fst first
#define snd second
#define sqr(x) ((x)*(x))

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define ones(x) __builtin_popcountll(x)
using namespace std;

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

const int MAXN = 101000;
vector<pair<ii,int>> adj[MAXN];
int indeg[MAXN], vis[MAXN], coord[MAXN];
bool ok;

void go(int u){
	vis[u] = 1;
	REP(i,0,adj[u].size()){
		int v = adj[u][i].fst.fst;
		int d = adj[u][i].fst.snd;
		int dir = adj[u][i].snd;
		if(!vis[v]){
			coord[v] = coord[u] + d * dir;
			go(v);
		}else if(coord[v] != coord[u] + d * dir){
			ok = false;
		}
	}
}

int main(){
   fastio;
	
	int n,m;
	cin >> n >> m;
	REP(i,0,n) indeg[i] = vis[i] = 0;
	REP(i,0,m){
		int u, v, d;
		cin >> u >> v >> d;
		u--;v--;
		adj[u].pb(mp(mp(v,d),1));
		adj[v].pb(mp(mp(u,d),-1));
		indeg[v]++;
	}
	
	ok = true;
	REP(i,0,n){
		if(!vis[i] && indeg[i] == 0){
			coord[i] = 0;
			go(i);
		}
	}
	
	REP(i,0,n) if(!vis[i]) ok = false;
	if(!ok) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
   return 0;
}



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

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vs){
  for (const T& v : vs) os << v << " ";
  return os;
}

int main() {
  int N; cin >> N;
  vector<int> P(N), Q(N); cin >> P >> Q;

  std::vector<int> v(N);
  for (int i = 0; i < N; ++i) v[i] = i+1;

  int pindex = 0, qindex = 0;
  int i = 0;
  do {
    if (v == P) pindex = i;
    if (v == Q) qindex = i;
    ++i;
  } while(next_permutation(v.begin(), v.end()));
  cout << abs(pindex-qindex) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main() {
	string s;
	cin >> s;
	int a = 0;
	int b = 0;
	for(int i = 0; i < s.size(); i++) {
		if(s[i]==((i%2==0)?'0':'1')) a++;
		if(s[i]==((i%2==0)?'1':'0')) b++;
	}
	cout << min(a,b) << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
ll a,b,c,d,z;
ll gcd(ll x,ll y) {
	if (!x||!y) return x+y;
	return gcd(y,x%y);
}
int main() {
	//freopen("1.txt","r",stdin);
	read(a); read(b); read(c); read(d);
	z=c/gcd(c,d)*d; a--;
	printf("%lld\n",(b-a)-(b/c-a/c+b/d-a/d-b/z+a/z));
	return 0;
}

Measured memory_bytes: 256
s = input()
m = set(s)

if len(m) == 1:
    print(0)
    exit()

ans = float('inf')
for k in m:
    cnt = 0
    tt = s
    while True:
        cnt += 1
        t = ''
        for i in range(len(tt)-1):
            if tt[i] == k or tt[i+1] == k:
                t += k
            else:
                t += tt[i+1]
        tt = t

        if len(set(tt)) == 1:
            break
    ans = min(ans,cnt)       
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int i,j,n,m,y[101][101],max,cnt,dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
void func(int s,int x)
{
	int ss,xx,i;
	for(i=0;i<4;i++){
		ss=s+dy[i]; xx=x+dx[i];
		if(y[ss][xx]==1&&0<=ss&&ss<n&&0<=xx&&xx<m){
			cnt++;
			y[ss][xx]=0;
			if(max<cnt) max=cnt;
			func(ss,xx);
			y[ss][xx]=1; cnt--;
		}
	}
}
int main(void)
{
	while(1){
		scanf("%d%d",&m,&n);
		if(m==0&&n==0) break;
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				scanf("%d",&y[i][j]);
			}
		}
		max=0;
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				cnt=0;
				func(i,j);
			}
		}
		printf("%d\n",max);
	}
	return 0;
}

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

ll x;
int main(){
  cin>>x;
  if(x>=1200){
    cout<<"ARC"<<endl;
  }else{
    cout<<"ABC"<<endl;
  }


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << x << "\n"
constexpr int mod = 1000000007;
using namespace std;
int d, c[30], l[30], s[400][30];
signed main() {
	cin >> d;
	for1(i, 26)cin >> c[i];
	for1(i, d)for1(j, 26)cin >> s[i][j];
	for1(i, d) {
		int p = 0, k = -mod;
		for1(j, 26) {
			int kj = s[i][j] + c[j] * (i - l[j]) * 7 + c[j] * 5;
			if (kj > k) { p = j; k = kj; }
			else if (kj == k && c[j] > c[p])p = j;
		}
		puts(p); l[p] = i;
	}
}

Measured memory_bytes: 3684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
using namespace std;

struct Node { int key; Node *next, *prev; };
Node *nil;

void init() {
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil, nil->prev = nil;
}
Node *searchKey(int key) {
	Node *x = nil->next;
	while (x->key != key && x != nil)x = x->next;
	return x;
}

void printlist() {
	Node *cur = nil->next;
	for (int i = 0; cur != nil;i++) {
		if (i)cout << " ";
		cout << cur->key;
		cur = cur->next;
	}
	cout << endl;
}

void popback(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	nil->prev->next = x;
	x->prev = nil->prev;
	x->next = nil;
	nil->prev = x;
	x->key = key;
}

void popfront(int key) {
	Node *x = (Node *)malloc(sizeof(Node));
	nil->next->prev = x;
	x->next = nil->next;
	x->prev = nil;
	nil->next = x;
	//if (nil->prev = nil)nil->prev = x;
	x->key = key;
}

void deleteNode(Node *t) {
	if (t == nil)return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst() {
	deleteNode(nil->next);
}

void deleteLast() {
	deleteNode(nil->prev);
}

void deleteKey(int key) {
	deleteNode(searchKey(key));
}

void print(list<int> x) {
	list<int>::iterator it = x.begin();
	while (it != x.end()) {
		cout << *(it++);
	}
}

int main() {
	init();
	int n, x;
	string s;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (s[0] == 'i')cin >> x, popfront(x);
		if (s == "delete")cin >> x, deleteKey(x);
		if (s == "deleteFirst")deleteFirst();
		if (s == "deleteLast")deleteLast();
	}
	printlist();
	return 0;
}

Measured memory_bytes: 34400
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
  if (b==0) return a;
  return gcd(b,a%b);
}

int main()
{
  int n;
  int el;
  cin >> n;
  int mo[n];
  for(int i=0;i<n;i++) cin >> mo[i];
  if (n == 1) cout << mo[0] << endl;
  else{
    el = gcd(mo[0],mo[1]);
    if (n ==2) cout << el << endl;
    else{
      for(int i=2;i<n;i++){
        el = gcd(el,mo[i]);
      }
      cout << el << endl;
    }
  }
  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 sec = sc.nextInt();
    
    if(0 <= sec && sec <= 86400) {
        int h = sec / 3600;
        int m = (sec - (3600 * h)) / 60;
        int s = sec - (h * 3600 + m * 60);
        System.out.println(h + ":" + m + ":" + s);
    }else {
        System.out.println("??£??????????????\?????????????????????");
    }
  }    
}

Measured memory_bytes: 26252
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  ll a[N],b[N],ans1=0,ans2=0;
  FOR(i,0,N)cin >> a[i];
  FOR(i,0,N-1)a[i+1] += a[i];
  FOR(i,0,N)b[i] = a[i];

  ll S = 0;
  FOR(i,0,N){
    a[i] += S;
    if(i%2){
      if(a[i] >= 0){
        S -= a[i] + 1;
        ans1 += abs(a[i]+1);
      }
    }
    else{
      if(a[i] <= 0){
        S += -a[i] + 1;
        ans1 += abs(-a[i]+1);
      }
    }
  }

  S = 0;
  FOR(i,0,N){
    b[i] += S;
    if(i%2 == 0){
      if(b[i] >= 0){
        S -= b[i] + 1;
        ans2 += abs(b[i]+1);
      }
    }
    else{
      if(b[i] <= 0){
        S += -b[i] + 1;
        ans2 += abs(-b[i]+1);
      }
    }
  }
  cout << min(ans1,ans2) << endl;
}


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

const int MAXN = 50005;
const int MAXM = 50005;
const string str[12] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};

map<string, int> id;
int n, m;
int T[MAXN], S[MAXM];

bool rec(int k, int p) {
  if((m - p) * 2 < (n - 1) - k) return false;
  if(p == m) return (n + 1) - k <= 2;
  if(k-1 > 0 && (T[k-1]+11)%12 == S[p] && rec(k-1, p+1)) return true;
  if(k+1 < n+1 && (T[k+1]+0)%12 == S[p] && rec(k+1, p+1)) return true;
  if(k+2 < n+1 && (T[k+2]+1)%12 == S[p] && rec(k+2, p+1)) return true;
  return false;
}

int main() {
  for(int i = 0; i < 12; ++i) id[str[i]] = i;

  int Tc; cin >> Tc;
  while(Tc--) {
    cin >> n >> m;
    for(int i = 0; i < n; ++i) {
      string s; cin >> s;
      T[i+1] = id[s];
    }
    for(int i = 0; i < m; ++i) {
      string s; cin >> s;
      S[i] = id[s];
    }
    cout << (rec(0, 0) ? "Yes" : "No") << endl;
  }
  return 0;
}

Measured memory_bytes: 3948
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
int main(){
    ll n,k;cin>>n>>k;
    vector<vector<ll> >b(n);
    priority_queue<pll,vector<pll>,greater<pll> >small;
    priority_queue<pll>big;
    priority_queue<pll>big2;
    ll t,d;
    map<ll,ll>m;
    ll T=0;
    rep(i,n){
        cin>>t>>d;
        if(m.find(t)==m.end()){
            m[t]=T;
            T++;
        }
        b[m[t]].pb(d);
    }
    rep(j,T)sort(rall(b[j]));
    rep(j,T)big2.push(mp(b[j][0],j));
    rep(j,T)REP(i,1,b[j].size())big.push(mp(b[j][i],j));
    vector<ll>a(T);
    vector<bool>used(T);
    ll sum=0;
    ll now=min(k,T);
    rep(i,now){
        pll q=big2.top();
        big2.pop();
        sum+=q.first;
        small.push(q);
        used[q.second]=1;
        a[q.second]++;
    }
    rep(i,k-T){
        pll q=big.top();
        big.pop();
        sum+=q.first;
        a[q.second]++;
    }
    ll ma=sum+now*now;
    while(T>1){
        pll r=small.top();
        small.pop();
        if(a[r.second]>1)break;
        if(big.empty())break;
        pll q=big.top();
        if(!used[q.second])break;
        big.pop();
        a[r.second]--;
        used[r.second]=0;
        a[q.second]++;
        now--;
        sum-=r.first;
        sum+=q.first;
        ma=max(ma,sum+now*now);
    }
    cout<<ma<<endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;

int main(void) {
    int n; scanf("%d", &n);
    map<pii, int> m;
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        char buf[50]; scanf("%s", buf);
        int l = strlen(buf);
        int pos = -1;
        for (int j = 0; j < l; ++j)
            if (buf[j] == '.') pos = j;
        ll r;
        if (pos != -1) {
            int a, b; sscanf(buf, "%d.%d", &a, &b);
            for (int k = 0; k < 9 - (l - pos) + 1; ++k)
                b *= 10;
            r = a * 1000000000ll + b;
        }
        else {
            sscanf(buf, "%lld", &r);
            r *= 1000000000;
        }
        int c2 = 0, c5 = 0;
        while (r % 2 == 0) r /= 2, ++c2;
        while (r % 5 == 0) r /= 5, ++c5;
        for (auto x : m) 
            if (min(x.first.first + c2, x.first.second + c5) >= 18)
                ans += x.second;
        m[{ c2, c5 }]++;
    }
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;

int main()
{
	long long int H, W;
	long long int ans;

	cin >> H >> W;


	if (H == 1 || W == 1)
		ans = 1;
	else
	{
		ans = H * W / 2;

		if (H % 2 == 1 && W % 2 == 1)
			ans += 1;
	}

	cout << ans << endl;



}

Measured memory_bytes: 3576
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
void print() {
    cout << endl;
}

// template <class Head, class... Tail>
// void print(Head&& head, Tail&&... tail) {
//     cout << head;
//     if (sizeof...(tail) != 0) cout << " ";
//     print(forward<Tail>(tail)...);
// }

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << " ";
    }
    cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i,k-1)cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<class T, class U>
void print(pair<T,U> &p){
    cout << p.first << " " << p.second << "\n";
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n,k; cin >> n >> k;
    vector<ll> h(n+1);
    rep(i,n) cin >> h[i+1];

    vector<vector<ll>> dp(n+1, vector<ll>(n + 1, INF));
    dp[0][0] = 0;
    rep(i,n){
        reps(j,n){
            rep(l, j)chmin(dp[i+1][j], dp[i][l] + max(0LL, h[j] - h[l]));
        }
    }

    // print(dp);

    ll ans = INF;
    for(int i = n - k; i <= n; i++){
        rep(j, n+1)chmin(ans, dp[i][j]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
typedef long long int LL;

int n; LL seq[MAXN], ans, cnt;

void simulate(){
	int i;
	for(i = 1; i < n; ++ i) ++ seq[i];
	for(seq[i --] -= n; i && seq[i] > seq[i + 1]; -- i)
		swap(seq[i], seq[i + 1]);
}
int main(){
	int i, j;
	cin >> n;
	for(i = 1; i <= n; ++ i)
		cin >> seq[i];
	sort(seq + 1, seq + 1 + n);
	for(i = n; i && seq[n] - seq[i] <= n + 1; -- i) ;
	while(i){
		cnt = (seq[n] - seq[i] - n - 1) / (n + 1);
		ans += cnt * (n - i);
		for(j = 1; j <= i; ++ j)
			seq[j] += cnt * (n - i);
		for(; j <= n; ++ j)
			seq[j] -= cnt * (i + 1);
		while(seq[n] - seq[i] > n + 1)
			simulate(), ++ ans;
		while(i && seq[n] - seq[i] <= n + 1) -- i;
	}
	cnt = max(seq[1] - n + 1LL, 0LL);
	ans += cnt * n;
	for(j = 1; j <= n; ++ j)
		seq[j] -= cnt;
	while(seq[n] >= n)
		simulate(), ++ ans;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

using namespace std;

int main(){

  ll X;
  cin >> X;
  ll sum = 100;
  ll ans = 0;

  while (sum < X) {
    sum = sum * 1.01;
    ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 67280421310721;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////

int n,q,k;vector<P> g[110000];
vector<int> dist(110000);

void dfs(int node, int par){
  rep(i,g[node].size()){
    int to = g[node][i].first, cost = g[node][i].second;
    if(to == par)continue;
    dist[to] = dist[node] + cost;
    dfs(to, node);
  }
}

signed main(){
  cin>>n;
  rep(i,n-1){
    int a,b,c;cin>>a>>b>>c;a--;b--;
    g[a].push_back(P(b,c));
    g[b].push_back(P(a,c));
  }
  cin>>q>>k;k--;dfs(k, -1);
  rep(i,q){
    int x,y;cin>>x>>y;x--;y--;
    cout << dist[x] + dist[y] << endl;
  }
}


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

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

const int MAX = 1010101;

long long fac[MAX], finv[MAX], inv[MAX];

void binom_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long binom(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

ll N;
ll A[201010], B[201010];
map<pair<ll, ll>, pair<ll, ll> > m;
ll zero;

int main() {
  binom_init();
  cin >> N;
  rep(i, 0, N) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      zero++;
      continue;
    } else if (A[i] == 0) {
      B[i] = 1;
      m[make_pair(0, 1)].second++;
      continue;
    } else if (B[i] == 0) {
      A[i] = 1;
      m[make_pair(0, 1)].first++;
      continue;
    }

    ll g = gcd(abs(A[i]), abs(B[i]));
    A[i] = A[i] / g;
    B[i] = B[i] / g;
    if (B[i] < 0) {
      A[i] = -A[i];
      B[i] = -B[i];
    }
    if (A[i] > 0) {
      m[make_pair(A[i], B[i])].first++;
    } else {
      m[make_pair(B[i], -A[i])].second++;
    }
  }

  ll ans = 0;
  ans += zero;
  ans += MOD - 1;
  ans %= MOD;

  ll non_zero = N - zero;
  ll patterns = 1;
  for (auto e : m) {
    ll by = ppow(2, e.second.first) + ppow(2, e.second.second) - 1;
    by %= MOD;
    patterns *= by;
    patterns %= MOD;
  }

  ans += patterns;
  ans %= MOD;

  cout << ans << endl;
}


Measured memory_bytes: 46028
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split(" ");
          int n = Integer.parseInt(l[0]);
          int x = Integer.parseInt(l[1]);

          if(n == 0 && x == 0) {
            break;
          }

          int count = 0;
          for(int a = 1; a <= n - 2; a++) {
            for(int b = a + 1; b <= n - 1; b++) {
              for(int c = b + 1; c <= n; c++) {
                if(a + b + c == x) {
                  count++;
                }
              }
            }
          }

          System.out.println(count);
        }
    }
}

Measured memory_bytes: 26980
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
#define int long long
#define double long double

////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

string s;int x,y;
vector<int> a,b;
bool dpx[4100][25100], dpy[4100][25100];
signed main(){
  cin>>s>>x>>y;
  bool f = true,g = true;int cnt = 0;
  s += 'T';
  rep(i,s.length()){
    if(s[i] == 'T'){
      if(cnt > 0){
        if(f){
          if(g){
            x -= cnt;
          }else a.push_back(cnt);
        }else{
          b.push_back(cnt);
        }
      }
      g = false;
      cnt = 0;
      f = !f;
    }else{
      cnt++;
    }
  }
  bool ans = true;
  int t = 0, n = a.size();
  rep(i,n)t += a[i];
  t = t-x;
  rep(i,n)a[i] *= 2;
  if(t < 0)ans = false;
  dpx[0][0] = true;
  rep(i,n){
    rep(j,t+1){
      dpx[i+1][j] = (dpx[i][j] || (j-a[i] >= 0 && dpx[i][j-a[i]]));
    }
  }
  ans = ans && dpx[n][t];

  t = 0, n = b.size();
  rep(i,n)t += b[i];
  t = t-y;
  rep(i,n)b[i] *= 2;
  if(t < 0)ans = false;
  dpy[0][0] = true;
  rep(i,n){
    rep(j,t+1){
      dpy[i+1][j] = (dpy[i][j] || (j-b[i] >= 0 && dpy[i][j-b[i]]));
    }
  }
  ans = ans && dpy[n][t];
  cout << (ans ? "Yes" : "No") << endl;
}




Measured memory_bytes: 99200