akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
using namespace std;

int main(){
	double v;
	while(cin>>v){
		double t=v/9.8;
		double y=4.9*t*t;
	//	int n=(((y+5)/5)*10+5)/10;
		int c=1;
	for(int i=0;0<y;i++){
			y-=5;
			c++;
		}
		cout<<c<<endl;
	//	cout<<n<<endl;
	}
}

Measured memory_bytes: 1224
n,m=map(int, input().split())
a=[int(x) for x in list(input().split())]
ans=0
suma=sum(a)
for i in range(len(a)):
        if a[i] >=(suma/(4*m)):
                ans+=1
                
if ans>=m:
        print('Yes')
else:
        print('No')

Measured memory_bytes: 9132
def extgcd(a,b):
    if b == 0:
        x = 1
        y = 0
        return a,x,y
    g,s,t = extgcd(b,a%b)
    x,y = t,s-a//b*t
    return g,x,y

def chineserem(b,m):
    r = 0
    M = 1
    for i in range(len(b)):
        g,p,q = extgcd(M,m[i])
        if (b[i]-r)%g != 0:
            return 0,-1
        tmp = (b[i]-r)//g*p%(m[i]//g)
        r += M*tmp
        M *= m[i]//g
    return r,M
n,m,d = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
r = [[int(x) for x in input().split()] for i in range(d)]
for d in range(d):
    mo = []
    b = []
    for i in range(m):
        if r[d][i] > -1:
            mo.append(a[i])
            b.append(r[d][i])
    x,M = chineserem(b,mo)
    if M < 0:
        print(-1)
        quit()
    i = (n-x)//M
    if i < 0:
        print(-1)
        quit()
    n = M*i+x
print(n)



Measured memory_bytes: 5616
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  double a,b,h,m;
  cin >> a >> b >> h >> m;
  double c1=h*30+m*0.5;
  double c2=m*6;
  
  complex<double>hour(a,0),minute(b,0);
  c1*=pi/180;
  c2*=pi/180;
  hour*=exp(complex<double>(0,c1));
  minute*=exp(complex<double>(0,c2));
  
  double ans=abs(hour-minute);
  cout << fixed << setprecision(10) << ans << endl;
  return 0;     
}


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

#define mp(x, y) make_pair((x), (y))

typedef long long ll;

int n;
char s[500005];
int dp[500005][27];
int nnext[500005][21];

int main()
{
	scanf("%s\n", s);
	n=strlen(s);
	for(int i=0; i<n; i++) s[i]-='a';
	for(int i=0; i<n; i++) for(int j=0; j<27; j++) dp[i][j]=-1;
	for(int i=0; i<n; i++) for(int j=0; j<21; j++) nnext[i][j]=-1;
	for(int i=n-1; i>=0; i--) {
		dp[i][s[i]]=i;
		int cur=i+1;
		for(int j=s[i]+1; j<27 && cur<n; j++) {
			if(dp[cur][j-1]==-1) break;
			dp[i][j]=dp[cur][j-1];
			cur=dp[cur][j-1]+1;
		}
		if(dp[i][26]==-1 || dp[i][26]+1>=n) continue;
		for(int j=0; j<s[i]; j++) {
			dp[i][j]=dp[dp[i][26]+1][j];
		}
	}
	for(int i=0; i<n; i++) {
		nnext[i][0]=dp[i][26];
	}
	for(int j=1; j<21; j++) {
		for(int i=0; i<n; i++) {
			if(nnext[i][j-1]==-1 || nnext[i][j-1]+1>=n) continue;
			nnext[i][j]=nnext[nnext[i][j-1]+1][j-1];
		}
	}
	int Q;
	scanf("%d\n", &Q);
	for(int x=0; x<Q; x++) {
		int l, r;
		scanf("%d %d\n", &l, &r);
		l-=2; r--;
		for(int k=20; k>=0 && l<r; k--) {
			if(nnext[l+1][k]!=-1 && nnext[l+1][k]<=r) {
				l=nnext[l+1][k];
			}
		}
		if(l!=r) {
			printf("No\n");
		} else {
			printf("Yes\n");
		}
	}

	return 0;
}

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

int main(){
    int N;
    string S;
    cin >> N >> S;
    int ans = 1;
    char c = S[0];
    for(int i=1;i<N;i++){
        if(S[i]!=c){
            ans++;
            c = S[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
D = gets.to_i
c = gets.split.map &:to_i
s = Array.new
D.times do
  s << gets.split.map(&:to_i)
end
# t = []
# D.times do
#   t << gets.to_i
# end
#
# last = Array.new(26){[0, false]}
#
#
#
# def cal_dec(c, last, day)
#   sum = 0
#   for i in 0..25
#     sum += c[i] * (day - last[i][0])
#   end
#   sum
# end
#
#
#
# point = 0
# for day in 1..D
#   point += s[day-1][t[day-1]-1]
#   last[t[day-1]-1][1] = true
#   last[t[day-1]-1][0] = day
#   point -= cal_dec(c, last, day)
#   puts point
# end
D.times do |i|
  puts i % 26 + 1
end


Measured memory_bytes: 14372
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <iomanip>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
int main(){
#define int long long 
	int n;
	cin >> n;
	for(int i = 1;i >= 0;++i){
		if(i * (i+1) / 2 >= n){
			for(int q = i;q >= 1;--q){
				if(n <= q){
					cout << n << endl;
					return 0;
				}
				cout << q << endl;
				n -= q;
			}
			return 0;
		}
	}
	return 0;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  if(n==1){
      cout << 0 << endl;
      return 0;
  }
  vector<pair<int,int>> p(n);
  for(int i=0;i<n;i++){
    cin >> p[i].first;
    p[i].second=i;
  }
  int ans=-1;
  int cnt=1;
  sort(p.begin(),p.end());
  for(int i=0;i<n-1;i++){
      if(p[i+1].second>p[i].second){
          cnt++;
        if(i==n-2){
          ans=max(ans,cnt);
        }
      }
      else{
          ans=max(ans,cnt);
          cnt=1;
      }
  }
  cout << n-ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ar array<int,2>
#define inf 1000000000000000000 
int mod=1e9+7;
int min(int a,int b){return (a<b)?a:b;}
int max(int a,int b){return (a>b)?a:b;}
int fp(int a,int b){if(b==0) return 1;int x=fp(a,b/2);x=(x*x)%mod;if(b&1) x=(x*a)%mod;return x;}


const int N=2e5+5;



void solve()
{
   int n;
   cin>>n;
   int ans=0;
   map<array<int,2>,int> mp; 
   for(int i=1;i<=n;i++)
   {
    long double x1;
    cin>>x1;
    int x=round(x1*1e9);
    //cout<<x<<endl;
    int a=0,b=0;
    while(x%2==0){
      x/=2;
      a++;
    }
    while(x%5==0)
    {
      b++;
      x/=5;
    }

    for(auto i:mp)
    {
      if((i.first[0]+a)>=18&&(i.first[1]+b)>=18)
        ans+=i.second;
    }
    mp[{a,b}]++;
   }  

   cout<<ans;
}

signed main() {
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
 srand(time(0));
 int t=1;
 //cin>>t;
 for(int i=1;i<=t;i++)
 {
   solve();
 }


}

Measured memory_bytes: 3756
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int max_n = 100000+10;

typedef struct M {
    int to;
    int color;
    int dist;
}node;

int N,q;
int par[max_n][20];
vector<node> V[max_n];
vector<node> Q[max_n];
int ans[max_n];
int h[max_n];
int de[max_n];
int c[max_n];
int co[max_n];

void get(int p) {
    h[p] = h[par[p][0]]+1;
    for(auto u: V[p]) {
        if(u.to != par[p][0]) {
            par[u.to][0] = p;
            de[u.to] = de[p]+u.dist;
            get(u.to);
        }
    }
}

int lca(int x,int y) {
    if(h[x] > h[y])
        swap(x,y);
    int t = h[y]-h[x];
    for(int i = 0;i < 18;i++) {
        if(t&(1<<i))
            y = par[y][i];
    }
    if(x == y)
        return x;
    for(int i = 17;i >= 0;i--) {
        if(par[x][i] != par[y][i]) {
            x = par[x][i];
            y = par[y][i];
        }
    }

    return par[x][0];
}

void dfs(int p) {
    for(auto u: Q[p]) {
        if(u.to > 0) {
            ans[u.to] += de[p]+c[u.color]*u.dist-co[u.color];
        } else {
            ans[-u.to] -= 2*(de[p]+c[u.color]*u.dist - co[u.color]);
        }
    }

    for(auto u:V[p]) {
        if(u.to == par[p][0])
            continue;
        c[u.color]++;
        co[u.color] += u.dist;
        dfs(u.to);
        c[u.color]--;
        co[u.color]-=u.dist;
    }

    return;
}

int main(void) {
    cin>>N>>q;

    for(int i = 1;i < N;i++) {
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        V[a].push_back({b,c,d});
        V[b].push_back({a,c,d});
    }

    get(1);
    for(int i = 1;i <= 17;i++) {
        for(int j = 1;j <= N;j++) {
            par[j][i] = par[par[j][i-1]][i-1];
        }
    }

    for(int i = 1;i <= q;i++) {
        int x,y,u,v;
        cin>>x>>y>>u>>v;
        Q[u].push_back({i, x, y});
        Q[v].push_back({i, x, y});
        Q[lca(u,v)].push_back({-i, x, y});
    }
    dfs(1);
    for(int i = 1;i <= q;i++) {
        cout<<ans[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 27576
#include<bits/stdc++.h>
using namespace std;
int a[101];
int main(){
	int n,minv=2147483647,ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
	    cin>>a[i];
	sort(a,a+n);
	int l=a[0],r=a[n-1];
	for(int i=l;i<=r;i++){
		ans=0;
		for(int j=0;j<n;j++){
			ans+=(a[j]-i)*(a[j]-i);
		}
		if(ans<minv) minv=ans;
	}
	cout<<minv;
	return 0;
}

Measured memory_bytes: 256
using System;
public class Hello
{
    public static int[] dp;
    public static void Main()
    {
        // Your code here!
        int n = int.Parse(Console.ReadLine());
        dp = new int[45];
        for(int i = 0; i < dp.Length; i++) //dpを初期化
        {
            dp[i] = -1;
        }
        System.Console.WriteLine(makeFib(n));
    }
    
    public static int makeFib(int n) //動的計画法
    {
        dp[0] = 1;
        dp[1] = 1;
        for(int i = 2; i <= n; i++)
        {
            dp[i] = dp[i - 1] + dp[i - 2];
        }
        
        return dp[n];
    }
}



Measured memory_bytes: 7864
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
using namespace std;

int a, b, c, xa, xb, xc;
string AA, BB, CC, ss[110];

void iter() {
	for (int i = 0; i < a; i++)
		ss[i] = AA;
	// int now = 0;
	for (int i = 0; i < c; i++) {
		ss[i % a] += CC;
	}
	int ll = 0;
	if (c % a == 0)
		ll = 0;
	else
		ll = (c - 1) % a + 1;
	int now = ll;
	for (int i = 0; i < b; i++) {
		ss[now] += BB;
		now += 1;
		if (now >= a)
			now = ll;
	}
	sort(ss, ss + a);
	// for ()
	int cnt = 0;
	xa = xb = xc = 0;
	for (int i = 0; i < a; i++) {
		if (i == 0 || ss[i] != ss[i - 1]) {
			cnt += 1;
			if (cnt == 1)
				AA = ss[i];
			else if (cnt == 2)
				BB = ss[i];
			else CC = ss[i];
		}
		if (cnt == 1)
			xa += 1;
		else if (cnt == 2)
			xb += 1;
		else xc += 1;
	}
	a = xa;
	b = xb;
	c = xc;
}

string solve() {
	AA = "a";
	BB = "b";
	CC = "c";
	if (a == 0) {
		a = b; b = c; c = 0;
		AA = BB; BB = CC;
	}
	string ans = "";
	if (a == 0) {
		for (int i = 0; i < c; i++)
			ans += "c";
		// printf("\n");
		// return 0;
		return ans;
	}
	while (b + c > 0) {
		iter();
	}
	while (a--) {
		// cout << AA;
		ans += AA; 
		// return
	}
	return ans;
	// cout << endl;
}

int main() {
	scanf("%d%d%d", &a, &b, &c);
	// for (int aa = 0; aa <= 50; aa++)
	// 	for (int bb = 0; bb <= 50; bb++)
	// 		for (int cc = 0; cc <= 50; cc++)
	// 			if (aa + bb + cc > 0 && aa + bb + cc <= 50) {
	// 				// int aa = a, bb = b, cc = c;
	// 				a = aa;
	// 				b = bb;
	// 				c = cc;
	// 				cout << aa << ' ' << bb << ' ' << cc << ' '<< solve() << endl;;
	// 			}
	string ans = solve();
	cout << ans << endl;
}


Measured memory_bytes: 256
a, b, c, k = map(int, input().split())
lis = [a, b, c]
ans = 0
for num, i in enumerate(lis):
    if i < k:
        if num == 0:
            ans += i
        elif num == 1:
            ans += 0
        else:
            ans -= i
        k -= i
    else:
        if num == 0:
            ans += k
        elif num == 1:
            ans += 0
        else:
            ans -= k
        break

print(ans)

Measured memory_bytes: 9204
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define bitcount(a) __builtin_popcountll(a)
#define P pair<int,int>
#define ff first
#define ss second
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
long double eps=1e-9;
long mod=1e9+7;
int dp[100005];

int rec(int i,int n,int *a){
	if(i==n-1) return 0;
	if(i>=n) return 1e18;
	if(dp[i]!=-1) return dp[i];
	return dp[i]=min(abs(a[i]-a[i+1])+rec(i+1,n,a),abs(a[i]-a[i+2])+rec(i+2,n,a));
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	int a[n+1]={0};
	for(int i=0;i<n;i++)
		cin>>a[i];
	cout<<rec(0,n,a);
	return 0;
}

Measured memory_bytes: 5760
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int T = sc.nextInt();
		int X = sc.nextInt();
		
		out.println((double)T/X);
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <unordered_map>
#include <algorithm>

#define ll long long

using namespace std;
int x, k, q, t, a, low, up, add, delta, now, ans, r[100007];
bool flag;

int cal(int tt, int lower = 0, int upper = x) {
    if (tt < lower) return lower;
    if (tt > upper) return upper;
    return tt;
}

int main() {
   // ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    cin >> x >> k;
    for (int i = 1; i <= k; i++) cin >> r[i];
    cin >> q;

    low = x, now = 1;
    while (q--) {
        cin >> t >> a;
        while (t >= r[now] && now <= k) {
            delta = (flag ? 1 : -1) * (r[now] - r[now - 1]), add += delta;
            up = cal(delta + up), low = cal(delta + low);
            flag = !flag, now++;
        }
        ans = cal((flag ? 1 : -1) * (t - r[now - 1]) + cal(a + add, up, low));
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;
  ll res = 1000000;
  for(int i = 1;i <= sqrt(n);i++){
    if(n % i == 0){
      ll big = n / i;
      string s = to_string(big);
      res = min(res,(ll)s.size());
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3748
#include<cstdio>
int n,c[510],s[510],f[510],*d=c,*t=s,*g=f,i;int main(){scanf("%d",&n);for(;d<c+n-1;++d,++t,++g)scanf("%d%d%d",d,t,g);++(*g=*d=*t=0);for(;i<n;)for(int a=0,j=i++;j<n||!printf("%d\n",a);)a=(a<s[j]?s[j]:(a/f[j]+(a%f[j]!=0))*f[j])+c[j++];}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int dp[2000][2];

int N, Z, W;
int arr[2000];

int recurse(int pos, bool player) {
	if (dp[pos][player] != -1) return dp[pos][player];

	int lpscore = (pos == 0) ? W : arr[pos - 1];
	int best = abs(arr[N-1] - lpscore);

	for (int i = pos + 1; i < N; ++i) {
		if (!player) { 
			// maximize
			best = max(best, recurse(i, !player));
		} else {
			// minimize 
			best = min(best, recurse(i, !player));
		}
	}

	dp[pos][player] = best;
	return best;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> Z >> W;

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 2; ++j) {
			dp[i][j] = -1;
		}
	}

	for (int i = 0; i < N; ++i) {
		cin >> arr[i];
	}

	print(recurse(0, false));
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] p = new int[n];
		double[] e = new double[n];
		double[] s = new double[n+1];
		s[0] = 0;
		double ans = 0;
		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
			e[i] = (double)(1+p[i])/2;
			s[i+1] = s[i]+e[i];
		}
		for(int i = 0; i <= n-k; i++) {
			double a = s[i+k]-s[i];
			if(ans < a)ans = a;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 87624
#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n, s, t, p, m;
    string w, time;
    cin >> s >> n >> t >> w >> time >> p >> m;
    if (n == 0)
      break;
    long long all = 10080;
    long long ok = 0, ok2s = all * 2, ok2t = all * 2;
    if (w == "All") {
      if (time == "All")
        ok = 10080;
      else {
        ok = 720;
        all = 1440;
      }
    } else {
      if (time == "All")
        ok = 1440;
      else if (time == "Night") {
        ok = 360;
        ok2s = 1080;
        ok2t = 1440;
      } else {
        ok = 720;
      }
    }
    long long q = 0;
    for (int j = 0; j < t; j++) {
      if (ok == all) {
        q = m;
        break;
      }
      long long qq = 0;
      long long now = j;
      for (int i = 0; i < m; i++) {
        // [now, now + s] && [0, ok)
        if ((0 <= now && now < ok && 0 <= (now + s) && (now + s) < ok) ||
            ((ok2s <= now && now < ok2t && ok2s <= (now + s) &&
              (now + s) < ok2t))) {
          qq++;
        }
        now += t;
        now %= all;
      }
      q = max(q, qq);
    }
    double ans = 1. - pow(1. - (1. / p), q * n);
    printf("%.9lf\n", ans);
  }
  return 0;
}


Measured memory_bytes: 3428
from copy import deepcopy

N, A = map(int, input().split())
X = list(map(int, input().split()))

for i in range(N):
    X[i] -= A

cnt = [0] * 5000

for x in X:
    cnt2 = [0] * 5000
    for i in range(-2500, 2500):
        cnt2[i + x] += cnt[i]
    cnt2[x] += 1
    for i in range(5000):
        cnt2[i] += cnt[i]
    cnt = deepcopy(cnt2)

print(cnt[0])


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

int main()
{
    int W,H,x,y,r;
    
    cin >> W >> H >> x >> y >> r;
    
    if(x + r > W || y + r > H || x - r < 0 || y - r < 0)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    
    return 0;
}


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

// x以下のyの倍数の個数を返す
ll count(ll x, ll y){
  return(x / y);
}

int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  
  ll e = __gcd(c,d);
  ll f = c*d / e;
  
  ll tmp1 = b/c + b/d - b / f;
  ll tmp2 = (a-1)/c + (a-1)/d - (a-1)/f;
  cout << b - (a-1) - (tmp1 - tmp2) << endl; 
}


Measured memory_bytes: 256
using System;

class Program {
  static void Main() {
    var s = Console.ReadLine();
    var a = int.Parse(s[0].ToString());
    if (s[0] < s[1] || (s[0] == s[1] && s[1] < s[2])) a++;
    Console.WriteLine(a * 111);
  }
}

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

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

  int dice[6];
  for (int i=0; i<6; i++) cin >> dice[i];

  string s = "XEEENEEENEEESEEESEEENEEEN";
  string ans = "Yes";

  for (int x=1; x<N; x++) {

    int mdice[6];
    for (int i=0; i<6; i++) cin >> mdice[i];

    for (int i=0; i<s.size(); i++) {

      int temp = dice[0];
      switch(s[i]) {
      case 'E':
        dice[0] = dice[3];
        dice[3] = dice[5];
        dice[5] = dice[2];
        dice[2] = temp;
        break;
      case 'W':
        dice[0] = dice[2];
        dice[2] = dice[5];
        dice[5] = dice[3];
        dice[3] = temp;
        break;
      case 'S':
        dice[0] = dice[4];
        dice[4] = dice[5];
        dice[5] = dice[1];
        dice[1] = temp;
        break;
      case 'N':
        dice[0] = dice[1];
        dice[1] = dice[5];
        dice[5] = dice[4];
        dice[4] = temp;
        break;
      }

      if ((dice[0] == mdice[0]) && (dice[1] == mdice[1]) && (dice[2] == mdice[2]) &&
          (dice[3] == mdice[3]) && (dice[4] == mdice[4]) && (dice[5] == mdice[5]))
        ans = "No";
    }

  }

  cout << ans << endl;

  return 0;
}



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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    char a;
    cin >> a;
    cout << (a < 'a' ? "A" : "a") << endl;
}

Measured memory_bytes: 3636
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
MOD = 10**9 + 7

memo = [-1]*(1 << N) 
memo[0] = 1
def dfs(state, c):
    if memo[state] != -1:
        return memo[state]
    r = 0
    for i in range(N):
        if state & (1 << i) and A[c][i]:
            r += dfs(state ^ (1 << i), c+1) #xorでibit目の1を0に
    memo[state] = r = r % MOD
    return r
print(dfs((1 << N)-1, 0))
#c 何人目の男性か(女性が何人すでにマッチングしてるか)
#マッチングしてない(1)

Measured memory_bytes: 91144
#include <iostream>
#include <cmath>

using namespace std;

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

    int temp = 1;
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        if (A & 1) {
            temp *= 1;
        } else {
            temp *= 2;
        }
    }

    cout << pow(3, N) - temp << endl;
}


Measured memory_bytes: 256
from collections import deque
import bisect

N = int(input())
L = [int(input()) for _ in range(N)]
Q = deque()
Q.append(L[0])

for l in L[1:]:
    r = bisect.bisect_left(Q, l)
    if r == 0:
        Q.appendleft(l)
    else:
        Q[r-1] = l
print(len(Q))


Measured memory_bytes: 54488
N = int(input())
A = list(map(int, input().split()))

e = 1  # 次ほしい数字
k = 0  # 砕く
for ai in A:
    if ai == e:
        e += 1
    else:
        k += 1

if e == 1:
    print(-1)
else:
    print(k)

Measured memory_bytes: 24744
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

void solve() {
	LL n;
	inl(n);
	
	string ans = "";
	while(n>0) {
		int r = n % 26;
		if(r == 0) r=26;
		char c = (char) (r-1 + 'a');
		ans = c + ans;
		n/=26;
		if(r == 26) n--;
	}
	cout<<ans<<en;
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


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

using namespace std;

#define ll long long

int N;
int arr[200000];

void solve(){
    cin >> N;

    string s ;
    cin >> s;
    int i = 0;
    for (char c : s)
    {
        //cout << c << endl;
        if(c == 'R') arr[i] = 0;
        else arr[i] = 1;
        i++;
    }
    
    int l = 0;
    int r = N-1;


    
    
    int count = 0;
    while (l < r)
    {
        
        if(arr[l] == 1 && arr[r] == 0){
            count++;
            l++;
            r--;
            continue;
        }
        if(arr[l] == 0 ){
            l++;
        }
        if(arr[r] == 1){
            r--;
        }

    }
    
    cout << count << "\n";

    
}






int main(){

    //ios::sync_with_stdio(false);
    //cin.tie(0);

    solve();

}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    ll k;

    cin >> s;
    cin >> k;

    char ch;
    string ans;
    ll c = 0;

    int i, len = s.size();

    rep(i, len) {
        ch = s[i];

        if (ch == '1') {
            c++;
        } else {
            ans = string(1, ch);

            break;
        }

        if (k <= c) {
            ans = "1";

            break;
        }
    }

    Out(ans);

    return 0;
}


Measured memory_bytes: 256
def main():
    s_list = list(input())

    ans = 0
    len_s2 = len(s_list) // 2
    for i in range(len_s2):
        if s_list[i] != s_list[-(i+1)]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#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;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;
const ll mno=1007;

int main() {
    
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) {
        puts("Yes");
    }
    else {
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 384
fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val t = readLine()!!.split(" ").map { it.toInt() }
    val m = readLine()!!.toInt()
    val px = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }

    val time = t.sum()
    px.map { d ->
        val (p,x) = d
        time - t[p-1] + x
    }.joinToString("\n")

})


Measured memory_bytes: 38000
N, M = gets.split.map(&:to_i) 
C = Hash.new do |h, x|
  h[x] = Hash.new(Float::INFINITY)
end 

M.times do
  a, b, c = gets.split.map(&:to_i)
  C[a][b] = c
  C[b][a] = c
end

def smaller(a, b)
  a < b ? a : b 
end

dp = Array.new(N + 1) do |k|
  Hash.new do |h1, i| 
    h1[i] = Hash.new do |h, j| 
      h[j] = smaller(dp[k - 1][i][j], dp[k - 1][i][k] + dp[k - 1][k][j])
    end
  end
end

dp[0] = C

tot = 0 
C.keys.each do |i|
  C[i].keys.each do |j| 
    next if j > i 
    tot += 1 if dp[N][i][j] != C[i][j]
  end
end

puts tot

Measured memory_bytes: 75644
#include<iostream>
#include<string>
using namespace std;
string s;
int stp,edp;
int main()
{
    cin>>s;
    for(int i=0; i<s.length(); i++)
        if(s[i]=='A')
        {
            stp=i+1;
            break;
        }
    for(int i=stp; i<s.length(); i++)
        if(s[i]=='Z')
            edp=i+1;
    if(stp==0||edp==0)
    {
        cout<<0;
        return 0;
    }
    cout<<edp-stp+1;
}


Measured memory_bytes: 640
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push_back
#define ITR ::iterator


#define MOD 1000000009LL
#define EPS 1e-8


const LL INF = LLONG_MAX / 8;

int n, s;
vLL l, r;
VV(LL) w;


int main(){
	scanf("%d%d", &n, &s);
	l.resize(n);
	r.resize(n);
	initvv(w, n, n, INF);
	for(int i = 0; i < n; ++i){
		scanf("%lld%lld", &l[i], &r[i]);
	}
	for(int i = 0; i < n; ++i)
	for(int j = 0; j < n; ++j){
		scanf("%lld", &w[i][j]);
	}
	for(int k = 0; k < n; ++k)
	for(int i = 0; i < n; ++i)
	for(int j = 0; j < n; ++j){
		w[i][j] = min(w[i][j], w[i][k] + w[k][j]);
	}

	vector<pll> ri(n);
	for(int i = 0; i < n; ++i){
		ri[i] = pll(r[i], i);
	}
	sort(ALL(ri));

	vLL mx(n, -INF);
	for(int i = 0; i < n; ++i){
		if(w[s - 1][i] <= r[i]){
			mx[i] = r[i] - max(w[s - 1][i], l[i]);
		}
	}

	for(int i = 0; i < n; ++i){
		int v = ri[i].second;
		if(mx[v] < 0){ continue; }
		for(int j = 0; j < n; ++j){
			LL t = r[v] + w[v][j];
			if(t <= r[j]){
				mx[j] = max(mx[j], r[j] - max(t, l[j]) + mx[v]);
			}
		}
	}
	
	LL ans = *max_element(ALL(mx));
	if(ans < 0){ throw 0; }
	cout << ans << endl;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);


static ll dp[100005];
static const int INF = 1000000007;

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

  REP(i,n) dp[i] = 0;
  REP(i,m){
    int a;
    cin >> a;
    a;
    dp[a] = -1;
    if(dp[a] == dp[a-1]){
      cout << 0 << endl;
      return 0;
    }
  }


  dp[0] = 1;
  if(dp[1] == 0) dp[1] = 1;
  else dp[1] = 0;

  for(int i = 2; i <= n; i++){
    if(dp[i] == -1){
      dp[i] = 0;
      continue;
    }
    dp[i] = dp[i-1]+dp[i-2];
    dp[i] %= 1000000007;
    //dp[i] = dp[i-1]+dp[i-2];

  }

  cout << dp[n] << endl;

  // REP(i,n+1){
  //
  //   cout << dp[i] << endl;
  // }


  return 0;
}

Measured memory_bytes: 4416
import java.util.Scanner;
public class Main {
     public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] H = new int[(int)N];
        int[] A = new int[2];
        int ans = 0;
        
        int[] C = new int[(int) N];
        for(int i = 0; i < N ; i++){
            C[i] = 1;
        }
        
        for(int i = 0 ; i < N ; i++){
                H[i] = sc.nextInt(); 
        }
        
        
        for(int n = 0; n < M ; n++){
            A[0] = sc.nextInt();
            A[1] = sc.nextInt();
            if(H[A[0] - 1] == H[A[1] - 1]){
                C[A[0] - 1] = 0;
                C[A[1] - 1] = 0;
            }else if(H[A[0] - 1] < H[A[1] - 1]){
                C[A[0] - 1] = 0;
            }else{
                C[A[1] - 1] = 0;
            }
            
        }
        
        for(int i = 0; i < N ;i++){
            ans = ans + C[i];
        }        
        System.out.println(ans);
    
    }
}


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

int main(){
  int n,k,tmp;
  int s[100];
  bool f;

  while(1){
    cin >> n >> k;
    if(!n && !k)break;

    for(int i=0;i<k;i++)cin >> s[i];

    f = true;
    for(int i=0;i<n;i++){
      for(int j=0;j<k;j++){
	cin >> tmp;
	s[j] -= tmp;
	if(s[j] < 0)f = false;
      }
    }

    if(f)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

int main() {
	int n;
	cin >> n;
	int x = n%10;
	if (x == 3) cout << "bon" << endl;
	else if (x == 0 || x == 1 || x == 6 || x == 8) cout << "pon" << endl;
	else cout << "hon" << endl;
	return 0;
}

Measured memory_bytes: 3636
a,b,c = map(int,input().split())
k = int(input())

while k > 0 and a >= b:
    b *= 2
    k -= 1

while k > 0 and b >= c:
    c *= 2
    k -= 1

if k >= 0 and a<b<c:
    print("Yes")
else:
    print("No")



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

int main()
{
	int a,b;
	while(cin >> a >> b)
	{
		if(a == 0 && b == 0)
		{
			break;
		}

		if(a <= b) cout << a << " " << b << endl;
		else cout << b << " " << a << endl;

	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>
#include <string>

using namespace std;

string f( const string s ) {
  int count = 0;
  char cur_ch = '0';
  string answer = "";
  for ( const char ch : s ) {
    // cerr << answer << endl;
    if ( cur_ch == ch ) {
      count++;
    } else {
      if ( count > 0 ) {
	answer += to_string( count );
	answer += cur_ch;
      }
      cur_ch = ch;
      count = 1;
    }
  }
  answer += to_string( count );
  answer += cur_ch;
  return answer;
}

string apply_n( int n, string line ) {
  if ( n == 0 ) {
    return line;
  } else {
    return apply_n( n - 1, f( line ) );
  }
}

int main() {
  
  while ( true ) {
    string line;
    getline(cin, line);
    int n = stoi( line );
    if ( n == 0 ) break;
    getline(cin, line);

    cout << apply_n( n, line ) << endl;
  }
}

Measured memory_bytes: 1340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1<<29;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)

// 累積和を用いて、リーダーとして仮定した位置よりも左に存在するWをEにする
// その項より左に存在するWの数 +  その項より右に存在するEの数 の最小値を探す。
// その項より右に存在するEの数は、最終稿までに出現したEの数 - その項までに出現したEの数

int main(){
    int N; cin >> N;
    string s; cin >> s;
    vint W(N), E(N);
    //  各EとWに対する累積和を取る前処理
    for(int i = 1; i <= N; i++){
        W[i] += W[i - 1];
        E[i] += E[i - 1];
        if(s[i - 1] == 'W') W[i]++;
        if(s[i - 1] == 'E') E[i]++;
    }
    int mixi =  INF;
    rep(i, N){
        int w = W[i];
        int e = E[N] - E[i + 1];
        mixi = min(mixi, e + w);
    }
    cout << mixi << endl;
}

Measured memory_bytes: 3076
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long a,b,c;
    scan(a,b,c);
    long k = lread();
    long three_max = max(a,b,c);
    three_max = three_max * pow(2, k);
    three_max -= max(a,b,c);
    writeln(three_max + a + b + c);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int i,len1,len2,c=0;
    char S[100],T[100];
    gets(S);
    gets(T);
    len1=strlen(S);
    len2=strlen(T);
    if(len1==(len2-1))
    {
      for(i=0;i<len1;i++)
        {
            if(S[i]>='a'&&S[i]<='z')
            {
                if(T[i]>='a'&&T[i]<='z'&&T[len2-1]>='a'&&T[len2-1]<='z')
                {
                    if(S[i]==T[i])
                    {
                        c++;
                    }
                    else
                        c=0;
                }

            }

        }

    }
    if(c==len1)
    {
        printf("Yes");
    }
    else
        printf("No");
}


Measured memory_bytes: 2016
use proconio::input;

fn main() {
    input!(n: usize, a: [u64; 1 << n]);
    let mut dp: Vec<_> = a.iter().map(|&x| [0, x]).collect();
    for i in 0..n {
        for bs in (0..1 << n).filter(|&bs| bs >> i & 1 == 1) {
            let c = &dp[bs];
            let d = &dp[bs ^ 1 << i];
            dp[bs] = if c[1] < d[1] {
                [c[1].max(d[0]), d[1]]
            } else {
                [d[1].max(c[0]), c[1]]
            };
        }
    }
    let mut ans = 0;
    for bs in 1..1 << n {
        let x = dp[bs][0] + dp[bs][1];
        if ans < x {
            ans = x;
        }
        println!("{}", ans);
    }
}


Measured memory_bytes: 12052
#include<iostream>

using namespace std;
int main()
{
	int r, d, x[11];
	cin >> r >> d >> x[0];
	for (int i = 0; i < 10; i++) {
		x[i + 1] = r*x[i] - d;
		cout << x[i + 1] << endl;
	}
    return 0;
}

Measured memory_bytes: 256
/**
 *    Author:  "Robin Singh" !!!
 *    BrainyIsTheNewSexy     (CodeForces)
 *    rob_in_1               (Other OJs)
**/
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define IO  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ff first
#define ss second
#define mp make_pair
#define szz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)     
#define bk(i, j, k) for(int i = j-1; i >= k; i--)
#define mem(ptr)  memset(ptr, 0, sizeof ptr)
#define sbit(n)  __builtin_popcount(n)
#define nl "\n"
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vll;
typedef vector < pair<int,int> > vpii;
typedef vector < pair<ll, ll> > vpll;

//---------------------------------------------*DEBUGGING*--------------------------------------------------------->]
#define dbg( args...) { vector<string> _v = split( #args, ','); err( _v.begin(), args); cerr << '\n'; }
vector<string> split( const string& s, char c) { vector<string> v; stringstream ss( s); string x; 
while ( getline( ss, x, c)) v.emplace_back(x); return move(v); }
void err( vector<string>::iterator it) { } 
template<typename T, typename... Args>
void err( vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr( ( *it)[0] == ' ', it -> length()) << " = " << a << '\t'; err( ++it, args...); }
//----------------------------------------------------------------------------------------------------------------->]
//*****************************************!Template Ends Here!*****************************************************]

const long long mod = 1e9+7;
const long double eps = 1e-9;
const long long INF = (1LL<<61);
const int inf = (1<<30);
const int nn = 1e6+5;

int main()
{
    // IO;
    IOS;
    ll n, m;
    cin >>  n >> m;
    string s, t;
    cin >> s >> t;
    ll g = __gcd(n, m);
    ll ans = n * m / g;

    map <ll, char> c;

    for(ll i = 1, j = 0; i <= ans && j < n; ){
    	c[i] = s[j];
    	j++;
    	i = j * (ans/n) + 1;
    }

    for(ll i = 1, j = 0; i <= ans && j < m; ){
    	if(! c.count(i)){
    		c[i] = t[j];
    	}
    	else{
    		if(c[i] != t[j]){
    			cout << -1;
    			return 0;
    		}
    	}
    	j++;
    	i = j * (ans/m) + 1;
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 10880
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};
ll dp[41][401][401];
int main(){
    rep(i,41){
        rep(j,401){
            rep(k,401)dp[i][j][k]=INF;
        }
    }
    dp[0][0][0]=0;
    ll n;cin>>n;
    ll ma,mb;cin>>ma>>mb;
    vl a(n),b(n),c(n);
    rep(i,n)cin>>a[i]>>b[i]>>c[i];
    rep(i,n){
        rep(j,401){
            rep(k,401){
                dp[i+1][j][k]=min(dp[i][j][k],dp[i+1][j][k]);
                if(j>=a[i]&&k>=b[i])dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j-a[i]][k-b[i]]+c[i]);
            }
        }
    }
    ll ans=INF;
    for(ll i=1;i*ma<=400&&i*mb<=400;i++){
        ans=min(ans,dp[n][i*ma][i*mb]);
    }
    if(ans>=INF)cout<<-1<<endl;
    else cout<<ans<<endl;
}
    

Measured memory_bytes: 51712
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する

int main(){
    int n,m,a,b;
    string s;
    cin>>a>>b>>m;
    vector<int> A(a),B(b),c(m);
    int amin = 10000000;
    int bmin = 10000000;
    vector<int> x(m),y(m);
    rep(i,a){
        cin>>A[i];
        if(A[i]<amin){
            amin = A[i];
        }
    }
    rep(i,b){
        cin>>B[i];
        if(B[i]<bmin){
            bmin = B[i];
        }
    }
    int ans = amin+bmin;
    rep(i,m){
        cin>>x[i]>>y[i]>>c[i];
        x[i]--,y[i]--;
    }
    rep(i,m){
        int k;
        k = A[x[i]] + B[y[i]]-c[i];
        if(k<ans){
            ans = k;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >>n;
  int a[10100];
  for(int i=0; i<n; i++) cin >> a[i];
  int sum=0;
  for(int i=0; i<n; i++){
    while(a[i]%2==0){
    	a[i]/=2;
      	sum++;
    }
  }
 
  cout << sum << endl;
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cstdint>

#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<iterator>
#include<algorithm>
#include<utility>

using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int32_t i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int32_t i = n-1; i>=x; i--)
#define rrep(i,n) RREP(i,0,n)

#define P(p) cout<<(p)<<endl;
#define pb push_back

typedef vector<int> VI;

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

int main(void){
    int32_t W = 0, H = 0, x = 0, y = 0, r = 0;
    
    cin >> W >> H >> x >> y >> r;
    
    // ?????????????????????4?????????????????????????????????
    
    // ???
    if( ( y + r > H ) || ( y - r > H ) || ( y + r < 0 ) || ( x - r < 0 ) ||
        ( x + r > W ) || ( x - r > W) || ( x + r < 0 ) || ( x - r < 0 ) ){
        cout << "No" << endl;
        return 0;
    }
    
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
    ll n;
    ll a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    ll mn = min({a,b,c,d,e});
    ll ans = (n+mn-1)/mn+4;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604