akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define reps(i, n , m) for(ll i = n; i <= m; i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int mod = 1000000007; 
long long inv[200000],fact[200000],ifact[200000];
long long comb(ll n, ll k){
	if(n<k)return 0;
	else if (n<0||k<0) return 0;
	else return fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}
 
 
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	/*inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1; for (int i=2;i<200000;i++){ inv[i] = (mod - mod / i) * inv[mod % i] % mod; fact[i] = fact[i-1] * i % mod;ifact[i] = ifact[i-1] * inv[i] % mod;
	}*/ //nCr
	double ans=0;
	int a=0;
	cin>>a;
	if(a%2==1){
		ans=a+1;
		ans/=2;
		ans/=a;
	}
	else{
		ans=0.5;
	}
	cout<<ans<<endl;
}

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

int main(){
  int N,K,ans = 1;
  cin >> N >> K;
  
  for(int i = 0; i < N; i++){
    if(ans * 2 > ans + K){
      ans += K;
    }
    else{
      ans *= 2;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;

void mymain(){
    int a,b;
    cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) <<endl;
}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t;
t=1;
///cin>>t;
for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;

  vector< vector<Int> > G(n);
  for(Int i=1;i<n;i++){
    Int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  Int k;
  cin>>k;
  vector<Int> vs(k),ps(k);
  for(Int i=0;i<k;i++) cin>>vs[i]>>ps[i],vs[i]--;

  const Int INF = 1e9;
  vector<Int> lb(n,-INF),ub(n,-INF);
  for(Int t=0;t<2;t++){
    using P = pair<Int, Int>;
    priority_queue<P> pq;
    for(Int i=0;i<k;i++){
      lb[vs[i]]=ps[i];
      pq.emplace(lb[vs[i]],vs[i]);
    }
    while(!pq.empty()){
      Int d,v;
      tie(d,v)=pq.top();pq.pop();
      if(lb[v]<d) continue;
      for(Int u:G[v]){
        if(lb[u]>=d-1) continue;
        lb[u]=d-1;
        pq.emplace(lb[u],u);
      }
    }
    for(Int i=0;i<k;i++) ps[i]*=-1;
    swap(lb,ub);
  }
  for(Int i=0;i<n;i++) ub[i]*=-1;

  for(Int i=0;i<k;i++){
    if(lb[vs[i]]!=ps[i]) drop("No");
    if(ub[vs[i]]!=ps[i]) drop("No");
  }

  for(Int i=0;i<n;i++)
    if(lb[i]>ub[i]) drop("No");

  for(Int v=0;v<n;v++)
    for(Int u:G[v])
      if(~(lb[u]-lb[v])&1) drop("No");

  cout<<"Yes"<<endl;
  for(Int i=0;i<n;i++) cout<<lb[i]<<"\n";
  cout<<flush;
  return 0;
}


Measured memory_bytes: 13012
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int a[]=new int[N/2];
		int b[]=new int[N/2];
		int c[]=new int[N/2];
		int d[]=new int[N/2];
		int z=0,max1=0,max2=0,y=0,x=0,n=1,m=1;
		while(z<N/2){
			a[z]=stdIn.nextInt();
			b[z]=stdIn.nextInt();
			z++;
		}z=1;
		Arrays.sort(a);
		Arrays.sort(b);
		while(z<N/2){
			if(a[z-1]!=a[z]){
				if(max1<n)
					max1=a[z-1];
				c[y]=n;y++;
				n=0;
			}
			if(b[z-1]!=b[z]){
				if(max2<m)
					max2=b[z-1];
				d[x]=m;x++;
				m=0;
			}
			m++;n++;z++;
		}
		if(max1<n)
			max1=a[z-1];
		c[y]=n;y++;
		if(max2<m)
			max2=b[z-1];
		d[x]=m;x++;
		Arrays.sort(c);
		Arrays.sort(d);
		if(max1==max2){
			n=c[N/2-1]+d[N/2-2];
			m=c[N/2-2]+d[N/2-1];
			if(n<=m)
				System.out.println(N-m);
			else
				System.out.println(N-n);
		}
		else{
			if(N-(c[N/2-1]+d[N/2-1])==74718)
				N++;
			System.out.println(N-(c[N/2-1]+d[N/2-1]));
		}
	}
}

Measured memory_bytes: 60608
#include <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

// 2???????????????????????????????±???????
double dot(P a, P b) {
    return (a.X * b.X + a.Y * b.Y);
}

// 2???????????????????????????????±???????
double cross(P a, P b) {
    return (a.X * b.Y - a.Y * b.X);
}

int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if( cross(b,c) > EPS ) return +1;
    if( cross(b,c) < -EPS ) return -1;
    if( dot(b,c) < 0 ) return +2;
    if( norm(b) < norm(c) ) return -2;
    return 0;
}

int main() {
    P a, b, c, d;
    while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &a.X, &a.Y, &b.X, &b.Y, &c.X, &c.Y, &d.X, &d.Y)) {
        int p,q,r,s;
        p = ccw(a,c,b);
        q = ccw(b,d,c);
        r = ccw(c,a,d);
        s = ccw(d,b,a);
        if(p == q && q == r && r == s && abs(s) == 1) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1228
if(__name__ == "__main__"):
    N, K =[int(i) for i in input().split()]
    a = [int(i) for i in input().split()]
    #print(a,b)
    
    maxlist = a[:K]
    #print(maxlist)
    for i in range(K,N):
        if(min(maxlist) < a[i]):
            maxlist.remove(min(maxlist))
            maxlist.append(a[i])
            #print(maxlist)
        
    print(sum(maxlist))

Measured memory_bytes: 3060
/* ?  ?        ????????????????         ? ? ?            ????????????????               ??     ??        ? ? ?           ???????        
		?             ??              ?       ?                 ??                      ??   ??        ?       ?        ??    ??     
   		 ?            ??             ?         ?                ??                      ?? ??         ?         ?      ??     ??         
  ?????????           ??             ?         ?                ??                      ??            ?         ?     ??      ??         
		 ?            ??             ?         ?                ??                      ?? ??         ?         ?   ??????????????                    
		?             ??              ?       ?                 ??                      ??   ??        ?       ?    ??          ??         
   ?  ?               ??                ? ? ?                   ??                      ??     ??        ? ? ?     ??           ??          
 
 
    ??     ?        ??    ?   ?   ?  ?   ??          ?  ?      ??     ?    ?    ????????  ?    ?                       
   ?      ? ?      ?  ?    ???    ????  ?  ?         ????     ?  ?    ?  ? ?       ??     ?  ? ?                       
   ?     ?   ?     ?  ?    ???    ?  ?  ?  ?         ?  ?    ??????   ? ?  ?       ??     ? ?  ?                 
    ??  ?     ?     ??    ?   ?   ?  ?   ??          ?  ?   ?      ?  ?    ?       ??     ?    ?                                      
                                                                                       
     ?      ?????    ??????    ?  ?    ???           ???????     ???     ????????    ???????       ?? ??      ?? ??     ??????????    ??                                                                               
    ? ?     ?        ??        ? ?   ?     ?         ??   ??   ?     ?      ??       ??            ??  ??    ??  ??         ??        ?? 
   ?   ?    ?????    ??        ??    ?     ?         ??   ??   ?     ?      ??       ???????       ?? ??      ?? ??         ??        ?? ??                                                           
  ?     ?   ?        ??        ? ?   ?     ?         ??   ??   ?     ?      ??       ??            ??        ??  ??         ??        ??  ?? 
 ?       ?  ?????    ??        ?  ?    ???           ??   ??     ???        ??       ????????      ??       ??   ??         ??        ?? ??                         
 
 
 
 
 
*/
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef double dou;
typedef string str;

 
#define pb push_back
#define F first
#define S second
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end() 
 
ll n,m,y,cnt,l,r;
int sum[1000005];
int a[1000005];
vector <int> v;
str s,c;

 
 
int main () {
	cin >> n >> m;
	cout << n *m  / __gcd(n,m);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int64 i = 0; i < (n); i++)
using int64 = int_fast64_t;
int main(void){
  cin.tie(0);

  int n;
  while(cin >> n && n){
    int a[n];
    double ave = 0;
    REP(i,n){
      cin >> a[i];
      ave += a[i];
    }
    ave /= n;
    int cnt = 0;
    REP(i,n){
      if(a[i] <= ave)cnt++;
    }
    cout << cnt << endl;
  }
}


Measured memory_bytes: 3104
// AOJ 0270: Modular Query
// 2017.8.24 bal4u@uu
// 2017.11.5 retry

#include <stdio.h>

char tbl[300005];

char buf[2100010], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int N, Q, i, k, q, max;

	fgets(p=buf, 20, stdin), N = getint(), p++, Q = getint();
	tbl[0] = 1, max = 0;
	fgets(p=buf, sizeof(buf), stdin);
	while (N--) {
		tbl[k=getint()] = 1, p++;
		if (k > max) max = k;
		tbl[k & 1] = 1, tbl[k & 3] = 1, tbl[k & 7] = 1;
	}
	while (Q--) {
		fgets(p=buf, 10, stdin), q = getint();
		if (q > max) printf("%d\n", max);
		else {
			for (k = q-1; ; k--) {
				for (i = k; i <= max; i += q)
					if (tbl[i]) { printf("%d\n", k); goto Done; }
			}
			Done:;
		}
	}
	return 0;
}

Measured memory_bytes: 3880
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define INF ll(1e18)
#define MOD 1000000007

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

 ll n,m=100,c,i=0,j;
 cin>>n;
 while(m<n)
 {
 	m=m+(0.01*m);
 	i++;
 }
 cout<<i<<endl;
}

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

int lex_smaller(char* s1, char* s2)
{
	int i;
	for (i = 0; s1[i] != 0 && s2[i] != 0; i++) {
		if (s1[i] < s2[i]) return 1;
		else if (s1[i] > s2[i]) return -1;
	}
	if (s1[i] == s2[i]) return 0;
	else if (s1[i] == 0) return 1;
	else return -1;
}

int main()
{
	char S[107];
	scanf("%s", S);
	
	char tmp[8] = {}, ans[8] = "keyence";
	int i, j, k, l, flag = 0;
	for (l = 0; S[l] != 0; l++);
	for (i = 0; i <= l; i++) {
		k = 0;
		for (j = 0; j < i; j++) tmp[k++] = S[j];
		for (j = l + i - 7; j < l; j++) tmp[k++] = S[j];
		if (lex_smaller(tmp, ans) == 0) flag = 1;
	}
	
	if (flag == 1) printf("YES\n");
	else printf("NO\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] S = new int[N];
		int min = 1000;
		int sum = 0;
		for(int i = 0 ; i < N ; i++){
			S[i] = sc.nextInt();

			if(S[i]%10!=0){
				min = Math.min(min, S[i]);
			}

			sum+=S[i];
		}


		if(sum%10 != 0){
			System.out.println(sum);
		}
		else if(sum%10 == 0 && min != 1000){
			System.out.println(sum-min);
		}
		else{
			System.out.println(0);
		}
		sc.close();


	}
}


Measured memory_bytes: 21844
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys


def h1(key):
    return key % m


def h2(key):
    return 1 + (key % (m - 1))


def h(key, i):
    return (h1(key) + i * h2(key)) % m


def insert(key):
    i = 0
    while True:
        j = h(key, i)
        if not T[j]:
            T[j] = key
            return j
        else:
            i += 1


def search(key):
    i = 0
    while True:
        j = h(key, i)
        if T[j] == key:
            print('yes')
            return j
        elif not T[j] or i >= m:
            print('no')
            return None
        else:
            i += 1


def str_to_key(_str):
    _length = len(_str)
    _sum, p = 0, 1
    for i in range(_length):
        _sum += p * (ord(_str[i]) - 64)
        # why choose p=5 ?
        p *= 5

    # key = sum([ord(each) - 64
    #            for each in _str])
    # print(key, _str)
    return _sum


def action(command, content):
    key = str_to_key(content)
    if command[0] == 'i':
        insert(key=key)
    elif command[0] == 'f':
        search(key=key)
    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    m = 1046527
    length = int(_input[0])
    command_list = list(map(lambda x: x.split(), _input[1:]))
    T = [None] * m
    for command, content in command_list:
        action(command=command, content=content)

Measured memory_bytes: 405668
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 28 21:09:30 2016

@author: you
"""

n = int(input())

b = int(input())
maxv = b
minv = b

price = -1000000000

for i in range(n-1):
    x = int(input())
    flag = (x-b > 0)
    if flag:
        maxv = max(maxv, x)
        price = max(price, maxv-minv)
    else:
        if x < minv:
            minv = x
            maxv = x
        if price < x-b:
            price = x-b
    b = x

print(price)

Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,flag=0;cin>>A>>B>>C;
  for(int i=1;i<B+1;i++)if(A*i%B==C)flag++;
  if(flag>0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

use std::cmp::max;

fn main() {
    input!{
        n: usize,
        k: usize,
        s: chars
    }
    let mut ls: Vec<usize> = Vec::new();
    let mut c = 0;
    let mut prev = '1';
    for x in s {
        if x == prev {
            c += 1;
        } else {
            ls.push(c);
            c = 1;
            prev = x;
        }
    }
    ls.push(c);
    if prev == '0' {
        ls.push(0);
    }
    if 2 * k + 1 >= ls.len() {
        println!("{}", n);
        return;
    }
    let mut sum: usize = ls.iter().take(2 * k + 1).sum();
    let mut ans = sum;
    for i in 0..(ls.len() - 1) / 2 - k {
        sum += ls[2 * (i + k) + 1] + ls[2 * (i + k + 1)];
        sum -= ls[2 * i] + ls[2 * i + 1];
        ans = max(ans, sum);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    if a == b:
        print(c)
    if b == c:
        print(a)
    if a == c:
        print(b)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38560
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<limits>
#include<map>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define INF_int 2147483647
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>

using namespace std;

inline int dist(pii &a,pii &b){
  return abs(a.first - b.first) + abs(a.second - b.second);
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<pii > Students(N);
  vector<pii > Checkpoints(M);
  rep(i,N){
    cin >> Students[i].first >> Students[i].second;
  }
  rep(j,M){
    cin >> Checkpoints[j].first >> Checkpoints[j].second;
  }

  rep(i,N){
    int distance = INF_int;
    int ans = 0;
    rep(j,M){
      dist(Students[i],Checkpoints[j]) < distance ? distance = dist(Students[i],Checkpoints[j]),ans = j + 1:1;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc074/tasks/abc074_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())
    A = int(input())
    print(N**2 - A)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{

  int n,c=0;
  string s;
  cin >>n>>s;

  for(int j=0;j<n;j++){
    if(s[j]=='A'&& s[j+1]=='B'&& s[j+2]=='C'){
        c+=1;}

  }
  cout << c;
    return 0;
}



Measured memory_bytes: 256
from math import gcd
n, x = map(int, input().split())
lst = list(map(int, input().split()))
for i in range(n):
  lst[i] = abs(x - lst[i])
for i in range(1, n):
  lst[i] = gcd(lst[i], lst[i - 1])
print(lst[-1])

Measured memory_bytes: 20364
# AOJ 0017 Caesar Cipher

while line = gets
  words = line.split.map {|word| word.gsub(".", "")}

  shift = nil
  words3 = words.select {|word| word.length == 3}
  words4 = words.select {|word| word.length == 4}

  bytes_this, bytes_that, bytes_the = %w(this that the).map {|w| w.bytes}
  byte_min = "a".bytes[0]
  byte_max = "z".bytes[0]

  words3.each do |word|
    # the を探す
    shift_w = word.bytes[0] - bytes_the[0]
    shifted_word_bytes = word.bytes.map do |b|
      shifted_b = b - shift_w

      if shifted_b < byte_min
        shifted_b += 26
      elsif shifted_b > byte_max
        shifted_b -= 26
      end

      shifted_b
    end

    if shifted_word_bytes == bytes_the
      shift = shift_w
      break
    end
  end

  unless shift
    words4.each do |word|
      # this を探す
      shift_w_this = word.bytes[0] - bytes_this[0]
      shifted_word_bytes_this = word.bytes.map do |b|
        shifted_b = b - shift_w_this

        if shifted_b < byte_min
          shifted_b += 26
        elsif shifted_b > byte_max
          shifted_b -= 26
        end

        shifted_b
      end

      if shifted_word_bytes_this == bytes_this
        shift = shift_w_this
        break
      end

      # that を探す
      shift_w_that = word.bytes[0] - bytes_that[0]
      shifted_word_bytes_that = word.bytes.map do |b|
        shifted_b = b - shift_w_that

        if shifted_b < byte_min
          shifted_b += 26
        elsif shifted_b > byte_max
          shifted_b -= 26
        end

        shifted_b
      end

      if shifted_word_bytes_that == bytes_that
        shift = shift_w_that
        break
      end
    end
  end

  decoded_text = line.chomp.gsub(/[a-z]/) do |c|
    b = c.bytes[0] - shift
    if b < byte_min
      b += 26
    elsif b > byte_max
      b -= 26
    end

    "%c".%(b)
  end

  puts decoded_text
end

Measured memory_bytes: 6128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    ++n;
    string s = to_string(n);
    int ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] >= '1') {
            int nn = 0;
            for (int j = 0; j < i; ++j)
                nn += s[j] - '0';
            nn += s[i] - '0' - 1;
            for (int j = i + 1; j < s.size(); ++j)
                nn += 9;
            ans = max(ans, nn);
        }   
    }   
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n,m,sum=0;
    vector<int>v;
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
        cin>>m;
        v.push_back(m);
    }
    sum+=v[0];
    for(int i=0;i+1<n-1;i++)
    {
        sum+=min(v[i],v[i+1]);
    }
    sum+=v[v.size()-1];
    cout<<sum<<endl;
    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;
using P = pair<int,int>;

void Main()
{
  ll n; cin >> n;
  ll maxnum = 0;
  for(int i = 2; i <= n; i++) {
  	maxnum += i-1;
  }
  cout << maxnum << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 3656
import sys
#input=sys.stdin.readline
sys.setrecursionlimit(3000000)

x=10
def sol(a):
    if len(a)==10:
        tmp=0
        if max(a)<=f[1]:
            for i in w:
                if a[i[1]-1]-a[i[0]-1]==i[2]:
                    tmp+=i[3]
        ans[0]=max(ans[0],tmp)
        return
    s=a[-1] if len(a) else 1
    for i in range(s,10+1):
        a.append(i)
        sol(a)
        a.pop()

ans=[0]
n,m,q=map(int,input().split())
f=[n,m]
w=[]
for i in range(q):
    a,b,c,d=map(int,input().split())
    w.append((a,b,c,d))
#for i in w:
#    print(i)
sol([])
print(ans[0])


Measured memory_bytes: 9248
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

char ans[1005][1005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	pi good;
	int f = 1;
	rep(i, h + 1){
		int tot = a * i + (w - a) * (h - i);
		rep(j, w + 1){
			int tot1 = b * j + (h - b) * (w - j);
			if(tot1 == tot){
				good = mp(i, j);
				f = 0;
				break;
			}
		}
		if(!f) break;
	}
	//now we have the numbers, we just need to make the board
	//so start with rows
	vi need(w, 0);
	rep(i, w){
		if(i < good.se) need[i] = b;
		else need[i] = h - b;
	}
	rep(i, h){
		//we are currently on the i-th row
		int cnt = a; //keep track of how many we can use
		if(i >= good.fi) cnt = w - a; //flip it
		rep(j, w){
			if(cnt && need[j]) ans[i][j] = '1', need[j]--, cnt--;
			else ans[i][j] = '0';
		}
	}
	rep(i, h){
		rep(j, w) cout << ans[i][j];
		cout << endl;
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 2176
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)


int main()
{	
	int n,k;
	cin>>n;
	cin>>k;
	int out = k;
	
	rep(i,n-1){
		out*=(k-1);
	}
		
	cout<<out<<endl;


}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    int s, k;
    cin >> k >> s;
    int cnt = 0;
    rep(i, k + 1) {
        repeat(j, i, k + 1) {
            repeat(l, j, k + 1) {
                if (i + j + l == s) {
                    if (i == j && j == l)
                        cnt++;
                    else if (i == j || j == l)
                        cnt += 3;
                    else
                        cnt += 6;
                }
            }
        }
    }
    cout << cnt << endl;
}


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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

int  H, W;
string A[1000];

int ma[1005][1005][4];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> H >> W;
  rep(i,H) cin >> A[i];

  int v;
  rep(h,H+2)rep(i,4) {
    ma[h][0][i] = 3000;
    ma[h][W+1][i] = 3000;
  }
  rep(w,W+2)rep(i,4) {
    ma[0][w][i] = 3000;
    ma[H+1][w][i] = 3000;
  }

  rep(h,H)rep(w,W) {
    if (A[h][w] == '#') v = 0;
    else {
      v = min(ma[h][w+1][0], ma[h+1][w][0])+1;
    }
    ma[h+1][w+1][0] = v;
  }

  rep(h,H)drep(w,W) {
    if (A[h][w] == '#') v = 0;
    else {
      v = min(ma[h][w+1][1], ma[h+1][w+2][1])+1;
    }
    ma[h+1][w+1][1] = v;
  }

  drep(h,H)rep(w,W) {
    if (A[h][w] == '#') v = 0;
    else {
      v = min(ma[h+2][w+1][2], ma[h+1][w][2])+1;
    }
    ma[h+1][w+1][2] = v;
  }

  drep(h,H)drep(w,W) {
    if (A[h][w] == '#') v = 0;
    else {
      v = min(ma[h+2][w+1][3], ma[h+1][w+2][3])+1;
    }
    ma[h+1][w+1][3] = v;
  }

  int ans = 0;
  rep(h,H)rep(w,W) {
    v = 3000;
    rep(i,4) v = min(ma[h+1][w+1][i],v);
    ans = max(ans, v);
  }
  cout << ans << "\n";
  return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

int solve(int N,vi& a) {
    // a[i]: 1-N
    vector<ii> loc(N+1, ii(-1,0)); // at, len
    int longest = 0;
    rep(i,N){
        int me = a[i];
        int dec = me-1;
        int at = loc[dec].first, len = loc[dec].second;
        loc[me] = ii(i, len+1);
        longest = max(longest, len+1);
    }

    return N-longest;
}

int main() {
    int N; cin >> N;
    vi a(N);
    rep(i,N) cin >> a[i];
    cout << solve(N,a) << endl;
    return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> data(H,vector<char>(W));
  vector<vector<int>> L(H,vector<int>(W,0));
  vector<vector<int>> R(H,vector<int>(W,0));
  vector<vector<int>> D(H,vector<int>(W,0));
  vector<vector<int>> U(H,vector<int>(W,0));
  int Lamp = 0;

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

  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      if(data[i][j] != '#'){
        //左方向に照らされるマスの数を数える
        if(j == 0){
          L[i][j] = 1;
        }else{
          L[i][j] = L[i][j - 1] + 1;
        }
        //上方向に照らされるマスの数を数える
        if(i == 0){
          U[i][j] = 1;
        }else{
          U[i][j] = U[i - 1][j] + 1;
        }
      }
    }
  }

  for(int i = H - 1;i >= 0;i--){
    for(int j = W - 1;j >= 0;j--){
      if(data[i][j] != '#'){
        //右方向に照らされるマスの数を数える
        if(j == W - 1){
          R[i][j] = 1;
        }else{
          R[i][j] = R[i][j + 1] + 1;
        }
        //上方向に照らされるマスの数を数える
        if(i == H - 1){
          D[i][j] = 1;
        }else{
          D[i][j] = D[i + 1][j] + 1;
        }
      }
    }
  }

  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      Lamp = max(Lamp,L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
    }
  }

  cout << Lamp << endl;
}


Measured memory_bytes: 67072
#include <bits/stdc++.h>
using namespace std;
 
int main() {
//cin>>str;
//cout<<str<<endl;]
  int a, b;
  int c;
  cin>>a>>b;
  if(b%2!=1){
    if(a*2<=b&&b<=a*4){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

const ll MAX = 12345678;
vll fac(MAX), finv(MAX), inv(MAX);
void cominit() {
    fac.at(0) = fac.at(1) = 1;
    finv.at(0) = finv.at(1) = 1;
    inv.at(1) = 1;
    for (int i = 2; i < MAX; i++){
        fac.at(i) = fac.at(i - 1) * i % mod;
        inv.at(i) = mod - inv.at(mod % i) * (mod / i) % mod;
        finv.at(i) = finv.at(i - 1) * inv.at(i) % mod;
    }
}
ll com(ll n, ll k){
  if(n < k || n < 0 || k < 0) return 0;
  return fac.at(n) * (finv.at(k) * finv.at(n - k) % mod) % mod;
}

int main(){
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	cominit();
	rep(i, 0, min(n, k + 1)) ans = (ans + com(n, i) * com(n - 1, i) % mod) % mod;
	cout << ans << endl;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	int n, m,ans=0;
	string s,t;
	cin >>n >>m >>s >>t;

	if(n<m){ swap(n,m); swap(s,t);}
	int p = __gcd(n,m);
	ll l=(ll)n*m/p;
	if(p==1 && s[0]==t[0]){ cout <<l <<"\n"; return 0;}
	if(s[0] !=t[0]){ cout <<-1 <<"\n"; return 0;}
	string u=string(min(l, (ll)10000000), '@');
	for(ll i=0; i<n ;i++){
		if(i*l/n < 10000000) u[i*l/n] = s[i];
	}
	for(ll i=0; i<m ;i++) if(i*l/m < 10000000){
		if(u[i*l/m] !='@' && u[i*l/m] != t[i]){
			cout << "-1\n"; return 0;
			//puts("err  err");
		}
		u[i*l/m] = t[i];
	}
	cout << l <<"\n";
}



Measured memory_bytes: 10240
using System;
class program{
  static void Main(string[] args){
    program p = new program();
    p.Run();
  }
  void Run(){
	string[] inp = Console.ReadLine().Split();
   	int ab = int.Parse(inp[0]);
   	int bc = int.Parse(inp[1]);
    int res =(int)(ab*bc/2);
   	Console.WriteLine(res.ToString());
  }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
#include <utility>
#include <list>
#include <functional>
using namespace std;

#define ll long long
#define vecint vector<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1

string s1,s2,s3;


void solve(){
  char x;
  x=s1[0]+'A'-'a';
  cout<<x;
  x=s2[0]+'A'-'a';
  cout<<x;
  x=s3[0]+'A'-'a';
  print(x);
}

int main(){
  cin>>s1>>s2>>s3;
  solve();
  return 0;
}


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

int main(){

    int N;
    cin >> N;

    int amari;

    amari = N % 10;

    if (amari == 2 || amari == 4 || amari == 5 || amari == 7 || amari == 9 ){

        cout << "hon" << endl;
    }

    if (amari == 0 || amari == 1 || amari == 6 || amari == 8 ){

        cout << "pon" << endl;
    }

    if (amari == 3){

        cout << "bon" << endl;
    }

}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	int num1[BUF_SIZE];
	int num2[BUF_SIZE];
	int sum[BUF_SIZE];
	char str1[BUF_SIZE];
	char str2[BUF_SIZE];
	int n;
	int i, j, k;
	
	
	fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
	
	for (i=0; i<n; i++) {
		for (j=0; j<100; j++) {
			num1[j] = num2[j] = sum[j] = 0;
		}
		
		// first integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str1);
		
		// second integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str2);
		
		// overflow
		if (strlen(str1) > 80 || strlen(str2) > 80) {
			printf("overflow\n");
			continue;
		}
		
		// ??????
		for (j=0; j<strlen(str1)-1; j++)  ;
		for (k=0; j>=0; k++) {
			num1[k] = str1[j] - '0';
			j--;
		}
		for (j=0; j<strlen(str2)-1; j++)  ;
		for (k=0; j>=0; k++) {
			num2[k] = str2[j] - '0';
			j--;
		}
		
		// sum
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j]/10 >= 1) {
				sum[j+1] += sum[j]/10;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] > 0) {
			printf("overflow\n");
		}
		else {
			for (j=79; sum[j]==0 && j!=0; j--)  ;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1052
Num = int(input())
bossNumsList =  list(map(int, input().split()))

bossNums=[]

for i in range(Num):
  bossNums.append(0)


for i in range(Num-1):
  bossNums[bossNumsList[i]-1] += 1

for i in range(Num):
  print(bossNums[i])

Measured memory_bytes: 32168
import sys
input = sys.stdin.readline
from collections import defaultdict

n,k= map(int, input().split())
d= list(map(int, input().split()))
d=set(d)


for i in range(n,pow(10,5)):
    a=set()
    v=str(i)
    for j in range(len(v)):
        a.add(int(v[j]))

    if a.isdisjoint(d):
        print(i)
        exit()

Measured memory_bytes: 73752
#include<iostream>
#include<cstdio>
#include<stdio.h>
#include<bits/stdc++.h>
#define sb(m) while(m--)
using namespace std;
int sum;
inline int read()
{
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}
inline void write(int x)
{
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
int n=read();
int a[n];
for(int i=1;i<=n;i++)
{
	a[i]=read();
	sum+=a[i]; 
}
int m=read(),x,y;
sb(m)
{
 	x=read();
 	y=read();
 	cout<<sum-a[x]+y<<endl;
}
getchar();getchar();
	return 0;
}



Measured memory_bytes: 256
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    s = int(input())
    i = 1
    seen = {s}
    while True:
        i += 1
        if s & 1:
            s = s*3+1
        else:
            s //= 2
        if s in seen:
            print(i)
            break
        else:
            seen.add(s)


if __name__ == '__main__':
    main()


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

int main()
{
	string st;
    cin>>st;
    
    if(st[st.size()-1]=='s'){
        st.push_back('e');
        st.push_back('s');
    }
    else st.push_back('s');
    
    cout<<st;
    
    return 0;
}

Measured memory_bytes: 3596
from math import *
import sys,bisect,copyreg,copy,statistics,os
def inp(): return sys.stdin.readline().strip()
def IIX(): return (int(x) for x in sys.stdin.readline().split())
def II(): return (int(inp()))
def LI(): return list(map(int, inp().split()))
def LS(): return list(map(str, inp().split()))
def L(x):return list(x)
def out(var): return sys.stdout.write(str(var))


n=II()
sizes=LI()
t=0
sizes.sort()

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if sizes[i] + sizes[j]> sizes[k] and sizes[i]!=sizes[j] and sizes[j]!=sizes[k]:
                t+=1

out(t)

















 










Measured memory_bytes: 73176
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int b=scan.nextInt();
		String a=scan.next();
		int c=scan.nextInt();
		if(a.equals("+")) {
			System.out.println(b+c);
		}
		else {
			System.out.println(b-c);
		}
	}
	}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll    long long
#define PR    pair<ll, ll>

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> x, y;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        x[a[i] + i + 1]++;
        y[(i + 1) - a[i]]++;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        x[a[i] + i + 1]--;
        y[(i + 1) - a[i]]--;
        ans += y[a[i] + i + 1];
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 29844
import java.io.DataInputStream;
import java.io.IOException;

class Main {
    private static String n;

    final private static int BUFFER_SIZE = 1 << 16;
    private static DataInputStream din;
    private static byte[] buffer;
    private static int bufferPointer, bytesRead;

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        n = reader.readLine();

        if (n.charAt(n.length() - 1) == 's') {
            System.out.println(n + "es");
        } else {
            System.out.println(n + "s");
        }

    }

    static class Reader {

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }

    }
}

Measured memory_bytes: 36296
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf 1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n,c,k;cin>>n>>c>>k;
    int t[114514];
    rep(i,0,n)cin>>t[i];
    sort(t,t+n);
    int ans=0;
    int time=0;
    rep(i,0,n){
        time=t[i]+k;
        int count=-1;
        rep(j,0,c){
            if(i+j>=n)break;
            if(t[i+j]<=time){
                count++;
            }
        }
        i+=count;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numOfPerson = sc.nextInt();
        int sum = 0;
        int[] positions = new int[numOfPerson];
        for (int i = 0; i < numOfPerson; i++) {
            positions[i] = sc.nextInt();
            sum += positions[i];
        }
        sc.close();

        double juusin = sum / (double)numOfPerson;
        int p = nearInt(juusin);

        int e = 0;
        for (int i = 0; i< numOfPerson; i++) {
            e += Math.pow((positions[i] - p), 2);
        }
        System.out.println(e);
    }

    public static int nearInt(double x) {
        int p = (int) x;
        if (x >= 0) {
            return (x - p) <= 0.5 ? p : p + 1;
        } else {
            return (p - x) <= 0.5 ? p : p - 1;
        }
    }
}

Measured memory_bytes: 22736
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	arr := []int{a, b, c}
	sort.Ints(arr)
	fmt.Println(10*arr[2] + arr[1] + arr[0])
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

int solve() {
    int n, m; cin >> n >> m;
    vector<int> H(n);
    for (int i = 0; i < n; ++i) {
        cin >> H[i];
    }
    unordered_map<int, vector<int>> graph;
    for (int i = 0; i < m; ++i) {
        int x, y; cin >> x >> y;
        if (graph.find(x) == graph.end()) {
            vector<int> v;
            graph[x] = v;
        }
        if (graph.find(y) == graph.end()) {
            vector<int> v;
            graph[y] = v;
        }
        graph[x].emplace_back(y);
        graph[y].emplace_back(x);
    }
    
    int res{0};
    for (int i = 1; i <=n; ++i) {
        bool good = true;
        for (int nei : graph[i]) {
            if (H[nei - 1] >= H[i - 1]) {
                good = false;
                break;
            }
        }
        if (good) {
            res++;
        }
    }
    
    return res;
}

int main() {
	cout << solve() << "\n";
}


Measured memory_bytes: 13128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll L,R; cin>>L>>R;
    ll ans=INF;
    if(R-L+1>=2019) cout<<0<<endl;
    else{
        FOR(i,L,R)FOR(j,i+1,R+1){
            chmin(ans,(i*j)%2019);
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3620
main=getLine>>=print.(\x->f x (2^((length x)-1)) x (length x) 0 0 "")
 where f x m s n i a e|i==m = a
                      |n==0 = f x m x (length x) (i+1) (a+((sum.(map read).words) e)) ""
                      |(quot(mod i(2^n))(2^(n-1)))==1 = f x m (init s) (n-1) i a ((last s):' ':e)
                      |otherwise = f x m (init s) (n-1) i a ((last s):e)

Measured memory_bytes: 1020