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

using ll = long long;
// #define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))


struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

/***** MAIN *****/
signed main() {
  int N, M;
  cin >> N >> M;
  if(abs(N - M) > 1) {
    cout << 0 << endl;
    return 0;
  }
  mint n = N, m = M;
  for(int i = 2; i < N; ++i) {
    n *= i;
  }
  for(int i = 2; i < M; ++i) {
    m *= i;
  }
  mint ans = 0;
  if(N == M) {
    ans = n * m * 2;
  } else {
    ans = n * m;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e6 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
    ll p[MAX];

void speed_solve(){
    repe(i,2,MAX) p[i] = 2;
    p[1] = 1;
    for(ll i = 2 ; i * i < MAX ; i++) {
        for(ll j = i * i ; j < MAX ; j += i) {
            if(i * i == j) {
                p[j]++;
            } else {
                p[j] += 2;
            }
        }
    }
    ll tot = 0;
    ll n;
    cin >> n;

    // rep(i,n) cout << p[i] << " ";

    repe(i,1,n) tot += p[i];
    cout << tot << endl;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 19308
package main

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

func ScanInt() int {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    stringInput := scanner.Text()
    intInput, err := strconv.Atoi(stringInput)
    if err != nil {
       fmt.Println(err)
    }
    return intInput
}

func main () {
    N := ScanInt()
    odds := N / 2
    if N % 2 == 1 {
        odds += 1
    }
    fmt.Println(float64(odds) / float64(N))
    
}

Measured memory_bytes: 640
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	string str;
	int k;
	cin>>k>>str;
	if(str.size()>k)
		cout<<str.substr(0,k)<<"...";
	else
		cout<<str;
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

int n,m,x,y,xx,yy; char s[15][15];

int main() {
//	file_put();
	
	scanf("%d%d",&n,&m);
	rep(i,1,n+1) scanf("%s",s[i]+1);
	x=1,y=1; s[x][y]='.';
	while (!(x==n && y==m)) {
		xx=x,yy=y;
		while (x<=n && y+1<=m && s[x][y+1]=='#') y++,s[x][y]='.';
		while (x+1<=n && y<=m && s[x+1][y]=='#') x++,s[x][y]='.';
		if (xx==x && yy==y) break;
	}
	rep(i,1,n+1) rep(j,1,m+1) if (s[i][j]=='#') return 0*printf("Impossible\n");
	printf("Possible\n");
	
	return 0;
}



Measured memory_bytes: 256
//Back and Forth

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int sx,sy,tx,ty;cin>>sx>>sy>>tx>>ty;
    rep(i,0,tx-sx)cout<<"R";
    rep(i,0,ty-sy)cout<<"U";
    rep(i,0,tx-sx)cout<<"L";
    rep(i,0,ty-sy)cout<<"D";
    cout<<"D";
    rep(i,0,tx-sx+1)cout<<"R";
    rep(i,0,ty-sy+1)cout<<"U";
    cout<<"L";
    cout<<"U";
    rep(i,0,tx-sx+1)cout<<"L";
    rep(i,0,ty-sy+1)cout<<"D";
    cout<<"R"<<nnn;
    return 0;
}

Measured memory_bytes: 3564
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>

#define MAX_N 100
using namespace std;

int main(void){
    int n;
    int x[MAX_N];
    int y[MAX_N];
    int i;
    
    int dif, sum_dif, sq_sum_dif, max_dif;
    long int cb_sum_dif;
    sum_dif = sq_sum_dif = cb_sum_dif = max_dif = 0;
    
    cin >> n;
    for(i = 0; i < n; i++) cin >> x[i];
    for(i = 0; i < n; i++){
        cin >> y[i];
        
        dif = abs(x[i] - y[i]);
        sum_dif += dif;
        sq_sum_dif += dif*dif;
        cb_sum_dif += dif*dif*dif;
        if(max_dif < dif) max_dif = dif;
    }
    
    cout << fixed << sum_dif << endl << sqrt(sq_sum_dif) << endl << cbrt(cb_sum_dif) << endl<< max_dif;
    return 0;
}

Measured memory_bytes: 3464
n,m = map(int,input().split())
mod = 10**9+7

if abs(n-m) >1:
    print(0)
    exit()

ans = 1

if n == m:
    for i in range(1,n+1):
        ans = ans*i%mod
    print(ans**2*2%mod)
elif n > m:
    for i in range(1,m+1):
        ans = ans*i%mod
    ans = ans**2*n%mod
    print(ans)
else:
    for i in range(1,n+1):
        ans = ans*i%mod
    ans = ans**2*m%mod
    print(ans)


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define test ll t; cin>>t; while(t--)
typedef long long int ll;
int main() {
    FIO;
    //test
    {
        ll a;
        cin>>a;
        string s;
        cin>>s;
        ll ans1,ans2;
        ans1=a*(s[0]-'0');
        ans2=0;
        ans2+=10*(s[2]-'0');
        ans2+=(s[3]-'0');
        ans2*=a;
        ans2/=100;
        ans1+=ans2;
        cout<<ans1<<endl;
        
    }
	return 0;
}


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

int main() {
  long long X, a, b;
  cin >> X;
  int A = 1, B, f = 0;
  for (;A < 120;A++) {
    if (f == 1) {
      break;
    }
    a = pow(A, 5);
    B = -118;
    for (;B < 120;B++) {
      b = pow(B, 5);
      if (a - b == X) {
        f = 1;
        break;
      }
    }
  }
  cout << A - 1 << " " << B << endl;
}

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

#define ll long long

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++) cin >> A[i];

  int cnt = 0, t = 1;
  for (int i=1; i<N; i++) {
    if (A[i] == A[i-1]) {
      t++;
    } else {
      cnt += t/2;
      t = 1;
    }
  }
  cnt += t/2;

  cout << cnt << endl;

  return 0;
}


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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int a, b, c;
    int ans = 0;
    rep(i, 3) {
        cin >> a;
        if (a == 5)
            ans++;
    }
    if (ans == 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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=1001001001;
const int mod=1e9+7;

int main() {
  int N,x;
  cin>>N>>x;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  int64_t cnt=0;
  if(a[0]>x){cnt+=a[0]-x;a[0]=x;}
  for(int i=0;i<N-1;i++){
    if(a[i]+a[i+1]>x){cnt+=a[i+1]+a[i]-x;a[i+1]-=a[i+1]+a[i]-x;}
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 3716
#include<iostream>
using namespace std;
int main(void)
{
	char a[4],b[4];
	int i,j;
	for(i=1;i<=3;i++) cin>>a[i];
	for(j=1;j<=3;j++) cin>>b[j];
	if(a[1]==b[3] && a[2]==b[2] && a[3]==b[1]) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200010






int main() {
	int k, x;
	int n;
	scanf("%d", &n);
	f(i, n-1) {
		f(j, n - i - 1) {
			k = 1;
			x = j + 1;
			while (x % 2 == 0) {
				x = x / 2;
				k++;
			}
			printf("%d", k);
			if(j<(n-i-2))printf(" ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define MAX_C 10000
using namespace std;
int r,c;
int senbei[1<<10][MAX_C+1];

int bitCnt(int n){
  int cnt=0;
  while(n>0){
    if(n%2==1)cnt++;
    n/=2;
  }
  if(r-cnt<cnt){
    return r-cnt;
  }else{
    return cnt;
  }
}

int rec(int s,int n){
  if(senbei[s][n]!=-1){
    return senbei[s][n];
  }
  int tmp=s;
  for(int i=0;tmp>0;i++){
    if(tmp%2==1){
      for(int j=0;j<c;j++){
	int bitpos=1<<i;
	senbei[s][j]=rec(s^bitpos,j)^bitpos;
      }
    }
    tmp/=2;
  }
  return senbei[s][n];
}

int minimam(){
  int ans=1<<30;
  int tmp=0;
  for(int i=0;i<1<<r;i++){
    tmp=0;
    for(int j=0;j<c;j++){
      tmp+=bitCnt(senbei[i][j]);
    }
    if(ans>tmp)ans=tmp;
  }
  return ans;
}

int main(){
  while(cin>>r>>c){
    if(c==0)break;
    int tmp[c];
    memset(tmp,0,sizeof(tmp));
    memset(senbei,-1,sizeof(senbei));
    for(int i=0;i<r;i++){
      for(int j=0;j<c;j++){
	tmp[j]=tmp[j]<<1;
	int bit;
	cin>>bit;
	if(bit==1){
	  tmp[j]=tmp[j]|1;
	}
      }
    }
    for(int i=0;i<c;i++){
      senbei[0][i]=tmp[i];
      //cout << tmp[i] << endl;
    }
    rec((1<<r)-1,0);

    cout<<r*c-minimam()<<endl;
  }
  return 0;
}

Measured memory_bytes: 41208
//BISMILLAH
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
int main()
{
    ll n,sum=0,ans=0;
    scanf("%lld",&n);
    vector<ll>v(n);
    for(int i=0;i<n;i++){
        scanf("%lld",&v[i]);
    }

    for(int i=0;i<n;i++)
    {
        ans=(ans+sum*v[i])%MOD;
        sum= (sum+v[i])%MOD; //prefix sum
    }

    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 4828
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
struct edge { int to, cost; };
signed main() {
	string s, t;
	cin >> s >> t;
	cout << t << s << endl;
	ggr
}


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

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

    int ans = 100000,count = 0;
    for (size_t i = 0; i < n; i++)
    {
        cin >> a;
        count = 0;
        while (1)
        {
            if(a % 2 == 0)
            {
                count++;
                a /= 2;
            }
            else
            {
                break;
            }
            
        }
        
        ans = min(ans,count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=2e5+10,lim=2000,mod=1e9+7;
int ksm(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=(ll)res*x%mod;
		x=(ll)x*x%mod;
		y>>=1;
	}
	return res;
}
int dp[lim*2+5][lim*2+5];
int a[maxn],b[maxn];
int fac[lim*4+5],ifac[lim*4+5];
inline int C(int n,int m){
	return (ll)fac[n]*ifac[n-m]%mod*ifac[m]%mod;
}
void init(){
	int n=lim*4;
	fac[0]=1;
	REP(i,1,n) fac[i]=(ll)i*fac[i-1]%mod;
	ifac[n]=ksm(fac[n],mod-2);
	DREP(i,n,1) ifac[i-1]=(ll)i*ifac[i]%mod;
}
inline void add(int &x,int y){
	x+=y;
	if(x>=mod) x-=mod;
}
int main(){
	init();
	int n=read();
	int ans=0;
	REP(i,1,n) a[i]=read(),b[i]=read(),add(ans,mod-C(a[i]*2+b[i]*2,a[i]*2)),dp[lim-a[i]][lim-b[i]]++;
	REP(i,0,2*lim) REP(j,0,2*lim) add(dp[i+1][j],dp[i][j]),add(dp[i][j+1],dp[i][j]);
	REP(i,1,n) add(ans,dp[lim+a[i]][lim+b[i]]);
	ans=((ll)ans*(mod+1)/2)%mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 64512
import java.util.Collections

fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val Ls = readInputLine().split(" ").map { it.toInt() }.sorted()
    val LsArr = Ls.toIntArray()
    
    var ans = 0
    
    for (mid in N - 1 downTo 0) {
        for (low in mid - 1 downTo 0) {
            ans += lowerBound(Ls, LsArr[mid] + LsArr[low]) - 1 - mid
        }
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}

fun <T: Comparable<T>> lowerBound(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, {x, y -> if (x >= y) 1 else -1}).inv()
}


Measured memory_bytes: 48560
from collections import deque
import sys

def main():
    s = sys.stdin.readline().strip()
    qn = int(sys.stdin.readline().strip())
    qs = [input().split() for _ in range(qn)]

    s = deque(s)
    r = 1
    for q in qs:
        if len(q) == 1:
            r = r * -1

        else:
            if q[1] == '1':
                if r == 1:
                    s.appendleft(q[2])
                else:
                    s.append(q[2])
            else:
                if r == 1:
                    s.append(q[2])
                else:
                    s.appendleft(q[2])

    if r == 1:
        print(''.join(s))
    else:
        s.reverse()
        print(''.join(s))

if __name__ == "__main__":
    main()

Measured memory_bytes: 44532
#include <iostream>
#include <vector>

unsigned long int N, K;

int main() {
    std::cin >> N >> K;
    unsigned long int cnt = 0;
    if (K != 0) {
        for (unsigned long int i = K + 1; i <= N; i++) {
            cnt += (N / i) * (i - K);
            if ((N % i != 0) && (N % i >= K)) {
                cnt += N % i - K + 1;
            }
        }
    }else{
        for (unsigned long int i = K + 1; i <= N; i++) {
            cnt += (N / i) * (i - K);
            if ((N % i != 0) && (N % i >= K)) {
                cnt += N % i;
            }
        }
    }
    std::cout << cnt << std::endl;
}

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

int main(void){
    int n, k;
    string s;
    char tar;
    cin >> n >> s >> k;

    tar = s[k-1];
    for (int i = 0; i< n; i++){
        if (s[i] != tar)
            s[i] = '*';
    }

    for (int i = 0; i< n; i++)
        cout << s[i];

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;

#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;
	vector<int> as(n) , bs(n);
	rep(i,0,n){
		cin >> as[i] >> bs[i];
	}

	long long a = as[0];
	long long b = bs[0];

	rep(i,0,n){
		long long d = max( a / as[i] , b / bs[i] );
		while(!(a<=as[i]*d &&  b<=bs[i] * d))
			d++;

		a = as[i] * d;
		b = bs[i] * d;

	}
	P(a+b);
	ret 0;
}

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

int main(){
  int N, K, C;
  string S;
  cin >> N >> K >> C >> S;
  vector<int> F;
  int l = 0;
  for(int i = 0; i < N; ++i){
    if(F.size() == K) break;
    if(S[i] == 'o' and l <= 0){
      F.push_back(i);
      l = C;
    }else{
      --l;
    }
  }
  l = 0;
  vector<int> B;
  for(int i = N-1; i >= 0; --i){
    if(B.size() == K) break;
    if(S[i] == 'o' and l <= 0){
      B.push_back(i);
      l = C;
    }else{
      --l;
    }
  }

  reverse(B.begin(), B.end());
  vector<int> A;
  for(int i = 0; i < K; ++i){
    if(F[i] == B[i])
      A.push_back(F[i]+1);
  }
  for(auto a : A)
    cout << a << "\n";
}


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    ll n,q,ans;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<ll> l(q),r(q);
    rep(i,q) cin >> l[i] >> r[i];
    vector<ll> sum(n+1,0);
    REP(i,1,n){
        sum[i+1] = sum[i];
        if(s[i-1]=='A' && s[i]=='C') sum[i+1]++;
    }
    rep(i,q){
        ans = sum[r[i]] - sum[l[i]];
        cout << ans << "\n";
    }
    return 0;
}

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

using namespace std;
int main(){
  long long a,b,i=1,num=0;
  cin>>a>>b;
  if(a<b)swap(a,b);
  while(num<a*b){
    num=a*i;
    if(num%b==0){
      cout<<num;
      break;
    }
    i++;
  }

  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define ld long double
#define si(x) (ll)((x).size())
#define pb push_back
#define F first
#define S second
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>=1;i--)
#define all(x) (x).begin(), (x).end()
#define make_unique(x) (x).resize(unique(all(x))-(x).begin())
#define pr_vec(v) for(ll _=0;_<v.size();_++) cout << v[_] << " " ;
const int N = 1e6+7;
ll m = 998244353;


void solve()
{
    ll n, w, x, y;
    cin >> n >> w;
    std::vector<ll> wt(N + 1,1e16);
    wt[0]=0;
    rep(_, n)
    {
        std::vector<ll> n_wt = wt;
        cin >> x >> y;
        for(ll i = 0; i + y < N; i++)
            n_wt[i + y] = min(n_wt[i + y], wt[i] + x);

        // pr_vec(n_wt);
        // cout<<endl;
        swap(wt, n_wt);


    }
    ll ans = 0;
    rep(i, N)
    if(wt[i] <=w)
        ans = max(ans, i);

    cout << ans;

}



int main()
{



    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    // cin >> t;


    rep1(i, t)
    {
        // cout << "Case #" << i << ": ";
        solve();
        cout << endl;
    }


}

Measured memory_bytes: 15992
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
//typedef pair<int, int> P;

/** Problem1119 : Exploring Caves **/
int main()
{
	int N; cin>>N;
	rep(i, N) {
		int dx, dy;
		int x=0, y=0;
		int tmp=0, tx, ty;
		while (cin>>dx>>dy, dx||dy) {
			x+=dx; y+=dy;
			if (x*x+y*y>tmp) {
				tx = x; ty = y;
				tmp = x*x + y*y;
			} else if (x*x+y*y==tmp && x>tx) {
				tx = x; ty = y;
				tmp = x*x + y*y;
			}
		}
		cout << tx << " " << ty << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  string s;
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);  rep(i, 0, n) cin >> a[i];
  sort(all(a));
  
  ll ans = 0;
  rep(i, 0, k) ans += a[i];
  
  cout << ans << "\n";
  
  //cout << (  ?"Yes" :"No") << "\n";

}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <utility>

#define INF 1000000000000000

using namespace std;

typedef long long int lli;
typedef pair<int, int> P;

struct edge{
	int from, to, cost;
};

int V, E, r;
edge e[9900];
lli d[100][100];

bool solve(){
	for(int k = 0;k < V;k++){
		for(int i = 0;i < V;i++){
			for(int j = 0;j < V;j++){
				if(d[i][j] != INF || (d[i][k] != INF && d[k][j] != INF))
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	for(int i = 0;i < V;i++){
		if(d[i][i] < 0) return false;
	}
	return true;
}

int main(void){
	cin >> V >> E;
	for(int i = 0;i < V;i++){
		fill(d[i], d[i]+V, INF);
		d[i][i] = 0;
	}
	for(int i = 0;i < E;i++){
		int a, b, c;
		cin >> a >> b >> c;
		d[a][b] = c;
	}
	if(solve()){
		for(int i = 0;i < V;i++){
			for(int j = 0;j < V;j++){
				if(d[i][j] != INF)
					cout << d[i][j];
				else
					cout << "INF";
				if(j < V-1) cout << " ";
			}
			cout << endl;
		}
	}else{
		cout << "NEGATIVE CYCLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int T, D, ta, tb, da, db;

int main() {
    while (cin >> T >> D >> ta >> tb >> da >> db) {
        double Min = 100000;
        for (int i = 0; i <= D; ++i) {
            for (int j = 0; j <= D; ++j) {
                if (i % da == 0 && j % db == 0 && i+j >= 1 && i+j <= D) {
                    double t = (double)(ta * i + tb * j) / (i+j);
                    chmin(Min, abs(t - T));
                }
            }
        }
         
        cout << fixed << setprecision(9) << Min << endl;
    }
    return 0;
}


Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define LL long long
#define mp make_pair
#define pb push_back
#define INF (1<<29)
using namespace std;
typedef pair<int,int>pii;
int n,m;
int ans;
pii a[100010];
int main(){
    cin>>n>>m;
    for(int i=1;i<=m;i++)cin>>a[i].first>>a[i].second;
    sort(a+1,a+m+1);
    int ll=0,rr=0;
    for(int i=1;i<=m;i++){
        int x=a[i].first;
        int y=a[i].second;
        //cout<<x<<' '<<y<<' '<<ll<<' '<<rr<<' '<<endl;
        if(x>=rr||y<=ll)ans++,ll=x,rr=y;
        else{
            ll=max(ll,x),rr=min(rr,y);
        }
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int r,d,x;
    cin>>r>>d>>x;
    REP(i,10){
        x=r*x-d;
        cout<<x<<endl;
    }

    return 0;
}


Measured memory_bytes: 888
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

h,w = map(int,readline().split())
sh,sw = map(int,readline().split())
gh,gw = map(int,readline().split())
b = read().split()

sh -= 1; sw -= 1; gh -= 1; gw -= 1

#print(b)

from collections import deque

def nbd(nh,nw,dv):
    if dv < res[nh][nw]:
        res[nh][nw] = dv
        q.appendleft((dv,nh,nw))
    return 




INF = 1<<30
res = [[INF]*w for _ in range(h)] #startからの最短距離
res[sh][sw] = 0
q = deque([(0,sh,sw)]) #(そこまでの距離、点)
while q:
    dv,vh,vw = q.popleft()
    if res[vh][vw] < dv: continue
    if vh==gh and vw==gw: break
    
    if vh and b[vh-1][vw]==".":
        nbd(vh-1,vw,dv)
    if vw and b[vh][vw-1]==".":
        nbd(vh,vw-1,dv)
    if vh+1<h and b[vh+1][vw]==".":
        nbd(vh+1,vw,dv)
    if vw+1<w and b[vh][vw+1]==".":
        nbd(vh,vw+1,dv)
    
    for i in range(-2,3):
        nh = vh+i
        if nh < 0 or nh >= h: continue
        for j in range(-2,3):
            nw = vw + j
            if nw < 0 or nw >= w: continue
            if abs(i)+abs(j) > 1:
                if b[nh][nw] == "." and dv+1 < res[nh][nw]:
                    res[nh][nw] = dv+1
                    q.append((dv+1,nh,nw))


ans = res[gh][gw]
if ans != INF:
    print(ans)
else:
    print(-1)







Measured memory_bytes: 107880
import numpy as np
n, k = map(int, input().strip().split(' '))
p = 0
for i in range(n):
  coin = np.ceil(np.log2( k/(i+1) ))
  if coin > 0:
    p = p + 1.0/n * 0.5**coin
  else:
    p = p + 1.0/n
print(p)

Measured memory_bytes: 12488
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
typedef vector< ll > vi;
typedef vector<pair<ll,ll> > vpii;
#define all(c) c.begin(),c.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define INF 1000000007
#define N 100005
#define PI 3.14159265
bool compare(pair<ll,ll> i, pair<ll,ll> j) 
{
  return i.S < j.S;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
}
int main()
{
	ll i=1,n;
  	cin>>n;
  	while(1)
    {
    	if((i-1<=n)&&((2*i-1)>=n))
        	break;
      	else
          	i=2*i;
    }
  	cout<<2*i-1;
  	return 0;
}

Measured memory_bytes: 256
n,m,x = map(int,input().split())
c = [0]*n
a = []
ans = float('inf')

for i in range(n):
    l = list(map(int,input().split()))
    c[i] = l.pop(0)
    a.append(l)

for bit in range(1<<n):
    s = [0]*m
    sumnum = 0
    for i in range(n):
        if 1 & (bit>>i):
            sumnum += c[i]
            for j in range(m):
                s[j] += a[i][j]
    flag = True
    for k in range(m):
        if s[k] < x:
            flag = False
            break
    if flag:
        ans = min(ans, sumnum)

if ans != float('inf'):
    print(ans)
else:
    print(-1)

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for(int i = 0; i < s.size(); ++i) {
        if(s[i] != t[i]) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3884
import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final int p = 1;
        switch (p) {
            case 1:
            P1.p1();
        }
    }
}

class P1 {

    static void p1() {
        final Scanner sc = new Scanner(System.in);
        final String yohou = sc.nextLine();
        final String jissai = sc.nextLine();

        final int res = calc(yohou, jissai);
        System.out.println(res);
    }

    static int calc(final String yohou, final String kekka) {
        int res = 0;
        for (int i = 0; i < 3; i++) {
            if (Objects.equals(yohou.charAt(i), kekka.charAt(i))) {
                res++;
            }
        }
        return res;
    }
}

Measured memory_bytes: 21844
import sys
a, b, x = map(int, input().split())

if a == b == 0:
    print(1)
    sys.exit()

if x > b:
    if a != 0:
        print(0)
        sys.exit()
    else:
        print(1)
        sys.exit()

if x <= b:
    if a % x == 0:
        print(b // x - a //x + 1)
    else:
        print(b // x - a // x)



Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] titles = new String[n];
        int[] times = new int[n];
        for (int i = 0; i < n; i++) {
            titles[i] = sc.next();
            times[i] = sc.nextInt();
        }
        String target = sc.next();
        int sum = 0;
        boolean flag = false;
        for (int i = 0; i < n; i++) {
            if (flag) {
                sum += times[i];
            }
            if (target.equals(titles[i])) {
                flag = true;
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int MOD = 1e9 + 7;
const int MAXN = 200001;
const int MAXM = 31630; // sqrt(10^9)

int fact[MAXN];
int inv[MAXN];

map<int, int> factor_count;

int modpow(int a, int x){
    int res = 1, n = a;
    while(x){
        if (x & 1){
            res = ((LL)res * n) % MOD;
        }
        n = ((LL)n * n) % MOD; x >>= 1;
    }
    return res;
}

// finds a^-1 mod MOD
int flt(int a){
    return modpow(a, MOD - 2);
}

void pregen(){
    fact[0] = 1; inv[0] = 1;
    for (int i = 1; i < MAXN; ++i){
        fact[i] = ((LL)fact[i-1] * i) % MOD;
        inv[i] = flt(fact[i]);
    }
}

LL C(int n, int k){
    if (n < k) return 0;
    LL temp = ((LL)fact[n] * inv[k]) % MOD;
    return (temp * inv[n - k]) % MOD;
}


int main(){
    int k, M; cin >> k >> M;
    pregen();
    
    int MM = M;

    for (int i = 2; i * i <= M; ++i){
        while(MM % i == 0){
            factor_count[i]++;
            MM /= i;
        }
    }
    if (MM != 1) factor_count[MM] = 1;

    LL answer = 1;
    for (auto x : factor_count){
        answer = (answer * C(x.second + k - 1, k - 1)) % MOD;
    }
    cout << answer << endl;
        
    return 0;
}

Measured memory_bytes: 1792
/*Bismillahir Rahmanir Rahim*/

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

typedef long long ll;
typedef vector<int> vi;
typedef vector <long long> vll;
typedef pair<int, int> pii;
///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Macro Start-*-*-*-*-*-*-*--*-*-*-*-*/

#define Faster_IO              ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F                      first
#define S                      second
#define pb                     push_back
#define MP                     make_pair
#define sf                     scanf
#define pf                     printf
#define PI                     (2*acos(0))
#define to_radian(degree)      ((pi/180)*degree)
#define to_degree(radian)      ((180/pi)*radian)
#define SQ(a)                  (a)*(a)
#define SORT(x)                sort(x.begin(),x.end())
#define rSORT(x)               sort(x.rbegin(),x.rend())
#define SetPrint(a,x)          cout<<fixed<<setprecision(x)<<a<<endl
#define show(vec)              for (int i=0; i<vec.size(); i++)cout << vec[i] << " ";
#define lines                  cout <<"\n" <<"---------------" << "\n";
#define YES                    printf("YES\n")
#define NO                     printf("NO\n")
#define Yes                    printf("Yes\n")
#define No                     printf("No\n")
#define testcase(n)            int n; cin >> n; while(n--)
#define lcm(a,b)               ((a / __gcd(a,b) ) * b)
#define gcd(a,b)               __gcd(a,b)
#define all(vec)               vec.begin(), vec.end()
#define SUM(vec)               accumulate(vec.begin(), vec.end(), 0)
#define gcin(str)              getline(cin, str)
///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Macro END-*-*-*-*-*-*-*--*-*-*-*-*/

///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Template Start-*-*-*-*-*-*--*-*-*-*-*/

//template <class T> T isPrime(T n){if(n<=1)return 0;for(long long i=2;i*i<=n; i++)if(n%i==0)return 0;return 1;}
//template <class T> T bigmod(T X, T n, T M) {if (n==0) return 1;if (n%2) return ((X%M) * bigmod(X,n-1,M)) %M;else {long long int d = bigmod(X,n/2, M);return ((d%M) * (d%M))%M;}}

///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Template END-*-*-*-*-*-*-*--*-*-*-*-*/


int main()
{
    Faster_IO
    #ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
    #endif

      int a;
      for(int i=1;i<=5;i++)
      {
        cin >> a;
        if(a==0)
        {
            cout << i<< "\n";
            break;
        }
      }

    
    return 0;
}


Measured memory_bytes: 3604
import math
num = list(map(int,input().split()))
num.sort()

tmp = max(num) * 3 - sum(num)

for i in range(2):
    num[i] %= 2

if num[0] == num[1]:
    print(math.ceil(tmp/2))
else:
    print(math.ceil(tmp/2)+1)

Measured memory_bytes: 3060
def solve():
    from sys import stdin
    f_i = stdin
    
    q = int(f_i.readline())
    d = {}
    ans = []
    cnt = 0
    for i in range(q):
        op, x = map(int, f_i.readline().split())
        if op == 0:
            if d.setdefault(x, '0') == '0':
                d[x] = '1'
                cnt += 1
            ans.append(str(cnt))
        else:
            ans.append(d.setdefault(x, '0'))
    print('\n'.join(ans))

solve()


Measured memory_bytes: 37488
#include <iostream>
#include <vector>
#include <bitset>

using namespace std;

int main(void)
{
    int N, wightA = 0, wightB = 0, answer = 10000, tmp;
    cin >> N;
    vector<int> W(N);
    for (int count = 0; count < N; count++)
    {
        cin >> W.at(count);
    }
    for (int count = 0; count < N; count++)
    {
        for (int index = 0; index <= count; index++)
        {
            wightA += W.at(index);
        }
        for (int index = count + 1; index < N; index++)
        {
            wightB += W.at(index);
        }
        if (wightA > wightB)
        {
            tmp = wightA - wightB;
        }
        else
        {
            tmp = wightB - wightA;
        }
        if (answer > tmp)
        {
            answer = tmp;
        }
        wightA = 0;
        wightB = 0;
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int b,z,m,n;
int main()
{
    scanf("%lld%lld%lld",&n,&m,&b);
    if(m>=n)
    {
        printf("1\n");
        return 0;
    }
    if(m<=b)
    {
        printf("-1\n");
        return 0;
    }
    else if((n-m)%(m-b)>=1)
        z=1;
    printf("%lld\n",((n-m)/(m-b)+z)*2+1);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int H,W;
	int i,j,k;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0) break;
		for(i=0; i<H; i++){
			for(j=0; j<W; j++){
				if(i==0 || j==0 || i==H-1 || j==W-1){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
import java.io.*
import java.util.*

fun solve(N: Long){
    val m = Math.sqrt(N.toDouble()).toInt()
    (1..m).asSequence().filter{ N % it == 0L }.map{ it + N / it -2}.min().let{ println(it) }

    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    solve(N)
}



Measured memory_bytes: 42500
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse.csgraph import csgraph_from_dense
from collections import deque

n=int(input())
l=[]
ll=[]
E=[[] for i in range(n)]
# 二部グラフ判定用
V = [0 for i in range(n)]

for i in range(n):
    s=input()
    ll.append(s)
    for j in range(n):
        if s[j]=="1":
            l.append([i,j,1])
            E[i].append(j)
            E[j].append(i)

edge=np.array(l,dtype=np.int64).T
graph=csr_matrix(((edge[2],edge[:2])),(n,n))

dist_mat = floyd_warshall(graph).astype(np.int32)
 
max_d = dist_mat.max()
 
def dfs(cur, pre, col):
    stack = deque([[cur, pre, col]])
    while stack:
        cur, pre, col = stack.pop()
        if V[cur] and V[cur] != col:
            return False
        else:
            V[cur] = col
        for e in E[cur]:
            if e != pre:
                stack.append([e, cur, -1 * col])
        # 一度通った辺は通らない
        E[cur] = []
    return True
 
# 二部グラフ判定
if not dfs(0, -1, 1):
    print(-1)
    exit()

answer = max_d + 1
print(answer)



Measured memory_bytes: 20716
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};

string joi = "JOI";

signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int h, w;
    cin >> h >> w;
    vector<string> s(h), tmp(2);
    rep(i, h) cin >> s[i];
    rep(i, 2) cin >> tmp[i];

    int defcnt = 0;
    rep(i, h-1) {
        rep(j, w-1) {
            vector<string> now(2);
            now[0] = s[i].substr(j, 2);
            now[1] = s[i+1].substr(j, 2);
            if(now == tmp) defcnt++;
        }
    }

    int dif = 0;
    rep(i, h) {
        rep(j, w) {
            char focus = s[i][j];
            rep(k, 3) {
                if(focus == joi[k]) continue;
                s[i][j] = joi[k];
                int nowcnt = 0;

                REP(dy, -1, 1) {
                    int ny = i + dy;
                    REP(dx, -1, 1) {
                        // 左上
                        int nx = j + dx;
                        if(0 <= nx && nx < w-1 && 0 <= ny && ny < h-1) {
                            if(s[ny][nx] == tmp[0][0] && s[ny][nx+1] == tmp[0][1] && s[ny+1][nx] == tmp[1][0] && s[ny+1][nx+1] == tmp[1][1]) {
                                nowcnt++;
                                // cout << nx << " " << ny << endl;
                                // cout << s[ny][nx] << s[ny][nx+1] << endl;
                                // cout << s[ny+1][nx] << s[ny+1][nx+1] << endl;
                            }
                        }
                    }
                }
                chmax(dif, nowcnt);
                //cout << nowcnt << endl;

            }
            s[i][j] = focus;
        }
    }
    cout << defcnt + dif << endl;
    return 0;
}




Measured memory_bytes: 3948
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		int b =(int)(sc.nextDouble()*100+0.01);
				
		System.out.println((a*b)/100);
		
		
		sc.close();
	}
}


Measured memory_bytes: 37408
struct Santa {
    x: i32,
    y: i32,
    t: i32,
}

fn main() {
    let n = read::<i32>();
    let mut santa = Santa { x: 0, y: 0, t: 0 };
    for _ in 0..n {
        let v = read_vec::<i32>();
        let diff = (santa.x - v[1]).abs() + (santa.y - v[2]).abs();
        let tt = v[0] - santa.t;
        if tt >= diff && (diff - tt) % 2 == 0 {
        } else {
            println!("No");
            return;
        }
        santa.x = v[1];
        santa.y = v[2];
        santa.t = v[0];
    }
    println!("Yes");
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352