akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

struct tri{
  ll f,s,t;
};

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;ll K;cin >> N >> K;
  if(2*K-1>N){
    cout << -1 << endl;
    return 0;
  }

  vector<PII> v(N);
  ll b;
  int index = 0;
  b = K+2*N-1-N/2;
  if(N%2==1 && K%2==1)--b;
  repp(x,K,K+N){
    if(x&1)continue;
    v[index].first = x+b;
    v[index].second = x;
    ++index;
    --b;
  }

  b = K+2*N-1;
  repp(x,K,K+N){
    if((x&1)==0)continue;
    v[index].first = x+b;
    v[index].second = x;
    ++index;
    --b;
  }

  sort(all(v));
  ll c = K+2*N;
  queue<tri> que;
  rep(i,N){
    que.push({v[i].second,v[i].first-v[i].second,c});
    ++c;
  }
  while(!que.empty()){
    tri t = que.front();que.pop();
    cout << t.f SP t.s SP t.t << endl;
  }
  return 0;
}


Measured memory_bytes: 5504
#include<stdio.h>

int main() {
	int n;
	double debt=100000;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		debt = debt + debt*0.05;
		if ((int)debt % 1000 > 0) {
			debt = debt - (int)debt % 1000;
			debt += 1000;
		}
	}
	printf("%d\n", (int)debt);

	return 0;
}


Measured memory_bytes: 2724
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
	int N, a;
	cin >> N;
	if (N % 1000 != 0) {
		a = (N / 1000 + 1) * 1000 - N;
		cout << a << endl;
		return 0;
	}
	else {
		cout << 0 << endl;
	}
	
}


Measured memory_bytes: 3636
using System;
class atcoder{
    public static void Main(){
        long cnt = 0;
        int left = 0;
        int n = int.Parse(Console.ReadLine());
        string[] a = Console.ReadLine().Split(' ');
        string[] b = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++){
            int b1 = int.Parse(b[i]);
            int a1 = int.Parse(a[i]);

            if (a1 <= (b1 + left)){
                cnt += a1;
                left += b1 - a1;
                if (left >= b1){
                    left = b1;
                }
            }else{
                cnt += b1 + left;
                left = 0;
            }
        }

        int an = int.Parse(a[n]);
        if (an <= left){
            cnt += an;
        }else{
            cnt += left;
        }

        Console.WriteLine(cnt);
    }
}

Measured memory_bytes: 28372
#include <iostream>
using namespace std;
string str;
int main(void){
    // Your code here!
    cin >> str;
    int len = str.length();
    if (str[0] == str[len - 1]) cout << (len % 2 == 1 ? "Second" : "First") << endl;
    else cout << (len % 2 == 0 ? "Second" : "First") << endl;
}


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


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

    if(n[1] == n[2] && (n[0] == n[1] || n[2] == n[3]))
        cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
const main = input => {
  let n = input.split(' ').map(e => parseInt(e))
  
  let flag = 0
  while(n[0] > 0) {
    n[2] -= n[1]
    if(n[2] <= 0) {
      flag = 1
      break
    }
    n[0] -= n[3]
  }
  
  return flag == 1 ? "Yes" : "No"
}

console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")))

Measured memory_bytes: 29576
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.LT3H", "r", stdin );
	vector<int> h (10, 0 );
	rep (i, 10 ){
		scanf ("%d", &h[i] );
	} // end rep
	sort (ALL (h ), greater<int>() );
	rep (i, 3 ){
		printf ("%d\n", h[i] );
	} // end rep

	return 0;
}

Measured memory_bytes: 1204
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define pb push_back
#define mp make_pair
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int N,M;
int a,b;
vector<ll> retDivisors(ll N){
    vi res;
    for(ll i = 1;i*i<=N; i++){
        if(N%i==0){
            res.push_back(i);
            if(N/i != i)res.push_back(N/i);
        }
    }
    return res;
}
vector<pi> primeFactorize(ll N){
    vector<pi> res;
    for(ll a = 2; a*a<=N; a++){
        if(N%a != 0)continue;
        ll ex  = 0;
        while(N%a == 0){
            ex++;
            N/=a;
        }
        res.push_back({a,ex});
    }
    if(N!=1)res.push_back({N,1});
    return res;
}
vi retPrimePows(ll N){
    vi res;
    for(ll a = 2; a*a<=N; a++){
        if(N%a != 0)continue;
        ll ex  = 0;
        ll tmp = a;
        while(N%a == 0){
            ex++;
            N/=a;
            res.push_back(tmp);
            tmp*=a;
        }
    }
    if(N!=1)res.push_back(N);
    return res;
}
void input(){
    cin>>N;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    vi primePows = retPrimePows(N);
    int ans = 0;
    sort(primePows.begin(),primePows.end());
    rep(i,primePows.size()){
        if(primePows[i]>N)break;
        if(N%primePows[i]==0){
            ans++;
            N/=primePows[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3616
def bubble_sort(l):
    cnt = 0
    i = 0
    while i <=  len(l) - 1:
        for j in range(len(l) - 1, i, -1):
            if l[j-1] > l[j]: # Swap
                tmp = l[j]
                l[j] = l[j-1]
                l[j-1] = tmp
                cnt += 1
        i += 1
    return l, cnt

if __name__ == '__main__':
    N = int(input())
    l = list(map(int, input().split()))

    sl, cnt = bubble_sort(l)
    print(' '.join(map(str, sl)))
    print(cnt)



Measured memory_bytes: 5600
#include<stdio.h>

int main(){
  int P, Q, R;
  int min=0;
  
  scanf("%d%d%d", &P, &Q, &R);
  min = P+Q;
  if(min > (Q+R)) min = Q+R;
  if(min > (R+P)) min = R+P;
  
  printf("%d\n", min);
}

Measured memory_bytes: 128
use std::io;
use std::io::prelude::*;

fn main() {

    let stdin = io::stdin();
    let mut lines = stdin.lock().lines().map(|l| l.unwrap());

    let num_stones: usize = lines.next().unwrap().trim().parse().unwrap();
    let stones: Vec<i32> = lines.next().unwrap().split_whitespace().map(|x| x.parse().expect("Parse failed") ).collect();

    let mut dp = vec![std::i32::MAX; num_stones];
    dp[0] = 0;

    // cost(x, y) = |h[x] - h[y]|
    // dp(i) = min(dp(i-1) + cost(i, i-1), dp(i-2) + cost(i, i-2))

    for i in 0..num_stones {
        if i < num_stones - 1 {
            dp[i+1] = std::cmp::min(dp[i+1], dp[i] + (stones[i] - stones[i+1]).abs());
        }
        if i < num_stones - 2 {
            dp[i+2] = std::cmp::min(dp[i+2], dp[i] + (stones[i] - stones[i+2]).abs());
        }
    }

    println!("{}", dp[num_stones-1]);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define set_null(a,n) memset(a,0,sizeof(a))
#define pi acos(-1)
#define ll long long int
#define fr(a,b) for(int i=a;i<b;i++)

int main()
{
    int t;
    cin>>t;
    double ans;
    double x=(double)t/3;
    ans=x*x*(t-2*x);
    cout<<setprecision(15)<<ans<<endl;

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

constexpr ll INF=1e18;
struct edge{
  int to;
  ll cost;
  ll time;
};

vector<edge> g[60];
ll dis[60][2525];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, m;
  ll s;
  cin>>n>>m>>s;
  if(s>2500){
    s=2500;
  }
  REP(i, m){
    int u, v;
    ll a, b;
    cin>>u>>v>>a>>b;
    --u;--v;
    g[u].push_back({v, a, b});
    g[v].push_back({u, a, b});
  }
  REP(i, n){
    ll c, d;
    cin>>c>>d;
    g[i].push_back({i, -c, d});
  }
  REP(i, n){
    REP(j, 2501){
      dis[i][j]=INF;
    }
  }
  priority_queue<pair<ll, pll>, vector<pair<ll, pll>>, greater<pair<ll, pll>>> que;
  que.push(make_pair(0ll, pll(0, s)));
  while(que.size()){
    auto zxy=que.top();que.pop();
    ll z=zxy.first;
    auto xy=zxy.second;
    ll x=xy.first, y=xy.second;
    ll tmp=dis[x][y];
    if(z>=tmp){
      continue;
    }
    // DEBUG(x);
    dis[x][y]=z;
    for(auto u : g[x]){
      if(y<u.cost){
        continue;
      }
      if(dis[u.to][y-u.cost]<=z+u.time){
        continue;
      }
      if(y-u.cost>2500){
        continue;
      }
      que.push(make_pair(z+u.time, pll(u.to, y-u.cost)));
    }
  }
  FOR(i, 1, n){
    ll mi=INF;
    REP(j, 2500){
      CHMIN(mi, dis[i][j]);
    }
    cout<<mi<<'\n';
  }
  return 0;
}


Measured memory_bytes: 10452
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */
/* main */
int main(){

    int A, B, C;
    cin >> A >> B >> C;
    cout << min(A, min(B, C)) << ' ' << max(A, max(B, C)) << '\n';

}



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

vector<int> fa;

void add(int x, int v) {
  while (x < (int)fa.size()) fa[x] += v, x += (x & -x);
}

int query(int x) {
  int ans = 0;
  while (x > 0) ans += fa[x], x -= (x & -x);
  return ans;
}

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  int n;
  cin >> n;

  vector<int> a(n);
  for (auto& x : a) cin >> x;

  int mn = *min_element(a.begin(), a.end());
  int mx = *max_element(a.begin(), a.end());

  vector<int> b(n + 1);

  int l = mn;
  int r = mx;
  int ans = l;
  int offset = (n + 10);
  fa.resize(2 * offset);
  ll subarrays = n * (n + 1ll) / 2;
  ll cutoff = subarrays / 2;
  while (l <= r) {
    int m = (l + r) / 2;
    for (int i = 0; i < n; ++i) {
      b[i + 1] = b[i] + (a[i] <= m);
    }
    fill(fa.begin(), fa.end(), 0);
    ll sum = 0;
    for (int i = 0; i <= n; ++i) {
      int x = 2 * b[i] - i;
      sum += query(offset + x - 1);
      add(offset + x, 1);
    }
    if (sum <= cutoff)
      l = m + 1;
    else
      r = m - 1, ans = m;
  }
  cout << ans;
}

Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

string s;
ll n,a,b,c,d;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> a >> b >> c >> d;
    a-=1;
    b-=1;
    c-=1;
    d-=1;
    cin >> s;
    bool niiwa =false;
    bool san =false;
    if(c<d){
        for(ll i=a;i<c;i++){
            if((s[i]=='#')&&(s[i+1]=='#')){
                niiwa=true;
            }
        }
        for(ll i=b;i<d;i++){
            if((s[i]=='#')&&(s[i+1]=='#')){
                niiwa=true;
            }
        }
        if(niiwa==true){
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }else{
        niiwa=false;
        san=false;
        for(ll i=a;i<c;i++){
            if((s[i]=='#')&&(s[i+1]=='#')){
                niiwa=true;
            }
        }
        for(ll i=b;i<d;i++){
            if((s[i]=='#')&&(s[i+1]=='#')){
                niiwa=true;
            }
        }
        for(ll i=b-1;i<=c-2;i++){
            if((s[i]=='.')&&(s[i+1]=='.')&&(s[i+2]=='.')&&(i+1<=d)&&(i+2<=c)){
                san=true;
            }
        }
        if((niiwa==true)||(san==false)){
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }
    return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define number_of_digit(n) __builtin_ffs(n);
#define ll long long
#define T int
#define ld long double
inline void print(T n)
{
	if (n == 0)
	{
		putchar('0');
		putchar('\n');
	}
	else if (n == -1)
	{
		putchar('-');
		putchar('1');
		putchar('\n');
	}
	else
	{
		char buf[11];
		buf[10] = '\n';
		int i = 9;
		while (n)
		{
			buf[i--] = n % 10 + '0';
			n /= 10;
		}
		while (buf[i] != '\n')
			putchar(buf[++i]);
	}
}
int read()
{
       int cc = getc(stdin);
       for (;cc < '0' || cc > '9';)  cc = getc(stdin);
       int ret = 0;
       for (;cc >= '0' && cc <= '9';)
       {
          ret = ret * 10 + cc - '0';
          cc = getc(stdin);
       }
      return ret;
}
ll power(ll num,ll g)
{
	if(g==0)return 1;

	if(g%2==1)return (num*power((num*num)%mod,g/2))%mod;
	return power((num*num)%mod,g/2);
}
bool visit[1000005];
int main()
{
	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
  	cout.tie(NULL);

  	int n;
  	cin>>n;
  	int a[n];
  	For(i,n)cin>>a[i];
  	if(n<=3)
  	{
  		cout<<abs(a[n-1]-a[0])<<endl;
  		return 0;
  	}
  	int b[n];
  	b[0]=0;
  	b[1]=abs(a[1]-a[0]);
  	for(int i=2;i<n;i++)
  	{
  		b[i]=min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i]-a[i-2]));
  	}
  	cout<<b[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(){
  long long int a, b, c;
  scanf("%lld%lld%lld", &a, &b, &c);
  if (c - a - b > 0 && (c - a - b) * (c - a - b) > 4 * a * b) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 128
A,B,C,X,Y = map(int,(input().split()))

#ABピザの最大枚数
limit = max(X,Y)*2
Min = 10**10

for i in range(limit+1):
    a=0
    b=0
    c=0
    
    if i/2 < X:
        a = (X-int(i/2)) *A
    if i/2 < Y:
        b= (Y-int(i/2))*B    
        
    c = i*C
    
    Min = min(Min,a+b+c)
    
    
    
print(Min)
        
            





Measured memory_bytes: 9164
#include <iostream>
int main(int argc, const char * argv[]) {
    long a, b;
    std::cin >> a >> b;
    if((a+b)%2 == 0)
        std::cout << (a+b)/2 << std::endl;
    else
        std::cout << "IMPOSSIBLE" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
	  #define endl "\n"
	  using namespace std;
	  int main()
	  {
	    std::ios::sync_with_stdio(false);
	    cin.tie(NULL);
	    int a;
	    cin>>a;
	    cout<<a + (a*a) + (a*a*a)<<endl;
	    return 0;
	  }


Measured memory_bytes: 3652
import math
import collections

N, P = map(int, input().split())

def soinsuu(n):
    ass = []
    for i in range(2, int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)

    return ass

answer = 1
for k, v in collections.Counter(soinsuu(P)).items():
    if v >= N:
        answer *= k ** (v // N)

print(answer)

Measured memory_bytes: 3316
N, K, Q = input().split()
N = int(N)
K = int(K)
Q = int(Q)

A = []
for i in range(Q):
    A.append(int(input()))

people = []
for i in range(N):
    people.append(K - Q)

for i in A:
    people[i-1] += 1

for i in people:
    if i <= 0:
        print("No")
    else:
        print("Yes")


Measured memory_bytes: 11768
#include"bits/stdc++.h"
using namespace std;

int main(){
    long long n;
    cin >> n;
    long long *a = new long long[n];
    long long *b = new long long[n];
    vector<long long> vec;
    long long index[n];
    for(long long i=0;i<n;i++){
        cin >> a[i] >> b[i];
        vec.push_back(a[i]+b[i]);
    }
    typedef pair<long long, long long> pair;
    vector<pair> pair_vec;
    for(long long i=0;i<n;i++){
        pair_vec.push_back(pair(i, vec[i]));
    }
    sort(
        pair_vec.begin(),
        pair_vec.end(),
        [](const pair& x, const pair& y){return x.second > y.second;}
    );
    long long ans = 0;
    for(long long i=0;i<n;i++){
        if(i%2){
            ans -= b[pair_vec[i].first];
            //cout << b[pair_vec[i].first]<< endl;
        }
        else{
            ans += a[pair_vec[i].first];
            //cout << a[pair_vec[i].first] << endl;
        }
    }
    cout << ans << endl;
}

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

int main(){
	int a;
	string s;
	cin >> a >> s;

	if(a < 3200) cout << "red" << endl;
	else cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x[100010],y[100010],z[100010];
signed main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);

    long long  a,b,n,cnt=0;
    string s;
    cin>>n;
    for(int i=1; i<n; i++){
        cin>>x[i];
        cnt=cnt+min(x[i],x[i-1]);
        if(i==1){
            cnt=cnt+x[i];
        }
    }
    cout<<cnt+x[n-1]<<'\n';
}


Measured memory_bytes: 256
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

main :-
	get_number(N),
    get_number(M),
    X is (N - 1) * (M - 1),
    writeln(X).


Measured memory_bytes: 8148
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;



int main() { 
  string s; cin >> s;
  ll a = 0, b = 0, c = 0;
  rep(i, 0, s.size()){
    if(s[i] == 'a') a++;
    else if(s[i] == 'b') b++;
    else c++;
  }
  if(max({a, b, c}) - min({a, b, c}) <= 1) puts("YES");
  else puts("NO");

  return 0;
}


Measured memory_bytes: 512
/*
ID: jerrywcy
TASK: AtCoder ABC 099 Problem B
LINK: https://abc099.contest.atcoder.jp/tasks/abc099_b
LANG: C++
*/
#include <bits/stdc++.h>

#define sum(n) ((n)+1)*(n)/2

using namespace std;

int a,b;

int main()
{
	cin>>a>>b;
	cout<<sum(b-a)-b<<endl;

	return 0;
}



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

#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;i++)
#define FORD(i,a,b) for(int i=(a),_b=b;i>=_b;i--)
#define arrayin(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define arrayout(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" ";cout<<"\n";
#define endl "\n"
#define MS(v) memset(v,0,sizeof(v))
#define ULL unsigned long long
#define LL unsigned long long
#define elif else if

void solve() {
	int x;
	cin>>x;
	if(x==3 || x==5 || x==7) cout<<"YES";
	else cout<<"NO";
}


int main() {
	#ifdef HoaSayyy
//		freopen("" , "r" , stdin);
		//freopen("" , "w" , stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
	cout<<"\n";
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

int get(int x){
	for(int i=-200;i<=200;i++){
		if(x==(i*i*i*i*i)){
			return i;
		}
	}
}

int32_t main(){
	fastio();
	int x;
	cin>>x;
	set<int>s;
	for(int i=-200;i<=200;i++){
		int k = i*i*i*i*i;
		s.insert(k);
	}
	int a,b;
	for(auto i:s){
		int l = x + i;
		if(s.count(l)){
			a = i;
			b = l;
			break;
		}
	}
	cout<<get(b)<<" "<<get(a);
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> foo(m);
    for (int i = 0; i < m; i++) {
        cin >> foo[i];
    }
    vector<vector<int>> vec(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> vec[i][j];
            vec[i][j] *= foo[j];
        }
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        int sum = 0;
        for (int j = 0; j < m; j++) {
            sum += vec[i][j];
        }
        sum += c;
        res += (sum > 0);
    }
    cout << res << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int K, S, ans = 0;
    cin >> K >> S;
    for (int i = 0; i <= K; i++) {
        for (int j = 0; j <= K; j++) {
            if (S - i - j >= 0 && S - i - j <= K) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
  int n;
   cin>>n;
   vector<int> co(n);
   rep(i,n)co.at(i)=0;
   rep(i,n-1){
   int x;
     cin>>x;
     co.at(x-1)++;
   }
   rep(i,n)cout<<co.at(i)<<endl;
}

Measured memory_bytes: 3972
import io.StdIn._
object Main extends App {
  val n = readInt
  val b = readLine.split(" ").map(_.toLong).toList

  val t = if(n > 2 ) {
      b.sliding(2)
        .foldLeft(0L)((a, b) => math.min(b(0), b(1)) + a)
    } else 0
  val res = b.head + t + b.last
  println(res)
}


Measured memory_bytes: 25404
#include <bits/stdc++.h>
using namespace std;
#define long int64_t

int main()
{
   int r,d,t;
   cin>>r>>d>>t;
   int arr[11];
   arr[0] = t;
   for(int i=0; i<10; i++)
   {
   	arr[i+1] = arr[i]*r - d;
   }

   for(int i=0; i<10; i++)
   {
   	cout<<arr[i+1]<<endl;
   }
   return 0;
}
 

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

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

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

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

#define FF first
#define SS second

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


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

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

  int N;
  cin >> N;
  VI xs(N);
  cin >> xs;
  RSORT(xs);

  int ans = 0;
  REP(i,N){
	ans += xs[i] * (i%2==0?1:-1);
  }
  cout << ans << endl;

  return 0;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int x; cin >> x;
    if(x==7 || x==5 || x==3) cout << "YES" << endl;
    else cout << "NO" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    ll x,y;
    cin>>x>>y;
    ll g=__gcd(x,y);
    cout<<(x/g)*y;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include <chrono>
#include<math.h>

#define FIO ios_base::sync_with_stdio(0);  cin.tie(0);
#define PI 3.14159265358979323846
#define mod 998244353
#define ll long long
#define vll vector<long long>  
#define all(c) c.begin(), c.end()
// Used to traverse in any STL container with iterators
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
// Find whether element is present in given container or not
#define present(container, element) (container.find(element) != container.end())
// Finds whether element in present container is present in vector or not
#define cpresent(container, element) (find(all(container),element) != container.end())

using namespace std;
using namespace std::chrono; 

const ll INF = 1e13;

// void dfs(int v, vector<vector<int> >& adj, vector<bool> visited){
//     visited[v] = true;
//     for(int u: adj[v]){
//         if(!visited[u])
//             dfs(u, adj, visited);
//     }
// }

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    FIO

    ll n, w;
    cin>>n>>w;
    pair<ll, ll> arr[n]; 
    ll sum = 0;
    for(int i=0;i<n;i++){
        cin>>arr[i].first>>arr[i].second;
        sum += arr[i].second;
    }
    ll dp[n+1][sum+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=sum;j++){
            if(j == 0)dp[i][j] = 0;
            else if(i==0)dp[i][j] = INF;
            else{
                if(arr[i-1].second <= j){
                    dp[i][j] = min(arr[i-1].first + dp[i-1][j - arr[i-1].second], dp[i-1][j]);
                }
                else dp[i][j] = dp[i-1][j];
            }
        }
    }
    // for(int i=0;i<=n;i++){
    //     for(int j=0;j<=sum;j++){
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    
    for(int i=sum;i>=0;i--){
        if(dp[n][i] <= w){
            cout<<i<<endl;
            break;
        }
    }


    return 0;
}

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

long long gcd(long long a, long long b)
{
	if (a > b) {
		a += b;
		b = a - b;
		a -= b;
	}
	if (b % a == 0) return a;
	else return gcd(b % a, a);
}

int main()
{
	long long N, M;
	char S[100001] = {}, T[100001] = {};
	scanf("%lld %lld", &N, &M);
	scanf("%s", S);
	scanf("%s", T);
	
	long long i, j, G = gcd(N, M), flag = 1;
	long long L = N * M / G, n = L / N, m = L / M;
	for (i = 0, j = 0; i < N && j < M; i += m, j += n) {
		if (S[i] != T[j]) flag = 0;
	}
	
	if (flag == 1) printf("%lld\n", L);
	else printf("-1\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,x,ans=0;
    cin>>a>>b>>c>>x;
    for (int i=0;i<=a;i++)
        for (int j=0;j<=b;j++)
            for (int l=0;l<=c;l++)
            {
                int cnt=i*500+j*100+l*50;
                if (cnt==x)
                  ans++;
            }
    cout<<ans<<endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> as;
	int a;
	for (int i = 0; i < N; ++i) {
		cin >> a;
		as.push_back(a);
	}
	int minsum = 200*200*1000;
	for (int ave = -100; ave <= 100; ++ave) {
		int sum = 0;
		for (auto val : as) {
			sum += (val - ave)*(val - ave);
		}
		minsum = min(minsum, sum);
	}
	cout << minsum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE

//FUNCTION
void solve(void)
{
  double A,B,H,M;
  cin>>A>>B>>H>>M;
  double degH = 30*H + M/2;
  double degM = 6*M;
  double deg = min(360.0 - abs(degM - degH), abs(degM - degH));
  // DEBUG(cos(deg/180.0*2*M_PI));
  double res = sqrt(A*A +B*B - 2.0*A*B*cos(deg/180.0*M_PI));
  cout<<res<<endl;

  
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 4248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n;
  in(n);
  vector<string> s(n);
  rep(i, n)
    in(s[i]);
  vector<vector<ll>> a(n, vector<ll> (26, 0));
  char f = 'a';
  rep(i, 26){
    rep(j, n){
      rep(k, s[j].size()){
        if(s[j][k] == f)
          a[j][i]++;
      }
    }
    f++;
  }
  vector<ll> b(26, 999999999999999);
  rep(i, 26){
    rep(j, n)
      b[i] = min(b[i], a[j][i]);
  }
  f = 'a';
  rep(i, 26){
    rep(j, b[i])
      out(f);
    f++;
  }
  memi;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
p = [int(i) for i in input().split()]

for i in range(len(p)):
    p[i]=(p[i]+1)/2
tmp=sum(p[0:k])
x=sum(p[0:k])
for i in range(k,len(p)):
    x=x-p[i-k]+p[i]
    if x>tmp:
        tmp=x
print(tmp)

Measured memory_bytes: 25188
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  rep(i, N) cin >> p[i];

  int cnt = 0;
  rep(i, N) {
    if (i + 1 != p[i]) cnt++;
  }
  if (cnt <= 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << 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 ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvii vector<vector<ii>>
#define vvll vector<vector<ll>>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define uni(v) v.erase(unique(v.begin(), v.end()), v.end())
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (ll) a / __gcd(a, b) * b

using namespace std;

void print();
template <typename T, typename... Args>
void print(T x, Args... args);

void solve() {
    int n;
    cin >> n;
    vi a(n);
    for(auto&i:a)cin>>i;
    sort(all(a));
    int res = 0;
    for(int i=0;i<n;++i)for(int j=i+1;j<n;++j)for(int k=j+1;k<n;++k)if(a[i] != a[j] && a[j] != a[k] && a[k] != a[i])
        if(a[i] > a[k] - a[j] && a[i] + a[j] > a[k])res++;
    print(res);
}
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

void print() { cout << "\n"; }
template <typename T, typename... Args>
void print(T x, Args... args) {
    if(sizeof...(args)){
        cout << x << ' ';
        print(args...);
    }else{
        cout << x << '\n';
    }
}

Measured memory_bytes: 3652
S=input()
# ACGT
lis=[]
for x in range(len(S)):
	alt=len(S)-x
	for y in range(alt):
		y=len(S)-y
		ts=S[x:y]
		ca=ts.count('A')
		cg=ts.count('G')
		cc=ts.count('C')
		ct=ts.count('T')

		if len(ts)==ca+cg+cc+ct:
			lis.append(len(ts))
if lis !=[]:
	print(max(lis))
else:
	print(0)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    string s;
    cin>>s;
    int a=0,b=0;
    rep(i,s.size()){
        if(s[i]=='0') a++;
        else b++;
    }
    cout<<min(a,b)*2<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
	int n;
	cin >> n;
	 long long sum = 0;
	int s = 0;
	 long long ans = 0;
	 long long a[200006];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		while ((sum^a[i]) != (sum + a[i])) {
			ans += i - s;
			sum -= a[s];
			s += 1;
		}
		sum += a[i];
	}
	ans += ((long long)(n - s+1)*(n - s )) / 2;
	cout << ans;

}

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

int main(){
    int k;
    cin >> k;
    long long ans = 0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans += (__gcd(i,__gcd(j,l)));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main() {
    long long n, ans = 0;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    n /= 2;
    while (n > 0) {
        ans += n / 5;
        n /= 5;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <bits/stdc++.h>
#include <deque>
#define ll long long int
#define l long double
#define pi 3.14159265358979323846
#define mod 1000000007
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll a[n],sum=0;
    for(int i=0;i<n;i++)
    cin>>a[i];
    ll b[n];
    for(int i=0;i<n;i++)
    b[i]=0;
    b[0]=a[n-1];
    for(int i=1;i<n;i++)
    b[i]=b[i-1]+a[n-1-i];
    /*for(int i=0;i<n;i++)
    cout<<b[i]<<endl;*/
    for(int i=0;i<n-1;i++)
    {
        sum+=((a[i]%mod)*(b[n-2-i]%mod));
       // cout<<sum<<endl;
       sum=sum%mod;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 6744
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
                                                                                                
  
int main(){
                                                                                                
   
    int i;

    string s;

    
    cin >> s;


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

         if( s.at(i) == s.at(i + 1) ){

             cout << i + 1 << " " << i + 2 << endl;

             return 0;

             }

         else if( i < s.size() - 2 && s.at(i) == s.at(i + 2) ){

                  cout << i + 1 << " " << i + 3 << endl;

                  return 0;
 
                  }

         }


    cout << -1 << " " << -1 << endl;


    return 0;

}

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

int main() {
	int n; scanf("%d", &n);

	map <int, int> mp;
	for(int i = 1; i <= n; i++) {
		int x; scanf("%d", &x);
		mp[x]++;
	}

	for(auto o : mp) {
		if(o.second > 1) {
			printf("NO\n");
			return 0;
		}
	}

	printf("YES\n");
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<long long,long long>>ab(n);
    for(int i=0; i<n; i++){
        cin >> ab[i].first >> ab[i].second;
    }
    sort(ab.begin(),ab.end());
    long long ans = 0, tmp=m;
    for(int i=0; i<n; i++){
        if(ab[i].second>=tmp){
            ans += ab[i].first * tmp;
            break;
        }else{
            ans += ab[i].second * ab[i].first;
            tmp -= ab[i].second;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4812
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a, b;
    cin >> a >> b;
    if(a >= 10 || b >= 10)
        cout << -1;
    else
        cout << a * b;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    int n;
    long int a[100001];long int b[100000];
    long int sum=0;
    cin >> n;
    for(int i=0;i<=n;i++)cin >> a[i];
    for(int i=0;i<n;i++) cin >> b[i];

    for(int i=0;i<n;i++){
        if(a[i]+a[i+1]<=b[i]){
            sum = sum + a[i] + a[i+1];
            a[i+1]=0;
        }
        else if( b[i]>a[i]&&b[i]<a[i+1]+a[i]){
            sum += b[i];
            a[i+1] = a[i] + a[i+1] - b[i];

        }
        else if(b[i] <= a[i]) sum += b[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792