akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		List<Integer> a = new ArrayList<>();
		a.add(s);
		int ans = 0;
		for (int i = 0; i < 1000000; i++) {
			int ai = a.get(i) % 2 == 0 ? a.get(i) / 2 : 3 * a.get(i) + 1;
			if (a.contains(ai)) {
				ans = i + 2;
				break;
			}
			a.add(ai);
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 21844
#include<stdio.h>

int main(int argc, char* argv[])
{
  int a[200], n, swc;
  int i, j, w;

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

  swc = 0;
  for(i = 1; i <= n; i++){
    for(j = n; i + 1 <= j; j--){
      if(a[j] < a[j-1]){
        w = a[j-1];
        a[j-1] = a[j];
        a[j] = w;
        swc++;
      }
    }
  }
  for(i = 1; i < n; i++){
    printf("%d ", a[i]);
  }
  printf("%d\n", a[i]);
  printf("%d\n", swc);
  return(0);
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

int n;
int cnt[100000 + 5];
int mi;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        cnt[a]++;
        cnt[a + 1]++;
        if (a == 0) mi++;
        else cnt[a - 1]++;
    }
    int ans = 0;
    rep(i, 100000 + 2) {
        ans = max(ans, cnt[i]);
    }
    cout << ans << endl;
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1'000'000'000'000'000'000ll + 7;

const double eps = 1e-8;

i64 n, m;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> m;
    for (i64 i = 0; i < m; i++) {
        i64 t;
        cin >> t;
        n -= t;
    }

    cout << max(-1ll, n) << endl;

    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<string>
#include<climits>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<queue>


int main(){
	int n;
	std::vector<int> aList;

	std::cin>>n;
	aList.resize(n);

	for(int i=0; i<n; i++)
		std::cin>>aList[i];

	int maxIdx=0;
	int maxNum=0;
	int subMaxNum=0;

	bool isMaxNumDpl= false;

	for(int i=0; i<n; i++){
		if(maxNum< aList[i]){
			maxNum= aList[i];
			maxIdx= i;
		}
	}

	std::sort(aList.begin(), aList.end(),[](int x, int y){return x>y;});

	maxNum= aList[0];
	subMaxNum= aList[1];

	for(int i=0; i<maxIdx; i++){
		std::cout<<maxNum<<std::endl;
	}

	std::cout<<subMaxNum<<std::endl;

	for(int i=maxIdx+1; i<n; i++)
		std::cout<<maxNum<<std::endl;



	return 0;
	
}

Measured memory_bytes: 2432
import bisect

def solve():
    N, Q = map(int, input().split())
    S = input()
    
    index = []
    for i in range(N-1):
        if S[i:i+2] == 'AC':
            index.append(i+1)
    for _ in range(Q):
        l, r = map(int, input().split())
        print(bisect.bisect_left(index, r) - bisect.bisect_left(index, l))
        
solve()

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

using namespace std;

int main() {
    //freopen("sample-8.in", "r", stdin);
    //freopen("output8.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n,k;
    cin>>n>>k;
    double res=0;
    for(long long i=1;i<=n;i++){
        long long cur=i,cnt=0;
        double p=1;
        while(cur<k){
            cur*=2;
            cnt++;
            p*=(0.5);
        }
        res+=p;
    }
    res/=n;
    cout<<fixed<<setprecision(9)<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	to := make([][]int, N)
	for i := 0; i < M; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		b, _ := strconv.Atoi(sc.Text())
		a--
		b--
		to[a] = append(to[a], b)
		to[b] = append(to[b], a)
	}

	ans := make([]int, N)
	for i := range ans {
		ans[i] = -1
	}

	// queue of (room, depth)
	qs := make([][]int, 0)
	qs = append(qs, []int{0, 0})

	for len(qs) > 0 {
		q := qs[0]
		qs = qs[1:]
		for _, room := range to[q[0]] {
			if ans[room] != -1 {
				continue
			}
			ans[room] = q[0]
			qs = append(qs, []int{room, q[1] + 1})
		}
	}
	fmt.Println("Yes")
	for i := 1; i < N; i++ {
		fmt.Println(ans[i] + 1)
	}
}


Measured memory_bytes: 25488
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz(x) (int)x.size()
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	string s;
	cin>>s;
	int yt = 0;
	for(auto &&u : s)
	yt = ((yt%9) + ((u-'0')%9))%9;
	cout<<((!yt) ? "Yes" : "No")<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int h,n,x,sum;
void solve()
{
    cin>>h>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        sum+=x;
    }
    if(h<=sum)puts("Yes");
    else puts("No");
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("XORQUERY.inp","r",stdin);
    //freopen("XORQUERY.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.util.PriorityQueue
import java.util.Comparator
import scala.io.StdIn.{readLine,readInt}
import scala.collection.mutable.ArrayBuffer

object Main {

  class Node(var cost:Int, var id:Int) { }

  class NodeComparator extends Comparator[Node] {
    def compare(node1:Node,node2:Node) = { node1.cost-node2.cost }
  }

  def main(args:Array[String]) = {
    val comp:Comparator[Node] = new NodeComparator()
    val n = readInt
    val pq = new PriorityQueue[Node](n, comp)
    val g = for(i<-0 until n) yield { readLine.trim.split(" ").map(_.toInt) }
    val dist = new Array[Int](n)
    val nodes = new Array[Node](n)
    nodes(0) = new Node(0,0)
    pq.add(nodes(0))
    for(i<-1 until n) {
      dist(i) = 1000000
      nodes(i) = new Node(1000000, i)
    }
    dist(0) = 0

    while(!pq.isEmpty()) {
      val nd = pq.poll()
      val v = g(nd.id)

      for(i<-0 until v(1)) {
        val j = i*2+2
        val k = i*2+3
        val alt = v(k) + dist(v(0))
        if(alt < dist(v(j))) {
          dist(v(j)) = alt
          val node = nodes(v(j))
          if(pq.contains(node)) {
            pq.remove(node)
          }
          node.cost = dist(v(j))
          node.id = v(j)
          pq.add(node)
        }
      }
    }

    println{
      { for(i<-0 until n) yield (i.toString + " " + dist(i).toString) }.mkString("\n")
    }
  }
}

Measured memory_bytes: 157528
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	nums := make(map[int]int)

	for i := 0; i < n; i++ {
		nums[nextInt()]++
	}

	// All 0
	if nums[0] == n {
		fmt.Println("Yes")
		return
	}

	// 0, x, x
	if len(nums) == 2 && n%3 == 0 && nums[0] == n/3 {
		fmt.Println("Yes")
		return
	}

	// x, y, z
	if len(nums) == 3 && n%3 == 0 {
		keys := make([]int, 0)
		values := make([]int, 0)
		for key, value := range nums {
			keys = append(keys, key)
			values = append(values, value)
		}

		if keys[0]^keys[1]^keys[2] == 0 && values[0] == values[1] && values[1] == values[2] {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
}


Measured memory_bytes: 6784
s = input()
d = {}
for i in s:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
if len(d.keys()) == 2:
	k = list(d.keys())
	if d[k[0]] == 2 and d[k[1]] == 2:
		print('Yes')
	else:
		print('No')
else:
	print('No')

Measured memory_bytes: 3060
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val inputs = Iterator.continually(StdIn.readLine()).takeWhile(_ != null)
    for{
      in <- inputs
      val Array(h, w, _*) = in.split(" ").map(_.toInt)
      }{
        if(h != 0 && w != 0) println(List.tabulate(h, w) { (i, j) =>
          val simbol = if ((i % 2 == 0 && j % 2 == 0) ||
            (i % 2 != 0 && j % 2 != 0)) "#"
          else "."
          val EOS = if(j == w - 1) "\n" else ""
          simbol + EOS
        }.flatten.mkString)
      }
  }
}

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

using namespace std;

int main(){
	string s;
	
	int k;
	cin>>k;
	cin>>s;
	if(s.length()<=k)
	cout<<s<<endl;
	else
	{
		for(int i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"..."<<endl;
	}
	return 0;
}

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

int main(){
  string S;
  cin >> S;
  constexpr int mod = 2019;
  int cnt[mod] = {};
  ++cnt[0];
  reverse(S.begin(), S.end());
  long long ans = 0, t = 1, s = 0;
  for(auto c : S){
    int d = c-'0';
    d *= t;
    d %= mod;
    s += d;
    s %= mod;
    ans += cnt[s];
    ++cnt[s];
    t *= 10;
    t %= mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3748
#include <map>
#include <iostream>

using namespace std;

/** Problem0039 : Roman Figure **/
int main()
{
	char num[110]; int now, old, ans;
	map<char, int> list;
	list.insert(map<char, int>::value_type('I', 1));
	list.insert(map<char, int>::value_type('V', 5));
	list.insert(map<char, int>::value_type('X', 10));
	list.insert(map<char, int>::value_type('L', 50));
	list.insert(map<char, int>::value_type('C', 100));
	list.insert(map<char, int>::value_type('D', 500));
	list.insert(map<char, int>::value_type('M', 1000));
	
	while (cin >> num) {
		ans = 0;
		old = list[num[0]];
		for (int i=1; i<110 && num[i]!='\0'; i++) {
			now = list[num[i]];
			if (old == 0) {
				old = now;
			} else if (old<now) {
				ans += (now-old);
				old = 0;
			} else {
				ans += old;
				old = now;
			}
		}
		ans += old;
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1176
#define lop(i, n) for (int i = n-1; i >= 0; i--)
#define loop(i, x) for (int i = 0; i < x; i++)
#define loopf(i, x, n) for (int i = x; i < n; i++)
#define loopr(i, x, n) for (int i = x - 1; i >= n; i--)
#define ain(arr, n) for (int i = 0; i < n; i++) cin>>arr[i]
#define aout(arr, n) for (int i = 0; i < n; i++) cout<<arr[i]<<" "
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)

#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fe first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
#define _ <<" "<<

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <iterator>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <limits.h>
#include <iomanip>
#include <cctype>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef complex<int> ci;

int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	int h;cin>>h;
	int mx = -1;
	vi attack;
	loop(i, n)
	{
		int a,b;cin>>a>>b;
		mx = max(mx, a);
		attack.pb(a);attack.pb(b);
	}
	sort(ALL(attack));
	int cnt = 0;
	int i = sz(attack)-1;
	while(h > 0)
	{
		if (attack[i] > mx)
		{
			h -= attack[i];cnt++;
			i--;
		}
		else
		{
			cnt += (h+attack[i] - 1)/attack[i];
			break;
		}
	}
	cout<<cnt<<"\n";
	return 0;
}

Measured memory_bytes: 1400
import scala.io.StdIn._;

object Main{
    def main(args:Array[String]){
        readLine();
        val _a = readLine().split(" ");
        var a = Array.ofDim[Int](_a.length);
        for(i <- 0 until a.length){
            a(i) = _a(i).toInt;
        }
        a = a.sorted;
        var s = 0;
        for(i <- 0 until a.length){
            if(i % 2 == 0){
                s += a(i).toInt;
            }
        }
        printf("%d\n",s);
    }
}

Measured memory_bytes: 21684
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define lli long long int
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
ll n;
ll a[100010][4];
ll dp[100010][4];
ll getans(ll i,ll k)
{
if(i>n)
{
	return 0;
}
if(dp[i][k]!=-1)
{
	return dp[i][k];
}
ll ans=0;
for(ll p=1;p<=3;p++)
{
	if(k!=p)
	ans=max(ans,getans(i+1,p)+a[i][p]);
}
return dp[i][k]=ans;
}
int main()
{
ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
cin>>n;
for(ll i=1;i<=n;i++)
{
	for(ll j=1;j<=3;j++)
	cin>>a[i][j];
}
memset(dp,0,sizeof(dp));
dp[1][1]=a[1][1];
dp[1][2]=a[1][2];
dp[1][3]=a[1][3];
for(ll i=2;i<=n;i++)
{
dp[i][1]=max(dp[i-1][2]+a[i][1],dp[i-1][3]+a[i][1]);
dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][3]+a[i][2]);
dp[i][3]=max(dp[i-1][2]+a[i][3],dp[i-1][1]+a[i][3]);
}
ll ans=max(dp[n][1],max(dp[n][2],dp[n][3]));
cout<<ans<<endl;
}




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

int main() {
  unsigned N;
  std::cin >> N;
  std::vector<long long> a(N);
  for (unsigned i = 0; i < N; ++i) { std::cin >> a[i]; }
  long long sum = 0;
  for (const auto &i : a) { sum += i; }
  long long sum2 = 0;
  long long ans = std::numeric_limits<long long>::max();
  for (unsigned i = 0; i + 1 < N; ++i) {
    sum -= a[i];
    sum2 += a[i];
    ans = std::min(ans, std::abs(sum - sum2));
  }
  std::cout << ans << std::endl;
  return 0;
}

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

const int M = 1010000;
bool p[M];

void prime() {
  fill(p, p+M, true);
  p[0] = false;
  p[1] = false;
  for(int i = 0; i < M; i++) {
    if(p[i]) {
      for(int j = 2; i*j < M; j++) {
	p[i*j] = false;
      }
    }
  }
}

int main() {
  int a, d, n;
  prime();

  while(cin >> a >> d >> n, a+d+n) {
    int cnt = 0;
    if(p[a]) cnt++;
    while(cnt != n) {
      a += d;
      if(p[a]) cnt++;
    }
    cout << a << endl;
  }
}

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

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    ll a; cin >> a;
    string b; cin >> b;
    b.erase(b.begin()+1);
    ll c = stoi(b);
    a *= c;
    cout << a/100 << endl;
}

Measured memory_bytes: 3656
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
r = 0
l = 0
for i in range(x, n+1):
    if i in a:
        r += 1
for i in range(0, x):
    if i in a:
        l += 1
print(min(r, l))

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

bool dp[85][85][26000];

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<int>> s(h, vector<int>(w));
    rep(i,h) rep(j,w) cin >> s[i][j];
    rep(i,h) rep(j,w){
        int b;
        cin >> b;
        s[i][j] = abs(s[i][j] - b);
    }

    dp[1][1][13000+s[0][0]] = dp[1][1][13000-s[0][0]] = true;
    rep(i,h+1) rep(j,w+1) rep(k,26000){
        if(!dp[i][j][k]) continue;
        if(i != h) dp[i+1][j][k+s[i][j-1]] = dp[i+1][j][k-s[i][j-1]] = true;
        if(j != w) dp[i][j+1][k+s[i-1][j]] = dp[i][j+1][k-s[i-1][j]] = true;
    }
    int ans = 1e5;
    rep(k,26000) if(dp[h][w][k]) ans = min(ans, abs(k-13000));
    cout << ans << endl;
}

Measured memory_bytes: 109064
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC108.C
{
    class Program
    {
        static void Main()
        {
            var sc = new Scanner();
            var n = sc.Nextint();
            var k = sc.Nextint();

            var count = 0d;
            if (k % 2 == 0)
            {
                var multiples = n / k;
                count += Math.Pow(multiples, 3);
                var halfk = k / 2;
                var halfkCount = 0;
                while (halfk <= n)
                {
                    halfkCount++;
                    halfk += k;
                }
                count += Math.Pow(halfkCount, 3);
                Console.WriteLine((long) count);
            }
            else
            {
                var multiples = n / k;
                count += Math.Pow(multiples, 3);
                Console.WriteLine((long) count);
            }
        }
    }
    class Scanner
    {
        string[] s;
        long i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public int Nextint()
        {
            return int.Parse(Next());
        }
        public int[] Arrayint(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Nextint() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }

        public double[] ArrayDouble(long N, double add = 0)
        {
            double[] Array = new double[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }

        public decimal NextDecimal()
        {
            return decimal.Parse(Next());
        }

        public decimal[] ArrayDecimal(long N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDecimal();
            }
            return Array;
        }
    }
}


Measured memory_bytes: 13140
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main{
	//WRWWRWRR     wwwrrrrwwwwrrr
	///112 112
	///1223 12
	public void solve(int testNumber, InputReader in, PrintWriter out) {

	}
	public static void main(String[] args){
		Scanner scanner = new Scanner(new InputStreamReader(System.in));
		long n = Long.parseLong(scanner.nextLine());
		n--;
		long max = (long)1e18+1;
		List<Long> res = new ArrayList<>();
		long aka = 0;
		long[] arr = new long[20];
		arr[0] = 1;
		for(int i=1;i<20;i++){
			arr[i] = arr[i-1]*26;
		}
		long sum = 0;
		for(int i=1;i<20;i++){
			sum+=arr[i];
			if(n<sum){
				int len = i;
				StringBuilder sb = new StringBuilder();
				n-=(sum-arr[i]);
				for(int j=0;j<len;j++){
					int idx = (int) (n/arr[len-j-1]);
					//System.out.println(n+" "+arr[len-j-1]);
					sb.append((char)(idx+'a'));
					n-=arr[len-j-1]*idx;
				}
				System.out.println(sb.toString());
				return ;
			}
		}
	}
//	public static void main(String[] args){
//        InputStream inputStream = System.in;
//        OutputStream outputStream = System.out;
//        InputReader in = new InputReader(inputStream);
//        PrintWriter out = new PrintWriter(outputStream);
//        Main solver = new Main();
////        int num = in.nextInt();
////        while(num-->0){
////            solver.solve(1, in, out);
////        }
//        solver.solve(1, in, out);
//        out.close();
//    }
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

	}
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){

  ll s;
  cin >> s;
  ll mx = 1000000000;
  ll k = (mx-s%mx)%mx;
  ll l = (s+k)/mx;
  printf("0 0 1000000000 1 %lld %lld\n",k,l);
  




  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    if(k<=a)
    {
        cout<<k<<endl;
    }
    else
    {
        ans+=a;
        k-=a;
        if(k<=b)
        {
            cout<<ans<<endl;
        }
        else
        {
            k-=b;
            cout<<ans-k<<endl;
        }
    }
    
}
return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define ff first
#define ss second
typedef pair<int,int> pii;

int32_t main()
{
 int n ; 
 cin >> n ;

 string s ;
 cin >> s ;

 int i = 0 , j = n - 1 ;
 int cnt = 0 ;
 while(i < j){
  while(i < n && s[i] != 'W'){
   i++ ;
   // cout << i <<"i ";
  }
  while( j >= 0 && s[j] != 'R'){
   j-- ;
   // cout << j <<" ";
  }
  if(i < j){
   
  swap(s[i] , s[j]) ;
  ++cnt ;
  ++i ;
  --j ;
  }

 }

 for(int i = 0 ; i < n -1 ; i++){
  if(s[i] == 'W' && s[i + 1] == 'R')cnt++ ;
 }

 cout << cnt ;
 return 0;
}        

Measured memory_bytes: 3752
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
  
public class Main 
{ 
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
  
    public static void main(String[] args) 
    { 
        FastReader s=new FastReader(); 
        
        int N = s.nextInt();
        int[] a = new int[N];
        int[] b = new int[N];
        int[] c = new int[N];
        int[][] dp = new int[2*N][3];
        
        for (int i = 0; i < N; i++) {
            a[i] = s.nextInt();
            b[i] = s.nextInt();
            c[i] = s.nextInt();
        }
        
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 3; j++) {
                if (i == 0) { // first day
                    switch (j) {
                        case 0:
                            dp[i][j] = a[i];
                            break;
                        case 1:
                            dp[i][j] = b[i];
                            break;
                        default:
                            dp[i][j] = c[i];
                            break;
                    }
                } else {
                    for (int k = 0; k < 3; k++) {
                        if (j == k) {}
                        else if ( j == 0) { dp[i][j] = Math.max(dp[i][j], dp[i-1][k] + a[i]); }
                        else if ( j == 1) { dp[i][j] = Math.max(dp[i][j], dp[i-1][k] + b[i]); }
                        else { dp[i][j] = Math.max(dp[i][j], dp[i-1][k] + c[i]); }
                    }
                }
            }
        }
        
        int ret = 0;
        
        ret = Math.max(ret, dp[N-1][0]);
        ret = Math.max(ret, dp[N-1][1]);
        ret = Math.max(ret, dp[N-1][2]);
        
        System.out.println(ret);
    } 
} 


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

using namespace std;


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000009
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl			'\n'
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

const int maxn = 1e5 + 5;
void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;
	for (int i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

set<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	set<int> primes;

	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.insert(i);
	}
	return primes;
}
set<int> primeFactors(int  n)
{
	set<int> factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors.insert(2);

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		// int count = 0;
		while (n % i == 0)
		{
			factors.insert(i);
			n /= i;
		}
	}
	if (n > 2)
		factors.insert(n);
	return factors;
}

int power(int x, unsigned int y, int p)
{
	int res = 1;

	x = x % p;

	if (x == 0) return 0;
	;
	while (y > 0)
	{

		if (y & 1)
			res = (res * x) % p;

		y = y >> 1; // y = y/2
		x = (x * x) % p;
	}
	return res;

}

// Graph------------------------------------------------------------------------


int32_t main()
{
	FIO;
	// c_p_c();
	// --------------------------------------------------
	// Never GIVE UP !!!!

	int d, t, s;
	cin >> d >> t >> s;
	if ((int)ceil(d / (float)s) <= t)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 3660
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <utility>
using namespace std;
#define omajinai ios::sync_with_stdio(false);cin.tie(nullptr);

#pragma region typedef 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ld PI = 3.141592653589793;
const ll INF18 = 1e18;
#pragma endregion

#pragma region function
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;
}
#pragma endregion

ll a[100010][3];
ll dp[100010][3];

int main(){
omajinai;

int n; cin >> n;
rep(i, n)rep(j, 3) cin >> a[i][j];

rep(i, n)rep(j, 3)rep(k, 3){
    if(j == k) continue;
    chmax(dp[i+1][k], dp[i][j] + a[i][k]);
}


ll res = 0;
rep(i, 3) chmax(res, dp[n][i]);
cout << res << endl;

return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vi h(n);
  rep(i,n) cin >> h[i];
  vi b(n), a(n);
  rep(i,n) {
    a[i] = i+h[i];
    b[i] = i-h[i];
  }
  sort(all(a));
  sort(all(b));
  ll ans = 0;
  rep(i,n) {
    auto mn = lower_bound(all(b), a[i]);
    auto mx = upper_bound(all(b), a[i]);
    if(mn == b.end()) continue;
    else ans += (mx - mn);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5572
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> s(H, vector<char>(W));
  rep(i, H) {
    rep(j, W) {
      cin >> s[i][j];
    }
  }

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


  vector<vector<int>> dp(H, vector<int>(W, INF));
  dp[0][0] = (s[0][0] == '#');
  rep(i, H) {
    rep(j, W) {
      rep(d, 2) {
        int ni = i + di[d];
        int nj = j + dj[d];
        if (ni == H || nj == W)
          continue;
        chmin(dp[ni][nj], dp[i][j] + (s[i][j] == '.' && s[ni][nj] == '#'));
      }
    }
  }
  cout << dp[H - 1][W - 1] << endl;
}

Measured memory_bytes: 384
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <functional>
#include <set>

using namespace std;

int main()
{
	int n;
	int k;
	cin >> n >> k;
	int x = 1;
	for (int i = 0; i < n; ++i) {
		x = min(2 * x, x + k);
	}
	cout << x << endl;

}

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

#define ll long long
ll MOD = 998244353;

using namespace std;

int main() {
    int m, d;
    cin >> m >> d;
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 22; j <= d; j++) {
            if (j % 10 >= 2 && (j % 10) * (j / 10) == i) ans++;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n;
    char s[max];
    
    scanf("%d%s", &n, s);
    
    rep(i, strlen(s)){
        if (s[i]-64+n>26) {
            printf("%c", s[i]+n-26);
        } else {
            printf("%c", s[i]+n);
        }
    }
    
    return 0;
}


Measured memory_bytes: 1668
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC114B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            int length = S.Length;
            int min = int.MaxValue;
            for (int i = 0; i < length - 2; i++)
            {
                int a = int.Parse(S[i].ToString());
                int b = int.Parse(S[i + 1].ToString());
                int c = int.Parse(S[i + 2].ToString());
                int num = a * 100 + b * 10 + c;
                int div = Math.Abs(num - 753);
                min = Math.Min(div, min);
            }
            Console.WriteLine(min);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11220
<?php

fscanf(STDIN, "%d %d", $n, $q);
$G = array_fill(0, $n, []);
for ($i = 0; $i < $n - 1; ++$i) {
    fscanf(STDIN, "%d %d", $a, $b);
    --$a;
    --$b;
    $G[$a][] = $b;
    $G[$b][] = $a;
}
$ans = array_fill(0, $n, 0);
for ($i = 0; $i < $q; ++$i) {
    fscanf(STDIN, "%d %d", $a, $b);
    --$a;
    $ans[$a] += $b;
}

function dfs($v, $p = -1) {
    global $G;
    global $ans;

    foreach ($G[$v] as $next_v) {
        if ($next_v == $p) continue;
        $ans[$next_v] += $ans[$v];
        dfs($next_v, $v);
    }
}

dfs(0);

echo implode(' ', $ans);


Measured memory_bytes: 154104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;
    
int main(){
    int n,sum=0;
    cin>>n;
    vector<int> t(n);
    rep(i,n){
        cin>>t[i];
        sum += t[i];
    }
    int total = sum;
    int m;
    cin>>m;
    vector<int> p(m),x(m);
    rep(j,m){
        cin>>p[j]>>x[j];
    }
    
    rep(i,m){
        sum = sum - t[(p[i]-1)] + x[i];
        cout<<sum<<endl;
        sum = total;
    }
    return 0;
}

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  int N;
  cin >> N;
  vector<int> V(510000,0);
  rep(i,N){
    int A;
    cin >> A;
    V[A]++;
  }
  
  int sum = 0;
  
  bool x = true;

  if(N%2==1){
    if(V[0]!=1) x = false;
    
    for(int i = 1;i<=N/2; i++){
      if(V[2*i]!= 2) x = false;
    }
  }
  else{
    for(int i = 0;i<= N/2-1;i++){
      if(V[2*i+1]!=2) x = false;
    }
  }
  
  long long ans = 1;
  if(x){
    rep(i, N/2){
      ans *=2;
      ans %= 1000000007;
    }
     cout << ans << endl;
  }
  else{
    cout << 0 << endl;
  } 
}
      
       





      
       







Measured memory_bytes: 5352
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

signed main() {
    //宣言
    int x;
    cin >> x;
    bool flag = true;
    int sum = 100,count=0;
    while (flag) {
        sum += sum/100;
        ++count;
        if (sum >= x) {
            flag = false;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3588
private fun solve() {
    println(readLine()!!.toInt().let { it / 2 + it % 2 })
}

fun main(args: Array<out String>) = solve()
private fun readAtOnce(): List<String> = readLine()!!.split(" ")
private fun readInts(): List<Int> = readAtOnce().map(String::toInt)
private fun readLongs(): List<Long> = readAtOnce().map(String::toLong)
private fun zeroArray(size: Int): IntArray = IntArray(size) { 0 }
private fun Int.repeat(predicate: (Int) -> Unit) = repeat(this, predicate)

Measured memory_bytes: 33392