akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    map<int, int> mp;
    vector<ll> b;
    ll ans;
    rep(i, n) {
      int a;  cin >> a;
      mp[a]++;
    }
    for (auto const& entry: mp) {
      if (entry.second >= 4) {
        b.push_back(entry.first);
        b.push_back(entry.first);
      } else if (entry.second >= 2) {
        b.push_back(entry.first);
      }
    }
    b.push_back(0);
    sort(b.begin(), b.end(), greater<int>());
    ans = b[0] * b[1];
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 4992
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        int result = 0;
        if (n != 1) {
            Map<Integer, Integer> map = primeFactorizationMap(n);

            int[] count = new int[40];
            for (int i = 1; i < count.length; i++) {
                count[i] = count[i - 1] + i;
            }

            for (int key : map.keySet()) {
                int val = map.get(key);
                for (int i = 0; i < count.length; i++) {
                    if (val < count[i]) {
                        result += i - 1;
                        break;
                    }
                }
            }
        }

        // 出力
        System.out.println(result);

    }

    public static Map<Integer, Integer> primeFactorizationMap(long num) {
        Map<Integer, Integer> map = new HashMap<>();
        int max = (int) Math.sqrt(num);
        int div = 2;
        while (div <= max) {
            if (num % div == 0) {
                num /= div;
                if (map.containsKey(div)) {
                    map.put(div, map.get(div) + 1);
                } else {
                    map.put(div, 1);
                }
            } else {
                div++;
            }
        }
        if (num != 1) {
            map.put((int) num, 1);
        }
        return map;
    }
}


Measured memory_bytes: 37688
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto a = RD;
	auto b = RD;
	auto c = RD;
	auto d = RD;

	long ans = a * c;
	ans.chmax(a*d);
	ans.chmax(b*c);
	ans.chmax(b*d);

	writeln(ans);
	stdout.flush;
	debug readln;
}


Measured memory_bytes: 2760
#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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);

int main () {
  int n = in();
  for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= 9; ++j) {
      if (i*j == n) {
        puts("Yes");
        return 0;
      }
    }
  }
  dame;
  return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

// int main() {
//     cout << "2000 2000" << endl;
//     rep(r, 2000) {
//         rep(c, 2000) cout << ".";
//         cout << endl;
//     }
// }

pair<int, int> wrl[2020][2020], hud[2020][2020];

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H) cin >> S[i];

    rep(r, H) {
        int num1 = 0, num2 = 0;
        rep(c, W) {
            wrl[r][c].first = num1;
            if (S[r][c] == '#') {
                num1 = 0;
            }
            else {
                num1++;
            }

            int idx2 = W-c-1;
            wrl[r][idx2].second = num2;
            if (S[r][idx2] == '#') num2 = 0;
            else num2++;
        }
    }

    rep(c, W) {
        int num1 = 0, num2 = 0;
        rep(r, H) {
            hud[r][c].first = num1;
            if (S[r][c] == '#') {
                num1 = 0;
            }
            else {
                num1++;
            }

            int idx2 = H-r-1;
            hud[idx2][c].second = num2;
            if (S[idx2][c] == '#') num2 = 0;
            else num2++;
        }
    }

    int ans = 0;
    rep(r, H) rep(c, W) {
        if (S[r][c] != '#') {
            ans = max(ans, wrl[r][c].first+wrl[r][c].second+hud[r][c].first+hud[r][c].second+1);
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 70144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,m,sum;
    sum=0;
    cin >> n;
    int t[n];
    for(int i=0;i<n;i++){
     cin>>t[i];
     sum+=t[i];
    }
    cin>>m;
    int p[m],x[m],sa;
    for(int i=0;i<m;i++){
      cin>>p[i]>>x[i];
    }
    sa=0;
    for(int i=0;i<m;i++){
      sa=t[p[i]-1]-x[i];
      cout<<sum-sa<<endl;
    }
  return 0;
}


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

//INSERT ABOVE HERE
signed main(){
  Int n,h;
  cin>>n>>h;
  vector<Int> as(n),bs(n);
  for(Int i=0;i<n;i++) cin>>as[i]>>bs[i];

  Int uku=0;
  for(Int i=0;i<n;i++) chmax(uku,as[i]);

  priority_queue<Int> pq;
  for(Int i=0;i<n;i++){
    if(bs[i]>uku) pq.emplace(bs[i]);
  }

  Int ans=0;
  while(h>0&&!pq.empty()){
    h-=pq.top();pq.pop();
    ans++;
  }
  if(h>0) ans+=(h+uku-1)/uku;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2936
package main

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

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	input := bufio.NewReader(os.Stdin)

	var a, b int
	fmt.Fscanf(input, "%d %d\n", &a, &b)
	for k := 0; k < a || k < b; k++ {
		if abs(a-k) == abs(b-k) {
			fmt.Println(k)
			return
		}
	}
	fmt.Println("IMPOSSIBLE")
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

struct Rect {
    int w, h;
};

pair<Rect, Rect> cut(Rect r, int s) {
    int h = r.h, w = r.w;
    s %= 2 * (h + w);
    Rect r1, r2;
    if (s < w) {
        r1 = {s, h};
        r2 = {w - s, h};
    } else if (s < w + h) {
        s -= w;
        r1 = {w, s};
        r2 = {w, h - s};
    } else if (s < 2 * w + h) {
        s -= w + h;
        r1 = {s, h};
        r2 = {w - s, h};
    } else {
        s -= 2 * w + h;
        r1 = {w, s};
        r2 = {w, h - s};
    }
    return {r1, r2};
}

void solve() {
    int N, W, D;
    while(cin >> N >> W >> D, W) {
        vector<Rect> R;
        R.push_back({W, D});
        for (int i = 0; i < N; i++) {
            int p, s;
            cin >> p >> s;
            p--;
            pair<Rect, Rect> r = cut(R[p], s);
            R.erase(R.begin() + p);
            if (r.first.h * r.first.w < r.second.h * r.second.w) {
                R.push_back(r.first);
                R.push_back(r.second);
            } else {
                R.push_back(r.second);
                R.push_back(r.first);
            }
        }
        vector<int> S;
        for (int i = 0; i < R.size(); i++) {
            S.push_back(R[i].w * R[i].h);
        }
        sort(all(S));
        for (int i = 0; i < S.size(); i++) {
            cout << S[i];
            if (i != S.size() - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();

    #ifdef LOCAL_ENV
    assert(cin.rdstate() & ios_base::eofbit);
    #endif
}


Measured memory_bytes: 3180
import sys
import math
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

N,H =na()
a=[]
b=[]
for i in range(N):
    t = na()
    a.append(t[0])
    b.append(t[1])

#print(a,b)
m_a = max(a)
b.sort(reverse=True)
#print(b)
sum_b=0
b_i=0
if(m_a>b[-1]):
    for i in range(N):
        sum_b+=b[i]
        if(b[i]<=m_a):
            sum_b-=b[i]
            b_i=i
            break
else:
    b_i=N
    sum_b=sum(b)
#print(b[:b_i])
res=0
if(sum_b>=H):
    #print("upper")
    for i in range(b_i):
        res+=b[i]
        if(res>=H):
            print(i+1)
            exit()

else:
    ct=0
    #print("under",b_i)
    '''while(True):
        H-=m_a
        ct+=1
        if(sum_b>=H):
            print(ct+b_i)
            exit()
    '''
    H_resi = H-sum_b
    ct+=math.ceil(H_resi/m_a)
    print(ct+b_i)

Measured memory_bytes: 11380
s = gets.chomp.chars
if s.size == 2 && s.uniq.size == 1
  puts "1 2"
  exit
end
s.each_cons(3) do |c|
  if c.uniq.size < 3
    index = s.join.index(c.join)
    puts "#{index + 1} #{index + 3}"
    exit
  end
end
puts "-1 -1"


Measured memory_bytes: 11644
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();

        if(Character.isUpperCase(str.charAt(0))) {
            System.out.println("A");
        }else {
            System.out.println("a");
        }
    }
}

Measured memory_bytes: 35708
open System
open System.Collections
open System.Collections.Generic
open System.IO

[<EntryPoint>]
let main _ = 
    let N = Console.ReadLine() |> int
    let S = Console.ReadLine().Split() |> seq
    
    let ans =
        let cnt = S |> Seq.distinct |> Seq.length
        if  cnt = 3 then
            "Three"
        else 
            "Four"

    printfn "%s" ans
    
    0



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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

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

    ll c[3] = {};
    ll ans = 1;

    rep(i,N) {
        ll a;
        cin >> a;
        bool t = false;
        ll cnt = 0;
        rep(j,3) {
            if (c[j]==a && !t) {
                c[j]++;
                cnt++;
                t = true;
            }
            else if (c[j]==a) {
                cnt++;
            }
        }
        ans*=cnt;
        ans%=MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int K;
  cin >> N >> K;
  int sum = 0;
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    if(x <= K / 2) 
      sum += 2 * x;
    else
      sum += 2 * (K - x);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
// battle
#include <iostream>
using namespace std;

int main(void){

    int A, B, C, D;
    int turn = 1; // 0:高橋くんのターン, 1:  青木くんのターン
    scanf("%d %d %d %d", &A, &B, &C, &D);

    while(A > 0 && C > 0) {
        turn = 1 - turn; // ターンの入れ替えを行う
        if(turn == 0)
            C -= B; // 高橋くんが攻撃を行う
        else
            A -= D; // 青木くんが攻撃を行う
    }

    if(turn == 1){
        // 青木くんのターンでバトルが終わったので、青木くん勝利。
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	int A, B, K;
	cin >> A >> B >> K;

	vector<int> Num;
	for (int i = 1; i <= min(A, B); i++) {
		if (A % i == 0 && B % i == 0) {
			Num.push_back(i);
		}
	}

	reverse(Num.begin(), Num.end());

	cout << Num[K - 1] << endl;
}






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

string sNum;
int nNum[4];

int shori(int pos, string S, int Sum){
  
  
  if(pos == 3){
    
    if(Sum == 7){
      cout << S + sNum[pos] + "=7" << endl;
      return 0;
    }else{
      return 1;
    }
  }
  
  if(shori(pos + 1, S + sNum[pos] + "+", Sum + nNum[pos + 1]) == 0) return 0;
  if(shori(pos + 1, S + sNum[pos] + "-", Sum - nNum[pos + 1]) == 0) return 0;
}


int main(){
  
  cin >> sNum;
  for(int i = 0; i < 4; i++) nNum[i] = sNum[i] - '0';
  
  string _S = "";
  _S = _S + sNum[0];
  
  if(shori(1, _S + "+", nNum[0] + nNum[1]) == 0) return 0;
  shori(1, _S + "-", nNum[0] - nNum[1]);
  
  return 0;
}

Measured memory_bytes: 256
def rec(a):
    dp=[0]*len(a)
    for i in range(len(a)):
        if i==0:
            dp[i]=0
        elif i==1:
            dp[i]=abs(a[i]-a[i-1])
        else:
            dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2])
    return dp[len(a)-1]
n=int(input())
a=[int(i) for i in input().split()]
print(rec(a))

Measured memory_bytes: 13928
let to_list str =
  let rec doit i acc =
    if i < 0 then acc
    else doit (i - 1) (str.[i] :: acc) in
  doit (String.length str - 1) []

let calc_area lst =
  List.fold_left2
    (fun (is, acc) i x -> match x with
      | '_' -> (is, acc)
      | '\\' -> (i :: is, acc)
      | '/' ->
        begin match is with
        | [] -> ([], acc)
        | j :: tl -> (tl, ((j, i), i - j) :: acc)
        end
      | _ -> assert false)
    ([], [])
    (List.mapi (fun i _ -> i) lst)
    lst
  |> snd

let integrale lst =
  let rec doit acc = function
    | [] -> acc
    | [e] -> e :: acc
    | ((j1, i1), a1) as hd :: (((j2, i2), a2) :: l as tl) ->
      if j1 < j2 && i2 < i1 then doit acc (((j1, i1), a1 + a2) :: l)
      else doit (hd :: acc) tl in
  doit [] lst

let () =
  let areas = read_line () |> to_list |> calc_area |> integrale in
  List.fold_left (fun acc (_, n) -> acc + n) 0 areas |> Printf.printf "%d\n";
  print_int (List.length areas);
  List.iter (fun (_, n) -> print_string " "; print_int n) areas;
  print_newline ()

Measured memory_bytes: 6016
#include<iostream>
#include<cstdio>
#include<string> 

using namespace std;

string s;

int main()
{
    cin>>s;
    for(int i=0;i<s.size();i++){
    	if(s[i]=='1') cout<<9;
    	else cout<<1;
	}
    return 0;
}

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

int main() {
	int n;
	int p[10];
	int max = 0;
	int sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		if (p[i] > max) { max = p[i]; }
		sum += p[i];
	}

	sum -= max / 2;

	cout << sum << endl;	
}

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

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

    int counter = 0;
    int max = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if (S.at(i) == 'A' || S.at(i) == 'C' ||
            S.at(i) == 'G' || S.at(i) == 'T')
        {
            counter++;
        }
        else
        {
            counter = 0;
        }
        if (max < counter)
            max = counter;
    }
    cout << max << endl;

    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,X,tx=0,txx=0;
    double P;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> X;
        tx += X;
        txx += X*X;
    }
    P = 1.0 * tx / N ;
    
    int PP = round(P);

    int ans = N * pow(PP,2) - 2 * PP * tx + txx;

    cout << ans << endl;
}


Measured memory_bytes: 256
while(1):
    [b,r,g,c,s,t]=[int(x) for x in raw_input().split()]
    if t==0:
        break
    else:
        n=t-6*b-4*r-g-c-2*s
        m=100+b*(12+5*13)+r*(12+3*13)+g*4-c-3*(n+s)
        print m

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

int main() {
  int n;
  cin >> n;
  int64_t kokochi = 0LL;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  kokochi += a[0];
  if((n - 1) % 2 == 0) {//nが奇数、心地よさの加算はn-1人分(偶数人)
    for(int i = 1; i <= (n - 3) / 2; i++) kokochi += a[i] * 2LL;
    kokochi += a[(n-3)/2+1];
  }else {//nが偶数、心地よさの加算はn-1人分(奇数人)
    for(int i = 1; i <= (n - 1) / 2; i++) kokochi += a[i] * 2LL;
  }
  cout << kokochi;
}

Measured memory_bytes: 4040
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let n : i32 = get_one();
    println!("{}", (n * (n + 1)) / 2);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
int main(){
    cin>>a>>b;
    int tar;
    int ans=0;
    for (int i=0; i<a; i++){
        cin>>tar;
        if (tar>=b) ans++;
    }
    cout<<ans<<endl;
}

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

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    if(a%2==0 && a%3!=0 && a%5!=0){
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
}  

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

int main(void){
  int N;
  int count=0;
  int a[3];
  
  if(scanf("%d",&N) != 1){
    printf("*****SCANF ERROR****\n");
    exit(1);
  }
  a[0]=N%10;
  N=N/10;
  a[1]=N%10;
  N=N/10;
  a[2]=N;
  
  for(int i=0;i<3;i++){    
    if((a[i]%7 == 0) && (a[i] != 0)){
      count++;
    }
  }
  
  if(count != 0){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  
  return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


long long oddsolve(long long a) { return (a+1)/2 % 2; }
long long solve(long long a) {
    if (a % 2 == 1) return oddsolve(a);
    else return oddsolve(a+1) ^ (a+1);
}

int main() {

 
  int A, B, C;
  cin >> A >> B >> C;

  if(B >= A * C)cout << C << endl;
  else cout << B/A << endl;
  
}


/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

int main(void){
  int A[3][3],N,f;
  
  
  for(int i=0;i<3;i++){
    scanf("%d",&A[0][i]);
  }
  
  for(int i=0;i<3;i++){
    scanf("%d",&A[1][i]);
  }
  
  for(int i=0;i<3;i++){
    scanf("%d",&A[2][i]);
  }
  scanf("%d",&N);
  
  int b[N];
 
  for(int i=0; i<N; i++){
    f=scanf("%d",&b[i]);
    if(f!=1){
     printf("正しく入力してください\n");
      exit(0);
    }
  }

  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(b[i]==A[j][k]){
          A[j][k]=0;
        }
      }
    }
  }
  
  if((A[0][0]==0 && A[0][1]==0 && A[0][2]==0)||(A[1][0]==0 && A[1][1]==0 && A[1][2]==0)||(A[2][0]==0 && A[2][1]==0 && A[2][2]==0)){
    printf("Yes\n");
  }
  else if((A[0][0]==0 && A[1][0]==0 && A[2][0]==0)||(A[0][1]==0 && A[1][1]==0 && A[2][1]==0)||(A[0][2]==0 && A[1][2]==0 && A[2][2]==0)){
    printf("Yes\n");
  }
  else if((A[0][0]==0 && A[1][1]==0 && A[2][2]==0)||(A[0][2]==0 && A[1][1]==0 && A[2][0]==0)){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
   
    return 0;
  }
    
    
    
  
  
  

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

using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   int A, B, M;
   cin >> A >> B >> M;
   vector<int> ca(A);
   vector<int> cb(B);
   for (int i = 0; i < A; ++i) cin >> ca[i];
   for (int i = 0; i < B; ++i) cin >> cb[i];
   int ans = *min_element(ca.begin(), ca.end()) + (*min_element(cb.begin(), cb.end()));
   while (M--) {
      int x, y, c;
      cin >> x >> y >> c;
      --x, --y;
      ans = min(ans, ca[x] + cb[y] - c);
   }
   cout << ans << "\n";
   return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int N;cin>>N;
  vector<int> vec (N,0);
  int M = 1e6+1;
  vector<int> table(M,0);
  int flg = 0;
  set<int> ST;
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
     ST.insert(vec[i]);
     if(vec[i] == 1)
     {
       flg++;
     }
  }
  if(flg >1)
  {
    cout<<0<<endl;
    return;
  }
  else if(flg == 1)
  {
    cout<<1<<endl;
    return;
  }
  sort(ALL(vec));
  int res = 0;
  for (int i = 0; i < N; i++)
  {
    int X = vec[i];
    int flg2 = 0;
    if(i < N -1)
    {
      if(vec[i] == vec[i+1])
      {
        flg2 = 1;
      }
    }
    if(table[X] == 0)
    {
      if(flg2 == 0)
      res++;

      while(X < M)
      {
        table[X] = 1;
        X += vec[i];
      }
    }
    // DEBUG(vec[i],res,"\n");
  }

  cout<<res<<endl;
  

  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 21788
a=int(input())
b=int(input())
c=int(input())
x=int(input())
x_dash=x//50
cnt=0
for i in range(0,a+1):
  for j in range(0,b+1):
    k=x_dash-10*i-2*j
    if 0<=k<=c:
      cnt+=1
print(cnt)

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 300;

int n,e,t;
int w[N];
vector<vector<int>> rule[N];

const int INF = 19191919;
int dp[N];

int main(){
    cin >>n >>e >>t;
    --t;

    rep(i,n) cin >>w[i];

    rep(i,e){
        int g,c;
        cin >>g >>c;
        --g;

        vector<int> s(c);
        rep(j,c){
            cin >>s[j];
            --s[j];
        }
        rule[g].pb(s);
    }

    fill(dp,dp+N,INF);
    rep(i,n)if(w[i]==1) dp[i]=1;

    rep(loop,n){
        rep(i,n){
            for(vector<int> r:rule[i]){
                int sz = r.size();

                vector<int> v;
                for(int nx:r) v.pb(dp[nx]);
                sort(all(v));

                bool ok = true;
                rep(j,sz)if(v[j]==INF) ok=false;
                if(ok){
                    int tmp = 0;
                    rep(j,sz) tmp = max(tmp, v[j]+(sz-1-j));
                    dp[i] = min(dp[i], tmp);
                }
            }
        }
    }

    int ans = dp[t];
    if(ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3208
/*
Problem:People on a Line
Algorithm:"linear" DFS
Status:
*/

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <utility>
#include <list>
#include <ctime>
#include <memory.h>
#include <stack>
#include <stdio.h>
#include <string.h>

using namespace std;

const int INF=1e9+7;

vector<pair<int,int> > nei[100005];
int pos[100005];
int n,m;
bool used[100005];
bool exist[100005];

void dfs(int x,int cur){
	pos[x]=cur;
	used[x]=true;
	for(int i=0;i<nei[x].size();i++){
		if(used[nei[x][i].first]){
			if(pos[nei[x][i].first]-cur!=nei[x][i].second){
				cout<<"No"<<endl;
				exit(0);
			}
		}
		else{
			dfs(nei[x][i].first,cur+nei[x][i].second);
		}
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int l,r,d;
		scanf("%d%d%d",&l,&r,&d);
		l--;r--;
		exist[l]=true;exist[r]=true;
		nei[l].push_back(make_pair(r,d));
		nei[r].push_back(make_pair(l,-d));
	}
	
	for(int i=0;i<n;i++){
		if(!exist[i])continue;
		if(!used[i]){
			dfs(i,0);
		}
	}
	cout<<"Yes"<<endl;
	
	return 0;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#define for1(i,l,r) for(int i=(l);i<(r);i++)
#define for2(i,l,r) for(int i=(l);i>(r);i--)
using namespace std;
int n,pos=-1;
int a[205];
vector<int> ans;
signed main(){
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
//	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=n-1;i>-1;i--){
		for(int j=0;j<n;j++){
			if(a[j]==i){
				pos=j;
				break;
			}
		}
		if(pos==i) continue;
		for(int j=0;j<pos;j++) ans.push_back(1);
		for(int j=pos;j<i;j++){
			ans.push_back(1);
			ans.push_back(n-1);
		}
		for(int j=i;j<n;j++) ans.push_back(1);
		for(int j=pos;j<i;j++) swap(a[j],a[j+1]);
	}
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
	//for(int i=0;i<n;i++) cout<<a[i]<<" ";
}


Measured memory_bytes: 764
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;

int main(){
    long long int W,H,x,y;
    cin >> W >> H >> x >> y;

    cout << double(W*H)/2 << " ";
    bool a = 2*x==W;
    bool b = 2*y==H;
    if(a&b) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdlib.h>

using namespace std;
int main()
{
  string S, T;

  cin >> S >> T;

  if (S == T.substr(0, S.length()) && T.length() == S.length() + 1)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

const int DEBUG = 0;

#define MOCK 1

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;


ll powmod(ll a, ll e, ll mod) {
  ll sum = 1;
  ll cur = a;
  while (e > 0) {
    if (e % 2) {
      sum = sum * cur % mod;
    }
    cur = cur * cur % mod;
    e /= 2;
  }
  return sum;
}

const int A = 20;

int main(void) {
  const ll mod = 1e9 + 7;
  const ll mod2 = 1e9 + 9;
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  int p = 0;
  VI pos(n + 1);
  mt19937 mt;
  VL b(A);
  ll mods[A] = {};
  REP(i, 0, A) mods[i] = 1e9 + 7;
  
  REP(c, 0, A) {
    do {
      b[c] = mt() % mods[c];
    } while (b[c] == 0);
  }
  vector<VL> hsh(A, VL(n + 1));
  ll inv[A] = { 0 };
  REP(c, 0, A) inv[c] = powmod(b[c], mods[c] - 2, mods[c]);
  REP(c, 0, A) {
    p = 0;
    ll cur = 1;
    REP(i, 0, n) {
      ll tmp = hsh[c][i];
      if (s[i] == '>') {
        p++;
        cur = cur * b[c] % mods[c];
      }
      if (s[i] == '<') {
        p--;
        cur = cur * inv[c] % mods[c];
      }
      if (s[i] == '+') {
        tmp = (tmp + cur) % mods[c];
      }
      if (s[i] == '-') {
        tmp = (tmp + mods[c] - cur) % mods[c];
      }
      hsh[c][i + 1] = tmp;
      pos[i + 1] = p;
    }
  }
  if (DEBUG) {
    REP(i, 0, n + 1) {
      cerr << i << " " << hsh[0][i] << endl;
    }
  }
  VL meguru(A);
  REP(c, 0, A) meguru[c] = hsh[c][n];
  map<VL, int> kirika;
  kirika[meguru] = 1;
  ll tot = 0;
  VL cur(A);
  REP(c, 0, A) cur[c] = powmod(b[c], mods[c] - 1 + pos[n], mods[c]);
  for (int i = n - 1; i >= 0; --i) {
    if (DEBUG) {
      DEBUGP(i);
      DEBUGP(pos[i]);
    }
    if (pos[i + 1] - pos[i] == 1) {
      REP(c, 0, A) cur[c] = cur[c] * inv[c] % mods[c];
    }
    else if (pos[i + 1] - pos[i] == -1) {
      REP(c, 0, A) cur[c] = cur[c] * b[c] % mods[c];
    }
    VL ken(A);
    REP(c, 0, A) ken[c] = (cur[c] * meguru[c] + hsh[c][i]) % mods[c];
    tot += kirika[ken];
    VL tt(A);
    REP(c, 0, A) tt[c] = hsh[c][i];
    kirika[tt] += 1;
  }
  cout << tot << endl;
}


Measured memory_bytes: 169456
s = list(input())
t = list(input())
def f():
  for i in range(len(s)-len(t), -1, -1):
    temp = list(s[i:i+len(t)])
    for j in range(len(t)-1, -1, -1):
      if temp[j] == t[j] or temp[j] == '?':
        temp[j] = t[j]
    if temp == t:
      return ''.join(s[:i] + temp + s[i+len(temp):]).replace('?', 'a')
  
  return 'UNRESTORABLE'

print(f())

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <stack>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <iterator>
#include <sstream>
#define popcount(x) __builtin_popcount(x)
#define oddparity(x) __builtin_parity(x)
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define sf scanf
#define pf printf
using namespace std;

string s;
int i, a[26];

int main()
{
    cin >> s;
    for (i = 0; i < s.size(); i++) {
        a[s[i] - 'a']++;
    }
    for (i = 0; i < 26; i++) {
        if (a[i] % 2) {
            break;
        }
    }
    if (i == 26) pf("Yes\n");
    else pf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

ll a,b,c,d;
map<ll,ll> dp;
ll dfs(ll n) {
  if(n<2) return n*d;
  if(dp.count(n)) return dp[n];
  ll &res=dp[n]=1LL<<62;
  if(res/d>=n) res=n*d;
  res=min(res,dfs(n/2)+a+d*abs(n/2*2-n));
  res=min(res,dfs(n/3)+b+d*abs(n/3*3-n));
  res=min(res,dfs(n/5)+c+d*abs(n/5*5-n));
  res=min(res,dfs((n+1)/2)+a+d*abs((n+1)/2*2-n));
  res=min(res,dfs((n+2)/3)+b+d*abs((n+2)/3*3-n));
  res=min(res,dfs((n+4)/5)+c+d*abs((n+4)/5*5-n));

  return res;
}

int main() {
  ll t;
  cin >> t;
  while(t--) {
    ll n;
    dp.clear();
    cin >> n >> a >> b >> c >> d;
    cout << dfs(n) << endl;
  }
}

Measured memory_bytes: 4432
n = int(input())
A = [0]
a = list(map(int, input().split()))
for a_ in a:
    A.append(a_)
s = 0
A.append(0)
for i in range(n+1):
    s += abs(A[i+1]-A[i])

for i in range(1, n+1):
    print(s + abs(A[i+1]-A[i-1]) - (abs(A[i+1]-A[i]) + abs(A[i]-A[i-1])))

Measured memory_bytes: 20420
use itertools::Itertools;

fn distance((x1, y1): (i64, i64), (x2, y2): (i64, i64)) -> f64 {
    (((x1 - x2).pow(2) + (y1 - y2).pow(2)) as f64).sqrt()
}

fn total_distance(towns: Vec<(i64, i64)>, n: usize) -> f64 {
    (0..n - 1).map(|i| distance(towns[i], towns[i + 1])).sum()
}

fn factorial(n: usize) -> f64 {
    (1..=n).product::<usize>() as f64
}

fn solve(towns: &[(i64, i64)], n: usize) -> f64 {
    (0..n)
        .permutations(n)
        .map(|route| total_distance(route.iter().map(|&town| towns[town]).collect(), n))
        .sum::<f64>()
        / factorial(n)
}

fn main() {
    let n = read_1();
    let towns = read_tup2_n(n);

    println!("{}", solve(&towns, n));
}

// utils

fn read_1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_tup2_n<T: std::str::FromStr + Copy>(n: usize) -> Vec<(T, T)> {
    let mut ss = String::new();
    for _ in 0..n {
        std::io::stdin().read_line(&mut ss).ok();
    }
    let mut v = ss.split('\n').collect::<Vec<&str>>();
    v.pop();
    v.iter()
        .map(|s| {
            let v = s
                .trim()
                .split_whitespace()
                .map(|c| c.parse().ok().unwrap())
                .collect::<Vec<T>>();
            (v[0], v[1])
        })
        .collect()
}


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

int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  int a[10001];
  int ans=n;
  for(int i=0;i<m;i++){
    scanf("%d",&a[i]);
    ans-=a[i];}

  if(ans>=0){
    printf("%d\n",ans);}
  else{
    ans = -1;
    printf("%d\n",ans);}
  
  return 0;
}


Measured memory_bytes: 1748
import java.util.Scanner;

public class Main {
	static int count = 0;
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		String s = "" + n;
		add("" , n);
		sc.close();
		System.out.println(count);

	}
	public static void add(String s , long n) {
		for(int i = 1 ; i <= 3 ; i++) {
			String s2 = s;
			s2 += (i * 2 + 1);
			if(Long.valueOf(s2) <= n) {
				if(s2.contains("3") && s2.contains("5") && s2.contains("7")) {
					count++;
				}
				add(s2 , n);
			}
		}

	}
}



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

int main() {
	int n;
	long long a;
	long long minValue = 1000000;
	long long maxValue = -1000000;
	long long sum = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a < minValue)minValue = a;
		if (a > maxValue)maxValue = a;
		sum += a;
	}
	cout << minValue << " " << maxValue << " " << sum << endl;

	return 0;
}

Measured memory_bytes: 3096
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() { 
    int n,y;cin >> n >> y;
    rep(i, n+1) {
        rep(j, n+1) {
            if((y-10000*i-5000*j)%1000==0&&(y-10000*i-5000*j)/1000>=0&&(y-10000*i-5000*j)/1000+i+j==n) {
                cout << i << ' ' << j << ' ' << (y-10000*i-5000*j)/1000 << endl;
                return 0;
            }
        }
    }
    puts("-1 -1 -1");
    return 0;
}

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

int main() {
  int N, count = 0;
  bool b = true;
  cin >> N;

  int* A = new int[N];
  for (int i = 0; i < N; i++) {
      cin >> A[i];
  }

  while (b) {
      for (int i = 0; i < N; i++) {
          if (A[i] % 2 != 0) {
              b = false;
              break;
          }
          A[i] /= 2;
      }
      if (b) count++;
  }
  cout << count << endl;

  delete [] A;
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef complex<int> point;

int main(){
	point s,t;
	int x,y;
	cin>>x>>y;
	s=point(x,y);
	cin>>x>>y;
	t=point(x,y);
	string ans="";
	int resx=real(t)-real(s),resy=imag(t)-imag(s);
	if(resx>0)rep(i,resx)ans+='R';
	else rep(i,-resx)ans+='L';
	if(resy>0)rep(i,resy)ans+='U';
	else rep(i,-resy)ans+='D';
	if(resx>0)rep(i,resx)ans+='L';
	else rep(i,-resx)ans+='R';
	if(resy>0)rep(i,resy)ans+='D';
	else rep(i,-resy)ans+='U';
	if(resx>0){
		if(resy>0){
			ans+='D';
			rep(i,resx+1)ans+='R';
			rep(i,resy+1)ans+='U';
			ans+='L';
			ans+='U';
			rep(i,resx+1)ans+='L';
			rep(i,resy+1)ans+='D';
			ans+='R';
		}else{
			ans+='U';
			rep(i,resx+1)ans+='R';
			rep(i,-resy+1)ans+='D';
			ans+='L';
			ans+='D';
			rep(i,resx+1)ans+='L';
			rep(i,-resy+1)ans+='U';
			ans+='R';
		}
	}else{
		if(resy>0){
			ans+='R';
			rep(i,resy+1)ans+='U';
			rep(i,-resx+1)ans+='L';
			ans+='D';
			ans+='L';
			rep(i,resy+1)ans+='D';
			rep(i,-resx+1)ans+='R';
			ans+='U';
		}else{
			ans+='U';
			rep(i,-resx+1)ans+='L';
			rep(i,-resy+1)ans+='D';
			ans+='R';
			ans+='D';
			rep(i,-resx+1)ans+='R';
			rep(i,-resy+1)ans+='U';
			ans+='L';
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#define ll long long

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> v(N,0);
    for(int i=0;i<N;i++){
        cin >> v[i];
    }
    vector<int> gu,ki;
    for(int i=0;i<N;i++){
        if(i%2==0){
            gu.push_back(v[i]);
        }
        else{
            ki.push_back(v[i]);
        }
    }
    sort(gu.begin(),gu.end());
    sort(ki.begin(),ki.end());
    vector<pair<int,int>> gu_r;
    vector<pair<int,int>> ki_r;
    gu_r.push_back(make_pair(0,0));
    ki_r.push_back(make_pair(0,0));
    int count;
    for(int i=0;i<gu.size();i++){
        count=1;
        while(gu[i]==gu[i+1]){
            count++;
            i++;
        }
        gu_r.push_back(make_pair(count,gu[i]));
    }
    for(int i=0;i<ki.size();i++){
        count=1;
        while(ki[i]==ki[i+1]){
            count++;
            i++;
        }
        ki_r.push_back(make_pair(count,ki[i]));
    }
    sort(gu_r.rbegin(),gu_r.rend());
    sort(ki_r.rbegin(),ki_r.rend());
    if(gu_r[0].second!=ki_r[0].second){
        cout << N-gu_r[0].first-ki_r[0].first << endl;
    }
    else{
        int first,second;
        first=N-gu_r[1].first-ki_r[0].first;
        second=N-gu_r[0].first-ki_r[1].first;
        cout << min(first,second) << endl;
    }
    return 0;
}


Measured memory_bytes: 2168
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int main(){

  int n, x;
  int p[1111111];
  int data[33];
  bool dp[1111111];

  memset(p, -1, sizeof(p));
  p[0] = p[1] = 0;
  for(int i=2;i*i<1111111;i++) if(p[i]) for(int j=i+i;j<1111111;j+=i) p[j] = 0;

  while(scanf("%d %d", &n, &x), n){
    
    memset(dp, 0, sizeof(dp));
    dp[0] = true;
    for(int i=0;i<n;i++){
      scanf("%d", &data[i]);
      for(int j=data[i];j<=x;j++) if(dp[j-data[i]]) dp[j] = true;
    }
    
  int ans = 0;
  for(int i=0;i<=x;i++) if(p[i] & dp[i]) ans = i;

  if(!ans) cout << "NA\n";
  else cout << ans << endl;

  }

}

Measured memory_bytes: 6636
n = int(input())

cur = [0, 0, 0]

ok = True
for _ in range(n):
    [t, x, y] = map(int, input().split())

    dur = t - cur[0]
    dist = abs(x - cur[1]) + abs(y - cur[2])
    if not (dist <= dur and (dur - dist) % 2 == 0):
        ok = False
        print("No")
        break
    
    cur = [t, x, y]

if ok:
    print("Yes")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, P> P3;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(3e5 + 5);
const double EPS = 1e-4;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int n, q, cmax, cnt[MAX_N];

int solve(int m){
    int ma = 0;
    for(int i=0; i<cmax; i+=m){
        int bg = i+ma, en = min(i+m-1, cmax);
        if(bg>cmax || cnt[en]-cnt[bg]<=0)continue;
        ma = lower_bound(cnt+bg, cnt+en, cnt[en])-(cnt+i);
    }
    return ma;
}

int main() {
    cin >> n >> q;
    REP(i,n){
        int c;
        cin >> c;
        cnt[c]++;
        cmax = max(cmax, c);
    }
    REP(i,cmax){
        cnt[i+1] += cnt[i];
    }
    REP(i,q){
        int m;
        cin >> m;
        cout << solve(m) << endl;
    }
    return 0;
}



Measured memory_bytes: 4232
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
int main() {
	int n,k,sum=0;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++){
			cin>>arr[i];
		}
	sort(arr,arr+n);
	for(int x=0;x<k;x++){
		sum += arr[x];
	}
	cout<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 3592