akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n;
    intl cnt = 0;
    for(intl i = 1; i <= n; i += 2){
        intl a = 0;
        for(intl j = 1;j <= i; j++){
            if(!(i % j)){
                a++;
            }
        }
        if(a == 8)cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(a * 10 + b + c, max(a + b * 10 + c, a + b + c * 10)) << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){    
  int A , B , C , K , T = 0;  
  cin >> A >> B >> C >> K;
  if(0 <= A - K)
    cout << K << endl;
  else
  {
    T = K - A;
    if(0 >= T - B)
      cout << A << endl;
    else
    {
      T = T - B;
      cout << A -T << endl;
    }
  }
}

Measured memory_bytes: 3148
k = int(input())

res = []
q = list(range(1,10))
while len(q)>0:
    a = q.pop()
    res.append(a)
    if a<4*10**10:
        d = a%10
        if d>0:
            q.append(10*a+d-1)
        q.append(10*a+d)
        if d<9:
            q.append(10*a+d+1)

res.sort()
print(res[k-1])

Measured memory_bytes: 49220
let rec range x y = if x > y then [] else x :: range (x+1) y

let isPrime n =
  if n = 2 then true
  else
    range 2 (int_of_float (sqrt (float n)))
      |> List.map (fun x -> n mod x = 0)
      |> List.for_all (fun x -> not x)

let () =
  let counter = ref 0 in
  let n = Scanf.scanf "%d\n" (fun x -> x) in
  for i = 1 to n do
    let m = Scanf.scanf "%d\n" (fun x -> x) in
    if isPrime m then counter := !counter + 1 else ();
  done;
  Printf.printf "%d\n" !counter

      

Measured memory_bytes: 5644
#include<stdio.h>

int main(void){
  int N,flag=0;
  scanf("%d",&N);
  for(int i=1;i<10;i++){
    if(N%i==0){
      int b = N/i;
        if(b<10){
          flag = 1;
          break;
        }
    }
  }
  if(flag==0){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main() {
    int a,b,c,d,e,k;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> k;

    if (e-d > k) {cout << ":(" << endl; return 0;}
    if (e-c > k) {cout << ":(" << endl; return 0;}
    if (e-b > k) {cout << ":(" << endl; return 0;}
    if (e-a > k) {cout << ":(" << endl; return 0;}

    if (d-c > k) {cout << ":(" << endl; return 0;}
    if (d-b > k) {cout << ":(" << endl; return 0;}
    if (d-a > k) {cout << ":(" << endl; return 0;}

    if (c-b > k) {cout << ":(" << endl; return 0;}
    if (c-a > k) {cout << ":(" << endl; return 0;}

    if (b-a > k) {cout << ":(" << endl; return 0;}

    cout << "Yay!" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const ll mod = 1e9+7;
const ll INF = ll(1e18)+1;
const ll MAXN = 1e6;

int main()
{
    int n;
    int c;

    cin>>n;
    int v[n]={0};
    int income[n]={0};
    rep(i,n)
    {
        cin>>v[i];
    }
    rep(i,n)
    {
        cin>>c;
        income[i]=(v[i]-c);
    }
    int ans=0;
    rep(i,n)
    {
        if(income[i]>0)
        {
            ans+=income[i];
        }
    }

    cout<<ans;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 110;
int n, x;
int a[maxn];
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n >> x;
	for(int i = 1; i <= n; i ++)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	for(int i = 1; i < n; i ++)
	{
		if(x >= a[i])
			x -= a[i];
		else
		{
			cout << i - 1 << endl;
			return 0;
		}
	}
	if(x == a[n])
		cout << n << endl;
	else
		cout << n - 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
main(){
  int a[5];
  while(~scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])){
    int card[14]={};
    int p=1;
    int pan=0;
    int tpan=0;
    for(int i=0;i<5;i++){
      card[a[i]]++;
      if(card[a[i]]>3) p=7;
      else if(card[a[i]]>2){
	tpan++;
	pan--;
      }
      else if(card[a[i]]>1){
	pan++;
      }
    }
    if(p==7) puts("four card");
    else if(tpan==1 && pan==1) puts("full house");
    else if(tpan==1) puts("three card");
    else if(pan==2) puts("two pair");
    else if(pan==1) puts("one pair");
    else{
      bool f=false;
      for(int i=0;i<10;i++){
	for(int j=0;j<5;j++){
	  int ind = (i+j)%14+1;
	  if(!card[ind]) break;
	  if(j==4) f=true;
	}
	if(f) break;
      }
      if(f) puts("straight");
      else
	puts("null");
    }
    
  }
}

Measured memory_bytes: 1168
#include<stdio.h>

#include<string.h>

#include<math.h>

int main(){

int n;

int m;

scanf("%d%d ",&n,&m);



int a[m],sum=0;

for(int b=0;b<m;b++){

 scanf("%d",&a[b]);

 sum+=a[b];}



if(sum<=n)

 printf("%d\n",n-sum);



else

 puts("-1\n");



return 0;}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//value at the index->find_by_order(index), index->order_of_key(elme) [both in O(logn)]
//mt19937 mt(chrono::high_resolution_clock::now().time_since_epoch().count());
//cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define setbits(x)      __builtin_popcountll(x)
#define leadzero(x)     __builtin_clz(x)
#define trailzero(x)    __builtin_ctz(x)
#define bitsparity(x)   __builtin_parity(x)
#define mod             1000000007
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll              long long 
#define pre(y,x)        fixed<<setprecision(y)<<x
#define dbg1(x)         cerr << "|" << #x << ": " << (x) << "|\n";
#define dbg2(x,y)       cerr << "|" << #x << ": " << (x) << "|" << #y << ": " << (y) << "|\n";
#define dbg3(x,y,z)     cerr << "|" << #x << ": " << (x) << "|" << #y << ": " << (y) << "|" << #z << ": " << (z) << "|\n";
#define ff              first
#define ss              second
#define pb              push_back
#define eb              emplace_back
#define popb            pop_back
#define all(v)          v.begin(), v.end()
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii;
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl;
typedef vector<string> vs;
ll power(ll a,ll b){if(b==0) return 1;ll res;while(b>0){if(b&1) res *= a;a *= a;b >>=1;}return res;}
int is(int n){if(n==1) return 0;for(int i=2;i*i<=n;i++){if(n%i==0) return false;}return true;}
bool ispoweroftwo(ll x){ return (x&&!(x&(x-1)));}
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
const int inf = 1e9;
const double pi = acos(-1);
const ll INF = 1e18;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll powr(ll a, ll b) {
    a %= mod;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}
inline void solve(){
		int n;
		cin >> n;
		ll ans = powr(10, n);
		ans -= 2ll*powr(9, n);
		(ans += mod+mod) %= mod;
		ans += powr(8, n);
		ans %= mod;
		cout << ans << endl;
}	
int main(){
		FIO;
//		int t; cin >> t;
//		while(t--)
		solve();
		return 0;	
}
/*

*/

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
#define pii pair <int , int > 
#define pll pair < ll , ll >
vector <int > adj[200005] ;
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	int n , m ;
	cin >> n >> m ;
	
	for(int i = 0 ; i < n ; i++){
		int a , b ;
		cin >> a >> b ;
		if(a <= m)
			adj[a].pb(b) ;
	}
	ll ans = 0 ;
	priority_queue < int > pq ;
	for(int i = 1 ; i <= m ; i++){
		for(auto it : adj[i])pq.push(it) ;
		if(!pq.empty()){
			ans += pq.top() ;
			pq.pop() ;
		}
	}
	cout << ans ;
}


Measured memory_bytes: 8064
import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.util.StringTokenizer;

    public class Main {
     
    	public static void main(String[] args) {
    	
     
    		InputStream inputStream = System.in;
			OutputStream outputStream = System.out;
			IOUtils in = new IOUtils(inputStream);
			PrintWriter out = new PrintWriter(outputStream);
    		Solution solver = new Solution();
    		solver.solve(in, out);
    		out.close();
    		
    	
    	}
     
    	static class Solution {
    		
    		public void solve(IOUtils in, PrintWriter out) {
     
    			int a = in.nextInt();
    			int b = in.nextInt();
    			int c = a + b;
    			int goats = 3;
    			if (a % goats == 0 || b % goats == 0 || c % goats == 0) {
    				out.println("Possible");
    			} else {
    				out.println("Impossible");
    			}
     
    		}
     
    	}
     
    	static class IOUtils {

			private BufferedReader reader;
			private StringTokenizer tokenizer;

			public IOUtils(InputStream stream) {
				reader = new BufferedReader(new InputStreamReader(stream));
				tokenizer = null;
			}

			public String next() {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					try {
						tokenizer = new StringTokenizer(reader.readLine());
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				}
				return tokenizer.nextToken();
			}

			public int nextInt() {
				return Integer.parseInt(next());
			}

		}
    }

Measured memory_bytes: 22996
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int h = Integer.parseInt(in.next());
            int w = Integer.parseInt(in.next());
            int hc = 0;
            int wc = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if ("snuke".equals(in.next())) {
                        hc = i;
                        wc = j;
                    }
                }
            }

            // 出力
            out.println(String.valueOf((char) (wc + 'A')) + Integer.toString(hc + 1));

        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(void){
    int h,w,d;
    cin>>h>>w>>d;
    int Lx[90001],Ly[90001];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int a;cin>>a;
            Lx[a]=i;Ly[a]=j;
        }
    }
    
    int power[90001]={};
    for(int i=d+1;i<=h*w;i++){
        power[i]=power[i-d]+abs(Lx[i]-Lx[i-d])+abs(Ly[i]-Ly[i-d]);
    }
    
    
    int q;cin>>q;
    for(int i=0;i<q;i++){
        int l,r;cin>>l>>r;
        cout<<power[r]-power[l]<<endl;
    }
}

Measured memory_bytes: 2176
#include<iostream>
#include<string>
#include <vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
using vll = vector<ll>;
using Graph = vii;
const ll MOD = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vi d(n);
	rep(i, n) cin >> d[i];
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}


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

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

using namespace std;


int main(){
	int n;
	string s,t;
	cin>>n>>s>>t;
	rep(i,n)cout<<s[i]<<t[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a=0,b=0,day=0;

	while(day != 10)
	{
		scanf("%d %d",&a,&b);
		if(a==0 || b ==0)break;
		else if(a==1 || a==4 || a==7)
			day = 3 + b % 7;
		else if(a==2 || a==8)
			day = 6 + b % 7;
		else if(a==3 || a==11)
			day = b % 7;
		else if(a==5)
			day = 5 + b % 7;
		else if(a == 6)
			day = 1 + b % 7;
		else if(a==9 || a==12)
			day = 2 + b % 7;
		else 
			day = 4 + b % 7;
		if(day > 6)
			day-=7;
		switch (day)
		{
		case 1:
			printf("Monday\n");
			break;
		case 2:
			printf("Tuesday\n");
			break;
		case 3:
			printf("Wednesday\n");
			break;
		case 4:
			printf("Thursday\n");
			break;
		case 5:
			printf("Friday\n");
			break;
		case 6:
			printf("Saturday\n");
			break;
		case 0:
			printf("Sunday\n");
			break;
		}
	}
  return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    ll all = 0;
    REP(i, N){
        cin >> A[i];
        all = all^A[i];
    }

    REP(i, N){
        cout << (all^A[i]) << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    long long n; cin >> n;
    long long ans = 0;
    if (n % 2 == 1) {
        cout << 0 << "\n";
    } else {
        long long cur = 10;
        while (cur <= n) {
            ans += n / cur;
            cur *= 5;
        }
        cout << ans << "\n";
    }
}

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

int main(){
    int arr[10];
    for(int i=0; i<10; i++){
        cin>>arr[i];
    }
    sort(arr,arr+10);
    cout<<arr[9]<<endl;
    cout<<arr[8]<<endl;
    cout<<arr[7]<<endl;
}

Measured memory_bytes: 1176
n = int(input())
CSF = [list(map(int, input().split())) for _ in range(n-1)]
C, S, F = zip(*CSF)
for i in range(n):
  t = 0
  for j in range(i, n-1):
    if t < S[j]:
      t = S[j]
    elif t%F[j]:
      t += F[j]-t%F[j]
    t += C[j]
  print(t)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;

int main(){
  int N;
  string S;
  cin>>N>>S;
  int ans=0;
  for(int i=1;i<N;i++){
    int x[26]={0};
    int y[26]={0};
    for(int j=0;j<N;j++){
      if(j<i) x[S[j]-'a']++;
      else y[S[j]-'a']++;
    }
    int tmp=0;
    for(int j=0;j<26;j++){
      if(x[j]>0&&y[j]>0) tmp++;
    }
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
using namespace std;
#define pr(x) cout<<x
#define prs cout<<" "
#define prn cout<<"\n"
#define sc(x) cin>>x
#define ll long long int

int n,k;
int a[1000005];
int dp[1000005];

int solve(int i)
{ 
    //cout<<n<<k<<endl;
    if(i == (n-1)) return 0;
    if(i >= n) return INT_MAX;
    if(dp[i] != -1)  return dp[i];
    vector<int> v(k,INT_MAX);
    for(int j=1; j<=k; j++)
    {
        if(j+i > n-1)
         break;
        else
         v[j-1] = abs(a[i] - a[i+j])+solve(i+j);
    }
    dp[i] = *min_element(v.begin(), v.end());
    v.clear();
    return dp[i];
}

int main()
{
    ios :: sync_with_stdio(false); cin.tie(0);
    int t=1;
    //cin >> t;
    for(int i9 = 1; i9 <= t; i9++)
    {
        cin>>n>>k;
        memset(dp, -1, sizeof(dp));
        for(int i=0; i<n; i++)
          cin>>a[i];
        cout<<solve(0)<<endl;
        //cout<<"Cae #"<<i9<<": "<<res<<endl;
    }
}

Measured memory_bytes: 54784
_=input()
T,A = map(int,input().split())
H = [int(x) for x in input().split()]
min_i = -1
min_d = 10**10
for i,h in enumerate(H):
  d = abs(A-(T-h*0.006))
  if d<min_d:
    min_d=d
    min_i=i
print(min_i+1)

Measured memory_bytes: 3060
#include <stdio.h>

int main() {
  int a, b, c, x;
  int i, j, k;
  int ans = 0;

  scanf("%d %d %d %d", &a, &b, &c, &x);

  for (i = 0; i <= a; i++) {
    for (j = 0; j <= b; j++) {
      for (k = 0; k <= c; k++) {
        if ( (500*i + 100*j + 50*k) == x) {
          ans++;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

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

using namespace std;
typedef long long ll;
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}

int main(){
	ll A,B,C; cin>>A>>B>>C;
	if(maxx(A,B,C)*2==A+B+C) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

#ifndef errOut
#define errOut(s)
#endif

using Value = int;

Value calc(Value a, Value b, Value c, Value d) {
    Value ret = std::min(a, b) + std::min(c, d);
    return ret;
}

int main() {
    Value a, b, c, d;
    std::cin >> a >> b >> c >> d;
    auto ret = calc(a, b, c, d);
    std::cout << ret << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,K;
  cin>>N>>K;
 
  if(K%2==0){
    ll ans1=0;
    ll ans2=0;
    for(ll i=1;i<=N;i++){
      if(i%K==0){
        ans1++;
      }
      else if(i%K==K/2){
        ans2++;
    }
  }
    
    cout<<ans1*ans1*ans1+ans2*ans2*ans2<<endl;
  }
  else{
    ll ans=0;
for(ll i=1;i<=N;i++){
  if(i%K==0){
    ans++;
  }
}
   cout<<ans*ans*ans<<endl; 
  }
    
    
  }
    
  
  


Measured memory_bytes: 256
S = int(input())
 
A = [0,0,1]
if S == 1 or S == 2:
  print(0)
elif S == 3:
  print(1)
else:
  for i in range(3,S):
    A += [A[i-1] + A[i-3]]
  print(A[i] % (10 ** 9 + 7))

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

const int MAX_N = 1500000;

vector<int> prime;
bool is_prime[MAX_N+1];

void siege(int n) {
    for (int i = 0; i <= n; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime.push_back(i);
            for (int j = 2*i; j <= n; j += i) is_prime[j] = false;
        }
    }
}

int main(void) {

    siege(MAX_N);
    int N;
    while (cin >> N, N) {
        if (is_prime[N]) {
            cout << 0 << endl;
        } else {
            int idx = lower_bound(prime.begin(), prime.end(), N) - prime.begin();
            cout << prime[idx]-prime[idx-1] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4768
#include <iostream>
#include <string>
#include <array>

using namespace std;


int solve(const string& s1, const string& s2) {
    const size_t N = 1000 + 1;
    int A[N][N] = {0};

    auto m = s1.size();
    auto n = s2.size();
    for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (s1[i-1] == s2[j-1]) {
                A[i][j] = A[i-1][j-1] + 1;
            } else {
                A[i][j] = max(A[i][j-1], A[i-1][j]);
            }
        }
    }
    return A[m][n];
}

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

    string s1, s2;
    for (int i = 0; i < q; ++i) {
        cin >> s1 >> s2;
        cout << solve(s1, s2) << endl;
    }

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	long long sum = 0;
	long long change = 0;
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) cin >> a[i];
	sum = a[0];
	if (sum <= 0) {
		change += -sum + 1;
		sum = 1;
	}
	for (int i = 1; i < n; i++) {
		sum += a[i];
		if (i % 2 == 0 && sum <= 0) {
			change += -sum + 1;
			sum = 1;
		}
		if (i % 2 == 1 && sum >= 0) {
			change += sum + 1;
			sum = -1;
		}
	}
	long long ans = change;

	sum = a[0];
	change = 0;
	if (sum >= 0) {
		change += sum + 1;
		sum = -1;
	}
	for (int i = 1; i < n; i++) {
		sum += a[i];
		if (i % 2 == 0 && sum >= 0) {
			change += sum + 1;
			sum = -1;
		}
		if (i % 2 == 1 && sum <= 0) {
			change += -sum + 1;
			sum = 1;
		}
	}
	ans = ans > change ? change : ans;

	cout << ans;
}

Measured memory_bytes: 640
S = list(input())
ans = "WA"

if S[0] == "A":
    C_num = 0
    for char in S[2:-1]:
        if char == "C":
            C_num += 1
    if C_num == 1:
        check_S = S[1:]
        C_index = check_S.index("C")
        del check_S[C_index]
        frag = True
        for char in check_S:
            if char.isupper():
                frag = False
                break
        if frag == True:
            ans = "AC"

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    int ans1 = a[0];
    int ans2 = a[1];
    int dif = a[0];
    int mid = a[0] >> 1;
    for(int i = 1; i < n; ++i){
        int foo = abs(mid - a[i]);
        if(foo < dif){
            ans2 = a[i];
            dif = foo;
        }
    }
    cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 640
K,N=map(int,input().split())
A=list(map(int,input().split()))
m=0
for i in range(N-1):
  if m<(A[i+1]-A[i]):
    m=(A[i+1]-A[i])
if m<(K-A[-1]+A[0]):
  print(A[-1]-A[0])
else:
  print(K-m)

Measured memory_bytes: 25964
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	char b;
 	cin >> b;
 	if(b == 'A')
 		cout << 'T' << endl;
 	if(b == 'T')
 		cout << 'A' << endl;
 	if(b == 'C')
 		cout << 'G' << endl;
 	if(b == 'G')
 		cout << 'C' << endl;

 }

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

// 3000*5
#define BUF_SIZE 20000

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(double *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtod(tmp, NULL);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

#define NUM_MAX 2999

int main(void) {
    int num = get_int();
    static double ps[NUM_MAX+1];
    static double dp[NUM_MAX+1][NUM_MAX+1];
    dp[0][0] = 1;
    int i, heads;
    fget_array(&ps[1], num);
    for(i = 1; i <= num; i++) {
        for(heads = 0; heads <= i; heads++) {
            double res = 0;
            res = dp[i-1][heads] * (1.0-ps[i]);
            if(heads>0) res += dp[i-1][heads-1] * ps[i];
            dp[i][heads] = res;
        }
    }
    double ans = 0;
    for(i = (num/2 + 1); i <= num; i++) {
        ans += dp[num][i];
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 68864
#include <stdio.h> 

int main(void){

    int n; 

    int x;  

   int i;   

  long long sum; 

    int min,max;

    scanf("%d",&n);  

   sum=0;

    min=1000000; 

    max=-1000000; 

    for(i=0;i<n;i++){  

       scanf("%d",&x);  

       sum+=x;    

     if(x<min){ 

            min=x;  

       }   

      if(x>max){ 

            max=x;   

      }   

  } 

    printf("%d %d %lld\n",min,max,sum); 

    return 0;

} 

Measured memory_bytes: 600
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int n;
  cin >> n;
  vector<vector<int>> d(n,vector<int>(2));
  rep(i,n){
    rep(j,2) cin >> d.at(i).at(j);
  }
  bool ans = false;
  int num = 0;
  rep(i,n){
    if(d.at(i).at(0) == d.at(i).at(1)){
      num++;
    }
    else num = 0;
    if(num == 3){
      ans = true;
      break;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3636
import * as fs from "fs";

let [line1, ...lines] = fs.readFileSync("/dev/stdin", "utf8").trim().split('\n');

let [R, C, K] = line1.split(' ').map(Number);
let table: number[][] = new Array(R).fill([]).map(() => new Array(C).fill(0));

for(let i=0; i<K; i++) {
    let [r, c, v] = lines[i].split(" ").map(Number);
    table[r-1][c-1] = v;
}

let dp1 = new Array(C).fill(Number.NEGATIVE_INFINITY);
let dp2 = new Array(C).fill(Number.NEGATIVE_INFINITY);
let dp3 = new Array(C).fill(Number.NEGATIVE_INFINITY);
let old_row = new Array(C).fill(Number.NEGATIVE_INFINITY);

for(let i=0; i<R; i++) {
    dp1[0] = table[i][0];
    dp2[0] = Number.NEGATIVE_INFINITY;
    dp3[0] = Number.NEGATIVE_INFINITY;
    for(let j=0; j<C; j++) {
        if (j>0) {
            dp3[j] = Math.max(dp3[j-1], dp2[j-1]+table[i][j]);
            dp2[j] = Math.max(dp2[j-1], dp1[j-1]+table[i][j]);
            dp1[j] = dp1[j-1];
        }
        dp1[j] = Math.max(dp1[j], table[i][j], old_row[j]+table[i][j]);
        old_row[j] = Math.max(dp1[j], dp2[j], dp3[j]);
    }
}

console.log(old_row[C-1]);


Measured memory_bytes: 219192
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

ll n, m;
vector<string> s;
vvll d;

void bfs(ll si, ll sj) {
    queue<pll> que;
    d[si][sj] = 0;
    que.emplace(si, sj);
    while(!que.empty()) {
        pll p = que.front();
        que.pop();
        ll _d = d[p.first][p.second];
        ll i = p.first;
        ll j = p.second;
        if(i+1 < n && s[i+1][j] != '#' && d[i+1][j] == -1) {
            que.emplace(i+1, j);
            d[i+1][j] = _d + 1;
        }
        if(j+1 < m && s[i][j+1] != '#' && d[i][j+1] == -1) {
            que.emplace(i, j+1);
            d[i][j+1] = _d + 1;
        }
    }
    return;
}

void solve() {
    cin >> n >> m;
    s = vector<string>(n);
    rep(i, n) cin >> s[i];
    ll cntk = 0, cnts = 0;
    rep(i, n) rep(j, m) {
        if(s[i][j] == 'o') cntk++;
        if(s[i][j] != '#') cnts++;
    }
    mcf_graph<ll, ll> g(2 + cntk + cnts);
    for(int i = 0; i < cntk; ++i) {
        g.add_edge(0, i+1, 1, 0);
    }
    for(int i = 0; i < cnts; ++i) {
        g.add_edge(1+cntk+i, 1+cntk+cnts, 1, 0);
    }
    ll cnt_cntk = 0;
    rep(i, n) rep(j, m) {
        if(s[i][j] != 'o') continue;
        d.assign(n, vll(m, -1));
        bfs(i, j);
        ll cnt_cnts = 0;
        rep(i2, n) rep(j2, m) {
            if(s[i2][j2] == '#') continue;
            if(d[i2][j2] != -1) g.add_edge(1+cnt_cntk, 1+cntk+cnt_cnts, 1, 1000-d[i2][j2]);
            ++cnt_cnts;
        }
        ++cnt_cntk;
    }
    pll p = g.flow(0, 1+cntk+cnts);
    cout << p.first * 1000 - p.second << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

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

int	main () {
  string S, T;
  cin >> S >> T;
  if (S.length() < T.length()) {
    cout << "UNRESTORABLE";
  }
  else {
    bool check_s, check_l = false;
    string U, ans;
    for (int i = 0; i < S.length() - T.length() + 1; i++) {
      check_s = true;
      for (int j = 0; j < T.length(); j++) {
        if (S[i+j] != '?' && S[i+j] != T[j]) {
          check_s = false;
        }
      }
      if (check_s) {
        check_l = true;
        U = S;
        for (int j = 0; j < T.length(); j++) {
          U[i+j] = T[j];
        }
        for (int j = 0; j < S.length(); j++) {
          if (U[j] == '?') {
            U[j] = 'a';
          }
        }
        ans = U;
      }
    }
    if (check_l) {
      cout << ans;
    }
    else {
      cout << "UNRESTORABLE";
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int MOD=1000000007;
long long ans;
int dp[101][4][4][4];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<4;i++)
	{
		for(int j=0;j<4;j++)
		{
			for(int k=0;k<4;k++)
			{
				dp[3][i][j][k]=1;
			}
		}
	}
	dp[3][0][2][1]=0;
	dp[3][2][0][1]=0;
	dp[3][0][1][2]=0;
	for(int len=0;len<n;len++)
	{
		for(int c1=0;c1<4;c1++)
		{
			for(int c2=0;c2<4;c2++)
			{
				for(int c3=0;c3<4;c3++)
				{
					if(dp[len][c1][c2][c3]==0)continue;
					for(int a=0;a<4;a++)
					{
						if(c2==0&&c3==2&&a==1)continue;
						if(c2==2&&c3==0&&a==1)continue;
						if(c2==0&&c3==1&&a==2)continue;
						if(c1==0&&c3==2&&a==1)continue;
						if(c1==0&&c2==2&&a==1)continue;
                        dp[len+1][c2][c3][a]=(dp[len+1][c2][c3][a]+dp[len][c1][c2][c3])%MOD;
					}
				}
			}
		}
	}
	for(int c1=0;c1<4;c1++)
	{
		for(int c2=0;c2<4;c2++)
		{
			for(int c3=0;c3<4;c3++)
			{
				ans+=dp[n][c1][c2][c3];
			}
		}
	}
	ans%=MOD;
	cout<<ans;
	
	return 0;
	
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const long long inf = 1e9+7;
const long long mod = 1e9+7;

int main(){
    ll R,G,B,n;
    cin>>R>>G>>B>>n;

    ll ans=0;

    for (ll i=0;i<=n/R;i++) {
        for (ll j=0;j<=n/G;j++) {
            if((n-i*R-j*G)%B==0&&n-i*R-j*G>=0){
                ans++;
            }
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3624
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];

		int sum = 0;
		int count = 0;
		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
			if(count < k) {
				sum += p[i];
				count++;
			}
		}

		int tmpAns = sum;
		for(int i = k; i < n; i++) {
			sum = sum - p[i-k] + p[i];
			tmpAns = Math.max(tmpAns, sum);
		}

		double ans = (tmpAns + k) / 2.0;
		System.out.println(ans);
	}

}


Measured memory_bytes: 79060
N, K = map(int, input().split())

MAX = 10 ** 5 + 1
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1

# Inverse
inv = [0] * (MAX + 1)
inv[1] = 1

# Inverse factorial
finv = [0] * (MAX + 1)
finv[0] = 1
finv[1] = 1

for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD


for i in range(1, K + 1):
    n = i - 1 + 2  # 赤玉の位置
    k = N - K - (i - 1)
    if k < 0:
        print(0)
    else:
        res = comb(n + k - 1, k) * comb(K - 1, i - 1) % MOD
        print(res)


Measured memory_bytes: 76856
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (N*A <= B) {
			System.out.println(N*A);
		} else {
			System.out.println(B);
		}

	}
}


Measured memory_bytes: 35688
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_len=(n); i<i##_len; ++i)
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
using ll = long long;
using namespace std;

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

    REP(i, pow(2, 3))
    {
        int sum = ABCD[0]-'0';
        FOR(j, 1, 4)
        {
            int op = i >> (j-1) & 1;
            sum += (op ? 1 : -1) * (ABCD[j]-'0');
        }

        if (sum != 7) continue;

        cout << ABCD[0];
        FOR(j, 1, 4)
        {
            int op = i >> (j-1) & 1;
            cout << (op ? '+' : '-') << ABCD[j];
        }
        cout << "=7" << endl;
        break;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int gcd(int a,int b);

int main(int argc, const char * argv[]) {
  int a,b;
  scanf("%d %d",&a,&b);
  printf("%d\n",gcd(a,b));
}

int gcd(int a,int b){
  int r;
  while((r = a % b) != 0){
    a = b;
    b = r;
  }
  return b;
}


Measured memory_bytes: 2112
#include<stdio.h>
#include<stdlib.h>

void push(int);
int pop(void);
int A[1000];
int top=0;

int main(){
  char a[100];
  int num1,num2,sum;
    
  while(scanf("%s",a)!=EOF){
    
     if(a[0]=='+'){
      num1=pop();
      num2=pop();
      push(num1+num2);
     } 

     else if(a[0]=='-'){
       num2=pop();
       num1=pop();
       push(num1-num2);
     }

     else if(a[0]=='*'){
	num1=pop();
        num2=pop();
	push(num1*num2);
     }

     else{
       push(atoi(a));	 
     }  
   }

   printf("%d\n",pop());
}

 void push(int a){
   A[++top]=a;
 }

 int pop(){
   top--;
   return A[top+1];
 }





Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const ll INF = 1LL<<60;

int main(){
    int d;
    ll g;
    cin >> d >> g;
    VP q(d);
    rep(i,d) cin >> q[i].first >> q[i].second;

    VI p(d);
    rep(i,d) p[i] = i;

    ll ans = INF;
    do{
        VI pp(d);
        rep(i,d) pp[p[i]] = i;

        ll gg = g;
        ll cnt = 0;
        rep(i,d){
            int j = pp[i];
            ll pc = (j + 1) * 100;
            ll num = min((ll)q[j].first, ((gg + (pc-1)) / pc));
            cnt += num;

            gg -= pc * num;
            gg -= q[j].second;

            if (gg <= 0) break;
        }

        ans = min(ans, cnt);

    } while(next_permutation(all(p)));

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	int n,a,b;
	while(cin>>n>>a>>b){
		if(n*a>b){
			cout<<b<<endl;
		}
		else{
			cout<<n*a<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;

LL inf = 1000000000000;
LL mod = 1000000007;

int main()
{
	LL n, k;
	cin >> n >> k;

	vector<LD> a(n);
	for (auto &e : a) {
		LL temp;
		cin >> temp;
		if (temp %2 == 0) {
			e = temp/2 + double(0.5);
		}
		else {
			e = (temp+1)/2;
		}
	}

	LD mx = 0.00;

	for (LL i = 0; i < k; ++i) {
		mx += a[i];
	}

	LD cur = mx;

	for (LL i = k; i < n; ++i) {
		cur = cur - a[i-k]+a[i];
		mx = max(mx, cur);
	}


	cout << fixed << setprecision(12) << mx << "\n";


	
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int n, m; cin >> n >> m;
    vector<int> x(m);
    for(int i = 0; i < m; i++){
        cin >> x[i];
    }
    sort(all(x));
    vector<int> y(m - 1);
    for(int i = 0; i < m - 1; i++){
        y[i] = x[i + 1] - x[i];
    }
    sort(all(y));
    int ans = 0;
    for(int i = 0; i < m - n; i++){
        ans += y[i];
    }
    if(m == 1) cout << 0 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl '\n';

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);
	ll a, b, c;
	cin >> a >> b >> c;
	if (b * c >= a) 
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

Measured memory_bytes: 3632
n, q = map(int, input().split())
s = input()
ac = [0] * (n + 1)
for i in range(n):
    ac[i + 1] = ac[i] + (1 if s[i:i + 2] == "AC" else 0)
for i in [0] * q:
    l, r = map(int, input().split())
    print(ac[r-1] - ac[l-1])

Measured memory_bytes: 9796
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b;
    
    scanf("%d%d", &a, &b);
    
    printf("%d", (a+b)%24);
    
    return 0;
}



Measured memory_bytes: 1680
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
template <typename Monoid >
struct SegmentTree{
  using F = function< Monoid(Monoid,Monoid) >;

  int sz;
  vector<Monoid> seg;

  const F f;
  const Monoid M;

  SegmentTree(int n,const F f,const Monoid &M) : f(f),M(M){
    sz = 1;
    while(sz<n) sz<<=1;
    seg.assign(sz*2,M);
  }
  void set(int k,const Monoid &v){
    seg[k+sz] = v;
  }
  void build(){
    for(int k=sz-1;k>0;k--){
      seg[k] = f(seg[2*k],seg[2*k+1]);
    }
  }
  void update(int k,const Monoid &v){
    k += sz;
    seg[k] = v;
    while(k >>= 1){
      seg[k] = f(seg[2*k],seg[2*k+1]);
    }
  }
  Monoid que(int a,int b){
    Monoid L=M,R=M;
    for(a+=sz, b+=sz;a<b;a>>=1,b>>=1){
      if(a&1) L = f(L,seg[a++]);
      if(b&1) R = f(seg[--b],R);
    }
    return f(L,R);
  }
  Monoid operator[](const int &k) const{
    return seg[k+sz];
  }
};
signed main(){
  init_io();
  int n,q,c,x,y;
  cin >> n >> q;
  SegmentTree<int> seg(n+1,[](int a,int b){return a+b;},0);
  for(int i=0;i<q;i++){
    cin >> c >> x >> y;
    if(c==0){
      seg.update(x,y+seg[x]);
    }else{
      cout << seg.que(x,y+1)<<endl;
    }
  }
}



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

#define fi first
#define se second

const int N = 100100;

using namespace std;

int main()
{
        ios_base::sync_with_stdio(0);

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

        int n, m;
        cin >> n >> m;
        int res = 0;
        for(int i = 1; i <= n; i++){
                for(int j = 10; j <= m; j++){
                        if(j / 10 > 1 && j % 10 > 1 && (j / 10) * (j % 10) == i){
                                res += 1;
                        }
                }
        }
        cout << res << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;


int main() {
  string s;cin >> s;
  cout << ((1&s.length())^(s[0]==s.back())? "First":"Second") << endl;
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <vector>
using namespace std;

int main() {
    vector<pair<int,int>> d(5);
    for(int i = 0; i < 5; i++){
        int tmp;
        cin >> tmp;
        d[i].first = tmp % 10;
        d[i].second = tmp;
    }
    sort(d.begin(),d.end());
    int sum = 0;
    int last = 0;
    for(int i = 0; i < 5; i++){
        if(d[i].first != 0){
            last = i;
            break;
        }
    }
    sum += d[last].second;
    for(int i = 0; i < 5; i++){
        if(last != i)
        sum += ceil((float)d[i].second / (float)10) * 10;
    }
    cout << sum << endl;

}

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

int main() {
  int n;
  while(scanf("%d", &n) ,n) {
    vector<int> v;
    int t;
    long long maxsum = -10000000;

    for(int i=0; i<n; ++i) {
      scanf("%d", &t);
      v.push_back(t);
    }

    for(int i=0; i<n; ++i) {
      long long tmp = 0;
      for(int j=i; j<n; ++j) {
        tmp += v[j];
        maxsum = max( maxsum, tmp );
      }
    }
    printf("%lld\n", maxsum);
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int a,p;
    string s;
    cin >> a >> p;
    p += a*3;
    cout << p/2 << endl;
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n; cin >> n;
    vector<ll> v(n); cin >> v;
    vector<vector<ll>> dp(n, vector<ll>(2, linf));
    dp[0] = vector<ll>(2, 1);
    REP(i, n-1) REP(j, 2) {
        if (dp[i][j] == linf) continue;
        if (j == (v[i+1] > v[i]) || v[i+1] == v[i]) {
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        }
        REP(k, 2) {
            dp[i+1][k] = min(dp[i+1][k], dp[i][j]+1);
        }
    }
    ll ans = linf;
    REP(i, 2) ans = min(ans, dp[n-1][i]);
    cout << ans << endl;
    // v.erase(unique(ALL(v)), v.end());
    // if (v.size() == 1) cout << 1 << endl;
    // else {
    //     vector<ll> w(n-1);
    //     REP(i, n-1) {
    //         w[i] = v[i+1] > v[i] ? 1 : -1;
    //     }
    //     w.erase(unique(ALL(w)), w.end());
    //     cout << w.size() << endl;
    // }
}


Measured memory_bytes: 6528