akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;


int main()
{
	LL N, M;
	scanf("%lld%lld", &N, &M);

	LL r = min(N,M/2);
	LL l = M-2*r;

	printf("%lld\n", r + l/4);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int main() {
	int M, N;
	cin >> N >> M;
	vector<pair<int, int>> V;
	int a, b;
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		V.push_back({ a,b });
	}
	if (M == 1) {
		cout << 1 << endl;
		return 0;
	}
	sort(V.begin(), V.end());
	int cnt = 0;
	bool f = true;
	int y;
	for (int i = 0; i < V.size() - 1; i++) {
		if (f) {
			pair<int, int> p = V[i];
			y = p.second;
			f = false;
		}
		if (V[i + 1].first < y) {
			if (i == V.size() - 2)cnt++;
			y = min(y, V[i + 1].second);
		}
		else {
			if (i == V.size() - 2)cnt += 2;
			else cnt++;
			f = true;
		}
	
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

int N;

void solve() {
	int ans = 0;
	
	for (int i = 1; i <= N / 2; i++) {
		int sum = 0;
		for (int j = i; sum < N; j++) {
			sum += j;
		}
		if (sum == N) ans++;
	}
	
	cout << ans << endl;
}

int main() {
	while (1) {
		cin >> N; if (N == 0) break;
		solve();
	}
	
	return 0;
}

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

int main() {
	int a, i, N;
  cin >> N;
  vector<int> vec(N);
    for (i = 0; i < N; i++)
     cin >> vec.at(i); //aiの入力
    int j, k;//jはカウンター
  k = vec.at(0);
  for (j = 0; j < N; j++){
    if (k == 2)
      break;
    else
      k = vec.at(k - 1);
  }
  if (k == 2)
  cout << j + 1 << endl;//2に到達したらそれまでの回数を出力
  else
  cout << "-1" << endl;//N回繰り返してうまくいかない場合は失敗
}

Measured memory_bytes: 640
#include <stdio.h>

int main() {
	int N, i, tmp = 0, ans = 0;
	scanf("%d", &N);
	char S[N];
	scanf("%s", S);
	for (i = 0; i < N; i++) {
		if (S[i] =='I')
			tmp++;
		else
			tmp--;

		if (ans < tmp)
			ans = tmp;
	}

	printf("%d\n", ans);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int64_t ans=0;
  
  vector<int> count(100000,0);
  rep(i,n){
    int x;
    cin >> x;
    count[x-1]++;
    ans+=x;
  }


  int q;
  cin >> q;
  rep(i,q){
    int64_t x,y;
    cin >> x >> y;
    int64_t z=count[x-1];
    ans += z*(y-x);
    count[y-1]+=count[x-1];
    count[x-1]=0;
    
    cout << ans << endl;
  }
  
  
}

Measured memory_bytes: 3788
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		operateStack ost = new operateStack();
		String[] str;
		int len, top = 0;
		long op, cal;
		
		str = br.readLine().split(" ", 0);
		len = str.length;
		
		for(int i = 0; i < len; i++){
			
			if(str[i].equals("+")){
				ost.calc(1);
			}
			else if(str[i].equals("-")){
				ost.calc(2);
			}
			else if(str[i].equals("*")){
				ost.calc(3);
			}
			else{
				op = Long.parseLong(str[i]);
				ost.push(op);
			}
		}
		
		System.out.println(ost.pop());
	}
}

class operateStack{
	long[] stack = new long[100];
	int top;
	
	operateStack(){
		for(int i = 0; i < 100; i++){
			stack[i] = 0;
		}
		top = 0;
	}
	
	void push(long op){
		stack[top] = op;
		top ++;
	}
	
	long pop(){
		long op = stack[top - 1];
		stack[top - 1] = 0;
		top --;
		
		return op;
	}
	
	void calc(int flag){
		long op, op2;
		long cal;
		
		op = pop();
		op2 = pop();
		
		switch(flag){
		case 1:
			cal = op2 + op;
			break;
		case 2:
			cal = op2 - op;
			break;
		default:
			cal = op2 * op;
			break;
		}
		
		push(cal);
	}
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

struct Edge {
  int l,r;
  bool operator < ( const Edge &e ) const {
    if( r != e.r ) return r < e.r;
    return l > e.l;
  }
};

int main() {
  int V,E;
  cin >> V >> E;
  vector<Edge> es(E);
  rep(i,E) cin >> es[i].l >> es[i].r;
  sort(ALL(es));
  int cnt = 0;
  rep(i,E) {
    int limit = es[i].r;
    ++cnt;
    while( i < E && es[i].l < limit ) {
      ++i;
    }
    --i;
  }
  cout << cnt << endl;
  return 0;
}


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

int main(){
    char s[4]={};
    for(int i=0;i<4;i++){
        cin >> s[i];
    }

    if((s[0]==s[1])&&(s[2]==s[3])&&(s[0]!=s[2])){
        cout << "Yes" << endl;
    }else if((s[0]==s[2])&&(s[1]==s[3])&&(s[0]!=s[1])){
        cout << "Yes" << endl;
    }else if((s[0]==s[3])&&(s[1]==s[2])&&(s[0]!=s[1])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
S = input().split('/')
if int(S[0]) > 2019:
    print('TBD')
elif int(S[0]) < 2019:
    print('Heisei')
else:
    if int(S[1]) > 4:
        print('TBD')
    elif int(S[1]) <= 4:
        print('Heisei')

Measured memory_bytes: 3060
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

/**
 * @author Tran Anh Tai
 * @template for CP codes
 * What a trick prob!
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            int k = in.nextInt();
            char[][] b = new char[h][w];
            for (int i = 0; i < h; i++){
                b[i] = in.nextToken().toCharArray();
            }
            int cnt = 0;
            for (int row = 0; row < (1 << h); row++){
                for (int col = 0; col < (1 << w); col++){
                    int black = 0;
                    for (int y = 0; y < h; y++){
                        for (int x = 0; x < w; x++){
                            if ((row >> (h - y - 1)) % 2 == 0 && (col >> (w - x - 1)) % 2 == 0 && b[y][x] == '#'){
                                black++;
                            }
                        }
                    }
                    if (black == k){
                        cnt++;
                    }
                }
            }
            out.println(cnt);
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

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

int main(){
  string s,t;cin>>s>>t;
  int p= stoi(s+t);
  int x= pow(p,0.5);
  cout<<(x*x==p?"Yes":"No");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;
using vpii = vector<pii>;

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

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {
    
    int sx,sy,tx,ty;
    cin >>sx>>sy>>tx>>ty;
    
    FOR(i,1,tx-sx) {
        cout <<"R";
    }
    FOR(i,1,ty-sy) {
        cout <<"U";
    }
    FOR(i,1,tx-sx) {
        cout <<"L";
    }
    FOR(i,1,ty-sy) {
        cout <<"D";
    }
    cout <<"D";
    FOR(i,0,tx-sx) {
        cout <<"R";
    }
    FOR(i,0,ty-sy) {
        cout <<"U";
    }
    cout <<"L";
    cout <<"U";
    FOR(i,0,tx-sx) {
        cout <<"L";
    }
    FOR(i,0,ty-sy) {
        cout <<"D";
    }
    cout <<"R";
    

    return 0;
}








Measured memory_bytes: 256
/**
 *    created by : PawPaw       
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  

using namespace __gnu_pbds;  
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define PHI acos(-1)
#define EPS 0.000000001
#define N 1000001
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key

int solve(){
  int n;
  string s, t;
  cin >> n;
  cin >> s >> t;
  F(i, 0, 2*n-1){
    if(i%2 == 0) cout << s[i/2];
    else cout << t[i/2];
  }
  cout << '\n';
  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

Measured memory_bytes: 256
n = int(input())
ta = [tuple(int(x) for x in input().split()) for _ in range(n)]

a = 0
b = 0
for x, y in ta:
    if x >= a and y >= b:
        a = x
        b = y
    else:
        temp = max(a // x, b // y)
        while x * temp < a or y * temp < b:
            temp += 1
        a = x * temp
        b = y * temp

print(a + b)


Measured memory_bytes: 3060
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;

void main()
{
	auto ip = readln.split.to!(int[]);
	if(ip[0] <= 8 && ip[1] <= 8) writeln("Yay!");
	else writeln(":(");
}

//writeln("滲み出す混濁の紋章　不遜なる狂気の器　湧き上がり　否定し　痺れ　瞬き　眠りを妨げる　爬行する鉄の王女　絶えず自壊する泥の人形　結合せよ　反発せよ　地に満ち己の無力を知れ　破道の九十　黒棺")

Measured memory_bytes: 256
program r20628c
 
implicit none
integer :: c(1:26)
integer, allocatable :: interval(:, :)
integer, allocatable :: s(:, :)
integer, allocatable :: t(:), v(:)
integer :: i, j, d, m, h
integer, allocatable :: smalld(:)
integer, allocatable :: q(:)


read *, d

allocate(s(1:26, 1:d))
allocate(interval(1:26, 0:d))
allocate(t(1:d))
allocate(v(0:d))

interval(:, :) = 0 !interval(i,d) = d - last(d,i)
v(0) = 0

read *, c(1:26)

do i = 1, d
 read *, s(:, i)
end do

do i = 1, d
 read *, t(i)
 
 v(i) = v(i-1) + s(t(i), i)
 
 do j = 1, 26
  if(t(i) == j) then
   interval(j, i) = 0
  else
   interval(j, i) = interval(j, i-1) + 1
  end if
  v(i) = v(i) - (c(j) * interval(j, i))
 end do
 
! print *, v(i)
end do

read *, m

allocate(smalld(1:m))
allocate(q(1:m))

do h = 1, m
 read *, smalld(h), q(h)
 t(smalld(h)) = q(h)
 
  v(smalld(h)) = v(smalld(h)-1) + s(q(h), smalld(h))
  
  do j = 1, 26
  
   if(q(h) == j) then
    interval(j, smalld(h)) = 0
   else
    interval(j, smalld(h)) = interval(j, smalld(h)-1) + 1
   end if
   
   v(smalld(h)) = v(smalld(h)) - (c(j) * interval(j, smalld(h)))
  end do   
 
 do i = smalld(h)+1, d
 
 v(i) = v(i-1) + s(t(i), i)
 
  do j = 1, 26
   if(t(i) == j) then
    interval(j, i) = 0
   else
    interval(j, i) = interval(j, i-1) + 1
   end if
   v(i) = v(i) - (c(j) * interval(j, i))
  end do   
 end do
 
 print *, v(d)
 
end do


end program r20628c

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

int main(){
    int n;
    cin >> n;
    vector <int> a(n);
    rep(i,n) cin >> a[i];
    int num=0;
    rep(i,n){
        if(i == 0 || i == n-1){
            continue;
        }else{
            if(a[i-1] < a[i] && a[i+1] > a[i]){
                ++num;
            }
            if(a[i-1] > a[i] && a[i+1] < a[i]){
                ++num;
            }
        }
    }
    cout << num << endl;
}

Measured memory_bytes: 3596
n = int(input())
l = list(map(int, input().split()))
m = list(map(int, input().split()))

m.reverse()

ls = [0]*(n+1)
ms = [0]*(n+1)

for i in range(n):
  ls[i+1] = ls[i] + l[i]
  ms[i+1] = ms[i] + m[i]

max_a = 0
for j in range(n):
  max_a = max(max_a, ls[j+1]+ms[n-j])
print(max_a)
  

Measured memory_bytes: 38256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n, K;
    cin >> n >> K;
    vector<int> A(n, 0);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    for (int i = 0; i + K < n; ++i) {
        if (A[i] >= A[i + K]) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
        }
    }



    return 0;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector <ll>
#define vii vector <int>
#define vpii vector <pii>
#define vpll vector <pll>
#define ff first
#define ss second
#define vvll vector <vll>
#define vvii vector <vii>
#define all(v) v.begin(),v.end()
#define PQ priority_queue
using namespace std;
ll mod = 1000000007;
ll pow(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b&1) res*=a;
		b/=2;
		a*=a;
	}
	return res;
}
int main()
{
	//ios::sync_with_stdio(0);
	//cin.tie(0);
  	ll a, b, c;
  	cin >> a >> b >> c;
  	cout << max(0ll,c-(a-b)) << "\n";
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n, t = map(int, raw_input().split())

minCos = 1000
bestRoot = -1
for i in range(n):
    inpt = map(int, raw_input().split())
    if inpt[1] > t:
        continue

    if inpt[0] <= minCos:
        minCos = inpt[0]
        bestRoot = i + 1

if bestRoot == -1:
    print "TLE"
else:
    print minCos


Measured memory_bytes: 2568
N = int(input())
A = [input().split() for i in range(2)]
A = [[int(s) for s in row] for row in A]
numberOfCandies = []

for i in range(N):
    candies = 0
    for j in range(i+1):
        candies+=A[0][j]
    for j in range(i,N):
        candies+=A[1][j]
    numberOfCandies.append(candies)

print(max(numberOfCandies))

Measured memory_bytes: 9060
import java.io.*;
import java.util.*;
import java.math.BigDecimal;

class Main {

    void solve(){

	Scanner sc = new Scanner(System.in);
	int q = sc.nextInt();
	
	while ( q-- > 0 ) {

	    long b = Long.parseLong( sc.next(), 16 );

	    double res = (b&0x7fffff80) >> 7;

	    double frac = 0.5;
	    for ( long i=6; i>=0; --i ) {
		if ( ((b>>i)&1) == 1 ) res += frac;
		frac *= 0.5;
	    }
	    
	    System.out.printf("%s%s%s\n", ((b>>31) == 1) ? "-" : "",
			      BigDecimal.valueOf(res).stripTrailingZeros().toPlainString(),
			      ((b&0x0000007f)==0) ? ".0" : "" );
	}

    }

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



Measured memory_bytes: 61800
import collections
n = int(input())
s_ = [input() for i in range(n)]

cnt = collections.Counter(s_)
cntList = list(cnt.most_common())
cnt_f = cnt.most_common()[0][1]

resList = []
for i in range(len(cntList)):
    if cntList[i][1] == cnt_f:
        resList.append(cntList[i][0])
    else:
        break

resList.sort()
for i in resList:
    print(i)


Measured memory_bytes: 59376
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int K = int.Parse(Console.ReadLine());
            int X = int.Parse(Console.ReadLine());
            int Y = int.Parse(Console.ReadLine());

            int ans = 0;
            if (N > K)
            {
                ans = X * K + Y * (N - K);
            }
            else
            {
                ans = X * N;
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>
#include<bitset>


using namespace std;

#define rep(i,n) for(int i=0;i<n;i++) //0から
#define REP(i,n) for(int j=i;j<n;j++) //iから

typedef long long ll;



//英字ならture、数字ならfalse
bool isalpha(char s){
    if(('A'<=s&&s<='Z')||('a'<=s&&s<='z')){
        return 1;
    }else{
        return 0;
    }
}
//全ての文字が英字ならture、数字ならfalse
bool Isalpha(string s){
    ll n;
    bool tmp = true;
    rep(i,n){
        if(isalpha(s[i])){
            tmp = false;
        }
    }
    return tmp;
}




using Graph = vector<vector<ll>>;



//cout<<fixed<<setprecision(10);

ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

#define MOD 1000000007

ll INFLL =  pow(10,9)+1;




string periodic_table[104] = {
    "None","H(1)","He(2)", //2
    "Li(3)","Be(4)","B(5)","C(6)","N(7)","O(8)","F(9)","Ne(10)", //10
    "Na(11)","Mg(12)","Al(13)","Si(14)","P(15)","S(16)","Cl(17)","Ar(18)", //18
    "K(19)","Ca(20)","Sc(21)","Ti(22)","V(23)","Cr(24)","Mn(25)","Fe(26)","Co(27)","Ni(28)","Cu(29)","Zn(30)","Ga(31)","Ge(32)","As(33)","Se(34)","Br(35)","Kr(36)", //36
    "Rb(37)","Sr(38)","Y(39)","Zr(40)","Nb(41)","Mo(42)","Tc(43)","Ru(44)","Rh(45)","Pd(46)","Ag(47)","Cd(48)","In(49)","Sn(50)","Sb(51)","Te(52)","I(53)","Xe(54)", //54
    "Cs(55)","Ba(56)","La(57)","Ce(58)","Pr(59)","Nd(60)","Pm(61)","Sm(62)","Eu(63)","Gd(64)","Tb(65)","Dy(66)","Ho(67)","Er(68)","Tm(69)","Yb(70)","Lu(71)","Hf(72)","Ta(73)","W(74)","Re(75)","Os(76)","Ir(77)","Pt(78)","Au(79)","Hg(80)","Tl(81)","Pb(82)","Bi(83)","Po(84)","At(85)","Rn(86)", //86
    "Fr(87)","Ra(88)","Ac(89)","Th(90)","Pa(91)","U(92)","Np(93)","Pu(94)","Am(95)","Cm(96)","Bk(97)","Cf(98)","Es(99)","Fm(100)","Md(101)","No(102)" //102
};

int main(){
    ll n,sum=0;
    cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    ll ans = 0;
    rep(i,n){
        sum -= a[i];
        ll tmp = a[i]*(sum%MOD);
        tmp%=MOD;
        ans+=tmp;
        ans%=MOD;
    }
    ans%=MOD;
    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 4828
#include <bits/stdc++.h>
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define erep(i, x) for (register int i = h[x]; i; i = e[i].next)
#define maxn 
#define ll long long int 
using namespace std;

int main(){
	ll n, a, b;
	//#ifndef ONLINE_JUDGE
	//	freopen("A.in", "r", stdin);
	//#endif
	scanf("%lld%lld%lld", &n, &a, &b);
	if (abs(a - b) & 1) printf("%lld", min(a + ((b - a - 1) >> 1), n - b + 1 + ((b - a - 1) >> 1))); 
	else printf("%lld", abs(a - b) >> 1);
	return 0;
}

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

using namespace std;

int main() {
	int a, b;
	double c;
	cin >> a >> b ;

	cout << a / b << " " << a % b << " ";
	cout << fixed << setprecision(5) << (double)a / b << endl;

	return 0;
}


Measured memory_bytes: 3288
/*ex6_2
    takafumi_ueki*/
#include <stdio.h>
#include <string.h>
#define LIMIT 101
int main(void){
    char str[LIMIT];
    //文字列を受け取る
    scanf("%s",str);
    //最初の文字、挟まれている文字数(文字列の文字数-2)、最後の文字((文字列の文字数-1)番目の文字)を出力する
    printf("%c%d%c\n",str[0],(int)strlen(str)-2,str[(int)strlen(str)-1]);
    return 0;
}


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

int main(){
    int x, y;
    for( int i = 0;; i++){
        cin >> x >> y;
        if( x == 0 && y == 0) break;
        if( x > y ) swap(x, y);
        cout << x << " " << y << endl;
    }
    return 0;
}


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

int main( void )
{
    int n;
    cin >> n;
    
    cout << "ABC" << setw(3) << setfill('0') << n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include <cmath>
#include <limits>
#include <iostream>
#include <assert.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	int x,y,cost;
};
int main(){

	string s,t;
	cin>>s;
	cin>>t;

	cout<<t<<s<<endl;
	return 0;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int a=0,b;
  cin >> b;
  string s;
  cin >> s;
  int ans=0;
  rep(i,b){
    if (s[i]=='I') a++;
    else a--;
    ans=max(ans,a);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/perl
use Data::Dumper;
use POSIX qw(floor ceil);

# 引数取り込み
my $a = <>;
my ( $b, $c ) = split( / /, $a );

# 処理開始
my $ans;
if ( $b == $c ) {
    $ans = "Yes";
}
else {
    $ans = "No"
}

print "$ans";

1;

Measured memory_bytes: 7200
# input
N, K, Q = map(int, input().split())
points = {}
for i in range(1, N + 1):
    points[i] = 0

for q in range(Q):
    A = int(input())

    # check
    points[A] += 1

# output
for k in points.keys():
    if K - Q + points[k] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 15084
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()
  };
  ($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=>(n: i32));
    let mut ret: String; 

    if n < 1200 {
        ret = "ABC".to_string();
    }
    else if n < 2800 {
        ret = "ARC".to_string(); 
    }
    else {
        ret = "AGC".to_string();
    }
    
    ret
}

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 9" => "12",
    test2: "31 32" => "63",
    test3: "1 2" => "3",
    test4: "-1 2" => "1",
    test5: "10 1" => "11",
}



Measured memory_bytes: 4352
n,m,q=gets.split.map(&:to_i)
abcd=[]
q.times do
  abcd << gets.split.map(&:to_i)
end
max=0
[*1..n+m-2].combination(n-1) do |per|
  mi=[1]
  (n-1).times do |i|
    mi << per[i]-i
  end
  cnt=0
  abcd.each do |a,b,c,d|
    cnt+=d if mi[b-1]-mi[a-1]==c
  end
  max=cnt if cnt>max
end
puts max



Measured memory_bytes: 14936
a,b,c,d = gets.split.map(&:to_i)

if a*b < 0
  x = [a, 0, b]
else
  x = [a, b]
end

if c*d < 0
  y = [c, 0, d]
else
  y = [c, d]
end

puts x.map{|x| y.map{|y| x*y}}.flatten.max


Measured memory_bytes: 14404
#include <stdio.h>

int main(void){

    long n, m, res = 0, e;
    int i, j;

    scanf("%ld %d\n", &n,&i);
    
    for(j=0; j<i; j++){
        scanf(" %ld", &m);
        res += m;
    }

    e = n - res;
    if(e< 0){
        printf("-1\n");
    }else{
        printf("%ld\n", e);
    }

    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
using ll = long long;
using ld = long double;
#define long ll
#define double ld
using namespace std;

const int N = 2e5;
int n;
long arr[N];
long x[N], y[N];

void umax(long &a, long b) {
	a = max(a, b);
}

int main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif

	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> arr[i];
	}
	fill(all(x), -1e9);
	fill(all(y), -1e9);
	x[0] = 0;
	for (int i = 1; i <= n; ++i) {
		long c = arr[i];
		umax(x[i], x[i - 1] + c / 2);
		if (c >= 1) {
			umax(x[i], y[i - 1] + (c - 1) / 2 + 1);
			umax(y[i], x[i - 1] + (c - 1) / 2);
		}
		if (c >= 2) {
			umax(y[i], y[i - 1] + (c - 2) / 2 + 1);
		}
		assert(x[i] >= y[i]);
		//~ cerr << x[i] << " " << y[i] << endl;
	}
	cout << x[n] << "\n";
	
	return 0;
}


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

using ll = long long;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> h(n);
	for (auto& x : h)
		cin >> x;

	for (int i = n - 2; i >= 0; i--) {
		if (h[i] > h[i + 1])
			h[i]--;
	}

	bool ok = true;
	for (int i = 0; i < n - 1; i++) {
		if (h[i] > h[i + 1]) {
			ok = false;
			break;
		}
	}

	if (ok) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 640
N, M = map(int, input().split())
H = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]

graph = [[] for _ in range(N)]
for a, b in X:
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)

ans = [True] * N
for u in range(N):
    for v in graph[u]:
        ans[u] &= H[u] > H[v]

print(sum(ans))


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int L = A + B, R = C + D;
    if (L > R){
        cout << "Left" << endl;
    }
    else if(L < R){
        cout << "Right" << endl;
    }
    else{
        cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define forr(i,p,n) for(ll i=p;i<n;i++)
#define MAXN 500003
typedef long long ll;

using namespace std;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}




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

vector<ll>v;
 ll sum=0,act=0,k,n,q,f;
cin>>n>>k;
v.reserve(n);
ll dp[n]={0};
forr(i,0,n)
    {
        cin>>f;
        v.pb(f);
      
    }
    dp[n-1]=0;
    dp[n-2]=abs(v[n-1]-v[n-2]);
    

    
    
    for(ll i=n-3;i>=0;i--)
    {
        ll m=MOD;
        for(ll j=1;j<=k;j++)
      {
          if(i+j>=n)
          {
              break;
          }
          ll x=dp[i+j]+abs(v[i+j]-v[i]);
          m=(m>x)?x:m;
      }
      dp[i]=m;
    }
    cout<<dp[0]<<endl;

return 0;
}


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

struct A{
  int num;
  int cnt;
  A() {
    cnt = 0;
  }
  bool operator <(const A &a) const {
    if(cnt != a.cnt) return cnt > a.cnt;
    return num < a.num;
  }
};

main() {
  while(1) {
    int n, m;
    cin >> n >> m;
    if(n == 0 && m == 0) break;
    A M[m];
    for(int i = 0; i < m; i++) {
      M[i].num = i+1;
    }
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < m; j++) {
	int a;
	cin >> a;
	M[j].cnt += a;
      }
    }
    sort(M, &M[m]);
    for(int i = 0; i < m; i++) {
      if(i != 0) cout << ' ';
      cout << M[i].num;
    }
    cout << endl;
  }
}

Measured memory_bytes: 868
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin >> s;
    string ans = "Good";

    REP(i, 3){
        if(s[i] == s[i+1]) ans = "Bad";
    }

    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
ll H,W;
vector<pii> V;
int main() {
  cin >> W >> H;
  for (int i = 0; i < W; i++){
    int x;
    cin >> x;
    V.emplace_back(mp(x, 0));
  }
  for (int j = 0; j < H; j++){
    int x;
    cin >> x;
    V.emplace_back(mp(x, 1));
  }
  ll ret = 0;
  W++;
  H++;
  sort(V.begin(), V.end());
  for (auto &val : V){
    if (val.second == 1){
        ret += W * val.first;
        H--;
    }else{
      ret += H * val.first;
      W--;
    }
  }
  cout << ret << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int a, b;
  cin >> a >> b;
  cout << max(a - b * 2, 0) << endl;
}


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

int main () {

    int n, m; cin >> n >> m;
    int s[m], c[m];
    int number[n];

    if(m == 0) {
        if(n == 1) {
            cout << 0 << endl;
        } else if (n == 2) {
            cout << 10 << endl;
        } else {
            cout << 100 << endl;
        }
        return 0;
    }
    unordered_map<int, int> mp;
    bool flag = false;
    for(int i = 0; i < m; i++) {
        cin >> s[i] >> c[i];

        if(mp.find(s[i]) != mp.end() && mp[s[i]] != c[i]){
            flag = true;
        }
        mp[s[i]] = c[i];
    }
  
    for(int i = 0; i < n; i++) {
        number[i] = -1;
    }

    for(int i = 0; i < m; i++) {
        if(s[i] > n) {
            cout << "-1" << endl;
            return 0;
        }

        number[s[i] - 1] = c[i];
    }

    if(number[0] == 0 && n != 1) {
        flag = true;
    }

    if(flag) {
        cout << "-1" << endl;
        return 0;
    }

    for(int i = 0; i < n; i++) {
        if(number[i] == -1) {
            if(i == 0) {
                number[i] = 1;
            } else number[i] = 0;
        }
        cout << number[i];
    }

    cout << endl;


    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int main() {
	string S;
	while (getline(cin, S), S != ".") {
		vector<char> tmp;
		rep(i, S.size()) {
			if (S[i] == '(' || S[i] == ')' || S[i] == '[' || S[i] == ']') tmp.push_back(S[i]);
		}
		stack<char> st;
		bool ans = true;
		rep(i, tmp.size()) {
			if (st.empty() || tmp[i] == '(' || tmp[i] == '[') st.push(tmp[i]);
			else if ((st.top() == '(' && tmp[i] == ')') || (st.top() == '[' && tmp[i] == ']')) st.pop();
			else {
				ans = false;
				break;
			}
		}
		cout << (ans && st.empty() ? "yes" : "no") << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<vector<int> > g(N);
	vector<vector<int> > c(N);
	for (int i = 1; i < N; i++) {
		g[i].push_back(i - 1);
		c[i].push_back(0);
	}
	int a, b, C;
	for (int i = 0; i < M; i++) {
		cin >> a >> b >> C;
		a--; b--;
		g[a].push_back(b);
		c[a].push_back(C);
	}

	priority_queue<pair<int, int> > pq;
	int INF = (int)1 << 60;
	vector<int> D(N, INF);
	D[0] = 0;
	pq.push(make_pair(0, 0));

	while (pq.size()) {
		a = pq.top().second;
		pq.pop();

		for (int i = 0; i < g[a].size();i++) {
			if (D[g[a][i]] > D[a] + c[a][i]) {
				D[g[a][i]] = D[a] + c[a][i];
				pq.emplace(-D[g[a][i]], g[a][i]);
			}
		}
	}
	int res = D[N - 1];
	if (res == INF)res = -1;
	cout << res << endl;
}

Measured memory_bytes: 14712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    vector<double> a(n);
    rep(i, n) cin >> a[i];
    sort(ALL(a));

    FOR(i, 1, n){
        double b = (a[i-1] + a[i]) / 2.0;
        a[i] = b;
    }
    pr(a[n-1]);
    return 0;}

Measured memory_bytes: 3820
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<usize>();
    let s = read::<String>().chars().collect::<Vec<char>>();

    let mut v: Vec<char> = vec![];
    let mut lastchar = ' ';
    for i in 0..n {
        let c = s[i];
        if i == 0 || lastchar != c {
            v.push(c);
        }
        lastchar = c;
    }
    println!("{}", v.len());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define P(s) cout<<s<<"\n"

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

    vector<string> a(h + 2, string(w, '#'));
    for (auto i = 0; i < h; ++i) {
        cin >> a[i + 1];
    }
    
    for (const auto l: a) {
        P("#" << l << "#");
    }
    
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	n := scanInt()
	l := scanInt()

	a := scanInts(n)

	index := -1

	for i := 0; i < n-1; i++ {
		if a[i]+a[i+1] >= l {
			index = i
		}
	}

	if index == -1 {
		fmt.Println("Impossible")
		return
	} else {
		fmt.Println("Possible")
	}

	for i := 0; i < index; i++ {
		fmt.Println(i+1)
	}

	for i := n-1; i > index; i-- {
		fmt.Println(i)
	}

}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int a, b; cin >> a >> b;
	long long int ans = 0;
	if(a == 1 && b == 1) ans = 1;
	else if( a == 1 || b == 1) ans = a*b - 2;
	else ans = (a - 2)*(b - 2);
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int Y = sc.nextInt();
        
        loop: for(int x=0; x<=N; x++){
          for(int y=0; y<=N-x; y++){
            int z = N-x-y;
            if(10000*x+5000*y+1000*z==Y){
              System.out.println(x + " " + y + " " + z);
              break loop;
            }
          }
          if(x==N){
            System.out.println("-1 -1 -1");
          }
        }
            
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <string.h>

using namespace std;

#define arraySize(A) (sizeof(A)/sizeof(A[0]))
#define FOR(i,n) for(int i=0;i<n;i++)
#define LOOP(n) for(int __loopCountNum=0;__loopCountNum<n;__loopCountNum++)

int main(){
    int n; cin >> n;
    int a[100] = {};
    float mean = 0;
    FOR(i,n){
        cin >> a[i];
        mean += a[i];
    }
    mean /= n;
    float min = (mean-a[0] > 0)?(mean-a[0]):(a[0]-mean);
    int k = 0;
    FOR(i,n){
        float c = (mean-a[i] > 0)?(mean-a[i]):(a[i]-mean);
        if(c<min){
            k = i;
            min = c;
        }
    }
    
    cout << k <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//入力
int n;
long long a[100010][3];  //ai,bi,ciをそれぞれ、a[i][0],a[i][1],a[i][2]に格納

//DP テーブル
long long	dp[100010][3];//一個前にaを選んだ時のi番目の幸福度の最大値をdp[i][0] 

	int main(){
 		int n;cin>>n;
		for(int i = 0; i < n ; ++i){
			for(int j = 0 ; j<3 ;++j){
				cin>>a[i][j];
			}
		}
		for(int i = 0 ; i<n ; ++i){
			for(int j=0; j<3 ; ++j){	
				for (int k =0; k<3; ++k){
					if(j==k) continue;
						chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
				}
			}
		}

		//答え
		long long ans = 0 ;
		for(int j = 0; j < 3; ++j){
			chmax(ans, dp[n][j]);
		}
		cout<<ans<<endl;
	}


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

int main(){
        int h, w;
        while(1){
        cin >> h >> w;
        if(h == 0 && w == 0)break;
        for(int i = 1; i <= h; i++){
                for(int j = 1; j < w; j++){
                        cout << '#';
                }cout << '#' << endl;
        }
        cout << endl;
}
        return 0;
}

Measured memory_bytes: 1152