akhauriyash/Code-Regression huggingface dataset:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  ind=0
  nxt=k
  ans=[]
  for _ in range(n-k):
    if l[ind]<l[nxt]:
      ans.append('Yes')
    else:
      ans.append('No')

    ind+=1
    nxt+=1

  for x in ans:
    print(x)

main()
# print(main())


Measured memory_bytes: 33220
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String S = br.readLine();
		String T = br.readLine();
		String[] a = S.split(" ");
		String[] b = T.split(" ");
		int asum = 0;
		int bsum = 0;
		for(int i = 0 ; i < 4 ; i ++){
			asum+=Integer.parseInt(a[i]);
			bsum+=Integer.parseInt(b[i]);
		}
		System.out.println((asum>bsum)?asum:bsum);
	}
}

Measured memory_bytes: 17056
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{
	string a,b,g;
	int d,e;
	float c;
	cin>>a>>b;
	g=a+b;
	d=stoi(g);
	c=sqrt(d);	
	e=c;
	if(c==e)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3704
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();

            int K = 0;

            String pre = S.substring(0, 1);
            //System.out.println(pre);
            K++;

            int index = 1;
            while (true) {
                if (index == S.length()) {
                    break;
                }

                String str = S.substring(index, index + 1);
                if (!pre.equals(str)) {
                    pre = str;
                    //System.out.println(pre);
                    K++;
                    index++;
                    continue;
                }

                if (index + 1 == S.length()) {
                    break;
                }

                pre = S.substring(index, index + 2);
                //System.out.println(pre);
                K++;
                index += 2;
            }

            System.out.println(K);
        }
    }

}


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

int main()
{
	ios::sync_with_stdio(false);
	
	int maxv=-999,minv=9999999999,n;
	cin>>n;
	int a[n];
	
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		maxv=max(maxv,a[i]);
		minv=min(minv,a[i]);
	}
	
	cout<<maxv-minv<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define _rep(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
#define ll long long
std::string s;
int main(){
	std::cin>>s;
	if(*--s.end()!='s') s+='s';
	else{
		s+='e'; s+='s';
	}
	std::cout<<s<<'\n';
	return 0;
}

Measured memory_bytes: 3632
ARGF.each do |line|
  a = line.to_i
  break if a == 0
  b = gets.split.map(&:to_i)
  z = 0
  b.each{|p| z += (p - b.inject(0.0){|r,i| r+=i } / a) ** 2}
  puts Math.sqrt(z / a)
end

Measured memory_bytes: 6164
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n,k=MI()
	A=LI()

	print(-((-n+1)//(k-1)))




if __name__ == "__main__":
	main()


Measured memory_bytes: 18412
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main(){
	int n;
	double var=0., mean=0.;
	while(cin >> n && n != 0){
		var  = 0.;
		mean = 0.;
		int scores[n] = {0};

		for(int i=0;i<n;++i){
			cin >> scores[i];
			mean += scores[i];
		}
		mean /= n;

		for(int i=0;i<n;++i){
		var += pow(mean-scores[i],2);
		}

		cout << fixed << setprecision(7);
		cout << sqrt(var/n) << endl;
	}
	return 0;
}



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

int main(){
  int N;
  cin >> N;
  long long int H[N];
  long long int height;
  for (int i=0;i<N;i++){
    cin >> H[i];
  }
  int count=0;
  int count_M=0;
  for(int i=0;i<N-1;i++){
    if (H[i]>=H[i+1]){
      count++;
      if(count_M<count){
        count_M=count;
      }
    }else {
      count=0;
    }
  }
  cout << count_M;
}


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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef char* String;

String string_input(void){
    int i,len;
    char buf[100001];
    String str;
    scanf("%s",buf);//buf=入力した文字列が入るchar型の配列
    
    len=strlen(buf);//len=文字列の長さを表すint型変数
    NEW(str,len+1);//strはただのポインタだから、ここでNEWを使ってメモリを確保しなくちゃいけない
    for(i=0;i<len;i++){
        str[i]=buf[i];
    }
    str[len]=0;
    
    return str;
}

int main(void){
    String S;
    S=string_input();

    //D[0]~D[3]に与えられた文字列を入れる
    String* D;
    NEW(D,4);
    NEW(D[0],6);
    D[0]="dream";
    NEW(D[1],8);
    D[1]="dreamer";
    NEW(D[2],6);
    D[2]="erase";
    NEW(D[3],7);
    D[3]="eraser";

    //DPMapを作る
    int N=strlen(S);
    int Map[N+1];
    for(int i=1;i<=N;i++) Map[i]=0;
    Map[0]=1;

    //Mapを埋める
    for(int i=1;i<=N;i++){
        for(int j=0;j<4;j++){
            if(i<strlen(D[j])) continue;

            int flg=1;
            for(int k=0;k<strlen(D[j]);k++){
                if(S[i-strlen(D[j])+k]!=D[j][k]){
                    flg=0;
                    break;
                }
            }

            if(flg) Map[i]=Map[i-strlen(D[j])];
        }
    }

    if(Map[N]) printf("YES\n");
    else printf("NO\n");

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
  int i,j;
  int a[3];
  int max=0,max_i;
  int n;
  scanf("%d %d %d",&a[0],&a[1],&a[2]);
  scanf("%d",&n);
  for(i=0;i<3;i++){
    if(max<a[i]){
      max=a[i];
      max_i=i;
    }
  }
  for(i=0;i<n;i++){
    max=max*2;
  }
  printf("%d\n",max+a[(max_i+1)%3]+a[(max_i+2)%3]);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int a,b,c,temp,inc,inc2;
    scanf("%d%d%d",&a,&b,&c);
    if(a>=b && a>=c)
    {
        if(b<c)
        {
            temp=b;
            b=c;
            c=temp;
        }
    }
    else if(b>=a && b>=c)
    {
        temp=b;
        b=a;
        a=temp;
        if(b>=c)
            ;
        else
        {
            temp=b;
            b=c;
            c=temp;
        }
    }
    else if(c>=a && c>=b)
    {
        temp=c;
        c=a;
        a=temp;
        if(b>=c)
            ;
        else
        {
            temp=b;
            b=c;
            c=temp;
        }
    }
    if(a!=b || a!=c || b!=c)
    {
        inc=a-b;
        b=b+inc;
        c=c+inc;
        inc2=inc;
    }
    if(a!=c)
    {
        inc2=(a-c)/2;
         c=c+(inc2*2);
        inc2=inc2+inc;

    }
    if(a!=c)
    {
        inc2=inc2+2;
    }
    printf("%d",inc2);

}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void) {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	bool ok = true;
	while (1) {
		c -= b;
		if (c <= 0) {
			ok = true;
			break;
		}
		a -= d;
		if (a <= 0) {
			ok = false;
			break;
		}
	}
	cout << (ok ? "Yes" : "No");
	return 0;
}

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

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

using namespace std;

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

    ll n;
    cin >> n;
    vector<ll> p(n);
    REP(i,n)cin >> p[i];

    ll ans = 0;
    ll min = INF;
    for(int i = 0;i < n;i++){
        bool flag = true;
        if(p[i] < min){
            min = p[i];
            ans += 1;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int line[] = new int[N];
      double sum =0;
    
    for(int i=0;i<N;i++){
      line[i] = sc.nextInt();
      sum += 1.0/(double)line[i];
    }
    System.out.println(1.0/sum);
  }
}

Measured memory_bytes: 21332
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,t;
    cin>>n>>t;
    int ans=1e9;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
        if(b<=t) ans=min(ans,a);
    }
    if(ans==1e9) cout<<"TLE"<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 888
n = int(input())
s = list(input())
r_pos = []
g_pos = []
b_pos = []

for i in range(n):
    st = s[i]
    if st == "R":
        r_pos.append(i)

    if st == "G":
        g_pos.append(i)

    if st == "B":
        b_pos.append(i)

colors = [r_pos, g_pos, b_pos]
if len(colors[0]) > len(colors[1]):
    colors[0], colors[1] = colors[1], colors[0]
if len(colors[0]) > len(colors[2]):
    colors[0], colors[2] = colors[2], colors[0]
if len(colors[1]) > len(colors[2]):
    colors[1], colors[2] = colors[2], colors[1]

x_num, y_num, z_num = len(colors[0]), len(colors[1]), len(colors[2])

ans = x_num * y_num * z_num
c = set(colors[2])
for a in colors[0]:
    for b in colors[1]:
        x, y = min(a, b), max(a, b)

        dif = y - x
        left_pos = x - dif
        right_pos = y + dif
        mid_pos = 4000
        if dif % 2 == 0:
            mid_pos = x + dif // 2

        left = 0
        right = 0
        mid = 0
        if left_pos in c:
            left = 1
        if right_pos in c:
            right = 1
        if mid_pos in c:
            mid = 1

        ans -= left + right + mid

print(ans)


Measured memory_bytes: 9272
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = list(map(int, sys.stdin.readline().split()))
if K % 2 == 1:
    # K の倍数のパターンのみ
    m = N // K
    print(m ** 3)
else:
    m = N // K
    a1 = m ** 3
    m = (N + K // 2) // K
    a2 = m ** 3
    print(a1 + a2)


Measured memory_bytes: 21364
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
ll dfs(ll u, ll par, bool color, vector<vector<ll> > &graph, vector<vector<ll> > &ways) {
    if (ways[u][color] != -1)
        return ways[u][color];
    ll sum = 1;
    for (auto v : graph[u]) {
        if (v == par)
            continue;
        ll white = 0, black = 0;
        white = dfs(v, u, 1, graph, ways);
        if (color == 1) {
            black = dfs(v, u, 0, graph, ways);
        }
        sum = (sum % mod * (white + black) % mod) %mod ;
    }
    if (!sum)
        sum = 1;
    return ways[u][color] = sum;
}
int main() {
    ll n;
    cin>>n;
    vector<vector<ll> > graph(n+1);
    vector<vector<ll> > ways(n+1, vector<ll>(2, -1));
    for (int i = 1; i < n; i++) {
        ll u,v;
        cin>>u>>v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    ll ans = 0;
    ans = (dfs(1, 0, 1, graph, ways) + dfs(1, 0, 0, graph, ways)) % mod;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 23784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll kirisute(double a){
    ll k=(ll)a;
    if(fabs(k-a)<EPS){
        return k;
    }else if(a>k){
        return k;
    }else{
        return k-1;
    }
}

int main(){
    ll a,b;cin>>a>>b;
    rep(i,0,100000){
        if(kirisute(0.08*(double)i)==a && kirisute(0.10*(double)i)==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    
    
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define FILLINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) ((a) <= (i) && (i) <= (b))
using namespace std;
template <typename T> inline bool CHMIN(T& a, T b) { if(a > b) { a = b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a, T b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(begin(a), end(a)); }
template <typename T> inline void REV(T& a) { reverse(begin(a), end(a)); }
template <typename T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <typename S, typename T> inline T LB(S& v, T a) { return *lower_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int LBP(S& v, T a) { return lower_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> inline T UB(S& v, T a) { return *upper_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int UBP(S& v, T a) { return upper_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> ostream& operator << (ostream& os, const pair<S, T>& p) { os << p.first << " " << p.second; return os; }
template <typename S, typename T> istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator >> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) { for(auto &e : t) fill_v(e, v); }
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const lint MOD = 1000000007;

void _main() {
    double A, B;
    int H, M;
    cin >> A >> B >> H >> M;
    double m = 60 * H + M;
    double t1 = 6 * m;
    double t2 = m / 2;
    double t = min(abs(t1 - t2), 360 - abs(t1 - t2)) / 180 * PI;
    double ans = sqrt(A * A + B * B - 2 * A * B * cos(t));
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

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

using namespace std;

constexpr char endl('\n');


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

    //size_t x;
    //cin >> x;

    //size_t n1, n2;
    //n1 = x / 500;
    //n2 = (x % 500) / 5;

    //cout << n1 * 1000 + n2 * 5 << ::endl;

    size_t k, n;
    cin >> k >> n;
    vector<size_t> a(n + 2);
    for (auto i = 1; i <= n; ++i) {
        size_t t;
        cin >> t;
        a.at(i) = t;
    }
    a.at(0) = a.at(n) - k;
    a.at(n+1) = a.at(1) + k;

    vector<size_t> d(n);
    vector<size_t> e(n);
    for (auto i = 1; i <= n; ++i) {
        d.at(i - 1) = a.at(i + 1) - a.at(i);
    }

    cout << k - *max_element(d.begin(), d.end()) << ::endl;


    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <map>
using namespace std;
typedef long long ll;

int x, y;
int tm[51][51][51][51];
char field[51][51];
int dx[] = {
	0, -1, 0, 1
};
int dy[] = {
	1, 0, -1, 0
};
struct twins{
	int x1;
	int y1;
	int x2; 
	int y2;
};

bool can_move(int x1, int y1){
	if(x1 > 0 && x1 <= x && y1 > 0 && y1 <= y){
		if(field[y1][x1] == '0') return true;
		else return false;
	}
	return false;
}

void get_time(int x1, int y1, int x2, int y2){
	twins t0;
	t0.x1 = x1, t0.x2 = x2, t0.y1 = y1, t0.y2 = y2;
	queue<twins> qt;
	qt.push(t0);
	while(!qt.empty()){
		twins t = qt.front(); qt.pop();
		for(int i = 0; i < 4; i++){
			int ay = t.y1 + dy[i];
			int ax = t.x1 + dx[i];
			int by = t.y2 - dy[i];
			int bx = t.x2 - dx[i];
			if(!can_move(ax, ay)){
				ay = t.y1;
				ax = t.x1;
			}
			if(!can_move(bx, by)){
				by = t.y2;
				bx = t.x2;
			}
			if(tm[ay][ax][by][bx] < 0){
				tm[ay][ax][by][bx] = tm[t.y1][t.x1][t.y2][t.x2] + 1;
				t0.x1 = ax, t0.x2 = bx, t0.y1 = ay, t0.y2 = by;
				qt.push(t0);
			}
		}
	}
}

int main(){
	int ax, ay, bx, by;
	while(cin >> x >> y && (x || y)){
		int count = 101;
		memset(tm, -1, sizeof(tm));
		cin >> ax >> ay >> bx >> by;
		for(int i = 1; i <= y; i++){
			for(int j = 1; j <= x; j++){
				cin >> field[i][j];
			}
		}
		tm[ay][ax][by][bx] = 0;
		get_time(ax, ay, bx, by);
		for(int i = 1; i <= y; i++){
			for(int j = 1; j <= x; j++){
				if(tm[i][j][i][j] >= 0) count = min(count, tm[i][j][i][j]);
			}
		}
		if(count == 101) cout << "NA" << endl;
		else cout << count << endl;
	}
	return 0;
}

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

#define int long long
#define MAXN 3005
int dp[MAXN][MAXN];
int a[MAXN];
int n;

int dfs(int l, int r){
	if(dp[l][r]!=-1) return dp[l][r];
	if(l>r) return 0;
	int lev = (n-1-l)+r;
	lev%=2;
	if(lev==0){
		return dp[l][r] = max(dfs(l+1,r)+a[l], dfs(l,r-1)+a[r]);
	}
	else{
		return dp[l][r] = min(dfs(l+1,r)-a[l], dfs(l,r-1)-a[r]);
	}
}

int32_t main(){
	cin>>n;
	for(int i=0; i<n; i++) cin>>a[i];
	memset(dp,-1,sizeof(dp));
	cout<<dfs(0,n-1);
}

Measured memory_bytes: 70912
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
inline ll read() {
	ll kk=0,f=1;
	char cc=getchar();
	while(cc<'0'||cc>'9'){if(cc=='-')f=-1;cc=getchar();}
	while(cc>='0'&&cc<='9'){kk=(kk<<1)+(kk<<3)+cc-'0';cc=getchar();}
	return kk*f;
}
inline void write(ll xx){
	if(xx < 0){putchar('-');xx=-xx;}
	if(xx > 9)write(xx/10);
	putchar(xx%10+'0');
	return;
}
ll x,a,b;
int main(){
	x = read();
	int flag = 0;
	for(ll i = 1000;i>= 0;i--){
		for(ll j = 0;j <= 1000;j++){
			a = i * i * i * i * i;
			b = j * j * j * j * j;
			if(a - b == x){
				write(i);
				putchar(' ');
				write(j);
				flag = 1;
				break;
			}else if(a + b == x){
				write(i);
				putchar(' ');
				write(-j);
				flag = 1;
				break;
			}
		}
		if(flag){
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3000
using System.Linq;
using System;
 
namespace Application
{
	class Solution
	{
		static void Main(string[] args)
		{
			Console.ReadLine();
			var inputWords = Console.ReadLine().Split(' ');
 
			var cards = inputWords.Select(w => int.Parse(w))
				.OrderByDescending(i => i)
				.ToList();
 
			var aliceScore = 0;
			var bobScore = 0;
 
			for (var i = 0; i < cards.Count; i++)
			{
				if (i % 2 == 0)
				{
					aliceScore += cards[i];
				}
				else
				{
					bobScore += cards[i];
				}
			}
 
			Console.WriteLine(aliceScore - bobScore);
		}
	}
}

Measured memory_bytes: 13396
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();


    let mut iter = buf.split_whitespace();

    let H: usize = iter.next().unwrap().parse().unwrap();
    let W: usize = iter.next().unwrap().parse().unwrap();
    let h: usize = iter.next().unwrap().parse().unwrap();
    let w: usize = iter.next().unwrap().parse().unwrap();
    let res = (H - h) * (W - w);
    println!("{}", res);
}

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

struct tag
{
  int ni;
  int nid;
  int p;
  int y;
};

int main()
{
  int n, m;
  cin >> n >> m;
  tag *d = new tag[m];
  for( int i = 0; i < m; i++)
  {
    d[i].ni = i;
    cin >> d[i].p >> d[i].y;
  }
  sort(d, d + m, [](const tag& l, const tag& r){return l.y < r.y;});
  
  int *ns = new int[n]();
  for( int i = 0; i < m; i++)
  {
    d[i].nid = ++ns[d[i].p - 1];
  }
  sort(d, d + m, [](const tag& l, const tag& r){return l.ni < r.ni;});
  
  for(int i = 0; i < m; i++)
  {
    printf("%06d%06d\n", d[i].p, d[i].nid);
  }
}


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

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

    int ans = 1000;
    rep(i, s.size()-2) {
        int x = stoi(s.substr(i, 3));
        ans = min(ans, abs(753 - x));
    }

    cout << ans << endl;
    return 0;
}


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

#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

long long a;
long long b;
long long n;
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> a >> b >> n;
    long long x = min(n, b) - (b <= n);
    cout << ((a * x) / b) - a * (x / b) << "\n";
}



Measured memory_bytes: 3652
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main()
{
	int n;
	while (cin >> n&&n)
	{
		double y; cin >> y;
		int id = -1;
		double m=-1;
		for (int i = 0; i < n; i++)
		{
			double b, r, t;
			cin >> b >> r >> t;
			if (t == 2)
			{
				double x;
				x = pow((1.0 + r / 100.0),y);
				if (x > m)
				{
					m = x;
					id = b;
				}
			}
			else
			{
				double x;
				x = 1 + y*r / 100;
				if (x > m)
				{
					m = x;
					id = b;
				}
			}
		}
		cout << id << endl;
	}
}

Measured memory_bytes: 1320
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { if (i) os << " "; os << v[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
inline int add(int a, int b) { a += b; if (a >= mod) return a - mod; return a; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  string s;
  cin >> s;
  if (s.substr(0, 4) == "YAKI") cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(int j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll n;
ll a[100005];
int main(){FAST;
cin>>n;
for(ll i=0;i<n;i++)cin>>a[i];
sort(a,a+n);
ll mid1 = (n-1)/2;
ll mid2 = n/2;
cout<<a[mid2]-a[mid1]; 
return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    ll x; cin >> x; 
    ll ans = x;
    ans /= 11LL;

    if(x%11LL==0){
        cout << 2LL*ans << endl;
    }
    else if(x%11LL<=6){
        cout << 2LL*ans + 1LL << endl;
    }
    else cout << 2LL*ans + 2LL << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
xs = []
r = 1
for i in range(N):
    x, l = map(int, input().split())
    a,b = x-l, x+l
    xs.append((a,b))
xs.sort()
xs = xs[::-1]
for i, (a, b) in enumerate(xs):
    if i == 0:
        ba, bb= a, b
        continue
    if ba<b:
        continue
    else:
         ba, bb = a, b
         r += 1
print(r)


Measured memory_bytes: 54360
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
#include <array>
#include <numeric>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _NE noexcept
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _sc _il bool scan
_T T in(int c)_NE{T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_il int in()_NE{return in<int>(gcu());}
_T T scan(T &n)_NE{int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c)_NE{c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s)_NE{int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b)_NE{pcu('0'+b);}
_ot(const char *s)_NE{while(*s)pcu(*s++);}
_ot(char c)_NE{pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s)_NE{for(char c:s)pcu(c);}
#endif
_T _ot(T n)_NE{static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v)_NE{for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t)_NE{out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t)_NE{out(move(t)...);outl();}

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

void radix_sort(vector<int> &v) {
	vector<int> t(v.size());
	array<int, 256> c, s;
	for (int i = 0; i < 32; i += 8) {
		fill(all(c), 0);
		for_each(all(v), [&](int j) {c[(j >> i) & 255]++;});
		s.front() = 0;
		partial_sum(all(c) - 1, s.begin() + 1);
		for_each(all(v), [&](int j) {t[s[(j >> i) & 255]++] = j;});
		swap(v, t);
	}
}

int main() {
	for (int N, M; N = in(), M = in();) {
		vector<int> t(N), u;
		for (int &p: t)
			p = in();
		t.push_back(0);
		for (auto i = t.begin(); i != t.end(); i++)
			for (auto j = i; j != t.end(); j++)
				if (*i + *j <= M)
					u.push_back(*i + *j);
		radix_sort(u);
		int r = 0;
		for (auto i = u.begin(), e = u.end() - 1; i <= e; i++) {
			for (; *i + *e >= M; e--)
				;
			r = max(r, *i + *e);
		}
		outl(r);
	}
}


Measured memory_bytes: 6188
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()

X = int(input())
for A in range(-10 ** 3, 10 ** 3):
    A5 = A ** 5
    for B in range(-10 ** 3, 10 ** 3):
        if A5 - B ** 5 == X:
            print(A, B)
            exit()




Measured memory_bytes: 9184
// Shift-JIS（シフトジス）

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

int main()
{
    string S;
    cin >> S;
    char c = S[0];
    bool flag = false;

    for (int i = 1; i < 4; i++)
    {
        if (c == S[i])
        {
            flag = true;
        }
        c = S[i];
    }

    if (flag == true)
    {
        cout << "Bad" << endl;
    }
    else
    {
        cout << "Good" << endl;
    }
    
}

Measured memory_bytes: 256
card = {"S":[i for i in range(1,14)], "H":[i for i in range(1,14)],"C":[i for i in range(1,14)], "D":[i for i in range(1,14)]}

n = int(input())

for i in range(n):
    c, r = input().split()
    card[c].remove(int(r))
    
for i in ["S","H","C","D"]:
    [print("%s %d" % (i,j)) for j in card[i]]



Measured memory_bytes: 5600
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
 
using namespace std;

int main(){

	long long n;
	cin>>n;

	vector<long long> a(n);
	for(int i=0;i<n;i++) cin>>a[i];

	//(+,-,+,...)
	long long res1=0;
	long long s=1;
	long long sum=0;
	for(int i=0;i<n;i++){
		sum+=a[i];
		if(s==1){
			if(sum<s) res1+=s-sum,sum=s;
		}else{
			if(sum>s) res1+=sum-s,sum=s;
		}
		s=-s;
	}

	//(-,+,-,...)
	long long res2=0;
	s=-1;
	sum=0;
	for(int i=0;i<n;i++){
		sum+=a[i];
		if(s==1){
			if(sum<s) res2+=s-sum,sum=s;
		}else{
			if(sum>s) res2+=sum-s,sum=s;
		}
		s=-s;
	}

	cout<<min(res1,res2)<<endl;

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, k);
    
    int d = n*(n-1)/2 - (n-1);
    
    if(k > d){
        Cout(-1);
        return 0;
    }
    Cout(d-k+n-1);
    for(int i = 1; i < n; i ++){
        Cout(i, " ", n);
    }
    for(int i = 1; i < n; i ++){
        for(int j = i+1; j < n; j ++){
            if(k == d) return 0;
            Cout(i, " ", j);
            d --;
        }
    }
    
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    string s = "CODEFESTIVAL2016";
    string t;
    cin >> t;
    int cnt = 0;
    rep(i, s.size()){
        if(s[i] != t[i]) cnt++;
    }
    output(cnt);
    
    return 0;
}

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

using namespace std;

int tab[100005];
int opty[100005];

int main(){

ios_base::sync_with_stdio(0);

int n;
cin>>n;

for(int i=1; i<=n; i++){
cin>>tab[i];
}

opty[2]=abs(tab[2]-tab[1]);

for(int i=3; i<=n; i++){

opty[i]=min(abs(tab[i]-tab[i-1])+opty[i-1], abs(tab[i]-tab[i-2])+opty[i-2]);

}

cout<<opty[n];

return 0;
}


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

class union_find_tree {
public:
	int n;
	vector<int> parent;
	vector<int> hight;

	union_find_tree(int sz) {
		n = sz;
		for (int i = 0; i < n; ++i) {
			parent.push_back(i);
			hight.push_back(0);
		}
	}

	int find_root(int x) {
		if (parent[x] == x)return x;
		else return parent[x] = find_root(parent[x]);
	}

	void unite(int x, int y) {
		x = find_root(x);
		y = find_root(y);
		if (x == y)return;

		if (hight[x] < hight[y]) parent[x] = y;
		else {
			parent[y] = x;
			if (hight[x] == hight[y])++hight[x];
		}
	}

	bool same(int x, int y) {
		return find_root(x) == find_root(y);
	}
};

int main() {
	ll n, m;
	cin >> n >> m;
	union_find_tree uf(n);
	for (ll i = 0; i < m; ++i) {
		ll a, b;
		cin >> a >> b;
		uf.unite(a - 1, b - 1);
	}
	map<ll, ll> mp;
	for (ll i = 0; i < n; ++i) {
		++mp[uf.find_root(i)];
	}
	ll ans = 0;
	for (auto p : mp)ans = max(ans, p.second);
	cout << ans << endl;
}


Measured memory_bytes: 17124
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 100001
s = 0

for x in a:
    cnt[x] += 1
    s += x

q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    num = cnt[b]
    cnt[b] = 0
    s -= num * b
    cnt[c] += num
    s += num * c
    print(s)

Measured memory_bytes: 83888
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: u32 = read();
    let a1i: Vec<u32> = (0..n).map(|_| read()).collect();
    let a2i: Vec<u32> = (0..n).map(|_| read()).collect();

    let mut ans: u32 = 0;
    for i in 0..n {
        let a1: u32 = a1i.iter().take(i as usize + 1).sum();
        let a2: u32 = a2i.iter().skip(i as usize).sum();
        let cnt: u32 = a1 + a2;
        if cnt > ans {
            ans = cnt;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
object Main {
  def main(args:Array[String]) {
    val N = readLine().toInt    
    val S = readLine()
    var ans = List[Char]()
    for(i <- 0 until S.length) {
      ans = (((S(i) - 'A' + N) % 26) + 65).toChar :: ans
    }
    ans = ans.reverse
    ans.map{a => print(a)}
    println()
  }
}


Measured memory_bytes: 28244
#include<stdio.h>

#define nax 100009
#define nax2 109

long long max(long long a,long long b){
	return a>b? a:b;
}

int main(){
	long long W, peso[nax2],valor[nax2],n;
	long long dp[nax2][nax];

	scanf("%lld",&n);
	scanf("%lld",&W);
	for(int i = 0 ; i < n;i++){
		scanf("%lld %lld",&peso[i],&valor[i]);
	}

	//1ra entrada: posicion, 2da: peso actual (w hat)
	//Caso base:
	for(int i = 0 ; i < n;i++){
		dp[i][0] = 0;
	}

	for(int i = 1; i <=W;i++){//peso
		for(int j = 0; j < n ; j++){//posicion
			long long siEscojo = 0, noEscojo = 0;
			if(peso[j]<=i){
				if(j==0){
					siEscojo= valor[j];
				}else{
					siEscojo = valor[j] + dp[j-1][i-peso[j]];
				}
			}
			if(j!=0){
				noEscojo = dp[j-1][i];
			}
			dp[j][i] = max(siEscojo,noEscojo);
		}
	}

	printf("%lld",dp[n-1][W]);

	return 0;
}

Measured memory_bytes: 80128
#tree_walk
class Node
  attr_accessor :myname,:parent,:left,:right,:depth

  def initialize(n)
    @myname = n
    @parent = -1
    @left   = nil
    @right  = nil
  end

  def add_left(child)
      self.left    = child
      child.parent = self
  end

  def add_right(child)
      self.right    = child
      child.parent = self
  end

  def preorder
    printf(" %d",self.myname)
    if(left != nil)
      left.preorder
    end
    if(right!= nil)
      right.preorder
    end
  end

  def inorder
    if(left != nil)
      left.inorder
    end
    printf(" %d",self.myname)
    if(right!= nil)
      right.inorder
    end
  end

  def postorder
    if(left != nil)
      left.postorder
    end
    if(right!= nil)
      right.postorder
    end
    printf(" %d",self.myname)
  end

end


n = STDIN.gets.split[0].to_i
tree=Array.new(n){|i| Node.new(i)}

0.upto(n-1){|i|
  s = STDIN.gets.split
  id= s[0].to_i
  l = s[1].to_i
  r = s[2].to_i

#  printf("%d %d %d:\n",id,l,r)
  if(l != -1)
    tree[id].add_left(tree[l])
  end
  if(r != -1)
    tree[id].add_right(tree[r])
  end
}


def findroot(tree,n)
  0.upto(n-1){|i|
    if tree[i].parent == -1 
      return i
    end
  }
end 


rt = findroot(tree,n)
puts "Preorder"
tree[rt].preorder
printf("\n")
puts "Inorder"
tree[rt].inorder
printf("\n")
puts "Postorder"
tree[rt].postorder
printf("\n")

Measured memory_bytes: 8668
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    long long int num = 0;
    map<long long int, long long int> mp;
    rep(i, n)
    {
        int temp;
        cin >> temp;
        num += temp;
        if (mp[num % m] == 0)
        {
            mp[num % m] = 1;
        }
        else
        {
            mp[num % m] = mp[num % m] + 1;
        }
    }
    long long int ans=0;
    for(auto itr : mp){
        if(itr.first==0){
            ans+=itr.second;
        }
        if(itr.second>=2){
        ans+=itr.second*(itr.second-1)/2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define sz(v) (ll)v.size()
#define inf 1000000000000000000
#define vll vector<ll>
using namespace std;
const int N=505;

void solve()
{
	ll n,a[N],mx=0,ans,i,j,x[N],y[N];
	map<pair<ll,ll>,ll>mp;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>x[i]>>y[i];
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
		{
			if(x[j]-x[i] || y[j]-y[i])
			{
				mp[MP(x[j]-x[i],y[j]-y[i])]++;
				mx=max(mx,mp[MP(x[j]-x[i],y[j]-y[i])]);
			}
		}
	ans=n-mx;
	cout<<ans;
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 384
using System;
    class Program
    {
        private static string[] input;
        private static int h, w;

        private static bool IsValid(int i, int j)
        {
            if (i >= 0 && i <= h - 1 && j >= 0 && j <= w - 1 && input[i][j] == '#')
                return true;
            return false;
        }

        private static string Remove(int i, int j)
        {
            if (j == w - 1) return input[i].Substring(0, j) + '.';
            return
            input[i].Substring(0, j) + '.' + input[i].Substring(j + 1);
        }

        private static bool Check(int i, int j)
        {
            input[i] = Remove(i, j);
            if (i == h - 1 && j == w - 1)
            {
                for (int k = 0; k < h; k++)
                {
                    if (input[k].Contains("#")) return false;
                }
                return true;
            }
            
            int count = 0;
            int type = 0;
            if (IsValid(i+1,j))
            {
                count++;
                type = 1;
            }            
            if (IsValid(i, j+1))
            {
                count++;
                type = 2;
            }
            if (count > 1) return false;
            if (type == 1)
            {
                return Check(i + 1, j);
            }
            if (type == 2)
            {
                return Check(i, j + 1);
            }
            return false;
        }
        
        static void Main(string[] args)
        {
            string[] line1 = Console.ReadLine().Split(' ');
            h = int.Parse(line1[0]);
            w = int.Parse(line1[1]);
            input = new string[h];
            for (int i = 0; i < h; i++)
            {
                input[i] = Console.ReadLine();
            }
            if (Check(0, 0)) Console.WriteLine("Possible");
            else Console.WriteLine("Impossible");
        }
    }

Measured memory_bytes: 2776
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;

#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}


signed main(){
	IOS();
	vector<int>ans;
	while(1){
		int N,M,A;
		cin>>N>>M>>A;
		if(!N&&!M&&!A)break;
		vector<pair<int,pair<int,int>>>v;
		rep(i,0,M){
			int h,p,q;
			cin>>h>>p>>q;
			h--;p--;q--;
			v.push_back({h,{p,q}});
		}
		sort(all(v));
		reverse(all(v));
		vector<int>amida(N);
		iota(all(amida),0);
		for(auto e:v){
			swap(amida[e.se.fi],amida[e.se.se]);
		}
		rep(i,0,N){
			if(amida[i]==A-1){
				ans.push_back(i+1);
				break;
			}
		}
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	long long N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
	return 0;
}

Measured memory_bytes: 3636