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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  vector<ii> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].fi;
    a[i].sc = i + 1;
  }
  sort(all(a));
  for (auto &i : a) cout << i.sc << ' '; cout << '\n';
}


Measured memory_bytes: 4752
using System;

class MainClass
{
	public static void Main (string[] args)
	{
		string str = Console.ReadLine ();
		string[]spStr = str.Split(' ');

		int a = int.Parse (spStr[0]);
		int b = int.Parse (spStr[1]);
		int c = int.Parse (spStr[2]);

		int x = 0;
		for (int i = a; i <= b; i++) {
			if (c % i == 0) {
				x++;
			}
		}

		Console.WriteLine (x);
	}
}

Measured memory_bytes: 9264
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long int lli;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define YES_RTN s_cout("Yes");return 0
#define NO_RTN  s_cout("No");return 0


int i_cins(int n, int* A);
int l_cins2(int n, long* A,long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);


int main(void) {

	int   N, A[101];

	i_cin(N);
	i_cins(N,A);
	
	qsort(A, N, sizeof(int), s_asort);
	i_cout(A[N-1] - A[0]);
	return 0;
	}
	
//降順
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a -*(int*)b);
}
//
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	rept(i, 0, n) {
		i_cin(*(a + i));
	}
	return 0;
}




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

#define ll long long

inline ll read() {
    ll x = 0, f = 1; char ch = getchar();
    for(; ch < '0' || ch>'9'; ch = getchar())
        if(ch == '-') f = -f;
    for(; ch >= '0' && ch <= '9'; ch = getchar())
        x = x * 10 + ch - '0';
    return x * f;
}

inline void chkmin( int &a, int b ) { if(a > b) a = b; }

inline void chkmax( int &a, int b ) { if(a < b) a = b; }

#define _ read()

#define ln endl

const int N = 2e5 + 5;
int n, a[N];
ll pre[N], suc[N], ans = 2e18;

int main()
{
	n = _;
	for( int i = 1; i <= n; i++ ) 
		a[i] = _, pre[i] = pre[i - 1] + a[i];
	for( int i = n; i >= 1; i-- )
		suc[i] = suc[i + 1] + a[i];
	for( int i = 1; i < n; i++ ) 
		ans = min(ans, abs(suc[i + 1] - pre[i]));
	cout << ans << ln;
}

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

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

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

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

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

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

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

    LL a, b, n;
    cin >> a >> b >> n;
    LL t = min(n, b - 1);
    cout << (a * t / b) - a * (t / b) << endl;

    return 0;
}



Measured memory_bytes: 3612
#include <stdio.h>
long long gcd(long long a, long long b);
int main(void) {
    long long a1,m1,a2,m2,a3,m3,count[2],x,y,z,two,three;
    while (scanf("%lld%lld%lld%lld%lld%lld",&a1,&m1,&a2,&m2,&a3,&m3)!=EOF&&a1!=0) {
        count[0]=0,count[1]=0,count[2]=0,x=1,y=1,z=1;
        do {
            x=(a1*x)%m1;
            count[0]++;
        } while (x!=1);
        do {
            y=(a2*y)%m2;
            count[1]++;
        } while (y!=1);
        do {
            z=(a3*z)%m3;
            count[2]++;
        } while (z!=1);
        two=gcd(count[0],count[1]);
        two=count[0]*count[1]/two;
        three=gcd(two,count[2]);
        printf("%lld\n",two*count[2]/three);
    }
    return 0;
}

long long gcd(long long a, long long b) {
    long long temp;
    if (a<b) {
        temp=a;
        a=b;
        b=temp;
    }
    while (a%b!=0) {
        a%=b;
        temp=a;
        a=b;
        b=temp;
    }
    return b;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
	int ans = 1;
	for (; b; b >>= 1, a = a * a % mod)
		if (b & 1)
			ans = ans * a % mod;
	return ans;
}
double sum[500000];
signed main()
{
	io;
	int n,k;cin>>n>>k;
	rep(i,1,n){
		int x;cin>>x;
		sum[i]=1.0*(x)*(x+1)/2/x;
		sum[i] += sum[i-1];
	}
	double ans=0;
	rep(i,k,n){
		ans=max(ans,sum[i]-sum[i-k]);
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;

	getchar(); //
	getchar();
}


Measured memory_bytes: 1792
// AOJ ALDS1_2_A Bubble Sort
// 2018.4.27 bal4u

#include <stdio.h>

int bubble_sort(int n, int *a)
{
	int i, f, x;
int ans = 0;

	do {
		f = 0;
		for (i = n-1; i > 0; i--) {
			if (a[i] < a[i-1]) {
				x = a[i], a[i] = a[i-1], a[i-1] = x;
ans++;
				f = 1;
			}
		}
	} while (f);
return ans;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int a[102];

int main()
{
	int N, i, k;

	N = in();
	for (i = 0; i < N; i++) a[i] = in();
	k = bubble_sort(N, a);
	printf("%d", a[0]);
	for (i = 1; i < N; i++) printf(" %d", a[i]);
	putchar('\n');
	printf("%d\n", k);
	return 0;
}



Measured memory_bytes: 2100
N,X,Y = map(int,input().split())
L = []
for i in range(N-1):
     L.append(0)
for A in range(1,N):
    for B in range(A+1,N+1):
        a_1 = B-A
        a_2 = abs(X-A)+1+abs(Y-B)
        a = min([a_1,a_2])
        L[a-1]+=1 
for j in range(N-1):
    print(L[j])

Measured memory_bytes: 3444
private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main(args: Array<String>) {
    val (n, k) = readInts()
    val p = readInts()
    var sum = 0
    for (i in 0.until(k)) {
        sum += p[i]
    }
    var res = sum
    for (i in k.until(n)) {
        sum -= p[i - k]
        sum += p[i]
        res = if (res < sum) sum else res
    }
    println((res + k) / 2.0)
}

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

int A[100][100];

int main(){
  int n;
  cin >> n;
  int u, k, v;
  for(int i=0;i<n;i++){
    cin >> u >> k;
    for(int j=0;j<k;j++){
      cin >> v;
      A[u-1][v-1] = 1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j != n-1) cout << A[i][j] << " ";
      else cout << A[i][j] << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (((a & b) & 0x1) == 1) {
            System.out.println("Odd");
        } else {
            System.out.println("Even");
        }
    }
}


Measured memory_bytes: 21844
x1,y1,x2,y2 = map(int,input().split())

x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)

print(x3,y3,x4,y4)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
pi P[MAX_N];
int A[MAX_N], B[MAX_N];
int C[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> P[i].sec;
	rep(i, 0, N) cin >> P[i].fst;
	sort(P, P + N);
	rep(i, 0, N) {
		A[i] = P[i].sec;
		B[i] = P[i].fst;
		C[i] = P[i].sec;
	}
	sort(A, A + N);
	rep(i, 0, N) {
		if(A[i] > B[i]) {
			cout << "No\n"; return;
		}
	}
	rep(i, 0, N - 1) {
		if(A[i + 1] <= B[i]) {
			cout << "Yes\n"; return;
		}
	}
	map<int, int> D;
	rep(i, 0, N) {
		D[A[i]] = C[i];
	}
	int at = A[0];
	rep(i, 0, N - 1) {
		at = D[at];
		if(at == A[0]) {
			cout << "Yes\n"; return;
		}
	}
	cout << "No\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 11520
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import combinations
#import bisect# lower_bound etc
import numpy as np
def run():
    N, K, *A = list(map(int, read().split()))
    B = [a for a in A if a>0]
    C = [a for a in A if a<0]
    C_abs = [-c for c in C]
    O = A.count(0)
    B = np.array(sorted(B), dtype= np.int64)
    C = np.array(sorted(C), dtype = np.int64)
    C_abs = np.array(sorted(C_abs), dtype = np.int64)
    n_neg = len(B) * len(C)
    n_0 = O * (O - 1) // 2 + O * (len(B) + len(C))

    def find(x):
        ret = 0
        if x < 0:
            ret += np.searchsorted(C, x//B, side='right').sum()

        elif x == 0:
            ret += n_0 + n_neg
        else:
            ret += n_neg + n_0
            b_count = (B ** 2 <= x).sum()
            c_count = (C ** 2 <= x).sum()
            ret += (np.searchsorted(B, x//B, side='right').sum() - b_count) // 2

            ret += (np.searchsorted(C_abs, x//C_abs, side='right').sum() - c_count) // 2
        return ret

    high = 10 ** 18
    low = -high
    current = 0
    while high - low > 1:
        tmp = find(current)
        if tmp < K:
            low = current
        else:
            high = current

        current = (low + high) // 2

    print(high)

if __name__ == "__main__":
    run()

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


#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define pb push_back


template <typename T>

void prarr(T a)
{
    cerr << "[";
    for(auto i : a){
        
        cerr << i << " ";
    }
    
    cerr << "]" << endl;
}

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << "[" << name << " : " << arg1 << "]" << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout <<"[" ; cout.write(names, comma - names) << " : " << arg1<<"] ";__f(comma+1, args...);
}

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


    ll t=1;
    //cin >> t;

    while(t--){  
        
       ll N, K;
       
       cin >> N >> K;
       
       ll A[N + 1] = {0};
       
       ll ans[N + 1];
       
       
       
       
       for(ll i = 1; i <= N; i++){
           
           cin >> A[i];
           ans[i] = big;
       }
       
       ans[0] = 0;
       ans[1] = 0;
       
      for(ll i = 1; i <= N; i++){
          
          for(ll j = max(1LL, i - K); j < i; j++){
              
               ans[i] = min(ans[i], ans[j] + abs(A[i] - A[j]));
          }
      }
      
       cout << ans[N] << endl;
    }


    return 0;
        
}


Measured memory_bytes: 1792
/*
Original problem: https://atcoder.jp/contests/abc136/tasks/abc136_a
Author: sammochen
*/

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)

#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef vector<ll> VLL;
typedef vector<int> VI;

namespace SOLVE {
    void main() {
        int A, B, C;
		cin >> A >> B >> C;
		cout << max(0, B + C - A) << endl;
    }
}


signed main() {
	int t;
	t = 1;
	// cin >> t;
	while (t--) {
		SOLVE::main();
	}

	return 0;
}

Measured memory_bytes: 256
let m = 2019
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m
let inv10 = 202

let () =
  let s = read_line () in
  let n = String.length s in
  let a = Array.make 2019 0 in
  let inv = ref 1 in
  let acc = ref 0 in
  a.(0) <- 1;
  for i = 0 to n - 1 do
    inv := inv10 *^ !inv;
    acc := !acc +^ (Char.code s.[i] - Char.code '0') *^ !inv;
    a.(!acc) <- 1 + a.(!acc)
  done;
  Printf.printf "%d\n" @@
  Array.fold_right (fun a -> ( + ) @@ a * (a - 1) / 2) a 0



Measured memory_bytes: 4196
#include <stdio.h>

int main () {
	int N, K;
	scanf ("%d", &N);
	scanf ("%d", &K);
	int res = 1;
	for (int i=0; i<N; i++) {
		if (res < K)
			res *= 2;
		else
			res += K;
	}
	printf ("%d\n", res);
	return 0;
}

Measured memory_bytes: 128
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> data(h+1);
    FOR(i, 0, h) {
        cin >> data[i];
        data[i].push_back('.');
    }
    data[h].resize(w + 1);
    FOR(i, 0, w+1) {
        data[h][i] = '.';
    }
    if (data[0][0] == '.' || data[h - 1][w - 1] == '.') {
        cout << "Impossible" << endl;
        return 0;
    }
    int posy = 0, posx = 0;
    bool res = true;
    while (posx != w - 1 || posy != h - 1) {
        if ((posx > 0 && data[posy][posx - 1] == '#') || (posy > 0 && data[posy - 1][posx] == '#')) {
            res = false;
            break;
        }
        if (data[posy + 1][posx] == data[posy][posx + 1]) {
            res = false;
            break;
        }
        data[posy][posx] = '.';

        if (data[posy + 1][posx] == '#') {
            posy++;
        }
        else
            posx++;
    }
    if (res && (data[posy - 1][posx] == '#' || data[posy][posx - 1] == '#'))
        res = false;
    cout << (res ? "Possible" : "Impossible") << endl;
    return 0;
}

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

int dfs(int i, int n, std::vector< std::vector<bool> > &gr, std::vector<bool> &is_visited) {
	// visit i-th node
	is_visited[i] = true;
	for(int i_node = 0; i_node < n; ++i_node) {
		if(!gr[i][i_node]) continue;
		if(is_visited[i_node]) continue;
		dfs(i_node, n, gr, is_visited);
	}
	return 0;
}

int main(void) {
	// input
	int n, m;
	std::cin >> n >> m;
	std::vector<int> a(m), b(m);
	for(int j = 0; j < m; ++j) {
		std::cin >> a[j] >> b[j];
		a[j]--;
		b[j]--;
	}

	// adjacent matrix
	std::vector< std::vector<bool> > gr(n);
	for(int i = 0; i < n; ++i) gr[i].resize(n);
	for(int j = 0; j < m; ++j) gr[a[j]][b[j]] = gr[b[j]][a[j]] = true;
	
	// visited ?
	std::vector<bool> is_visited(n);

	int n_bridge = 0;

	for(int j = 0; j < m; ++j) {
		// disable j-th edge
		gr[a[j]][b[j]] = gr[b[j]][a[j]] = false;
		// dfs
		for(int i = 0; i < n; ++i) is_visited[i] = false;
		dfs(0, n, gr, is_visited);
		bool is_bridge = false;
		for(int i = 0; i < n; ++i) {
			if(!is_visited[i]) is_bridge = true;
		}
		if(is_bridge) n_bridge += 1;
		// enable j-th edge
		gr[a[j]][b[j]] = gr[b[j]][a[j]] = true;
	}

	std::cout << n_bridge << std::endl;

	return 0;
}


Measured memory_bytes: 256
S="*"+input()
N=len(S)-1

F=True
for i in range(1,N+1):
    if i%2==1:
        F&=S[i] in {"R","U","D"}
    else:
        F&=S[i] in {"L","U","D"}

if F:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61888
import java.util.Arrays;
import java.util.Scanner;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 0;

    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();

    int x = 100*r + 10*g + b;
    if(x%4 == 0){
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
    
    sc.close();
  }
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
  T r;
  while (a)
    r = b, b = a, a = r % a;
  return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  cin >> ch;
  cout << (char)(ch + 1) << endl;
  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string A, B;
    cin >> A >> B;
    if (A.size()==B.size()-1) {
        bool flag = true;
        for (int i=0; i<A.size(); i++) {
            if (A[i]!=B[i]) {
                flag = false;
                break;
            }
        }
        if (flag)
            cout << "Yes\n";
        else
            cout << "No\n";
    } else {
        cout << "No\n";
    } 
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>

using namespace std;

int main(void)
{
	int N,h[100010],i,max=0,flg=0;

	cin >> N;

	for(i=1;i<=N;i++)
	{
		cin >> h[i];
	}

	for(i=1;i<=N;i++)
	{
		if(max<=h[i])
			max=h[i];

		else if(max-2>=h[i])
			flg=1;
	}

	if(flg==0)
		cout << "Yes" << endl;

	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>

typedef long long ll;
using namespace std;

#define mod 1000000007
#define INF 1000000000 //(int)1e9
#define LLINF 8000000000000000000 //(ll)2e18
#define PI  3.1415926536

#define SIZE 100000

int main(){
    int a,b;
    
    scanf("%d%d",&a,&b);
    
    for(int i=0;i<a/2+1;i++){
        printf(i!=a-1?"%d ":"%d\n",0);
    }
    
    for(int i=a/2+1;i<a;i++){
        printf(i!=a-1?"%d ":"%d\n",b);
    }
}

Measured memory_bytes: 1188
count1=0
count2=0
count3=0
count4=0
for i in range(3):
  a,b=(int(x) for x in input().split())
  if a==1:
    count1 = count1 + 1
  elif a==2:
    count2 = count2 + 1
  elif a==3:
    count3 = count3 + 1
  elif a==4:
    count4 = count4 + 1
  if b==1:
    count1 = count1 + 1
  elif b==2:
    count2 = count2 + 1
  elif b==3:
    count3 = count3 + 1
  elif b==4:
    count4 = count4 + 1
if count1>2 or count2>2 or count3>2 or count4>2:
  print("NO")
else:
  print("YES")

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

ansdiv = K

# 一番近いやつ求める
for i, j in zip(A[:-1], A[1:]):
    div = K - j + i
    if div < ansdiv:
        ansdiv = div

# 最初のと最後のを忘れない
lastdiv = K - A[N-1] + A[0]
lastans = K - lastdiv
if lastans < ansdiv:
    ansdiv = lastans

print(ansdiv)


Measured memory_bytes: 26420
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pb push_back
using namespace std;

ll H, W;
bool check(ll h, ll w) {
  if (h < 0 || h >= H || w < 0 || w >= W) {
    return false;
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> H >> W;
  ll ch, cw;
  cin >> ch >> cw;
  ch -= 1;cw -= 1;
  ll dh, dw;
  cin >> dh >> dw;
  dh -= 1;dw -= 1;
  vector<vector<ll>> move = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
  vector<vector<char>> maze(H, vector<char>(W));
  for (ll i = 0; i < H; ++i) {
    for (ll j = 0; j < W; ++j) {
      cin >> maze.at(i).at(j);
    }
  }
  vector<vector<ll>> dp(H, vector<ll>(W, INF));
  vector<vector<bool>> already(H, vector<bool>(W, false));
  dp.at(ch).at(cw) = 0;
  already.at(ch).at(cw) = true;
  deque<vector<ll>> q;
  q.push_front({ch, cw});
  while (!q.empty()) {
    vector<ll> now = *q.begin();
    ll h = now.at(0), w = now.at(1);
    already.at(h).at(w) = true;
    q.pop_front();
    for (ll i = 0; i < 4; ++i) {
      ll nh = h + move.at(i).at(0), nw = w + move.at(i).at(1);
      if (!check(nh, nw)) {
        continue;
      }
      if (already.at(nh).at(nw) || maze.at(nh).at(nw) == '#') {
        continue;
      }
      if (dp.at(nh).at(nw) > dp.at(h).at(w)) {
        already.at(nh).at(nw) = true;
        q.push_front({nh, nw});
        dp.at(nh).at(nw) = dp.at(h).at(w);
      }
    }
    for (ll i = -2; i <= 2; ++i) {
      for (ll j = -2; j <= 2; ++j) {
        ll nh = h + i, nw = w + j;
        if (!check(nh, nw)) {
          continue;
        }
        if (maze.at(nh).at(nw) == '#') {
          continue;
        }
        if (dp.at(nh).at(nw) > dp.at(h).at(w) + 1) {
          q.push_back({nh, nw});
          dp.at(nh).at(nw) = dp.at(h).at(w) + 1;
        }
      }
    }
  }
  // for (ll i = 0; i < H; ++i) {
  //   for (ll j = 0; j < W; ++j) {
  //     cout << dp.at(i).at(j) << " ";
  //   }
  //   cout << "\n";
  // }
  if (dp.at(dh).at(dw) == INF) {
    cout << -1 << "\n";
  }
  else {
    cout << dp.at(dh).at(dw) << "\n";

  }
}


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

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

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

int main()
{
    ll a;
    string s;
    cin >> a >> s;
    if (a >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

int mod = 1e9 + 7;

// mod
void add(int& a, int b) {
    a += b;
    if (a >= mod)
        a -= mod;
}

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

    int H, W, K;
    cin >> H >> W >> K;

    int dp[105][10];
    CLR(dp, 0);

    dp[0][0] = 1;
    REP(i, H) {
        REP(j, W) {
            REP(k, 1 << W - 1) {
                bool ok = true;
                REP(kk, W - 2) {
                    if (((k >> kk) & 1) == 0) continue;
                    if (((k >> (kk + 1)) & 1) == 0) continue;
                    ok = false;
                    break;
                }
                if (!ok) continue;

                int jj = j;
                if (j > 0 && ((k >> (j - 1) & 1) == 1)) jj--;
                if (((k >> j) & 1) == 1) jj++;
                add(dp[i + 1][jj], dp[i][j]);
            }
        }
    }
    cout << dp[H][K - 1] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
struct Edge {
    Edge(int _to, int _cost) : to(_to), cost(_cost) {}
    int to;
    int cost;
};
using Graph = vector<vector<Edge>>;
struct VInfo {
    VInfo(int _dist, int _num) : minimum_distance(_dist), v_num(_num) {}
    bool operator ==(const VInfo &info) const { return this->minimum_distance == info.minimum_distance; }
    bool operator !=(const VInfo &info) const { return this->minimum_distance != info.minimum_distance; }
    bool operator <(const VInfo &info) const { return this->minimum_distance < info.minimum_distance; }
    bool operator <=(const VInfo &info) const { return this->minimum_distance <= info.minimum_distance; }
    bool operator >(const VInfo &info) const { return this->minimum_distance > info.minimum_distance; }
    bool operator >=(const VInfo &info) const { return this->minimum_distance >= info.minimum_distance; }
    int minimum_distance;
    int v_num;
};
void dijkstra(int s, vector<vector<Edge>> &graph, vector<int> &cost) {
    priority_queue<VInfo> q;
    cost[s] = 0;
    q.emplace(0, s);
    while (!q.empty()) {
        auto p = q.top();
        q.pop();
        int v = p.v_num;
        if (cost[v] < p.minimum_distance) continue;
        for (auto e: graph[v]) {
            if (cost[e.to] > cost[v] + e.cost) {
                cost[e.to] = cost[v] + e.cost;
                q.emplace(cost[e.to], e.to);
            }
        }
    }
};



int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--;
    y--;
    Graph g(n, vector<Edge>());
    g[x].emplace_back(Edge(y, 1));
    g[y].emplace_back(Edge(x, 1));
    for (int i = 0; i < n-1; ++i) {
        g[i  ].emplace_back(Edge(i+1, 1));
        g[i+1].emplace_back(Edge(i  , 1));
    }
    vector<int> dis(n, 0);
    for (int i = 0; i < n; ++i) {
        vector<int> cost(n, INF);
        dijkstra(i, g, cost);
        for (int j = i + 1; j < n; ++j) {
            dis[cost[j]]++;
        }
    }

    for (int i = 1; i < n; ++i) {
        cout << dis[i] << endl;
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int N,K;
    cin >>N>>K;
    int a=1;
    REP(i,N){
        a=min(a+K,a*2);
    }
    cout<<a<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int i,j,k,x[5];
  int t = 0;
  scanf("%d", &x[0]);
  scanf("%d", &x[1]);
  scanf("%d", &x[2]);
  scanf("%d", &x[3]);
  scanf("%d", &x[4]);

  i = x[0] % 10;
  j = 0;
  for(int m = 1;m < 5;m++){
    if(i > x[m] % 10 && x[m] % 10 != 0){
      i = x[m] % 10;
      j = m;
    }
  }
  for(int m = 0;m < 5;m++){
    if(m == j){
      t = t + x[m];
    }
    else if(x[m] % 10 == 0){
      t = t + (x[m] / 10) * 10;
    }
    else{
      t = t + (x[m] / 10) * 10 + 10;
    }
  }
  printf("%d",t );
}


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

int main(){
	int A,B,C;
	scanf("%d %d %d", &A, &B, &C);
	int cont5 = 0 + (A==5?1:0) + (B==5?1:0) + (C==5?1:0);
	int cont7 = 0 + (A==7?1:0) + (B==7?1:0) + (C==7?1:0);
	if(cont5 == 2 && cont7 == 1)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  A = list(map(int, input().split()))
  A = list(reversed(sorted(A)))

  max_ = A[0]
  max_iter = N-2
  iter_ = 0
  for i in range(1, N):
    for _ in range(2):
      if iter_ >= max_iter:
        print(max_)
        return
      max_ += A[i]
      iter_ += 1


if(__name__ == '__main__'):
  main()

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

using namespace std;

int win(int ,int);

int main(){
	int n;//候補数
	int p;//はじめの石の数

	while(1){
		cin>>n>>p;

		if(n==0&&p==0)
			break;
		cout<<win(n,p)<<endl;
	}
	return 0;
}

int win(int n,int p){
	int hito=0;
	int owan=p;
	int moti_isi[50]={0,};
	while(1){
		if(owan!=0){
			moti_isi[hito]++;
			owan--;
		}
		else{
			owan=moti_isi[hito];
			moti_isi[hito]=0;
		}
		
		if(owan==0){
			int hantei=0;
			for(int i=0;i<n;i++){
				if(moti_isi[i]>=p)
					hantei++;
			}
			if(hantei==1)
				break;
		}

		hito++;
		if(hito>n-1)
			hito=0;
	}
	return hito;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"

using namespace std;

const int INF = 1e9 + 7;

long long n, a, b;
vector<int> h(100001);
vector<int> hc;

bool enough(long long m)
{
  long long t = 0;
  for (int i = 0; i < n; i++) {
    hc[i] = max<long long>(0, hc[i] - b * m);
    t += hc[i] / (a - b) + !!(hc[i] % (a - b));
    if (t > m) return false;
    if (!(hc[i] / (a - b) + !!(hc[i] % (a - b)))) return true;
  }
  return true;
}

void solve()
{
  cin >> n >> a >> b;
  for(int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h.rbegin(), h.rend());
  hc = h;
  long long ans = 0;
  long long s = 1, e = 1e9, m;
  while (s < e) {
    m = (s + e) / 2;
    if (enough(m)) {
      e = m;
    } else {
      s = m + 1;
    }
    hc = h;
  }
  ans = (s + e) / 2;
  cout << ans << "\n";
}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) x.begin(),x.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

int main(){
    ll N,M,K;
    cin >> N >> M >> K;

    vector<ll>A(N),B(M);

    for(ll i = 0;i < N;i++)
        cin >> A.at(i);

    for(ll i = 0;i < M;i++)
        cin >> B.at(i);
    
    vector<ll> ruiA(N+1);
    ruiA.at(0) = 0;

    for(ll i = 1;i <= N;i++)
        ruiA.at(i) = ruiA.at(i-1) + A.at(i-1); 

    vector<ll> ruiB(M+1);
    ruiB.at(0) = 0;

    for(ll i = 1;i <= M;i++)
        ruiB.at(i) = ruiB.at(i-1)+B.at(i-1);
    
    ll res = 0;
    for(ll i = 0;i <= N;i++){
        const int j = upper_bound(ALL(ruiB),K - ruiA.at(i))- begin(ruiB);

        if(j)
            chmax(res,i+j-1);

    }

    cout << res << endl;

    return 0;


}

Measured memory_bytes: 9568
#include <cstdio>

#define N 50
#define M 50

char A[N+1][N+1], B[M+1][M+1];

bool is_contain(int x, int y, int temp_size) {
  for (int i = 0; i < temp_size; i++) {
    for (int j = 0; j < temp_size; j++) {
      if (A[x+i][y+j] != B[i][j]) return false;
    }
  }
  return true;

}

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

  for (int i = 0; i < n; i++) {
    scanf("%s", A[i]);
  }

  for (int i = 0; i < m; i++) {
    scanf("%s", B[i]);
  }

  for (int i = 0; i <= n - m; i++) {
    for (int j = 0; j <= n - m; j++) {
      if(is_contain(i, j, m)) {
        printf("Yes\n");
        return 0;
      }
    }
  }

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


Measured memory_bytes: 128
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  string s; readV(s);
  auto a = s.indexOf('A'), z = s.lastIndexOf('Z');
  writeln(z-a+1);
}


Measured memory_bytes: 2684
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          int[] a = Console.ReadLine().Split('/').Select(x=>int.Parse(x)).ToArray();
          Console.WriteLine(a[1]<=4 ? "Heisei" : "TBD");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

int main(){
    double L;
    cin >> L;
    
    double answer = pow(L,3)/27.0;
    DCOUT (answer,10)
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int N;

vector<vector<int>> A;

int solve(int i, int j) {
  if(i == 1 && j == N-1) return A[i][j];

  int res = 0;
  if(j != N - 1) res = max(res, A[i][j] + solve(i, j+1));
  if(i != 1) res = max(res, A[i][j] + solve(i + 1, j));
  return res;
}

int main () {
  cin >> N;

  A.resize(2, vector<int>(N));

  rep(i,2) rep(j,N) cin >> A[i][j];
  cout << solve(0, 0) << endl;
  return 0;
}


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

void solve(){
	
	#define ll long long
	ll N, M;
	cin>>N>>M;
	int sum = 0;
	int a = 0;
	for(int i = 0; i < M; i++){
		cin>>a;
		sum+=a;
	}
	if(sum<N)
		cout<<N-sum<<endl;
	else if(sum==N)
		cout<<0<<endl;
	else
		cout<<-1<<endl;
}

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

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

int main()
{
     long long  n , k, sum= 0 ;
     cin >> n >> k ;
     long long  a[n] ;
     for ( int i = 0 ; i < n ; i++) {
        cin >> a[i] ;
     }
     sort(a,a+n) ;
     for ( int i = 0 ; i < n-k ; i++) {
        sum += a[i] ;
     }
     cout << sum ;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

ll k;
ll d[55];

int main()
{
	cin >> k;
	for (int i = 0; i < 50; i++) {
		d[i] = 49;
	}
	ll j = k / 50;
	int l = k % 50;
	for (int i = 0; i < 50; i++) {
		d[i] += j;
	}
	if (l != 0) {
		for (int i = 1; i <= 50; i++) {
			if (i > l)d[i - 1] -= l;
			else d[i - 1] += 51 - l;
		}
	}
	cout << 50 << endl;
	for (int i = 0; i < 49; i++) {
		cout << d[i] << " ";
	}
	cout << d[49] << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(a, b) for (ll i = a; i < b + 1; i++)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;

signed main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n+1);
  vector<int> c(n+1);
  REP(i,n){
    int tmp;
    cin >> tmp;
    a[i]=tmp;
  }
  REP(i,n){
    int tmp;
    cin >> tmp;
    b[i+1]=tmp;
  }
  REP(i,n-1){
    int tmp;
    cin >> tmp;
    c[i+2]=tmp;
  }
  int ans=0;
  REP(i,n){
    ans+=b[a[i]];
    if(i==0){
      continue;
    }
    else if(a[i-1]+1==a[i]){
      ans+=c[a[i]];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// "header" {{{
#pragma GCC optimize("Ofast")

#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define int int64_t
#define double long double
#define Fixed fixed << setprecision(10)
#define moke_pair make_pair

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int64_t mod1 = 1000000007;
constexpr int64_t mod2 = 998244353;

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

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class T,class U> using umap = unordered_map<T,U>;

inline int64_t updiv(int64_t n,int64_t d){ return ((n + d -1) / d); }
inline int square(int a){ return a * a; }

int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
// }}}

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n),cuml(n+5),cumr(n+5);

    rep(i,n){
        cin >> a[i];
        cuml[i+1] = max(a[i],cuml[i]);
    }

    cumr[n] = a[n-1];
    for(int i = n-1;i >= 1;--i){
        cumr[i] = max(a[i-1],cumr[i+1]);
    }

    reps(i,n){
        cout << max(cuml[i-1],cumr[i+1]) << '\n';
    }

    return 0;
}

Measured memory_bytes: 6272
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

int par[10000],size[10000];
void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        size[i] = 1;
    }
}
int find(int x) {
    if (x == par[x]) return x;
    return find(par[x]);
}
void unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if (size[x] >= size[y]) {
        par[y] = x;
        size[x] += size[y];
    } else {
        par[x] = y;
        size[y] += size[x];
    }
}
bool same(int x, int y) {
    return find(x) == find(y);
}

struct edge {
    int u, v;
    double cost;
    edge() {}
    edge(int uu, int vv, double cc) : u(uu), v(vv), cost(cc) {}
    bool operator<(const edge &e) {
        return cost > e.cost;
    };
};

const int INF = 100000;
int N, M;
int x[10000], y[10000];
double sum;
//頂点10000で交差がないからせいぜい10倍だろうという見通し
edge G[100000];
//初めからクラスカルで書くべきだった

double dist(int x, int y) {
    return sqrt(x * x + y * y);
}

void kruskal() {
    //プリム法の実行　全体コストから最大全域木を作ってそのコストを引く
    //mincostとしてしまったが実体はmaxcost
    sort(G,G+M);
    init(N);
    double res = 0;
    for (int i = 0; i < M; i++) {
        edge e = G[i];
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }
    printf("%.3lf\n", sum-res);
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];

    }
    int p, q;
    
    for (int i = 0; i < M; i++) {
        cin >> p >> q;
        p--; q--;
        double d = dist(x[p]-x[q], y[p]-y[q]);
        G[i] = edge(p,q,d);
        sum += d;
    }

    //辺を保持→クラスカル
    kruskal();
}



Measured memory_bytes: 3752
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N ; cin >> N ;
    string str; cin >> str;
    
    ll ans = 0;
    ll cnt = 0;
    rep(i, str.size()){
        if(str[i] == 'W') cnt++;
    }
    
    rep(i,str.size()){
        if(i != 0){
            if(str[i-1] == 'E') cnt ++;
        }
        if(str[i] == 'W') cnt --;
        ans = max(ans, cnt);
    }
    
    cout << str.size() - ans -1 << endl;
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 720
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
  int n;
  int root_2n;
  int i, j, k;
  int num[550][550];

  scanf("%d",&n);
  root_2n = (int)sqrt(2*n);
  if(n==root_2n*(root_2n+1)/2) {
    puts("Yes");
    printf("%d\n",root_2n+1);
    for(i=1;i<=root_2n;i++){
      for(j=1;j<=i;j++){
        num[i][j] = i*(i-1)/2 + j;
      }
    }

    printf("%d",root_2n);
    for(i=1;i<=root_2n;i++) {
      //group[k][i] = num[i][i];
      printf(" %d",num[i][i]);
    }
    printf("\n");

    for(k=1;k<=root_2n;k++) {
      printf("%d",root_2n);
      for(j=1;j<=k;j++) {
        //group[k][j] = num[k][j];
        printf(" %d",num[k][j]);
      }
      for(i=k+1;i<=root_2n;i++) {
        //group[k][i] = num[i][k];
        printf(" %d",num[i][k]);
      }
      printf("\n");
    }
  } else {
    puts("No");
  }

  return 0;
}


Measured memory_bytes: 2304
#include<iostream>

using namespace std;

int main(){
	 
	int n;
	int dollar;
	long long sum = 0;
	
	cin >> n;
	int ps = n;
	
	while(n--) {
		cin >> dollar;
		sum += dollar;
	}
	cout << sum / ps << "\n"; 
	  
  	return 0;
}


Measured memory_bytes: 2956
#include<stdio.h>

int main()
{
	int scanCheck = 0;
	char n;
	
	scanCheck = scanf("%c", &n);

	if (n <= 90) {
		printf("%c", 'A');
	}
	else {
		printf("%c", 'a');
	}
	
	return (0);
}

Measured memory_bytes: 1596