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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define MAX_H 100
#define MAX_W 100
#define INF 10'000'000
i64 H, W;
i64 G[MAX_H][MAX_W];
i64 memo[MAX_H][MAX_W][2];


i64 dfs(i64 y, i64 x, i64 prev) {
    if (y == H - 1 && x == W - 1) {
        if (prev == 0 && G[y][x] == 1) return 1;
        else return 0;
    }

    if (memo[y][x][prev] >= 0) {
        return memo[y][x][prev];
    }

    i64 minc = INF;
    if (prev == 0 && G[y][x] == 1) {
        if (y + 1 < H) chmin(minc, dfs(y + 1, x, G[y][x]) + 1);
        if (x + 1 < W) chmin(minc, dfs(y, x + 1, G[y][x]) + 1);
    } else {
        if (y + 1 < H) chmin(minc, dfs(y + 1, x, G[y][x]));
        if (x + 1 < W) chmin(minc, dfs(y, x + 1, G[y][x]));
    }
    return memo[y][x][prev] = minc;
}

int main() {
    cin >> H >> W;
    REP(i, H) REP(j, W) {
        char c; cin >> c;
        G[i][j] = (c == '#');
    }

    REP(i, H) REP(j, W) REP(k, 2) memo[i][j][k] = -1;

    i64 minc = dfs(0, 0, 0);
    cout << minc << endl;
    return 0;
}

Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    dp=np.zeros(10**4+1,int)
    dp[0]=0
    for l in lis:
        dp[1:l[0]+1]=np.minimum(dp[1:l[0]+1],l[1])
    for i in range(1,h+1):
        dp[i]=np.min(dp[i-lis[:,0]]+lis[:,1])
    print(dp[h])

if __name__=='__main__':
    main()

Measured memory_bytes: 12624
#include<stdio.h>
int main(void){
	int a[5],min,t;
	min = 10; t = 0;
	for (int i = 0; i < 5; i++)
	{
	scanf("%d\n",&a[i]);}
	for (int i = 0; i < 5; i++)
	{
	if (a[i]%10==0)
	{
		t = t + a[i];
	}else{
		if(min>a[i]%10){
			min = a[i]%10;
			t = t + (a[i]/10)*10 +10;
		}else{
			t = t + (a[i]/10)*10 + 10;
		}	}
	}	
	
	t = t - 10 + min;
	printf("%d\n",t );
	return 0;
}

Measured memory_bytes: 128
char s[101],*p;
e(r){
	for(r=t();*p==43?r+=t(p++),1:*p==45?r-=t(p++),1:0;);
	return r;
}
t(r){
	for(r=f();*p==42?r*=f(p++),1:*p==47?r/=f(p++),1:0;);
	return r;
}
f(r){
	return *p==40?r=e(p++),p++,r:n(p);
}
n(r){
	for(r=0;47<*p&*p<58;)r=r*10+*p++-48;
	return r;
}
main(i){
	for(;gets(p=s);)--i&&!printf("%d\n",e());
}

Measured memory_bytes: 524
#include <iostream>
using namespace std;
int main(){
    int a,b,c,d,e;
    cin>>a;
    b=a/1000;
    c=a/100-a/1000*10;
    d=a/10-a/100*10;
    e=a-a/10*10;
    if((b==c || d==e) && c==d){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

Measured memory_bytes: 256
n,m = (int(x) for x in input().split())
if n < 2 and m < 2 :
    print(0)
elif n < 2 and m > 1 :
    print((m * (m-1)) // 2) 
elif n > 1 and m < 2:
    print((n * (n-1)) // 2) 
else:
    print((n * (n-1)) // 2 + (m * (m-1)) // 2) 

Measured memory_bytes: 3060
renga_num = int(input())
renga_line = list(map(int,input().split()))

num = 1
break_num = 0
for i in range(0,renga_num):
    if renga_line[i] != num:
        break_num += 1
    else:
        num += 1

if break_num == renga_num:
    print(-1)
else:
    print(break_num)

Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=105;
int n,a[N],ans;
signed main(){
	n=read(); 
	for(int i=1;i<=n;i++)a[i]=read(); a[n+1]=a[n]-1;
	int dq=1;
	for(int i=1;i<=n;i++){
		if(a[i]!=a[i+1]){ans+=dq/2; dq=1;}
		else dq++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
sum1=[]
sum2=[]
s1=0
s2=0
for i in range(n):
    s1+=a1[i]
    sum1.append(s1)
for j in range(n):
    s2+=a2[n-j-1]
    sum2.append(s2)
ans=0
for k in range(n):
    if ans<sum1[k]+sum2[n-k-1]:
        ans=sum1[k]+sum2[n-k-1]
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int n, maxv=0, minv=0;
	int A[102];

	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];

	minv = A[0];
	for (int j = 0; j < n; j++) {
		maxv = max(maxv, A[j]);
		minv = min(minv, A[j]);
	}

	cout << maxv - minv << endl;

	return 0;
}


Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split("");
    
    const Rsum = A.filter(n=>n==="E").length;
    const Lsum = N - Rsum;
    
    let Rcnt = 0;
    let Lcnt = 0;
    
    let answer = Infinity;
    
    for(let i=0; i<N; i++) {
        // 左半分
        const needMoveLeft = Lcnt;
        
        // 右半分
        let needMoveRight = Rsum - Rcnt;
        
        if(A[i] === "E") {
            needMoveRight--;
        }
    
        answer = Math.min(answer, needMoveLeft + needMoveRight);
        
        
        if(A[i] === "W") {
            Lcnt++;
        } else {
            Rcnt++;
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 20612
def main():
    S = input()
    combs = set()
    max_len = 0
    for i in range(len(S)):
        for j in range(len(S), i - 1, -1):
            S_tmp = S[i:j]
            for s in S_tmp:
                if s not in ["A", "C", "G", "T"]:
                    break
            else:
                combs.add(S_tmp)

    for s in combs:
        max_len = max(max_len, len(s))

    print(max_len)


if __name__ == '__main__':
    main()


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

int main(){
  int N;
  cin >> N;
  int d[110];
  for(int i=0;i<N;i++)cin >> d[i];

  int num[110] = {0};
  for(int i=0;i<N;i++){
    num[d[i]] += 1;
  }
  int res = 0;
  for(int i=1;i<=100;i++){
    if(num[i]>0)res++;
  }
  cout << res << endl;
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b,c,d,i,g,max=0;
	int f[100]={};
	scanf("%d",&a);
	for(i=0;i<a;i++)
	{
		scanf("%d",&f[i]);
	}
	for(i=0;i<a;i++)
	{
		if(f[i]==1)
		{
			b=0;
			for(d=i;f[d]==1;d++)
			{
				b++;
			}
			if(max<b)
			{
				max=b;
			}
		}
	}
	printf("%d\n",max+1);
	
	
	
	
	return 0;
	}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
  int n;
  cin >> n;
  while(n){
    if(n%10==7){
      cout << "Yes" << endl;
      return 0;
    }
    n /= 10;
  }
  cout << "No" << endl;
}

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

primes = []
def prime():
    global primes
    primes = []
    for i in range(2,100):
        p = True
        for j in primes:
            if i % j == 0:
                p = False
                break
        if p:
            primes.append(i)

hash = {}
prime()

for i in range(1, n+1):
    k = i
    for j in primes:
        if k % j == 0:
            while k % j == 0:
                if j in hash:
                    hash[j] += 1
                else:
                    hash[j] = 1
                k = k // j
a = 0
b = 0
c = 0
d = 0
e = 0
for k, v in hash.items():
    if v >= 4:
        a += 1
    if v >= 2:
        b += 1
    if v >=14:
        c += 1
    if v >= 24:
        d += 1
    if v >= 74:
        e += 1

total = 0
if a<2 or b<3:
    print(0)
else:
    total = a*(a-1)*(b-2) // 2 + c *  (a-1) + d * (b-1) + e
    print(total)


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

int syou(int a){
    if(a>0){
        return a/(-2);
    }else if(a==0){
        return 0;
    }else{
        if(a%2==0){
            return a/(-2);
        }else{
            return (a/(-2))+1;
        }
    }
}

int main(){
    vector<int> v;
    int N,num;
    cin >> N;
    if(N==0){
        cout << 0;
        exit(0);
    }
    while(1){
        num=syou(N);
        if(num==1){
            v.push_back(N - num * (-2));
            v.push_back(1);
            break;
        }
        v.push_back(N-num*(-2));
        N=num;
    }
    for(int i=v.size()-1;i>=0;i--){
        cout << v[i];
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    long long min = 1000000, max=-1000000, sum=0, n;
    cin >> n;
    
    int a;
    for(int i=0; i < n; i++){
        cin >> a; 
        if(a < min)min = a;
        if(a > max)max = a; 
        sum+=a;
    }
    cout << min<< " " << max << " " << sum << endl;
    return 0;
}


Measured memory_bytes: 3116
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int num;
    int firstpoint;
    int score;
    int correct[100001];
    int point[100001];
    int minuspoint[100001]={};
    int ans=0;
    char str[20];

    scanf("%d%d%d\n",&num,&firstpoint,&score);

    for(int i=0;i<score;i++){
        gets(str);
        correct[i]=atoi(str);
        minuspoint[correct[i]-1]++;
    }
    
    for(int a=0;a<num;a++){
        if(firstpoint-score+minuspoint[a]>0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }
    return 0;

}

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

int main() {
  string o, e;
  cin >> o >> e;
  string pw;
  for (int i=0; i<e.size(); i++) {
    pw.push_back(o.at(i));
    pw.push_back(e.at(i));
  }
  if (o.size()-e.size() == 1) {
    pw.push_back(o.back());
  }
  cout << pw << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  vector<int> x(m*2);
  for(int i=0;i<m*2;i++)cin>>x.at(i);
  for(int j=0;j<n;j++){
    int a=0;
    for(int k=0;k<m*2;k++){
      if(j+1==x.at(k))a++;
    }
    cout<<a<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffor(i,a,b) for(ll i=a;i<=b;i++)
#define rfor(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';
#define oset tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//functions: set.insert(val), *(set.find_by_order(order-1)), set.order_of_key(val)

using namespace __gnu_pbds;
using namespace std;
using namespace std::chrono;

const ll MOD = 1e9 + 7;
const ll N = 1e6 + 6;
const ll maxN = 1e5 + 6;

ll power(ll x, ll y, ll M = MOD) // default argument
{ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	FIO
	ll x, y; cin >> x >> y;
	if (y > (4 * x) || (y % 2 != 0) || (y < 2 * x)) {
		cout << "No\n";
	}
	else cout << "Yes\n";
	return 0;
}


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

using namespace std;

const int MX_SZ = 17000;
const int ADD = 8500;

bool frst = true;

void upd(bool can[][2], bool tmp[], int cur_cnt, int ch) {
    for (int i = 0; i < MX_SZ; ++i) {
        if (can[i][ch]) {
            tmp[i + cur_cnt] = true;
            if (!frst) {
                tmp[i - cur_cnt] = true;
            }
        }
    }
    for (int i = 0; i < MX_SZ; ++i) {
        can[i][ch] = tmp[i];
        tmp[i] = false;
    }
}

int main() {
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;

    bool can[MX_SZ][2];
    memset(can, 0, sizeof(can));
    bool tmp[MX_SZ];
    memset(tmp, 0, sizeof(tmp));
    int ch = 0;

    can[ADD][0] = true;
    can[ADD][1] = true;

    int cur_cnt = 0;
    for (auto c : s) {
        if (c == 'F') {
            ++cur_cnt;
        } else {
            upd(can, tmp, cur_cnt, ch);
            frst = false;
            cur_cnt = 0;
            ch = 1 - ch;
        }
    }
    upd(can, tmp, cur_cnt, ch);
    if (can[x + ADD][0] and can[y + ADD][1]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}


Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
using namespace std;

int N;
const int MAX_N = 100005;
int a[MAX_N];
int cnt[2][MAX_N];
int M[2][2],V[2][2];

int main(){

	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
		cnt[i%2][a[i]]++;
	}

	for(int i=1;i<MAX_N;i++){
		for(int j=0;j<2;j++){
			if(M[j][1] < cnt[j][i]){
				M[j][1] = cnt[j][i];
				V[j][1] = i;
			}
			if(M[j][0] < M[j][1]){
				swap(M[j][0],M[j][1]);
				swap(V[j][0],V[j][1]);
			}
		}
	}

	if(V[0][0]!=V[1][0]){
		printf("%d\n",N-M[0][0]-M[1][0]);
	}else{
		printf("%d\n",N-max(M[0][0]+M[1][1],M[0][1]+M[1][0]));
	}

	return 0;
}

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

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

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

    int count = 1;
    int m = H[0];

    for(int i = 1;i < N;i++){
        if(H[i] >= m){
            count++;
            m = H[i];
        }
        
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n;
    string s;
    cin>>n>>s;
    ll r=0,g=0,b=0;
    rep(i,n){
        if(s[i]=='R') r++;
        else if(s[i]=='G') g++;
        else b++;
    }
    ll cnt=0;
    for(ll d=1;d<=(n-1)/2;d++){
        for(ll i=0;i+2*d<n;i++){
            if(s[i]!=s[i+d]&&s[i+d]!=s[i+2*d]&&s[i+2*d]!=s[i]) cnt++;
        }
    }
    cout<<r*g*b-cnt<<endl;
    return 0;
}

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

int N;
int M;
char A[ 60 ][ 60 ];
char B[ 60 ][ 60 ];

bool Check( const int x, const int y )
{
int i;
int j;

	for( i = 1; i < M; i++ )
	{
		for( j = 0; j < M; j++ )
		{
			if( A[ y + i ][ x + j ] != B[ i ][ j ] )
				return false;
		}
	}

	return true;
}

int main( int argc, char *argv[] )
{
int i;
int x;
char *p;

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

	cin >> N;
	cin >> M;
	for( i = 0; i < N; i++ ) cin >> A[ i ];
	for( i = 0; i < M; i++ ) cin >> B[ i ];

	for( i = N - M; i >= 0; i-- )
	{
		x = 0;
		p = strstr( A[ i ], B[ 0 ] );
		while( p != NULL )
		{
			x = p - A[ i ];
			if( Check( x, i ) )
			{
				cout << "Yes" << endl;

				return 0;
			}

			x++;
			while( x > N - M ) break;

			p = strstr( A[ i ] + x, B[ 0 ] );
		}
	}

	cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 256
require 'prime'

ts, q = [], nil
Prime.take_while {|p| p <= 10000 }.each {|p|
  ts << p if p - 2 == q
  q = p
}
ts.reverse!
loop do
  n = gets.to_i
  break if n.zero?
  q = ts.bsearch {|p| p <= n }
  puts "#{q-2} #{q}"
end

Measured memory_bytes: 9160
n=gets.chomp.to_i
h={'M'=>0, 'A'=>1, 'R'=>2, 'C'=>3, 'H'=>4}
l=Array.new(5, 0)
ans=0
n.times{
  s=gets.chomp
  next if !h.key?(s[0])
  l[h[s[0]]]+=1
}
5.times{|i|
  for j in i+1..4 do
    for k in j+1..4 do
    ans+=l[i]*l[j]*l[k]
    end
  end
}
puts ans


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> dp(3);
    vector<int> m(3,0);
    int arr[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
        }
    }
    dp[0]=arr[0][0];dp[1]=arr[0][1];dp[2]=arr[0][2];
    for(int i=1;i<n;i++)
    {
        m[0]=arr[i][0]+max(dp[1],dp[2]);
        m[1]=arr[i][1]+max(dp[0],dp[2]);
        m[2]=arr[i][2]+max(dp[0],dp[1]);
        dp[0]=m[0];dp[1]=m[1];dp[2]=m[2];
    }
    cout<<max(dp[0],max(dp[1],dp[2]))<<endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  int a,b,c;
  cin >> a;
  if(a%2==0){
    cout << a <<endl;
  }else{
	cout << 2*a <<endl;
  }
  
   return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let _ = scan!(i64);
    let mut vs = scan!(i64;;);
    vs.sort();
    println!("{}", vs.last().unwrap() - vs.first().unwrap())
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll


auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}



signed main()
{
	fio
	inp(n) inp(k)
	inpa(a,n)
	bool win[k+1]={0};
	fo(i,k+1)
	{
		for(int j:a)
		{
			if(i-j>=0 && win[i-j]==0)
			{
				win[i]=1;
				break;
			}
		}
	}
	cout<<((win[k])?"First":"Second")<<'\n';
	printclock;
}

Measured memory_bytes: 384
use proconio::*;
use std::collections::BinaryHeap;

fn main() {
    input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d],
    };

    let mut score = 0;
    let mut lasts = [-1; 26];
    let mut t = vec![26; d];
    let depth = 400;
    for i in 0..d {
        let mut max_score = -10000000;
        for j in 0..26 {
            let tmp = search(i, j, &c, &s, &mut lasts, depth, d, 0);
            if tmp > max_score {
                max_score = tmp;
                t[i] = j;
            }
        }
        score += max_score;
        lasts[t[i]] = i as i64;
    }

    for &a in &t {
        println!("{}", a + 1);
    }
}

fn calc_score(i: usize, j: usize, c: &Vec<i64>, s: &Vec<Vec<i64>>, lasts: &mut [i64; 26]) -> i64 {
    let mut res = s[i][j];
    let tmp = lasts[j];
    lasts[j] = i as i64;

    for j in 0..26 {
        let i = i as i64;
        let last = lasts[j];
        res -= c[j] * (i - last);
    }

    lasts[j] = tmp;
    res
}

fn search(
    i: usize,
    t: usize,
    c: &Vec<i64>,
    s: &Vec<Vec<i64>>,
    lasts: &mut [i64; 26],
    depth: usize,
    d: usize,
    cscore: i64,
) -> i64 {
    if depth == 0 || i == d - 1 {
        return calc_score(i, t, &c, &s, lasts) + cscore;
    }

    let mut max_score = -1000000;
    let tmp_last = lasts[t];
    lasts[t] = i as i64;
    let tmp_score = calc_score(i, t, &c, &s, lasts);
    let mut cands = BinaryHeap::new();
    for j in 0..26 {
        let tmp_score = calc_score(i + 1, j, &c, &s, lasts);
        cands.push((tmp_score, j));
    }
    for &(_, j) in cands.iter().take(1) {
        let tmp = search(i + 1, j, &c, &s, lasts, depth - 1, d, cscore + tmp_score);

        if tmp > max_score {
            max_score = tmp;
        }
    }

    lasts[t] = tmp_last;
    max_score + cscore
}


Measured memory_bytes: 2612
#include <cstdio>
#include <cmath>

int main()
{
    double a, b, x;
    scanf("%lf %lf %lf", &a, &b, &x);
    if (x <= a * a * b / 2)
    {
        printf("%lf", 180 * atan(a * b * b / (2 * x)) / M_PI);
    }
    else
    {
        printf("%lf", 180 * atan(2 * (a * a * b - x) / (a * a * a)) / M_PI);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9 + 7;

const ll MAX = 1100000;

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

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

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

	int a = (2 * X - Y) / 3;
	int b = (2 * Y - X) / 3;
	if (X != a * 2 + b || Y != a + 2 * b) {
		cout << 0 << endl;
		return 0;
	}

	COMinit();

	ll ans = COM(a + b, a);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 29352
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
      a: i32,
      b: i32,
      c: i32
  }
  
  
  if c-b > 0 {
    if b-a > 0 {
        println!("Yes")
    } else {
        println!("No")
    }
  } else {
    println!("No")
  }
 
 
}


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

#define int long long
#define ll long long 
int mod = 1e9 + 7;
ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int a[n], p[100];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < 100; i++) {
        p[i] = power(2, i);
    }
    int ans = 0;
    for(int i = 0; i <= 61; i++) {
        int h[2] = {0};
        for(int j = n - 1; j >= 0; j--) {
            h[(a[j] >> i) & 1]++;
        }
        for(int j = 0; j < n; j++) {
            h[(a[j] >> i) & 1]--;
            ans = (ans + (p[i] * h[1 ^ ((a[j] >> i) & 1)]) % mod) % mod;
        }
    }
    cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;
 
vector<int> divisor(int a){
    vector<int> res;
    for(int i=2; i<=sqrt(a); i++){
        if(a%i==0){
            res.push_back(i);
            if(i!=a/i) res.push_back(a/i);
        }
    }
    res.push_back(a);
    sort(all(res));
    return res;
}


int main(){
    int n,k; cin >> n >> k;
    vector<int> a(n);
    int sum=0;
    rep(i,n){
        cin >> a[i];
        sum+=a[i];
    }

    vector<int> p=divisor(sum);
    reverse(all(p));

    rep(i,p.size()){
        vector<int> moda;
        rep(j,n){
            if(a[j]%p[i]) moda.push_back(a[j]%p[i]);
        }
        int ms=moda.size();
        /*if(!ms){
            cout << p[i] << endl;
            return 0;
        }*/
        sort(all(moda));
        vector<ll> rmoda(ms+1);
        rmoda[0]=0;
        rep(j,ms) rmoda[j+1]=p[i]-moda[j]+rmoda[j];
        int now=0;
        rep(j,ms){
            now+=moda[j];
            if(now==rmoda[ms]-rmoda[j+1]){
                if(now<=k){
                    cout << p[i] << endl;
                    return 0;
                }
                break;
            }
            else if(now>rmoda[ms]-rmoda[j+1]) break;
        }
    }
    cout << 1 << endl;
return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#define rg register

inline void read(int&x){
    char c11=getchar();x=0;while(!isdigit(c11))c11=getchar();
    while(isdigit(c11))x=x*10+c11-'0',c11=getchar();
}

inline void cmax(int&A,int B){A=A>B?A:B;}
const int inv2=500000004,p=1e9+7;
const int bs=2001,N=8007,T=201000;
int fac[N],inv[N],a[T],b[T];
int f[bs+bs+2][bs+bs+2];
int n,ans,ma,mb;

inline int qm(int x){return x<0?x+p:x<p?x:x-p;}
inline int c(int nn,int mm){return 1ll*fac[nn]*inv[mm]%p*inv[nn-mm]%p;}

void init();void work();
int main(){init();work();return 0;}

void work(){
    for(rg int i=bs-ma;i<=bs+ma;++i)
    for(rg int j=bs-mb;j<=bs+mb;++j)
        f[i][j]=qm(f[i][j]+qm(f[i-1][j]+f[i][j-1]));
    for(rg int i=1;i<=n;++i){
        ans=qm(ans+f[a[i]+bs][b[i]+bs]);
        ans=qm(ans-c(a[i]+a[i]+b[i]+b[i],a[i]+a[i]));
    }
    printf("%lld\n",1ll*ans*inv2%p);
}

void init(){
    read(n);
    for(rg int i=1;i<=n;++i){
        read(a[i]),cmax(ma,a[i]);
        read(b[i]),cmax(mb,b[i]);
        ++f[bs-a[i]][bs-b[i]];
    }
    fac[0]=inv[0]=1;
    for(rg int i=1;i<N;++i)fac[i]=1ll*fac[i-1]*i%p;
    inv[N-1]=923470334;
    for(rg int i=N-2;i;--i)inv[i]=1ll*inv[i+1]*(i+1)%p;
}

Measured memory_bytes: 64384
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))

n = int(input())
li_call = []
for i in range(n):
  li_call.append(int(input()))
for i in range(n):
  for j in range(3):
    if li_a[j] == li_call[i]:
      li_a[j] = 0
  for k in range(3):
    if li_b[k] == li_call[i]:
      li_b[k] = 0
  for l in range(3):
    if li_c[l] == li_call[i]:
      li_c[l] = 0
li_o = [0, 0, 0]
li_d = [li_a[0], li_b[0], li_c[0]]
li_e = [li_a[1], li_b[1], li_c[1]]
li_f = [li_a[2], li_b[2], li_c[2]]
li_g = [li_a[0], li_b[1], li_c[2]]
li_h = [li_a[2], li_b[1], li_c[0]]
if li_a == li_o:
  print("Yes")
elif li_b == li_o:
  print("Yes")
elif li_c == li_o:
  print("Yes")
elif li_d == li_o:
  print("Yes")
elif li_e == li_o:
  print("Yes")
elif li_f == li_o:
  print("Yes")
elif li_g == li_o:
  print("Yes")
elif li_h == li_o:
  print("Yes")

else:
  print("No")

Measured memory_bytes: 3064
package main

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

func main() {
	var N int
	fmt.Scan(&N)

	var cardStr string
	sc := bufio.NewScanner(os.Stdin)
	if sc.Scan() {
		cardStr = sc.Text()
	}

	var total []int
	total = make([]int, N, N)

	cardArray := strings.Split(cardStr, " ")

	for i, valueStr := range cardArray {
		value, _ := strconv.Atoi(valueStr)
		total[i] = value
	}

	isDenied := false
	for _, value := range total {
		if value%2 == 0 {
			if value%3 != 0 && value%5 != 0 {
				fmt.Println("DENIED")
				isDenied = true
				break
			}
		}
	}
	if !isDenied {
		fmt.Println("APPROVED")
	}
}


Measured memory_bytes: 640
(defvar pm
  (list '+ '-))

(let* ((line (read-line))
       (a (parse-integer (subseq line 0 1)))
       (b (parse-integer (subseq line 1 2)))
       (c (parse-integer (subseq line 2 3)))
       (d (parse-integer (subseq line 3 4))))
  (tagbody
    start
    (loop for i in pm do
      (loop for j in pm do
        (loop for k in pm do
          (when (= 7
                   (funcall (symbol-function k) (funcall (symbol-function j) (funcall (symbol-function i) a b) c) d))
            (format t "~A~A~A~A~A~A~A=7"
                    a (symbol-name i)
                    b (symbol-name j)
                    c (symbol-name k)
                    d)
            (go finish)))))
    finish))


Measured memory_bytes: 11240
#define MAX(x,y) x>y?x:y
typedef long long int ll;

ll N,C,x[100002],v[100002];

ll Solve(){
	ll lg=0,tem=0;
        ll max[100001];
        max[0]=0;
	for(ll i=0;i<N;i++)
	{
		lg+=v[i+1]+x[i]-x[i+1];
		max[i+1]=MAX(max[i],lg);
	}
	ll ans=max[N];
	for(ll i=N;i>1;i--)
	{
		tem+=v[i]+x[i]-x[i+1];
		ans=MAX(tem+x[i]-C+max[i-1],ans);
	}
	return ans;
}

int main(){
	scanf("%lld %lld",&N,&C);
	for(ll i=0;i<N;i++) scanf("%lld %lld",&x[i+1],&v[i+1]);
	x[N+1]=C;
        x[0]=0;
	ll Ans1=Solve();
	for(ll i=1;i<=N;i++) x[i]=C-x[i];
        for(ll i=1;i<=N/2;i++) {
            ll t=x[i];
            x[i]=x[N+1-i];
            x[N+1-i]=t;
            t=v[i];
            v[i]=v[N+1-i];
            v[N+1-i]=t;
        }
	ll Ans2=Solve();
	printf("%lld",MAX(Ans1,Ans2));
	return 0;
}


Measured memory_bytes: 2560
require 'set'
cards = {
  'S': Set.new((1..13).to_a),
  'H': Set.new((1..13).to_a),
  'C': Set.new((1..13).to_a),
  'D': Set.new((1..13).to_a)
}
gets.to_i.times do
  m, n = gets.chomp.split
  cards[m.to_sym].delete(n.to_i)
end
cards.each do |m, r|
  r.each do |c|
    puts "#{m} #{c}"
  end
end


Measured memory_bytes: 6976
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	A, B, K := sc.nextInt(), sc.nextInt(), sc.nextInt()
	ans := []int{}
	for i := 1; i <= 100; i++ {
		if A%i == 0 && B%i == 0 {
			ans = append(ans, i)
		}
	}
	fmt.Println(ans[len(ans)-K])
}


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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    bool ans = true;
    rep(i, N) {
        if (A[i] % 2) continue;
        if (A[i] % 3 != 0 && A[i] % 5 != 0) ans = false;
    }

    if (ans) puts("APPROVED");
    else puts("DENIED");
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <utility>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <sstream>
#include <cstring>
#include <bitset>
#include <stack>
using namespace std;
#define MP make_pair
#define PB push_back
const int INF=1e9;

int n,a[200005];

int main()
{
	long long c1=0,c2=0;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		c1+=(long long)a[i];
	}
	long long ans=1e18;
	for (int i=1;i<n;i++)
	{
		c1-=(long long)a[i];
		c2+=(long long)a[i];
		ans=min(ans,abs(c1-c2));
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> a;
    a.reserve(n);

    for (int i = 0; i < n; ++i) {
        vector<int> v(3);
        cin >> v[0] >> v[1] >> v[2];
        a.push_back(move(v));
    }

    int dp[n][3];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for (int i = 1; i < n; ++i) {
        auto& v = a[i];
        auto& prev = dp[i - 1];
        int c1 = max(v[0] + prev[1], v[0] + prev[2]);
        int c2 = max(v[1] + prev[0], v[1] + prev[2]);
        int c3 = max(v[2] + prev[0], v[2] + prev[1]);

        /*
        cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << '\n';
        cout << c1 << " " << c2 << " " << c3 << '\n';
        */

        dp[i][0] = c1;
        dp[i][1] = c2;
        dp[i][2] = c3;
    }

    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << '\n';

    return 0;
}


Measured memory_bytes: 6912
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	int A,B;
	cin>>A>>B;
	cout<<6-A-B<<endl;
	return 0;
}


Measured memory_bytes: 256
a = [int(input()) for _ in range(5)]

ans = 0
b = []
for aa in a:
    if aa%10 == 0:
        ans += aa
    else:
        b.append((aa, aa%10))
if len(b) > 0:
    b = sorted(b, key = lambda x: x[1], reverse = True)
    ans += sum([10*(bb//10+1) for bb, _ in b[:-1]])
    ans += b[-1][0]
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
//#define int long long
const int MOD = 1e9 + 7;
using ll = long long;
using intpair = pair<int, int>;
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

signed main(){
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    
    h += m/60.0;
    
    long double dx = b*cos(m/60.0 * 2*M_PI) - a*cos(h/12.0 * 2*M_PI);
    long double dy = b*sin(m/60.0 * 2*M_PI) - a*sin(h/12.0 * 2*M_PI);
    
    long double ans = hypot(dx, dy);
    
    printf("%.14Lf\n",ans);
}

Measured memory_bytes: 4128
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstdint>
using namespace std;

int main()
{
  uint64_t n;
  uint64_t d = 0;
  vector<uint64_t> v;

  cin >> n;
  v.resize(n+1);

  for (uint64_t i = 0; i <= n; ++i) {
    cin >> v[i];
  }

  for (uint64_t i = 0; i < n; ++i) {
    uint64_t a;
    cin >> a;
    if (v[i] + v[i+1] >= a) {
      d += a;
      if (v[i] < a) {
        v[i+1] -= (a - v[i]);
      }
    } else {
      d += v[i] + v[i+1];
      v[i+1] = 0;
    }
  }

  cout << d << endl;

  return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

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

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VP p(n);
    REP(i,0,n) cin >> p[i].first >> p[i].second;
    sort(all(p), [](auto &l, auto &r) {return l.second < r.second;});
    LL sum = 0;
    REP(i,0,n) {
        sum += p[i].first;
        if (sum > p[i].second) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main() {
    solve();
    
    return 0;
}

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

int main()
{
	long long int x, a = 100;
	int ans = 0;
	cin>>x;
	while(1){
		a = a * 1.01;
		ans++;
		if(a >= x){
			cout<<ans<<endl;
			return 0;
		}
	}
}

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

int main(){
    long long a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
    if(abs(a-b)<=t*(v-w)){
        cout << "YES" << endl;;
    }else{
        cout << "NO" << endl;;
    }
}



Measured memory_bytes: 3632
#include <stdio.h>
int main()
{
    int a,b,c;
    scanf(" %d%d%d",&a,&b,&c);
    if((-100<=a&&a<=1000)&&(-100<=b&&b<=100)&&(-100<=c&&c<=100)){

        if(c>=a&&c<=b){printf("Yes");}
        else {printf("No");}
    }

    return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    val inLine1 = readLine()?.split(" ").orEmpty()
    val inLine2 = readLine()?.split(" ").orEmpty()
    val numK = inLine1[0].toInt()
    val numN = inLine1[1].toInt()
    val houseList = mutableListOf<Int>()
    val pathList = mutableListOf<Int>()


    for(i in inLine2.indices){
        houseList.add(inLine2[i].toInt())
    }
    var i = 0
    while(i < numN) {
        if (i < numN - 1){
            pathList.add(houseList[i + 1] - houseList[i])
        }else{
            pathList.add((numK - houseList[i]) + houseList[0])
        }
        i += 1
    }

    val result = numK - pathList.max()!!

    println(result)
}

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


int main() {
  int a, b, x, y;
  scanf("%d%d%d%d", &a, &b, &x, &y);
  printf("%lf %d\n", double(a)*double(b) / 2, x + x == a&&y + y == b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, X;
	cin >> N >> X;
	vector<cat> B(N), L(N), U(N);
	for(int i = 0; i < N; i++) cin >> B[i] >> L[i] >> U[i];
	vector<cat> C_l(N), C_h(N);
	for(int i = 0; i < N; i++) {
		C_l[i] = -1LL * L[i] * B[i];
		C_h[i] = 1LL * U[i] * (X-B[i]);
	}
	cat sum0 = 0;
	vector< pair<cat, int> > dif(N);
	for(int i = 0; i < N; i++) {
		dif[i] = {C_h[i]-C_l[i], i};
		sum0 += C_l[i];
	}
	sort(begin(dif), end(dif));
	vector<cat> dif_ssum(N+1, 0);
	for(int i = N-1; i >= 0; i--) dif_ssum[i] = dif_ssum[i+1] + dif[i].ff;
	cat cost_min = -1, cost_max = 1LL * X * N;
	while(cost_max-cost_min > 1) {
		cat cost = (cost_min + cost_max) / 2;
		cat x = cost % X, cnt = cost / X;
		bool ok = false;
		for(int i = 0; i < N; i++) {
			int id = dif[i].ss;
			cat sum = sum0;
			if(x <= B[id]) sum += x * L[id];
			else sum += (x-B[id]) * U[id] + B[id] * L[id];
			if(i < N-cnt) sum += dif_ssum[N-cnt];
			else sum += dif_ssum[N-cnt-1] - dif[i].ff;
			if(sum >= 0) {
				ok = true;
				break;
			}
		}
		if(ok) cost_max = cost;
		else cost_min = cost;
	}
	cout << cost_max << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 6528
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    long long n,m;
    scanf("%lld%lld",&n,&m);
    printf("%lld\n",(100*(n-m)+1900*m)*llpow(2,m));
    return 0;
}

Measured memory_bytes: 128