akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	v := make([]int, n)
	sorted := make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		v[i], _ = strconv.Atoi(scanner.Text())
		sorted[i] = v[i]
	}
	sort.Ints(sorted)

	dpl := make([][]int, n+1)
	dpl[0] = make([]int, k+1)
	for i := 0; i <= k; i++ {
		dpl[0][i] = 0
	}
	dpr := make([][]int, n+1)
	dpr[0] = make([]int, k+1)
	for i := 0; i <= k; i++ {
		dpr[0][i] = 0
	}

	for i := 1; i <= n; i++ {
		size := k + 1 - i
		if size < 1 {
			break
		}

		dpl[i] = make([]int, size)
		dpr[i] = make([]int, size)

		var lSum int
		var ls []int
		for j := 0; j < i; j++ {
			lSum += v[j]
			ls = append(ls, v[j])
		}
		sort.Ints(ls)
		dpl[i][0] = lSum
		for j := 1; j < k+1-i; j++ {
			if j-1 < i && ls[j-1] < 0 {
				lSum -= ls[j-1]
			}
			dpl[i][j] = lSum
		}

		var rSum int
		var rs []int
		for j := 0; j < i; j++ {
			rSum += v[n-1-j]
			rs = append(rs, v[n-1-j])
		}
		sort.Ints(rs)
		dpr[i][0] = rSum
		for j := 1; j < k+1-i; j++ {
			if j-1 < i && rs[j-1] < 0 {
				rSum -= rs[j-1]
			}
			dpr[i][j] = rSum
		}
	}

	var max int
	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			for x := 0; x <= k-i-j; x++ {
				if dpl[i][x]+dpr[j][k-i-j-x] > max {
					max = dpl[i][x] + dpr[j][k-i-j-x]
				}
			}
		}
	}

	fmt.Println(max)
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
int px[200005];
signed main()
{
	int n; string s;
	cin>>n>>s;
	px[0]=(s[0]=='R');
	for (int i=1;i<n;i++){
		px[i]=px[i-1]+(s[i]=='R');
	}
	int ans=px[n-1];
	for (int i=0;i<n;i++){
		int nr=i+1-px[i];
		int nw=px[n-1]-px[i];
		ans=min(ans,max(nr,nw));
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 5324
// input に入力データが全部入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    
    var len = input[0].length;
    
    var ans = input[0].substr(0,len-8);
    // 出力
    console.log('%s', ans);
}

// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
	var input = document.getElementById("input").value;
	Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const int mod = 2019;
long long modpow(long long a, long long n){
  long long r = 1;
  while (n) {
    r = r * ( (n%2)?a:1 ) %mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}

int main(void){
    string s;cin>>s;
    reverse(s.begin(),s.end());
    map<ll,ll> mp;
    ll now=0;
    rep(i,s.size()){
        ll buf=s[i]-'0';
        ll buf2=buf*modpow(10,i)+now;
        buf2%=2019;
        mp[buf2]++;
        now=buf2;
    }
    ll res=0;
    for(auto& p:mp){
        ll x=p.second;
        if(p.first==0){
            res+=x*(x+1)/2;
        }else{
            res+=(x-1)*x/2;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3804
import sys
c = [[0]*3 for i in range(3)]
for i in range(3):
    c[i] = list(map(int, input().split()))
for i in range(101):
    b1, b2, b3 = c[0][0]-i, c[0][1]-i, c[0][2]-i
    if c[1][0]-b1 == c[1][1]-b2 and c[1][1]-b2 == c[1][2]-b3:
        if c[2][0]-b1 == c[2][1]-b2 and c[2][1]-b2 == c[2][2]-b3:
            print('Yes')
            sys.exit()
print('No')

Measured memory_bytes: 3064
#include <stdio.h>
int main (){
    long long int n; 
    long long int t=1;//biar kalo dikali ga 0 dan dibagi ga 0;
    
    scanf("%lld",&n);
    long long int A[n]; 
    
    for(int i=0; i<n; i++){
        scanf("%lld", &A[i]);
    }
    
    for(int j=0; j<n; j++){
        if(A[j] == 0){  
            printf("0");
            return 0;
        }
    }
    
    for(int k=0; k<n; k++){
        if(A[k] <= 1000000000000000000/t){
            t = t*A[k];
        } 
		else {
            printf("-1");
            return 0;
        }
    }
    
    printf("%lld", t);
    
    
return 0;
}

Measured memory_bytes: 4008
from bisect import bisect_right

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cumA = [0]
for i in range(N):
    cumA.append(cumA[-1] + A[i])
cumB = [0]
for i in range(M):
    cumB.append(cumB[-1] + B[i])

# print(cumA)
# print(cumB)

ans = 0
for i, s1 in enumerate(cumA):
    j = bisect_right(cumB, K - s1) - 1
    if j >= 0:
        s2 = cumB[j]
        assert s1 + s2 <= K
        ans = max(ans, i + j)

print(ans)



Measured memory_bytes: 47324
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;

const ll N = 1e5 + (1 << 16), inf = 1e9;

ll n, a[N], cnt[N], dp[N];
vector <int> adj[N];

ll dfs(ll w) {
	if(dp[w] >= 0)	return dp[w];
	else
		dp[w] = inf;
	for (int i = 0; i < 15; i++) {
		for (int j = 0; j < 15; j++) {
			if(i == j)	continue;
			if(!(w & (1 << i)) || !(w & (1 << j)))
				continue;
			int k = (i + 1) ^ (j + 1);
			k--;
			ll small = dfs(w ^ (1 << i) ^ (1 << j) ^ (1 << k)) + 1;
			if(w & (1 << k))
				dp[w] = min(dp[w], small + 1);
			else
				dp[w] = min(dp[w], small);
		}
	}
	return dp[w];
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < N; i++)
		dp[i] = -inf;
	// VORODI SEFR BASEE
	int m = n - 1;
	for (int i = 0; i < m; i++) {
		int v, u, w;
		cin >> v >> u >> w;
		adj[v].push_back(u), adj[u].push_back(v);
		a[v] ^= w, a[u] ^= w;
	}
	for (int i = 0; i < n; i++)	cnt[a[i]]++;
	int ans = 0, num = 0;
	for (int i = 1; i < (1 << 4); i++) {
		ans += cnt[i] / 2;
		cnt[i] &= 1;
		num |= (cnt[i] * (1 << (i - 1)));
	}
	dp[0] = 0;
//	cout << ans << "\n" << dfs(num) << "\n";
	ans += dfs(num);
	cout << ans << "\n";
}

Measured memory_bytes: 10744
// atcoder/abc088/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int h, w;
  while (cin >> h >> w) {
    char g[h][w];
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        cin >> g[i][j];
      }
    }

    const int inf = 1 << 29;
    int cost[h][w];
    fill(&cost[0][0], &cost[h - 1][w - 1] + 1, inf);
    cost[0][0] = 1;

    int di[] = {0, 0, -1, +1};
    int dj[] = {-1, +1, 0, 0};

    queue<pair<int, int>> q;
    for (q.push({0, 0}); q.size(); q.pop()) {
      pair<int, int> p = q.front();
      for (int d = 0; d < 4; ++d) {
        int ni = p.first + di[d];
        int nj = p.second + dj[d];
        unless (0 <= ni && ni < h) continue;
        unless (0 <= nj && nj < w) continue;
        if (cost[ni][nj] < inf) continue;
        if (g[ni][nj] != '.') continue;
        cost[ni][nj] = cost[p.first][p.second] + 1;
        q.push({ni, nj});
      }
    }

    if (cost[h - 1][w - 1] == inf) cout << -1 << endl;
    else cout << count(&g[0][0], &g[h - 1][w - 1] + 1, '.') - cost[h - 1][w - 1] << endl;
  }

  return 0;
}


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

using namespace std;
typedef long long ll;

vector<vector<int>> to, id;
vector<int> ans;

void dfs(int v,int c=-1, int p=-1) {
    int k = 1;
    for (int i = 0; i < to[v].size(); i++) {
        int u = to[v][i];
        int ei = id[v][i];
        if (u == p) continue;
        if (c == k) k++;
        ans[ei] = k; k++;
        dfs(u, ans[ei], v);
    }
}

int main() {
    int n; cin >> n;
    to.resize(n);
    id.resize(n);
    ans.resize(n-1);
    for (int i = 0; i < n-1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b); id[a].push_back(i);
        to[b].push_back(a); id[b].push_back(i);
    }
    dfs(0);
    int mx = 0;
    for (int i = 0; i < n; i++) {
        mx = max(mx, int(to[i].size()));
    }
    cout << mx << endl;
    for (int i = 0; i < n-1; i++) {
        cout << ans[i] << endl;
    }

}


Measured memory_bytes: 12032
N, A, B, C, D = list(map(int, input().split()))
isYes = False
for k in range(N-1):
	if k*C-(N-1-k)*D <= B-A and B-A <= k*D-(N-1-k)*C:
		isYes = True
		break
if isYes:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 3060
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef long long ll;

#define INF 1000000000000
#define MOD 10000007
#define int long long
#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 pb push_back

void YesNo(bool b) { b ? cout << "Yes" << endl : cout << "No" << endl; return; }
void YESNO(bool b) { b ? cout << "YES" << endl : cout << "NO" << endl; return; }
void yesno(bool b) { b ? cout << "yes" << endl : cout << "no" << endl; return; }

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

Measured memory_bytes: 3640
#include <stdio.h>
#define N 8

void put(int);
int B[N][N];
int yoko[N];
int tate[N];
int naname1[2*N-1];
int naname2[2*N-1];
int main(){
  int i,j,n,a,b;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){ 
      B[i][j] = 0;
      yoko[i] = -1;
      tate[i] = -1;
    }
  }
   for(i=0;i<2*N-1;i++){
      naname1[i] = -1;
      naname2[i] = -1;
   }
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&b);
    B[a][b] = 1;
  }

  put(0);
  
  return 0;
}

void put(int i){
  int j,k;
  //printf("%d\n",i);
  if(i == N){
    
    for(k=0;k<N;k++){
      for(j=0;j<N;j++){
	if(B[k][j] == 1){
	  if(yoko[k] != j){
	    return;
	  }
	}
      }
    }
    
    for(k=0;k<N;k++){
      for(j=0;j<N;j++){
	if(yoko[k] == j)printf("Q");
	else printf(".");
      }
      printf("\n");
    }
    
    return;
  }
  
  for(j=0;j<N;j++){
  if(tate[j] == 1 || naname1[i+j] == 1|| naname2[i-j+N-1] == 1)continue;
    
    yoko[i] = j;
    tate[j] = naname1[i+j] = naname2[i-j+N-1] = 1;
    
    /*if(yoko[i+1] != -1 && yoko[i+2] != -1)put(i+3);
    else if(yoko[i+1] != -1)put(i+2);
    else*/
    //printf("i is %d\n",i);
    put(i+1);
    
    tate[j] = naname1[i+j] = naname2[i-j+N-1] = -1;
    }
}



Measured memory_bytes: 2088
import math

N, K, S = map(int, input().split())

ma = N * (N + 1) / 2

k = 1
if S == 10 ** 9:
    k = -1

li = [S for i in range(K)] + [S+k for i in range(N-K)]

for i in range(N-1):
    print(li[i], end=" ")

print(li[N-1])

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

int main(void){
    long long int stock = 0, money = 1000, n, a[80];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n-1; i++){
        if(a[i] < a[i+1]){
            //buy all
            stock += money / a[i];
            money %= a[i];
        } else if(a[i] > a[i+1]){
            //sell all
            money += a[i] * stock;
            stock = 0;
        }
    }
    //sell all
    money += a[n-1] * stock;
    stock = 0;
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int A, B;
	cin >> A >> B;
	if ((A * B) % 2 != 0) {
		cout << "Odd" << endl;
	}
	else {
		cout << "Even" << endl;
	}
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = myconv(next(),1);
  var list = myconv(next(),4);
  for(var i = 0; i < N; i++){
    if(list[i] % 2 == 0){
       if(!(list[i] % 3 == 0 || list[i] % 5 == 0)){
          myout("DENIED");
         return;
       }
    }
  }
  myout("APPROVED");
}

Measured memory_bytes: 7372
import java.io.File;
import java.io.FileInputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class Main {
	
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		Scanner sc = new Scanner(System.in);
		
		long N = sc.nextLong();
		
		int i = 0;
		while(2 * N > i * (i + 1)) i++;
		System.out.println(i);
	}
}

Measured memory_bytes: 21716
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {

    FastReader sc = new FastReader();

    int n = sc.nextInt();

    int h[] = new int[n];
     int cost[] = new int[n];
        for(int i=0; i<n; i++){
         h[i] = sc.nextInt();
    }
        cost[0] = 0;
        cost[1] = Math.abs(h[1]-h[0]);
        for(int i=2; i<n; i++){
            cost[i] = Math.min(cost[i-1]+Math.abs(h[i]-h[i-1]),cost[i-2]+Math.abs(h[i]-h[i-2]));
        }
        System.out.println(cost[n-1]);
    }

}


Measured memory_bytes: 31732
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

struct UnionFind
{
	vector<int> par;
	UnionFind(int n) :par(n, -1) {}
	int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
	void unite(int x, int y)
	{
		x = find(x); y = find(y);
		if (x == y) return;
		if (par[y] < par[x]) swap(x, y);
		if (par[x] == par[y]) par[x]--;
		par[y] = x;
		if (find(x) != find(y)) par[find(y)] = x;
	}
	int count()
	{
		int cnt = 0;
		REP(i, par.size()) if (par[i] < 0) cnt++;
		return cnt;
	}
	bool same(int x, int y)
	{
		return find(x) == find(y);
	}
};

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int a, b; cin >> a >> b;
	cout << a - (b < a) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a;
	int b;
	int add;
	int min;
	int mul;
	int list[10000];
	int cek=-2000000;
	
	scanf("%d %d",&a,&b);
	
	add=a+b;
	min=a-b;
	mul=a*b;
	
	list[0]=add;
	list[1]=min;
	list[2]=mul;
	
	for(int i=0;i<3;i++)
	{
		if(list[i]>cek)
		{
			cek=list[i];
		}
	}
	
	printf("%d",cek);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size()
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define forn(i, n) for (int i = 1; i <= n; i++)
#define ford(i, n) for (int i = n; i >= 0; i--)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define foreach(itr, c) for (__typeof((c).begin(), (c).end()) itr = c.begin(); itr != c.end(); itr++)
#define fill(a, b) memset(a, b, sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<char> vs;
typedef vector<pi> vpi;

using namespace std;

int main()
{
    string s, t;
    int n;
    int x;
    int count = 0;
    int temp = 0;

    cin >> s >> t;

    for (int i = 0; i < s.length() - t.length() + 1; i++)
    {
        x = 0;
        temp = 0;
        for (int j = 0; j < t.length(); j++)
        {
            if (s[i + x] == t[j])
            {
                temp++;
            }
            x++;
        }
        if (count < temp)
        {
            count = temp;
        }
    }
    cout << t.length() - count;
}

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

int main() {
  int N;
  cin >> N;
  double ans = 0;
  double tempX;
  char tempU[4];
  for (int i = 0; i < N; i++) {
    cin >> tempX >> tempU;
    if (tempU[0] == 'J') {
      ans += tempX;
    } else {
      ans += tempX * 380000;
    }
  }
  printf("%.6lf", ans);
  return 0;
}

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

using namespace std;

void Main() {
    vector<int> x(5, 0);
    cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];

    for (int i = 0; i < 5; ++i) {
        if (x[i] == 0) {
            cout << i + 1 << endl;
            break;
        }
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3628
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <bits/stdc++.h>

using namespace std;

int main()
{
    char c;
    
    cin>>c;
    
    c+=1;
    
    cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, K: int, h: "List[int]"):
    h.sort()
    print(min(h[i + K - 1] - h[i] for i in range(N - K + 1)))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    h = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, h)


if __name__ == '__main__':
    main()


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n>>m;

    //cout <<fixed<<setprecision(16)<< << endl;
    
    cout<<max((n-1)*n,0)/2 +  max((m-1)*m,0)/2<<endl;
    
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys
n,y = map(int, input().split())
for i in range(n+1):
  for j in range(n-i+1):
    k = n-i-j
    if 10000*i+5000*j+1000*k==y:
      print("{0} {1} {2}".format(i,j,k))
      sys.exit()
print("-1 -1 -1")

Measured memory_bytes: 2940
a = int(input())
value = list(map(int, input().split()[:a]))
cost = list(map(int, input().split()[:a]))
l = []
for v, c in zip(value, cost):
    if v - c > 0:
        l.append(v -c)
res = 0
for item in l:
    if item > 0:
        res += item
print(res)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
//const ll MOD=1e9+7;
const ll MOD=998244353;
//const ll MOD=100000;
const ll MAX=1e7;
const ll INF=(1ll<<55);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
struct Union_Find{
    ll N;
    vi par;
    vi siz;
    Union_Find(int n):N(n){
        par.resize(N);
        siz.resize(N,1);
        rep(i,0,N) par[i]=i;
    }
    ll root(ll X){
        if(par[X]==X) return X;
        return par[X]=root(par[X]);
    }
    bool same(ll X,ll Y){
        return root(X)==root(Y);
    }
    void unite(ll X,ll Y){
        X=root(X);
        Y=root(Y);
        if(X==Y) return;
        par[X]=Y;
        siz[Y]+=siz[X];
        siz[X]=0;
    }
    ll size(ll X){
        return siz[root(X)];
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r];
}
signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll N,S; cin>>N>>S;
    vii dp(N+1,vi(S+1));
    dp[0][0]=1;
    rep(i,0,N){
        ll X; cin>>X;
        REP(j,0,S) dp[i+1][j]=dp[i][j]*2%MOD;
        REP(j,X,S){
            dp[i+1][j]+=dp[i][j-X];
            dp[i+1][j]%=MOD;
        }
    }
    cout<<dp[N][S]<<endl;
}


Measured memory_bytes: 73688
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long k = scanner.nextLong();
			long[] sum = new long[n + 1], patty = new long[n + 1];
			sum[0] = patty[0] = 1L;
			IntStream.rangeClosed(1, n).forEach(i -> {
				sum[i] = (sum[i - 1] << 1) + 3;
				patty[i] = (patty[i - 1] << 1) + 1;
			});
			System.out.println(getResult(n, k, sum, patty));
		}
	}

	/**
	 * パティは何枚あるかを計算する
	 * 
	 * @param n
	 * @param k
	 * @param sum   階層数の配列
	 * @param patty バティ総数の配列
	 * @return パティは何枚あるか
	 */
	private static long getResult(int n, long k, long[] sum, long[] patty) {
		if (k <= n) {
			// パティまで食べられない
			return 0L;
		} else if (k == sum[n]) {
			// すべて食べた場合
			return patty[n];
		} else if (k <= sum[n - 1] + 1) {
			// 前半までしか食べない場合
			return getResult(n - 1, k - 1, sum, patty);
		} else if (k == sum[n - 1] + 2) {
			// 前半＋真ん中のパティを食べる場合
			return patty[n - 1] + 1;
		} else {
			// 後半まで食べる場合
			return patty[n] - getResult(n - 1, sum[n] - k - 1, sum, patty);
		}
	}
}


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

int main(){
  long long A,B,C; cin >> A >> B >> C;
  if(A%2==0||B%2==0||C%2==0){
    cout << 0 << endl;
  }else{
    if(A==max({A,B,C})){
      cout << B*C << endl;
    }else if(B==max({A,B,C})){
      cout << A*C << endl;
    }else{
      cout << A*B << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.close();
		int ans = 0;

		for (int i = 1; i <= N; i++) {
			if (i % 2 != 0) {
				int a = 0;
				for (int j = 1; j <= i; j++) {
					if (i % j == 0) {
						a++;
					}
				}
				if (a == 8) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


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

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

    string ans = "No";
    if (n % 2 == 0) {
        int m = n / 2;
        string sub = s.substr(m);

        if (s == sub + sub) {
            ans = "Yes";
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,k,arr[200005],ans[200005],minim;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ans[0]=0;
    for(int i=0;i<n;i++)
    {
        minim=1e15;
        for(int j=i-1;j>=(ll)max(i-k,(ll)0);j--)
        {
            ans[i]=min(minim,ans[j]+abs(arr[i]-arr[j]));
            minim=min(minim,ans[j]+abs(arr[i]-arr[j]));
        }
    }
   /* for(int i=0;i<n;i++)
    {
        cout<<ans[i]<<' ';
    }
    cout<<'\n';*/
    cout<<ans[n-1]<<'\n';
    return 0;
}

Measured memory_bytes: 5172
N,M = (int(x) for x in input().split())
Broken = [True]*(N+1)
for TM in range(0,M):
    Broken[int(input())] = False
DP = [1]+[0]*N
for Now in range(0,N):
    for Next in range(Now+1,min(N+1,Now+3)):
        if Broken[Next]==True:
            DP[Next] = (DP[Next]+DP[Now])%1000000007
print(DP[N])

Measured memory_bytes: 13452
#include<iostream>
using namespace std;
int main()
{
int r,d,xi;
  int i,t;
  
  cin>>r>>d>>xi;
  t=xi;
  for(i=0;i<10;i++)
  {
    t= ((r*t)-d);
    cout<<t<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]
cH = [sum([1 for x in c[i] if x == '#']) for i in range(H)]
cW = [sum([1 for j in range(H) if c[j][i] == '#']) for i in range(W)]
B, ans = sum(cH), 0

for num in range(2**(W+H)):
    indexes = [(num >> i) % 2 for i in range(W+H)]
    indexesH = []
    temp = B
    for i in range(H):
        if indexes[i] == 1:
            temp -= cH[i]
            indexesH.append(i)
    for i in range(W):
        if indexes[H+i] == 1:
            temp -= cW[i] - sum([int(c[j][i] == '#') for j in indexesH])
    if temp == K:
        ans += 1
print(ans)

Measured memory_bytes: 9256
import java.util.Scanner;
public class Main{
 int time;
 int h;
 int m;
 int s;
 
  
  public void solve(){
    Scanner sc= new Scanner(System.in);
    time= sc.nextInt();
    h=time/3600;
    m=(time-h*3600)/60;
    s=time-(h*3600+m*60);
    System.out.println(h+":"+m+":"+s);
}


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

Measured memory_bytes: 17324
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)




int main() {
	ll n;
	cin >> n;
	n--;

	ll cur = 26LL;
	ll d = 1;
	while(n >= cur) {
		n -= cur;
		d++;
		cur = cur * 26LL;
	}

	string s(d, ' ');
	for(int i = d - 1; i >= 0; i--) {
		s[i] = n % 26 + 'a';
		n = n / 26LL;
	}
	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n;
    cin >> n;
    cout << 180*n - 360 << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int 
#define mk make_pair
int a[2*100005];
int n,k;
int find(int x){
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]%x==0 && (a[i]/x)!=0){ans+=a[i]/x;ans-=1;}
        else ans+=((a[i]/x));
    }
    if(ans<=k)return 1;
    else return 0;
}
int main(){
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>a[i];
   int l=1,r=(int)(1e9+7);
   int ans=0;
   while(l<=r){
       int mid=(l+r)/2;
      // cout<<l<<" "<<r<<endl;
       if(find(mid)){ans=mid;r=mid-1;}
       else l=mid+1;
   }
   cout<<ans<<endl;
    return 0;
}


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

ll a[252521];
ll tmp[252521];
 
ll solve(int l,int r){
  if(r-l <= 16){
    ll ret = (r-l)*(r-l-1)/2;
    REP(k,r-l-1)FOR(i,l,r-1-k)if(a[i]>a[i+1])swap(a[i],a[i+1]),ret--;
    return ret;
  }
  // if(r-l==1){
  //   return 0ll;
  // }
  int mid = (l+r)/2;
  ll ret = solve(l,mid) + solve(mid,r);
  int hl = l, hr = mid;
  FOR(i,l,r){
    if(hl<mid && (hr==r || a[hl]<=a[hr])){
      tmp[i] = a[hl++];
    }else{
      ret += hl-l;
      tmp[i] = a[hr++];
    }
  }
  FOR(i,l,r)a[i]=tmp[i];
  return ret;
}
 
int main(){
  int n;
  ll k;
  scanf("%d%lld",&n,&k);
  REP(i,n){
    scanf("%lld",a+i+1);
    a[i+1] += a[i] - k;
  }
  ll ans = solve(0,n+1);
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
#define NUM 39

int main(void)
{
	int i,d,result;

	while(scanf("%d",&d)!=EOF){
		for(i=0; i<d; i++)
			result=i%NUM;
		printf("3C%02d\n",result+1);
	}

	return 0;
}

Measured memory_bytes: 608
/* #pragma GCC optimize("O3") */
/* #pragma GCC target ("avx2") */
/* #pragma GCC optimize("Ofast") */
/* #pragma GCC optimize("unroll-loops") */
/* #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T, typename cmp=less<T>>
using ordered_set=tree<T,null_type,cmp,rb_tree_tag,tree_order_statistics_node_update>;
template<typename K, typename V, typename cmp=less<K>>
using ordered_map=tree<K, V, cmp, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
using ll = long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax = 1000*1007;
#define ar array
#define len(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define tT template<typename T
#define tV typename V
#define ins inline string
#ifdef LOCAL
tT>ins to_string(T& t);
ins to_string(string s) {return '"' + s + '"';}
ins to_string(char c){string res="'";res.push_back(c);return res+"'";}
ins to_string(const char* s) {return to_string((string)s);}
ins to_string(char* s) {return to_string((string)s);}
template <size_t N>ins to_string(bitset<N> v) {string res="";for(size_t i = 0; i < N; i++){
res += static_cast<char>('0' + v[i]);}return res;}
ins to_string(bool b) {return (b ? "true" : "false");}
tT,tV>ins to_string(pair<T, V>& p){return "("+ to_string(p.first)+", "+to_string(p.second)+")";}
tT>ins to_string(T& v){string res="{";for(auto& i:v){res+=to_string(i)+',';} return res+'}';}
#define log(...) cerr<< "[" << #__VA_ARGS__ << " : "<< to_string(__VA_ARGS__) << "]"<<endl
#else
#define log(...) 0x30
#endif

inline void test_case(){
    for(int i=0; i<5; i++){
        int x;
        cin>>x;
        if( x==0){
            cout<<i+1<<"\n";
            return;
        }
    }

}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt;
    tt = 1;
    for(int qq=1; qq<=tt; qq++){
        /* cout<<"Case #"<<qq<<": "; */
        test_case();
    }
}   



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

int main() {
  int h, w;
  cin >> h >> w;

  for (int i = 0; i < w + 2; i++) {
    cout << '#';
  }
  cout << endl;

  for (int i = 0; i < h; i++) {
    string a;
    cin >> a;
    cout << '#' << a << '#' << endl;
  }

  for (int i = 0; i < w + 2; i++) {
    cout << '#';
  }
  cout << endl;
  return 0;
}


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

int main(){
    int N, X, m;
    cin >> N >> X;
    int tempMin =1010;
    for(int i = 0; i < N; i++){
        cin >> m;
        X -= m;
        if(m < tempMin){
            tempMin = m;
        }
    }
    cout << N + X/tempMin << endl;
}

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

int n, c[1010], w[1010];
int ruiseki[1010];

bool possible[1010][1010];
int dp[1010];

bool memo(int start, int end)
{    
  if(!possible[start - 1][end] && start > 1 && ruiseki[end] - ruiseki[start - 1] <= c[start - 1]){
    possible[start - 1][end] = true;
    memo(start - 1, end);
  }
  if(!possible[start][end + 1] && end < n && ruiseki[end] - ruiseki[start - 1] <= c[end + 1]){
    possible[start][end + 1] = true;
    memo(start, end + 1);
  }
}

int main()
{
  scanf("%d", &n);
  for(int i = 1; i <= n; i++){
    scanf("%d%d", &c[i], &w[i]);
  }

  for(int i = 1; i <= n; i++){
    ruiseki[i] = ruiseki[i - 1] + w[i];
  }

  for(int i = 1; i <= n; i++){
    memo(i, i);
  }

  for(int i = 1; i <= n; i++){
    dp[i] = dp[i - 1] + 1;
    for(int j = i - 1; j >= 1; j--){
      if(possible[j][i]){
	dp[i] = min(dp[i], dp[j - 1] + 1);
      }
    }
  }

  printf("%d\n", dp[n]);
  return 0;
}

Measured memory_bytes: 2204
#include <iostream>
#include <string>

using namespace std;

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

    int n;
    string s;

    cin >> n >> s;

    if (n % 2 == 0) {
        int l = 0, r = n / 2;

        while (r < n) {
            if (s[l] != s[r]) {
                cout << "No\n";
                return 0;
            }
            l++, r++;
        }
        cout << "Yes\n";
    } else
        cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
@$_=$_ for@p=0..<>;map{unshift@a,$#p*~-$#p/2-$%;@$A>@$B&&($A^=$B^=$A^=$B),$%+=@$B*map$p[$$B[@$B]=$_]=$B,@$A if($B=$p[$'*/ /])-($A=$p[$`])}reverse<>;print"@a"

Measured memory_bytes: 140672
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const int NAX=1005;
const long long  MOD=(long long)(998244353);

Int N,M,K;
Int X,Y,Z;
Int H,W;

Int perform(Int x){
    return (x*(x+1))/2LL;
}
vector<Int> A;
vector<int> adj[MAXN];
using D=long double;

bool inRange(Int a,Int b){
    return a*b<=0;
}

long long C[NAX][NAX];
const D pi=3.14159265359;


long long ModExpo(long long x,unsigned long long y,long long M){
    Int ans=1;
    ans=(long long)ans;
    
    while(y>0){
        if(y&1) ans=((ans%M)*(x%M))%M;
        y>>=1LL;
        x=((x%M)*(x%M))%M;
    }
    return ans%M;
}
long long fac[MAXN];
void fillFac(){
    fac[0]=1;
    for(int i=1;i<MAXN;++i){
        fac[i]=((fac[i-1]%MOD)*(i%MOD))%MOD;
    }
}

long long ModInv(long long x){
    return ModExpo(x,MOD-2,MOD);
}

long long FermatLast(long long n,long long r){
    if(r>n) return 0;
    if(!r) return 1;
    return (fac[n] * ModInv(fac[r]) % MOD * ModInv(fac[n - r]) % MOD) % MOD;
}

Int performMod(Int x){
    Int y=((x%MOD)*((x+1)%MOD))%MOD;
    return (y*ModInv(2))%MOD;
}

Int madd(Int x,Int y){
    return (x+y)%MOD;
}

Int mmul(Int x,Int y){
    return ((x%MOD)*(y%MOD))%MOD;
}


bool isMSB(int bit,Int x){
    return (int)(floor(log2l(x)))==bit;
}
bool VIS[MAXN];
void dfs(int u){
    VIS[u]=true;
        for(auto &v:adj[u]){
            if(!VIS[v]){
                dfs(v);
            }
        }
}
int main()
{
    string S;cin>>S;
    vector<char> counts(26);
        for(auto x:S) ++counts[x-'a'];
        
        for(int i=0;i<26;++i){
            if(!counts[i]){
                cout<<char(i+'a');
                exit(0);
            }
        }
        cout<<"None\n";
            
}


Measured memory_bytes: 15464
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
from collections import deque as deq
import math

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

S = 0
for x in X:
    S += x

S /= len(X)
f, i = math.modf(S)
if f >= 0.5:
    i += 1

S = 0
for x in X:
    S += (i - x) ** 2

print(int(S))


Measured memory_bytes: 3316
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vs a;
string t;

int Judge(string s){
	int S=s.size();
	string as,bs;
	for(int i=0;i<S;i++){
		if(s[i]=='?'){
			as+='a';
			bs+='z';
		}
		else{
			as+=s[i];
			bs+=s[i];
		}
	}
	if(t<as) return 1;
	if(t>bs) return -1;
	return 0;
}

int main(){
	cin>>n;
	a=vs(n);
	for(int i=0;i<n;i++) cin>>a[i];
	cin>>t;
	int x=0,y=0;
	for(int i=0;i<n;i++){
		int f=Judge(a[i]);
		if(f==-1) x++;
		if(f==1) y++;
	}
	for(int i=x+1;i<=n-y+1;i++){
		if(i!=x+1) cout<<' ';
		cout<<i;
	}
	cout<<endl;
}

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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //     freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    //     freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif
    int n;
    cin>>n;
    int a[n];
    f1(i,0,n)
    cin>>a[i];

    sort(a,a+n);
    vector<int> odd;
    vector<int> even;
    vector<pair<int,int>> ans;
    int st=a[n-1];
    odd.pb(a[0]);
    f1(i,1,n-1)
    {
        if(a[i]<0)
            odd.pb(a[i]);
        else
            even.pb(a[i]);
    }
    f1(i,0,even.size())
    {
        ans.pb(mp(odd[0],even[i]));
        odd[0]-=even[i];
    }
    f1(i,0,odd.size())
    {
        ans.pb(mp(st,odd[i]));
        st-=odd[i];
    }
    cout<<st<<endl;
    f1(i,0,ans.size())
    {
        cout<<ans[i].ff<<gp<<ans[i].ss<<endl;
    }
    return 0;
}

Measured memory_bytes: 5872
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int sum = 0;
    cin >> s;
    int a=0;
    for(int i=0;i<s.size();i++)
    {
        a = s[i]-48;
        sum += a;
    }
    if( sum%9==0 || s =="0")
    {
        cout << "Yes";
    }
    else cout << "No";
}


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

int main() {
  int max_i, min_i;
  int A[10];
  cin >> A[0] >> A[1] >> A[2];

  max_i = max({A[0],A[1],A[2]});
  min_i = min({A[0],A[1],A[2]});

  cout << max_i - min_i << endl;
  return 0;
}


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

const int N = 1e5+10, A = 1e18;

int n, a[N], b[N];

signed main() {
	scanf("%lld", &n);
	b[0] = 1;
	for (int i = 0; i <= n; ++i) {
		scanf("%lld", a+i);
		b[i] -= a[i];
		if (b[i] < 0) {
			puts("-1");
			return 0;
		}
		if (i < n) b[i+1] = min(b[i]*2, A);
	}
	int cur = 0, ans = 0;
	for (int i = n; ~i; --i) {
		cur += a[i];
		ans += cur;
		if (i > 0) cur = min(cur, b[i-1]);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 5272
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
  ($line:expr, $name:ident, $t:tt) => {
    let $name = value!($line, $t);
  };
}

macro_rules! values_def {
  ($lines:expr, $n:expr, $name:ident, $t:tt) => {
    let $name = {
      let mut vec = Vec::new();
      for i in 0..$n {
        let mut next = $lines.next().unwrap().split_whitespace();
        vec.push(value!(next, $t));
      }
      vec
    };
  };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
  let mut input = String::new();
  io::stdin().read_to_string(&mut input).unwrap();
  let output = solve(input.trim().to_string());
  println!("{}", output);
}

fn solve(input: String) -> String {
  input!(input=>(h:usize w:usize)(a:usize b:usize));
  ((h - a) * (w - b)).to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}
tests! {
    test1: "3 2\n2 1\n" => "1\n",
    test2: "5 5\n2 3\n" => "6\n",
    test3: "2 4\n2 4\n" => "0\n",
}


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

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

const int N = 2e5 + 5, LOG = 64;

int n, dp[N][LOG];
ll k;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> dp[i][0];
		dp[i][0]--;
	}
	for (int j = 1; j < LOG; j++)
		for (int i = 0; i < n; i++)
			dp[i][j] = dp[dp[i][j - 1]][j - 1];
	int v = 0;
	for (int i = 0; i < LOG; i++)
		if(k & (1LL << i))
			v = dp[v][i];
	cout << v + 1 << "\n";
}


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

int main(){
string S;
  cin >> S;
  int a=0;
  for(int i=0;i<3;i++){
if(S.at(i)==S.at(i+1)){
    a=1;}
  }
  if(a){
    cout << "Bad" << endl;
  }
    else{
      cout << "Good" << endl;
    }
}

Measured memory_bytes: 256