akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int t = scn.nextInt();

        int h = t/3600;

        int m = (t-(h*3600))/60;

        int s = t%60;

        System.out.println(h+":"+m+":"+s);

        scn.close();
    }
}



Measured memory_bytes: 26388
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {



  int x,t;
  cin >> x >> t;
  cout << ((x - t) > 0 ?  x - t : 0);

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)
	ans := 0
	for x >= 500 {
		x -= 500
		ans += 1000
	}
	for x >= 5 {
		x -= 5
		ans += 5
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;

int main() {

    int s;
    cin >> s;

    set<int> S;
    S.insert(s);

    bool res = true;
    
    while (res) {

        if (s % 2 == 0) {
            s /= 2;
        } else {
            s = 3 * s + 1;
        }

        if (S.find(s) == S.end()) {
            S.insert(s);
        } else {
            res = false;
        }
    }

    cout << S.size() + 1 << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef long long llong;

char s[111];
int k;
int n;

int main()
{
    int i,j;
    llong ans = 0;

    scanf("%s",s+1);
    n = strlen(s+1);
    scanf("%d",&k);

    if (n == 1)
    {
        printf("%d\n",k/2);
        return 0;
    }

    int normal = 0;
    bool normal_droplast = false;
    for (i=2;i<=n;i++)
    {
        if (s[i] == s[i-1])
        {
            if (i == n)
                normal_droplast = true;

            normal++;
            i++;
        }
    }

    int first = 1;
    bool first_droplast = false;
    for (i=3;i<=n;i++)
    {
        if (s[i] == s[i-1])
        {
            if (i == n)
                first_droplast = true;

            first++;
            i++;
        }
    }

    if (s[1] != s[n] || normal_droplast)
    {
        ans = (llong)normal * (llong)k;
    }
    else
    {
        if (!first_droplast)
        {
            ans = (llong)normal + (llong)(k-1) * (llong)first;
        }
        else
        {
            ans = (llong)(k/2) * (llong)(first + normal);
            if (k % 2 == 1)
                ans += (llong)normal;
        }
    }

    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		System.out.println((int) Math.ceil((double) n / (2 * d + 1)));

	}

}


Measured memory_bytes: 22612
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  int a, b, c; cin >> a >> b >> c;
  if(a == b) cout << c << endl;
  else if(a == c) cout << b << endl;
  else cout << a << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
s = input()
s_list = []
alphabet_list = [chr(i) for i in range(97, 123)]
count = 0
exit = 0

for i in s:
    s_list.append(i)

for j in range(len(alphabet_list)):
    alphabet = alphabet_list[j]
    count = 0
    for k in range(len(s_list)):
        if alphabet == s[k]:
            count += 1
    if count == 0:
        print(alphabet)
        break
    else:
        exit += 1

if exit == len(alphabet_list):
    print("None")


Measured memory_bytes: 4016
#include<bits/stdc++.h>
using namespace std;
bool vis[101010];
int n,m;
int main()
{
	cin>>n>>m;
	if(n%2==1)
	{
		for(int i=1;i<=m;i++)
		{
			cout<<i<<' '<<n-i+1<<endl;
		}
	}
	else
	{
		for(int i=1;i<=n/4;i++)
		{
			if(i==m+1)
			{
				break;
			}
			cout<<i<<' '<<n-i+1<<endl;
		}
		for(int i=n/4+1;i<=m;i++)
		{
			cout<<i<<' '<<n-i<<endl;
		}
	}
	return 0;
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

int a[1000009];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    string s;
    cin >> s;
    rep(i, s.size()) a[i + 1] = s[i] - '0';

    int ans = 0;
    for(int i = s.size(); i; i--) {
        if(a[i] > 5) {
            ans += 10 - a[i];
            a[i - 1]++;
            a[i] = 0;
        }
        if(a[i - 1] >= 5 && a[i] == 5) {
            ans += 5;
            a[i - 1]++;
            a[i] = 0;
        }
    }
    rep(i, s.size() + 1) { ans += a[i]; }
    cout << ans << endl;
}

Measured memory_bytes: 5276
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	n <- readInt
	as <- readInts
	putStrLn $ if ( length . group . sort ) as == n
		then "YES"
		else "NO"

Measured memory_bytes: 31100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string S,T,p;
    int a,b;
    cin>>S>>T;
    cin>>a>>b;
    cin>>p;
    if(p==S)
    {
        a=a-1;
    }
    else{
        if(p==T)
        {
            b=b-1;
        }
        //cout<<a<<b;
    }
    cout<<a<<" "<<b;
    return 0;
}


Measured memory_bytes: 256
def main():
    n, k, q = [int(x) for x in input().split()]

    ok = [0] * n

    for _ in range(q):
        a = int(input()) - 1
        ok[a] += 1
    
    for p in ok:
        print("Yes" if k - q + p > 0 else "No")

main()


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll n,k;
    cin>>n>>k;
    vec<ll> h(n);
    REP(i,n) cin>>h[i];

    sort(all(h));
    ll ans=INF;
    REP(i,n){
        if(i+k-1>=n) break;
        chmin(ans,h[i+k-1]-h[i]);
    }
    cout<<ans<<en;
}

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

    solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;


int main() {
  int K,ans = 0;
  int a = 0;
  cin >> K;
  
  for(int i = 1; i <= K; i++){
    for(int j = 1; j <= K; j++){
      for(int k = 1; k <= K; k++){
        a = gcd(i,j);
       
        ans += gcd(a,k); 
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;

int main(void){
    // Your code here!
    long long n, k, count = 0;
    
    cin >> n >> k;
    for(long long i = k + 1; i <= n; i++){
         count += (n / i) * (i - k);
         if(n % i != 0){
            if(k == 0)
                count += max((n % i) - k, (long long)0);
            else
                count += max((n % i) - k + 1, (long long)0);
         }
    }
    
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e20;

signed main(){
    int A,B;cin>>A>>B;
  	cout<<A+B/2<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int A, B, C, D; std::cin >> A >> B >> C >> D;
  if ( A+B == C+D ) std::cout << "Balanced" << std::endl;
  else if ( A+B < C+D ) std::cout << "Right" << std::endl;
  else std::cout << "Left" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='1')cout<<'9';
    else if(s[i]=='9')cout<<'1';
    else cout<<s[i];
  }
}

Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<queue>
using namespace std;
int main(){
	int r, c, t;
	int *sh;

	cin >> r >> c;

	sh = new int[(r + 1)*(c + 1)];

	for (int i = 0; i < (r+1)*(c+1); ++i)
		sh[i] = 0;

	for (int i = 0; i < r; ++i){
		for (int j = 0; j < c; ++j){
			cin >> t;
			sh[j + i*(c+1) ] = t;
			sh[c + i*(c + 1)] += t;
		}
	}
	
	for (int i = 0; i < c+1; ++i)
		for (int j = 0; j < r; ++j)
			sh[i + r*(c + 1)] += sh[i + j*(c+1) ];
		
	for (int i = 0; i < r+1; ++i){
		for (int j = 0; j < c+1; ++j){
			cout << sh[j + i*(c + 1)];
			if(j<c)cout << " ";
		}
		cout << endl;
	}

	delete[]sh;

}

Measured memory_bytes: 1232
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace abc119c
{
    class Program
    {
        private Dictionary<string, int> cache = new Dictionary<string, int>();

        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().Solve();
        }

        void Solve()
        {
            var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var numBamboos = temp[0];
            List<int> requests = new List<int> { temp[1], temp[2], temp[3] };
            var materials = new List<int>();

            for (int i = 0; i < numBamboos; i++)
            {
                materials.Add(int.Parse(Console.ReadLine()));
            }

            Console.Error.WriteLine(string.Join(",", requests));
            Console.Error.WriteLine(string.Join(",", materials));

            Console.WriteLine(Craft(materials, requests));
        }

        int Craft(List<int> materials, List<int> requests)
        {
            if (cache.ContainsKey(string.Join(",", materials) + ":" + string.Join(",", requests)))
            {
                return cache[string.Join(",", materials) + ":" + string.Join(",", requests)];
            }

            if (requests.Count == 0) return 0;
            if (materials.Count == 0) return 1000000000;

            var min = int.MaxValue;
            var request = requests.First();

            foreach (int material in materials)
            {
                // 1本選んで使う
                var m = new List<int>(materials);
                var r = new List<int>(requests);
                m.Remove(material);
                r.Remove(request);
                var mp = Math.Abs(material - request) + Craft(m, r);

                if (mp < min)
                {
                    min = mp;
                }

                // 1本選んで次の竹と合成して使う
                if (requests.Count < materials.Count)
                {
                    m = new List<int>(materials);
                    r = new List<int>(requests);
                    m.Remove(material);
                    r.Remove(request);
                    r.Insert(0, request - material);
                    mp = 10 + Craft(m, r);

                    if (mp < min)
                    {
                        min = mp;
                    }

                    // 選ばない
                    m = new List<int>(materials);
                    r = new List<int>(requests);
                    m.Remove(material);
                    mp = Craft(m, r);

                    if (mp < min)
                    {
                        min = mp;
                    }
                }

                if (min == 0)
                {
                    break;
                }
            }

            cache.Add(string.Join(",", materials) + ":" + string.Join(",", requests), min);
            return min;
        }
    }
}


Measured memory_bytes: 21156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll x;
    cin >> x;

    vector<ll> a;
    for (ll i = 0;; i++) {
        ll t = i * i * i * i * i;
        if (i > 0 && t - a.back() > x) break;
        a.push_back(t);
    }
    int n = a.size();

    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            if (a[i] + a[j] == x) {
                cout << i << ' ' << -j << endl;
                exit(0);
            }
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            if (a[i] - a[j] == x) {
                cout << i << ' ' << j << endl;
                exit(0);
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 100020
#define MOD 998244353
using namespace std;

int a[N], c[N];

int Power(int x, int y)
{
    int o;

    for(o = 1; y; y >>= 1)
    {
        if(y & 1)
            o = (long long)o * x % MOD;
        x = (long long)x * x % MOD;
    }

    return o;
}

int main(void)
{
    int n;
    int i, o;

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

    if(c[0] != 1 || a[0])
        printf("0\n");
    else
    {
        for(i = o = 1; i < n; i ++)
            o = (long long)o * Power(c[i - 1], c[i]) % MOD;
        printf("%d\n", o);
    }

    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = Integer.parseInt(sc.next());
	int max = 0;
	int cnt = 0;
	for(int i = 0; i<N; i++) {
	    int yama = Integer.parseInt(sc.next());
	    if(max>yama) continue;
	    cnt++;
	    max = yama;
	}
	System.out.println(cnt);
    }
}

Measured memory_bytes: 21844
n = int(input())
T = tuple(map(int, input().split()))
A = tuple(map(int, input().split()))
mod = 10**9+7

mt = T[-1]
ma = A[0]
if mt != ma:
    print(0)
else:
    ans = 1
    for i in range(1, n-1):
        if T[i-1] == T[i] and A[i] == A[i+1]:
            ans *= min(T[i], A[i])
            ans %= mod
        if T[i] == A[i] and (T[i] != mt or A[i] != ma):
            print(0)
            break
        if ((T[i] > T[i-1] and T[i] > A[i]) or
            (A[i] > A[i+1] and T[i] < A[i])):
            print(0)
            break
    else:
        print(ans)


Measured memory_bytes: 25516
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
    int n, q, k,tmp;
    int a[100005] = { 0 };

    cin >> n >> k>> q;
    for (int i = 0; i < q; i++) {
        cin >> tmp;
        a[tmp]++;
    }

    for (int i = 1; i <= n; i++) {
        if (a[i] + (k - q) > 0) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 1024
n,q = gets.chomp.split(' ').map(&:to_i)
str = gets.chomp
lrs = []
q.times do
  lrs << gets.chomp.split(' ').map(&:to_i)
end
array = []
str.size.times do |i|
  if (i == 0)
    array << 0
    next
  end
  if (str[i-1] == 'A' && str[i] == 'C')
    array << array[i-1]+1
  else
    array << array[i-1]
  end
end

lrs.each do |lr|
  l = lr[0]-1
  r = lr[1]-1
  puts array[r] - array[l]
end

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

int main(){
	int N, L, i, sumL = 0, maxL = 0;
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		scanf("%d", &L);
		sumL += L;
		maxL = max(maxL, L);
	}
	if(2 * maxL < sumL){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string S;
    cin>>S;
    int a=999;
    rep(i,S.size()-2) {
        int n=(S.at(i)-'0')*100+(S.at(i+1)-'0')*10+(S.at(i+2)-'0');
        int diff=abs(n-753);
        a=min(a,diff);
    }
    cout<<a<<endl;
}

Measured memory_bytes: 256
dishes = [input() for i in range(5)]

sum_time = 0
last_order_surplus = 10

for dish in dishes:
  if last_order_surplus > int(dish) % 10 & int(dish) % 10 != 0:
    last_order_surplus = int(dish) % 10
  if int(dish) % 10 != 0:
    sum_time += int(int(dish) / 10 + 1)
  else:
    sum_time += int(int(dish) / 10)

print (sum_time * 10 + last_order_surplus - 10)

Measured memory_bytes: 3060
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    itv = []
    for i in range(n):
        x, l = map(int, input().split())
        itv.append((x+l, x-l))
    itv.sort()
    r = - 10 ** 12
    cnt = 0
    for x in itv:
        if r <= x[1]:
            cnt += 1
            r = x[0]
    
    print(cnt)

    
    
if __name__ == '__main__':
    main()

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

#define int long long 
#define dou double 
#define endl "\n"

const int MOD=1e9+7;

void solve()
{
	int n,k,x;
	cin >> n;
	//int a[n+1],b[n+1];
	int sum=0;
	int comfort=0;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++)
		cin >> a[i];
	sort(a.begin(), a.end()); 
	reverse(a.begin(), a.end());
	b.push_back(a[0]);
	comfort=comfort+a[0];
	//cout << comfort << '\n';
	//b.push_back(a[1]);
	int itr=1;
	for(int i=1;i<n-1;i++){
		comfort=comfort+a[itr];
		if(i%2==0)
			itr++;
	}
	cout << comfort << endl;

}

main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	return 0;
}


Measured memory_bytes: 7908
/*
      بسم اللہ الرحمن الرحیم
    Bismillahir Rahmanir Raheem.
    In the name of Allah, Most Gracious, Most Merciful.
*/
/*
    Masum
    RUET
    CSE-19
    #1903086
    NDC
    #11901058
*/

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

#define int long long
#define ld long double
/*****************************************************************/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<","<<p.second<<"}";
}

/*________________________________________________________________*/

void sol();
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    /* Test cases */
    bool isT = 0;
    if (isT) {
        int t;
        cin >> t;
        while (t--)
            sol();
    } else
        sol();
    return 0;
}
void sol() {
    /* Remember about test cases --> exits or not */
    
    int n; cin>>n;
    if( n%1000 == 0){
    cout<< 0 <<'\n';
    return;
    }
    int x = n/1000;
    x++;
    int y = x*1000 - n;
    cout<< y <<"\n";
}
//   ****Self_Motivation:****
//  i) First think, then code.
//  ii) Do not jump between problems:)


Measured memory_bytes: 3656
/*
 *  * main.cpp
 *   *
 *    */

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

int t;
int n;
double res;
vector<pair<int, int>> E;
int main() {
    int n;
    scanf("%d", &n);
    
    
    for (int i = 0; i < n; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        E.push_back({a + b, b});
    }
    sort(E.begin(), E.end());

    int m = 0;
    int largerThan = -0x7fffffff;

    for (int i = 0; i < E.size(); ++i) {
        if (E[i].first - 2 * E[i].second >= largerThan) m++, largerThan = E[i].first;
    }




    printf("%d\n", m);

	return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<algorithm>
int main()
{
	int n=0,k=0,num=1;
	std::cin >> n>>k;
	for(int i=0;i<n;i++)
	{
		if (k > num) {
			num += num;
	     }
		else {
			num += k;
		}
	}
	std::cout << num << std::endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "YES";
    private static final String NO = "NO";

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

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        int[] ans = solve(N, A);
        for (int i=0; i<N; i++) {
            System.out.println(ans[i]);
        }
    }

    private static int[] solve(int N, int[] A) {
        int[] ans = new int[N];

        int max =  Math.max(A[0], A[1]);
        int max2 = Math.min(A[0], A[1]);

        for (int i=2; i<N; i++) {
            if (A[i] >= max) {
                max2 = max;
                max = A[i];
            } else if (A[i] >= max2) {
                max2 = A[i];
            }
        }

        for (int i=0; i<N; i++) {
            if (A[i] == max) {
                ans[i] = max2;
            } else {
                ans[i] = max;
            }
        }

        return ans;
    }
}

Measured memory_bytes: 87176
fun main(args: Array<String>) {
    val l = readLine()!!.split(' ').map { it.toInt() }
    val accepted: MutableSet<Int> = mutableSetOf()
    var wrongAns: IntArray = IntArray(l[0]) { 0 }
    var penaltySum = 0
    for (i in 0 until l[1]) {
        val tmp = readLine()!!.split(' ')
        val problemNum = tmp[0].toInt()-1
        if (tmp[1] == "AC") {
            if (accepted.add(problemNum)) penaltySum += wrongAns[problemNum]
        } else {
            if (!accepted.contains(problemNum)) {
                wrongAns[problemNum]++
            }
        }
    }
    println("${accepted.size} $penaltySum")
}


Measured memory_bytes: 58420
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

n, m, c = mi()
b = li()
ans = 0
for i in range(n):
    a = li()
    p = sum(x * y for x, y in zip(a, b))
    ans += p + c > 0
print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;

  int count = 0;
  for(int i = 0; i < N; i++) {
    if(S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
      ++count;
    }
  }

  cout << count;

  return 0;
}

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

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

	const int p = 101;
	vector<int> num(p);

	vector<int> d(n); for (int i = 0; i < n; i++) {
		cin >> d[i];
		num[d[i]]++;
	}

	int ans = 0;

	for (int i = 0; i < p; i++) {
		if (0 < num[i]) ans++;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
 
using namespace std;
 
int main() {
    int a[5], k;
    scanf("%d%d%d%d%d%d", a, a + 1, a + 2, a + 3, a + 4, &k);
    sort(a, a + 5);
    puts(a[4] - a[0] <= k ? "Yay!" : ":(");  
    return 0;
}

Measured memory_bytes: 128
import copy


def search(start, adj, stack):
    nextNum = 0
    start[1][start[0]] = 1
    for i in range(len(adj[start[0]])):
        # print("start:{} next:{} vidited:{}".format(start, i, visited))
        if adj[start[0]][i] == 1 and start[1][i] == -1:
            stack.append([i, copy.deepcopy(start[1])])
            # print("append")
            nextNum += 1
            # print("visit to {}".format(next))
            # visited[i] = 1
    if nextNum > 0:
        return nextNum
    elif sum(start[1]) == len(adj):
        return 0
    else:
        return -1


n, m = [int(i) for i in input().split()]
adj = [[0 for j in range(n)] for i in range(n)]  # 隣接行列
for j in range(m):
    a, b = [int(i) - 1 for i in input().split()]
    adj[a][b] = 1
    adj[b][a] = 1

visited = [-1 for i in range(n)]
visited[0] = 1
stack = [[0, visited]]
poped = []
count = 0
while 1:
    size = len(stack)
    # print("\nstack:{}".format(stack))
    if size == 0:
        # print("visited:{}".format(visited))
        break
    next = stack.pop()
    # print("stack:{}".format(stack))
    # if len(stack) != 0:
    # poped.append(next)
    # print("poped:{}".format(poped))
    nextNum = search(next, adj, stack)
    if nextNum == 0:
        count += 1
        # print("ok")
    # elif nextNum == -1:
        # print("missed")
print(count)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n;
    cin >> n;
    vint d(n);
    REP(i, n) { cin >> d[i]; }
    sort(d.begin(), d.end());
    int k;
    k = d[n / 2] - d[n / 2 - 1];
    cout << k << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if(par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool issame(int x, int y) { return root(x) == root(y); }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y)
            return false;
        if(par[x] > par[y])
            swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) { return -par[root(x)]; }
};

int main() {
    long long N;
    cin >> N;
    vector<long long> x(N), y(N);
    rep(i, 0, N) { cin >> x[i] >> y[i]; }
    long long MAX = 110000;
    UnionFind uf(MAX * 2);
    rep(i, 0, N) { uf.merge(x[i], (MAX + y[i])); }
    map<int, long long> mx, my;
    rep(i, 0, MAX) { mx[uf.root(i)]++; }
    rep(i, MAX, MAX * 2) { my[uf.root(i)]++; }
    long long res = 0;
    rep(i, 0, MAX * 2) { res += mx[i] * my[i]; }
    cout << res - N << endl;
}

Measured memory_bytes: 30208
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=100*1007;
const ll mod=1000*1000*1000+7;

int n;
char wcz[nax];

int d;

ll row[nax][107];
ll mnie[nax][107];

void dod(ll &a, ll b)
{
	a=(a+b)%mod;
}

int main()
{
	scanf("%s", wcz+1);
	n=strlen(wcz+1);
	scanf("%d", &d);
	row[0][0]=1;
	for (int i=1; i<=n; i++)
	{
		int x=(wcz[i]-'0');
		for (int j=0; j<d; j++)
		{
			for (int l=0; l<10; l++)
			{
				if (l<x)
				{
					dod(mnie[i][(j+l)%d], row[i-1][j]);
				}
				if (l==x)
				{
					dod(row[i][(j+l)%d], row[i-1][j]);
				}
				dod(mnie[i][(j+l)%d], mnie[i-1][j]);
			}
		}
	}
	printf("%lld\n", (row[n][0]+mnie[n][0]-1+mod)%mod);
	return 0;
}


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

template <typename Monoid>
struct LazySegmentTree{
private:
    int N;
    vector<Monoid> node, lazy;

public:
    LazySegmentTree(int sz = 0){
        init(sz);
    }
    void init(int sz){
        N = 1;
        while(N < sz) N <<= 1;
        node.resize(2*N-1,0);
        lazy.resize(2*N-1,0);

    }
    void build(vector<Monoid>& v){
        int sz = int(v.size());
        init(sz);
        for(int i=0; i<sz; i++){
            node[i+N-1] = v[i];
        }
        for(int i=N-2; i>=0; i--){
            node[i] = node[i*2+1] + node[i*2+2];
        }
    }
    // node[k]
    void eval(int k){
        if(lazy[k] != 0){
            node[k] += lazy[k];
            if(k < N-1){ // 最下段でないとき
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }
    // [a,b)
    void add(int a, int b, Monoid x){add(a, b, x, 0, 0, N);}
    void add(int a, int b, Monoid x, int k, int l, int r){
        eval(k);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b){
            lazy[k] += x * (r-l);
        }
        else{
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }
    // [a,b)
    Monoid getSum(int a, int b){return getSum(a, b, 0, 0, N);}
    Monoid getSum(int a, int b, int k, int l, int r){
        if(b <= l || r <= a) return 0;
        
        eval(k);
        if(a <= l && r <= b) return node[k];
        Monoid vl, vr;
        vl = getSum(a, b, 2*k+1, l, (l+r)/2);
        vr = getSum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    LazySegmentTree<ll> seg(n);
    for(int i=0;i<q;i++){
        int c;
        cin >> c;
        if(c == 0){
            ll s, t, x;
            cin >> s >> t >> x;
            seg.add(s-1,t,x);
        }
        else{
            int s;
            cin >> s;
            cout << seg.getSum(s-1,s) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 7072
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
//#define at(x,i) get<i>(x);//
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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(){
    ll n;cin >> n;
    vvl g(n);
    vpl edge(n-1);
    rep(i,n-1){
        ll a,b;cin >> a >>b;a--;b--;
        g[b].pb(a);g[a].pb(b);
        edge[i].fi=a;edge[i].se=b;
    }
    ll tmp=0;
    rep(i,n)chmax(tmp,(ll)g[i].size());
    cout << tmp <<endl;
    map<pl,ll> m;
    vvl color(n);
    queue<ll> que;
    que.push(0);
    vl seen(n,0);
    seen[0]=1;
    while(!que.empty()){
        ll v=que.front();
        que.pop();
        ll c=1;
        for(auto nv:g[v]){
            if(seen[nv])continue;
            while(find(all(color[v]),c)!=color[v].end()){
                c++;
            }
            color[v].pb(c);
            color[nv].pb(c);
            m[mp(v,nv)]=c;
            m[mp(nv,v)]=c;
            que.push(nv);
            seen[nv]=1;
        }
    }
    for(auto e:edge)cout << m[e] <<endl;
}

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

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

    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> wn(n, 0);
    for(int i = 0; i < n; i++){
        if(s[i] == 'W') wn[i]++;
    }

    // wn[i] iまで西を向いている人数（iを含める）
    for(int i = 1; i < n; i++){
        wn[i] += wn[i - 1];
    }

    int ans = 1e9;
    for(int i = 0; i < n; i++){
        int left = (i > 0 ? wn[i - 1] : 0);
        int right = n - i - 1 - (wn[n - 1] - wn[i]);
        ans = min(ans, left + right);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1812
from math import sqrt
from collections import Counter

def primes(N):
    is_prime = [True]*(N+1)
    is_prime[0] = False
    is_prime[1] = False
    D = [0]*(N+1)
    for n in range(2, int(sqrt(N)+1)):
        if is_prime[n]:
            D[n] = n
            j = n+n
            while j <= N:
                is_prime[j] = False
                D[j] = n
                j+=n
    for n in range(int(sqrt(N)), N+1):
        if is_prime[n]:
            D[n] = n
                
    return is_prime, D

def solve(N):
    is_prime, D = primes(N)
    total = 0
    for c in range(1, N-1):
        if is_prime[N-c] and False:
            total += 2
            continue

        C = Counter()
        x = N-c
        while x >= 2:
            d = D[x]
            C[d] += 1
            x //= d
        a = 1
        for k, v in C.items():
            a *= (v+1)
        #print(f"{N=} {c=}, {a=}, {C=}")
        total += a
    # c = N-1
    total += 1
    return total

N = int(input())
print(solve(N))

Measured memory_bytes: 84804
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var num = Input.num;
        var ar = Enumerable.Repeat(0, num).Select(v => Input.num).ToArray();
        var res = 0L;
        for (var i = 0; i < num - 1; i++)
        {
            res += ar[i] / 2;
            ar[i] %= 2;
            if (ar[i] == 1 && ar[i + 1] != 0)
            {
                res++;
                ar[i + 1]--;
            }
        }
        WriteLine(res + ar[num - 1] / 2);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  
static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 17444
#include <stdio.h>

int main(void){
  long long n,m,tmp;

  scanf("%lld%lld",&n,&m);
  if(n>m){
    tmp=n;
    n=m;
    m=tmp;

  }

  if(n==1&&m==1){
    printf("1");
    return 0;
  }
   if(n==1&&m!=1) printf("%lld",m-2);
   else printf("%lld",(m-2)*(n-2));

  return 0;
}


Measured memory_bytes: 1680
#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>;

int main(){
   int n; cin>>n;
   vector<int> v(n);
   rep(i,n) cin>>v[i];
   sort(v.begin(),v.end());
   double ans=v[0];
   for(int i=1;i<n;i++) ans=(ans+v[i])/2;
   printf("%.10f\n",ans);
   return 0;
}

   


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

const int INF = 1e9+7;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
	int n,m,x;
	cin >> n >> m >> x;
	vector<int> a(m);
	rep(i, m) cin >> a.at(i);
	vector<bool> cost(n+1);
	rep(i, m) cost.at(a.at(i)) = true;

	int left=0;
	rep(i, x){
		if(cost.at(i)) left++;
	}
	int right=0;
	for(int i=x; i<n+1; i++){
		if(cost.at(i)) right++;
	}
	cout << min(left, right) << endl;

}

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

int main()
{

    int N;
    vector<int> W;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int temp;
        cin >> temp;
        W.push_back(temp);
    }

    int sum = accumulate(W.begin(), W.end(), 0);
    int half = 0;
    int i, mini = sum;
    for (i = 0; i < N; i++)
    {
        half += W[i];
        mini = min(mini, abs(half - (sum - half)));
    }

    cout << mini;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

string s[110];
int sum[110];

int main(){

    int n, l;
    cin >> n >> l;

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

    for(int i=0; i<n; i++){
        for(int j=1; j<n; j++){
            if(strcmp(s[j-1].c_str(), s[j].c_str()) > 0) swap(s[j-1], s[j]);
        }
    }


    for(int j=0; j<n; j++){
        cout << s[j];
    }

    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
main(){
int n,i,A,B,C,f;
for(std::cin>>n;n-->0;puts(f?"NO":"YES"))
 for(B=C=f=i=0;i++<10;){
  std::cin>>A;
  if(B<A)B=A;else C<A?C=A:f=1;
 }
}

Measured memory_bytes: 0
s=input()
if s=='SUN':
  print(7)
elif s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
else:
  print(1)

Measured memory_bytes: 38384
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn calc_dicstance(graph: &Vec<Vec<(usize, usize)>>, distances: &mut Vec<usize>, cur_v: usize){
    for next in &graph[cur_v]{
        let (next_v, cost) = (next.0, next.1);
        if distances[next_v] != std::usize::MAX{
            continue;
        }
        distances[next_v] = cost + distances[cur_v];
        calc_dicstance(graph, distances, next_v);
    }
}

fn main(){
    let n: usize = read_as_vec()[0];
    let dummy = std::usize::MAX;
    let mut graph: Vec<Vec<(usize, usize)>> = vec![vec![];n];
    for _ in 0..n-1{
        let line = read_as_vec::<usize>();
        let (a, b, c) = (line[0]-1, line[1]-1, line[2]);
        graph[a].push((b, c));
        graph[b].push((a, c));
    }
    let line = read_as_vec::<usize>();
    let (q, k) = (line[0], line[1]-1);

    let mut distances: Vec<usize> = vec![dummy;n];
    distances[k] = 0;
    calc_dicstance(&graph, &mut distances, k);

    for _ in 0..q{
        let line = read_as_vec::<usize>();
        let (x, y) = (line[0]-1, line[1]-1);
        println!("{}", distances[x]+distances[y]);
    }
}


Measured memory_bytes: 20732
#include <stdio.h>

int main(){
    long long int n, a[5], i, min, ans;

    scanf("%lld %lld", &n, &a[0]);

    min = a[0];
    for(i=1; i<5; i++){
        scanf("%lld", &a[i]);
        if(min > a[i])
            min = a[i];
    }

    ans = n / min + 4;
    if(n % min != 0)
        ans++;
    
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 128
using System;

namespace abc105_c
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            if (n == 0) Console.WriteLine(0);
            string ret = "";
            long zerostart = 0; long zerolen = 1; bool plusdight = true;
            while (!(zerostart <= n && n <= zerostart + zerolen))
            {
                ret = ((((n - zerostart) % (zerolen * 2)) + zerolen * 2) % (zerolen * 2) < zerolen ? "0" : "1") + ret;
                if (!plusdight) zerostart -= zerolen;
                zerolen *= 2;
                plusdight = !plusdight;
            }
            Console.WriteLine(ret);
        }
    }
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;



int main(){
    int n;
    cin>>n;
    vint p(n);
    rep(i,n)cin>>p[i];
    int count=0;
    rep(i,n-2){
        if((p[i]<p[i+1] && p[i+1]<p[i+2]) || (p[i+2]<p[i+1] && p[i+1]<p[i])){
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define EREP(i,n) for(int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#define BEG cout<<"D::";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#define BEG {}
#endif
const int MOD = 1000000007;
const ll INF = 50000000000000000;

	ll A,B,C,N,M,H;
  ll ans;

int main(){
	cin>>A>>B;
  cout<<(A+B)%24;

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


Measured memory_bytes: 256