akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
//typedef __int128_t Int;
#define DBG 1
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define loop(n) rep(loop,(0),(n))
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(12);

  int N; cin >> N;
  vector<int> v(N); rep(i, 0, N){ cin >> v[i]; }
  map<int,int>mp;
  int sum=0;
  int ans=0;
  rep(i,0,N){
    sum+=v[i];
    ans+=mp[sum];
    mp[sum]++;
    dump(sum,ans,mp[sum]);
  }
  ans+=mp[0];
  cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 14336
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>
#include <complex>

using namespace std;

#define mod 1000000007

int main()
{
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	vector<int> w, s;
	for(int i = 0; i <= f; i += 100 * a){
		for(int j = 0; i + j <= f; j += 100 * b){
			w.push_back(i + j);
		}
	}
	for(int i = 0; i <= f; i += c){
		for(int j = 0; i + j <= f; j += d){
			s.push_back(i + j);
		}
	}
	int answ = 100 * a, anss = 0;
	for(int i = 0; i < w.size(); i++){
		for(int j = 0; j < s.size(); j++){
			if(w[i] + s[j] > f ||s[j] > (w[i] / 100) * e) continue;
			if(s[j] * (answ + anss) > anss * (w[i] + s[j])){
				answ = w[i];
				anss = s[j];
			}
		}
	}
	cout << answ + anss << " " << anss << endl;
}

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

using namespace std;

map<string, int> cnt;

int main()
{
    int t;
    cin >> t;
    
    int d = 0;
    while(t --)
    {
        string s;
        cin >> s;
        cnt[s] ++;
        d = max(d, cnt[s]);
    }
    
    for(auto p : cnt)
        if(p.second == d)
            cout << p.first << endl;
    return 0;
}

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

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N;
    scan(N);
    auto a = readln.split.to!(int[]);

    auto g = a.sort!"a > b";

    long f = -1, s = -1;

    while (f == -1 || s == -1) {
        if (g.length <= 1) break;

        if (g[0] == g[1]) {
            if (f == -1) {
                f = g[0];
            }
            else {
                s = g[0];
            }

            g.popFront();
            g.popFront();
        }
        else {
            g.popFront();
        }
    }

    if (f == -1 || s == -1) {
        writeln(0);
    }
    else {
        auto ans = f * s;
        writeln(ans);
    }
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  ll ans = 0;
  int N, K; cin>>N>>K;
  vector<ll> V(N);
  REP(i,N) cin>>V[i];
  for(int left = 0; left < N; left++) {
    for(int right = left; right <= N; right++) {
      int cnt =	left + (N-right);
      int rem = K-cnt;
      //      cout << left << "," << right << "," << cnt << "," << rem << endl;              
      if(rem < 0) continue;
      vector<int> data;
      REP(i,left) data.push_back(V[i]);
      for(int i = right; i < N; i++) data.push_back(V[i]);
      sort(data.begin(), data.end());
      ll sum = 0;
      REP(i,data.size()) {
	if(i < rem && data[i] < 0LL) continue;
        sum += data[i];
      }
      //      cout << sum << "="; pp(data, data.size());                                     
      ans = max(ans, sum);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int[] A = {a, b, c};
        Arrays.sort(A);
        
        int n = (A[2] - A[1]) / 2;
        int m = (A[2] - A[0]) / 2;
        A[1] += 2 * n;
        A[0] += 2 * m;
        int count = n + m;
        if (A[2] > A[1] && A[2] > A[0]) {
            count++;
        } else if (A[2] > A[1] || A[2] > A[0]) {
            count += 2;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 22100
#include <stdio.h>
 
 
 
 
int main(void){
    int NUM[3000];
    int n,m,i;
    int a = 0;
 
    scanf("%d",&n);
 
 
    //スキャン
    for(i = 0; i<n; i=i+1){
        scanf("%d",&NUM[i]);
        a = a + NUM[i];
    }
 
    a = a-n;
 
 
 
printf("%d",a);
 
    return 0;
}

Measured memory_bytes: 128
using System;

namespace ABC_094_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');
            int A = int.Parse(word[0]);
            int B = int.Parse(word[1]);
            int X = int.Parse(word[2]);
            if (A > X)
            {
                Console.WriteLine("NO");
            }
            else if (A + B < X)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
            Console.ReadKey();
        }
    }
}

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

int main(){
  int N;
  cin>>N;
  vector<pair<string,int>> res(N),resorigin(N);
  for(int i=0;i<N;i++){
    cin>>res[i].first>>res[i].second;
    res[i].second=1000-res[i].second;
    resorigin[i].first=res[i].first;
    resorigin[i].second=res[i].second;
  }
  sort(res.begin(),res.end());
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(res[i].first==resorigin[j].first&&res[i].second==resorigin[j].second){
        cout<<j+1<<endl;
        break;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> A(N, 0);
    rep(i, N)
    {
        cin >> A[i];
    }
    rep(j, K)
    {
        vector<int> B(N, 0);
        rep(i, N)
        {
            int l = max(0, i - A[i]);
            int r = min(N - 1, i + A[i]);
            B[l]++;
            if (r + 1 < N)
                B[r + 1]--;
        }
        rep1(i, N)
        {
            B[i] += B[i - 1];
        }
        if (A == B)
            break;
        A = B;
    }
    rep(i, N)
    {
        cout << A[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 4844
#include<stdio.h>
int n,m,a[200001];
int main(){
	scanf("%d",&n);
	for(int i=1;i<n;++i){
		scanf("%d",&m);
		++a[m];
	}
	for(int i=1;i<=n;++i){
		printf("%d\n",a[i]);
	}
	return 0;
}

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

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

fn main() {
    let x: usize = read();
    let y: usize = read();
    let mut ans = 0;
    let mut v = x;
    while v <= y {
        ans += 1;
        v *= 2;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.BMI", "r", stdin );
	int id;
	double w, h;
	while (scanf ("%d,%lf,%lf", &id, &w, &h ) != EOF ){
		double bmi = w/h/h;
		if (bmi >= 25. ){
			printf ("%d\n", id );
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#include <map>
#include <climits>
#include <vector>
#include <set>
#include <string>
#include <numeric>

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
//#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
const int N = 1e5 + 2;
const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

int32_t main() {
    FAST_IO;
    int n, a, b;
    cin >> n >> a >> b;
    cin >> n >> a >> b;
    bool flag = false;
    for (int i = a; i <= b; i++) {
        if ((i % n) == 0) flag = true;
    }
    cout << (flag ? "OK" : "NG");
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define modp(x) ((x)%modn)
using namespace std;
const int maxn=25;
const ll maxm=1<<22,modn=1e9+7;
bool a[maxn][maxn];
ll f[maxm],n,m;
int main()
{
	cin>>n;m=(1<<n)-1;
	rep(i,0,n-1) rep(j,0,n-1) cin>>a[i][j];
	f[0]=1;
	rep(i,1,m)
	{
		int cnt=-1;
		rep(j,0,n-1) if(i&(1<<j)) cnt++;
		rep(j,0,n-1) if((i&(1<<j)) && a[cnt][j]) f[i]=modp(f[i]+f[i^(1<<j)]);
	}
	cout<<f[m];
	return 0;
}

Measured memory_bytes: 18688
import Control.Monad
import Control.Applicative
main = do
  n <- (read::String->Int) <$> getLine
  s <- replicateM n getLine
  let v = map (map (read::String->Int) . words) s
  mapM_ (putStrLn . aux ) v

aux :: [Int] -> String
aux [a,b,c]
  | a^2+b^2==c^2 = "YES"
  | b^2+c^2==a^2 = "YES"
  | c^2+a^2==b^2 = "YES"
  | otherwise    = "NO"

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

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
 	int N,K;
 	cin>>N>>K;
 	map<int,int>mp;
 	for(int i=0; i<N; i++){
 		int A;
 		cin>>A;
 		mp[A]++;
 	}
 	vector<int>v;
 	for(auto p:mp){
 		v.push_back(p.second);
 	}
 	sort(v.begin(),v.end());
 	int sum=0;
 	if(v.size()<=K){
 		cout<<0<<endl;
 	}
 	else{
 		for(int i=0; i<v.size()-K; i++){
 			sum+=v[i];
 		}
 		cout<<sum<<endl;
 	}
 }

Measured memory_bytes: 10744
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%li", &i);
    vector<ll> s(n+1);
    for (int i = 0; i < n; ++i) {
        s[i+1] = s[i]+v[i];
    }
    ll ans = INF<ll>;
    for (ll k = 1; k <= n; ++k) {
        int cnt = 0, cur = n;
        ll cost = x*(n+k);
        while(cur > 0){
            int cur2 = max((ll)0, cur-k);
            ll p = 5+max(cnt-1, 0)*2;
            cost += p*(s[cur]-s[cur2]);
            if(cost > ans){
                cost = ans;
                break;
            }
            cur = cur2; cnt++;
        }
        ans = min(ans, cost);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;
import java.io.*;
class Main{
    public static void main(String[] av)throws IOException{
	Scanner sc=new Scanner(System.in);

     
	while(true){
	    int a=sc.nextInt();
	    String op=sc.next();
	    int b=sc.nextInt();
	    if(op.equals("+"))		System.out.println(a+b);
	    if(op.equals("-"))		System.out.println(a-b);
	    if(op.equals("*"))		System.out.println(a*b);
	    if(op.equals("/"))		System.out.println(a/b);
	    if(op.equals("?"))		break;
	       
	
	}

    
    
    }
}



Measured memory_bytes: 26324
#include<bits/stdc++.h>
#define sio(); ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fio(); freopen("input","r",stdin); freopen("output","w",stdout);
using namespace std;
int main()
{
    long long n=0;
    string s;
    cin>>s;
    for(int i=0;s[i]!='\0';i++)
    {
        n += s[i]-48;
    }
    if(n%9==0)puts("Yes");
    else puts("No");
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A;
  cin >> A;
  
  if (N % 500 > A) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
    
}


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

void check(int a, int b, int c){
  if(a!=b&&b!=c&&c!=a){
    if(a+b>c&&b+c>a&&c+a>b){
      ans++;
    }
  }
}


int main(){
  cin>>n;
  vector<int> l(n,0);
  REP(i,n) cin>>l.at(i);
  REP(i,n-2){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        check(l.at(i),l.at(j),l.at(k));
      }
    }
  }

  cout<<ans;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> l(n*2);
  for(int i = 0; i < n*2; i++) {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end());
  int ans = 0;
  for(int i = 0; i < n*2; i += 2) {
    ans += l.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


typedef long long ll;
int N; ll Y;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> Y;
    rep(a, 0, N + 1) rep(b, 0, N + 1) {
        int c = N - (a + b);
        if (0 <= c) {
            if (10000LL * a + 5000LL * b + 1000LL * c == Y) {
                printf("%d %d %d\n", a, b, c);
                return;
            }
        }
    }

    printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
// あみだくじ

#include <iostream>
using namespace std;

int amida[30][2];
void read_input(int n);
void run(int w, int n);

int main() {
    int w; // w: たて棒
    int n; // n: よこ棒

    cin >> w >> n;
    read_input(n);
    run(w, n);
    return 0;
}

void run(int w, int n) {
    // 現在位置がamida[idx]のどちらかと同じだったら移動
    int final_positions[30]; // 最後の位置を溜める

    for (int start = 0; start < w; start++) {
        int current_pos = start;
        for (int idx = 0; idx < n; idx++) {
            if (current_pos == amida[idx][0]) {
                current_pos = amida[idx][1];
            } else if (current_pos == amida[idx][1]) {
                current_pos = amida[idx][0];
            }
        }
        final_positions[current_pos] = start+1;
    }
    for (int i = 0; i < w; i++)
        cout << final_positions[i] << "\n";
}

void read_input(int n){
    // read input and assign them to amida
    for (int idx = 0; idx < n; idx++) {
        int tmp;
        cin >> tmp;
        amida[idx][0] = tmp - 1; // 0から始まるインデックス
        cin.ignore(); // カンマ
        cin >> tmp;
        amida[idx][1] = tmp - 1;
    }
}



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

using namespace std;
typedef long long ll;

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

  int a, b;
  cin >> a >> b;

  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) cout << "Possible" << "\n";
  else cout << "Impossible" << "\n";
}


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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

Int par[500];

Int root(Int x) {
    if (x == par[x]) {
        return x;
    }
    else {
        return par[x] = root(par[x]);
    }
}

void unite(Int x, Int y) {
    Int rx = root(x);
    Int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
}

int main() {
    Int n;
    cin >> n;
    Int d[301][301] = {};
    Int wf[301][301] = {};
    for (Int i = 0; i < n; i++) {
        for (Int j = 0; j < n; j++) {
            cin >> d[i][j];
            wf[i][j] = d[i][j];
        }
    }
    for (Int k = 0; k < n; k++) {
        for (Int i = 0; i < n; i++) {
            for (Int j = 0; j < n; j++) {
                wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
            }
        }
    }
    bool check = true;
    for (Int i = 0; i < n; i++) {
        for (Int j = 0; j < n; j++) {
            if (d[i][j] != wf[i][j]) {
                check = false;
            }
        }
    }
    if (not check) {
        dump(-1);
        return 0;
    }
    Int res = 0;
    for (Int i = 0; i < n - 1; i++) {
        for (Int j = i + 1; j < n; j++) {
            bool check = true;
            for (Int k = 0; k < n; k++) {
                if (k == i or k == j) continue;
                if (d[i][j] == d[i][k] + d[k][j]) {
                    check = false;
                }
            }
            if (check) {
                res += d[i][j];
            }
        }
    }
    dump(res);
    return 0;
}

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

using namespace std;
const int maxn = 4;
typedef long long ll;
const int INF = 1e9+7;

list<int>sta[maxn];
void action()
{
    int a[maxn];
    for(int i=0; i<3; i++)
        scanf("%d",&a[i]);
    sort(a,a+3);
    int then = a[2]-a[1]+a[0];
    int coun = 0;
    for(int i=1; then <a[2]; i++)
    {
        then+=2;
        coun++;
    }
    int ans = a[2]-a[1] + coun;
    if(then >a[2])
        ans++;

    cout<<ans<<endl;

}
int main()
{

    action();
    return 0;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

static mut ret: u64 = 0;

fn dfs(i: u64, nums: &Vec<u64>, buf: u64, sum: u64) {
  if i == (nums.len() - 1) as u64{
    //println!("{}", sum + buf * 10 + nums[i as usize]);
    unsafe {
      ret += sum + buf * 10 + nums[i as usize];
    }
    return
  }

  dfs(i+1, &nums, buf * 10 + nums[i as usize], sum);
  dfs(i+1, &nums, 0, sum + buf * 10 + nums[i as usize]);
}

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

fn main() {
  let s: String = input();
  let mut nums: Vec<u64> = Vec::new();
  for c in s.chars() {
    nums.push(c as u64 - 48);
  }
  dfs(0, &nums, 0, 0);
  //println!("{:?}", nums);
  unsafe {
    println!("{}", ret);
  }
}


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

ll gcd(ll a,ll b){
  while(b!=0){
    a%=b;
    swap(a,b);
  }
  return a;
}

ll kaizyou(ll N){
  ll num=1;
  for(ll i=1;i<=N;i++){
  num*=i;
  }
  return num;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  priority_queue<int>A;
  rep(i,n){
    int a;
    cin >> a;
    A.push(a);
  }
  rep(i,m){
    int a=A.top();
    A.pop();
    A.push(a/2);
  }
  ll ans=0;
  rep(i,n){
    ans+=A.top();
    A.pop();
  }
  cout << ans << endl;
}
      
  
  
  

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> prii;

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    int A, B;
    cin >> A >> B;
    int ans = 0;
    REP(i, A, B+1) {
        string s = to_string(i);
        if(s[0]==s[4] && s[1]==s[3]) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

char s[100002];
int z[26];
int main(){
	int n;
	scanf("%d%s",&n,s+1);
	for(int i=1;i<=n;i++)
		z[s[i]-'a']++;
	int ans=1;
	for(int i=0;i<26;i++)
		ans=1ll*ans*(z[i]+1)%1000000007;
	printf("%d\n",(ans-1+1000000007)%1000000007);
}

Measured memory_bytes: 1824
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
int l,r;
ll ans=1<<30;
int main(){
	in(l);in(r);
	int x=r/2019*2019;
	if(x>=l)puts("0");
	else{
		for(int i=l;i<=r;i++){
			for(int j=i+1;j<=r;j++){
				ll x=i;
				x=x*j%2019;
				ans=min(ans,x);
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

#define MOD 1000000007

ll fact[100005];

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

  fact[0] = 1;
  for(int i=1;i<=100000;i++) fact[i] = (fact[i-1] * i) % MOD;

  ll res = 0;
  if(N == M){
    res = (fact[N] * fact[N] * 2) % MOD;
  }else if(abs(N-M) <= 1){
    res = (fact[N] * fact[M]) % MOD;
  }

  cout << res << endl;
}


Measured memory_bytes: 1024
MAX = 600000
MOD = int(1e9) + 7
fac = [0] * MAX
ifac = [0] * MAX
fac[0] = 1
for i in range(1,MAX):
    fac[i] = (fac[i-1] * i) % MOD
ifac[MAX-1] = pow(fac[MAX-1],MOD-2,MOD)
for i in reversed(range(1,MAX)):
    ifac[i-1] = (ifac[i] * i) % MOD

def combinations(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return (fac[n] * ifac[k] * ifac[n-k]) % MOD
MOD2 = 2019
s = list(input())
s.reverse()
n = len(s)
ans = 0
lis = [0] * 2020
x = 1
cnt = 0
lis[cnt] += 1
for i in s:
    cnt += int(i) * x
    cnt %= MOD2
    lis[cnt] += 1

    x *= 10
    x %= MOD2

# for i in lis:
#     if i >= 2:
#         print(i)

for i in lis:
    ans += combinations(i,2)

print(ans)


Measured memory_bytes: 87252
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

int main() {

  int sum = 0;
  for ( int i = 0; i < 5; i++ ){
	int val;
	cin >> val;
	if ( val >= 40 ) {
	  sum += val;
	} else {
	  sum += 40;
	}
  }
  cout << ( sum / 5 ) << endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[55], b[55];
int main() {
  ll n, x;
  cin >> n >> x;
  a[0] = 1;
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1] * 2 + 1;
  }
  b[0] = 1;
  for (int i = 1; i <= n; i++) {
    b[i] = b[i - 1] * 2 + 3;
  }
  ll ans = 0;
  while (x > 0) {
    if (x == b[n]) {
      ans += a[n];
      x = 0;
    } else if (x >= b[n] / 2 + 1) {
      ans += a[n - 1] + 1;
      x -= b[n] / 2 + 1;
    } else {
      x--;
    }
    n--;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long int lli;

lli n;

int qtdDigits(lli k)
{
	int ans = 0;

	while( k > 0 )
	{
		ans++;
		k /= 10;
	}

	return ans;
}

int main()
{
	scanf("%lld",&n);

	int ans = qtdDigits( n );

	for(lli i = 1 ; i*i <= n ; i++)
		if( n%i == 0 ) ans = min( ans , max( qtdDigits( i ) , qtdDigits( n/i ) ) );

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

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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  string res;
  for (char c : s) {
    res += ((c - 'A') + n) % 26 + 'A';
  }
  cout << res << '\n';
  return 0;
}


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

string int2string(int score){
    char hundred = ('9' - score/100);
    char ten = ('9' - (score%100)/10);
    char one = ('9' - score%10);
    string res = "";
    res += hundred;
    res += ten;
    res += one;
    return res;
}

int main(){
    int N;
    cin >> N;
    std::map<std::string, int> score;
    string city;
    int p;
    for(int i=0; i < N; i++){
        cin >> city >> p;

        score[city + int2string(p)] = i + 1;

    }
    for (auto s : score){
        cout << s.second << endl;

    }




}


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

int main() {
    string s;
    std::cin >> s;
    ll ans = 0;
    ll ame = 0;
    for (int i = 0; i < 3; i++) {
        if(s[i]=='R'){
            ame++;
            ans = max(ans,ame);
        }else{
            ame = 0;
        }
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3616
n = int(input())
a = [int(x) for x in input().split()]

suma = sum(a)
x = a[0]
ans = abs(suma - x * 2)

for i in range(1, n - 1):
    x += a[i]
    ans = min(ans, abs(suma - x * 2))
else:
    print(ans)

Measured memory_bytes: 31392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll>mp;
ll a[200005];
ll sum[200005];
int n;
ll ans;
int main()
{
    ll t=0;
    while(~scanf("%d",&n))
    {
        mp.clear();
        sum[0]=0;
        ans=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%lld",&a[i]);
            sum[i]=sum[i-1]+a[i];
            mp[sum[i]]++;
        }
        for(int i=1;i<=n;i++)
        {
            t=mp[sum[i]-a[i]];
            if(t>=0)
                ans+=t;
            mp[sum[i]]--;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 15872
#prag\
ma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

set<int> s;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		s.insert(x);
	}
	cout<<s.size();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int N, M, A;
string dp[10001];
map<int, int> mii;

string max_s(string s1, string s2) {
    if (s1 == "a") return s2;
    if (s2 == "a") return s1;

    if (s1.size() == s2.size()) {
        REP(i, s1.size()) {
            if (s1[i] < s2[i]) return s2;
            else if (s1[i] > s2[i]) return s1;
        }
    }
    return s1.size() > s2.size() ? s1 : s2;
}

int main() {
    int c[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
    cin >> N >> M;
    REP(i, M) {
        cin >> A;
        mii[A] = max(mii[A], c[A - 1]);
    }
    REP(i, N + 1) dp[i] = "a";
    dp[0] = "";

    FOR(i, 2, N + 1) {
        for (auto p : mii) {
            if (i - p.second >= 0 && dp[i - p.second] != "a") {
                dp[i] = max_s(dp[i], dp[i - p.second] + to_string(p.first));
            }
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 29312
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
void solve(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(c>=a&&c<=b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
} 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>


using namespace std;

int exchange(string str){
  int ans = 0;
  int i;
  for (i = 0; i < (int)str.length(); i++) {
	if(str[i] == 'm')
	  ans += 1000;
	else if(str[i] == 'c')
	  ans += 100;
	else if(str[i] == 'x')
	  ans += 10;
	else if(str[i] == 'i')
	  ans += 1;
	else if(str[i] >= '0' && str[i] <= '9'){
	  int a;
	  a = str[i] - '0';
	  i++;
	  if(str[i] == 'm')
		ans += a*1000;
	  else if(str[i] == 'c')
		ans += a*100;
	  else if(str[i] == 'x')
		ans += a*10;
	  else if(str[i] == 'i')
		ans += a*1;
	}	
  }
  return ans;
}

string rev(int a){
  string str;
  string m="",c="",x="",i="";
  str = to_string(a);
  int l = str.length();
  string ans;
  
  if(l == 4){
	if(str[0] == '1'){
	  m += "m";
	}
	else if(str[0] <= '9' && str[0] >= '2'){
	  m += str[0];
	  m += 'm';
	}
	str = str.substr(1);
	l = str.length();
  }
  
  if(l == 3){
	if(str[0] == '1'){
	  c += "c";
	}
	else if(str[0] <= '9' && str[0] >= '2'){
	  c += str[0];
	  c += 'c';
	}
	str = str.substr(1);
	l = str.length();
  }
  
  if(l == 2){
	if(str[0] == '1'){
	  x += "x";
	}
	else if(str[0] <= '9' && str[0] >= '2'){
	  x += str[0];
	  x += 'x';
	}
	str = str.substr(1);
	l = str.length();

  }

  if(l == 1){
	if(str[0] == '1'){
	  i += "i";
	}
	else  if(str[0] <= '9' && str[0] >= '2'){
	  i += str[0];
	  i += 'i';
	}
	str = str.substr(1);
	l = str.length();

  }
  
  ans = m + c + x + i;
  return ans;
}

int main(){
  int n;
  cin >> n;
  while(1){
	if(n <= 0) break;

	string str1,str2,str3;
	cin >> str1 >> str2;
	int a,b,c;
	a = exchange(str1);
	b = exchange(str2);
	c = a + b;
	str3 = rev(c);
	cout << str3 << endl;
	n--;
  }
  
  return 0;
}

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

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

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

    int ans = 0, mi = 1e9;
    for(int i = 0; i < n; i++){
        if(A[i] <= mi){
            ans ++;
            mi = A[i];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;

int main(){
  long N,n;
  vector<long> A;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>n;
    A.push_back(n);
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  long x,y,flag=0;
  for(int i=0;i<N-1;i++){
    /*if(A[i]==A[i+3]&&A[i]==A[i+1]&&A[i]==A[i+2]){
      cout<<A[i]*A[i]<<endl;
      return 0;
    }else */if(A[i]==A[i+2]){
      if(flag==0){
        x=A[i];
        flag+=1;
        i +=1;
      }else{
        y=A[i];
        cout<<x*y<<endl;
        return 0;
      }
    }else if(A[i]==A[i+1]){
      if(flag==0){
        x=A[i];
        flag+=1;
        //i +=1;
      }else{
        y=A[i];
        cout<<x*y<<endl;
        return 0;
      }
    }
    }
    cout<<0<<endl;
  return 0;
  }


Measured memory_bytes: 1400
# Author: cr4zjh0bp
# Created: Thu Mar 12 07:38:24 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()
a = na()

ans = -inf
for i in range(N):
    for j in range(N):
        if i != j:
            ans = max(ans, abs(a[i] - a[j]))

print(ans)

Measured memory_bytes: 3064
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
l=[]
s=0
while True:
  if len(l)==2:print(l[0]*l[1]);exit()
  if s==n-1:print(0);exit()
  if a[s]==a[s+1]:
    s+=1
    l.append(a[s])
  s+=1

Measured memory_bytes: 14252
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T =list(input())

ans =0
for i in range(N):
    if i<K:
        if T[i]=="r":
            ans+=P
        elif T[i]=="s":
            ans+=R
        else:
            ans+=S
            
    else:
        if T[i]=="r":
            if T[i-K]!="r":
                ans+=P
            else:
                T[i]="-"
        elif T[i]=="s":
            if T[i-K]!="s":
                ans+=R
            else:
                T[i]="-"
        else:
            if T[i]=="p":
                if T[i-K]!="p":
                    ans+=S
                else:
                    T[i]="-"
print(ans)

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

vector<vector<int64_t>> nakama = {{0, 1},
				  {0, 1, 2},
				  {1, 2, 3},
				  {2, 3, 4},
				  {3, 4, 5},
				  {4, 5, 6},
				  {5, 6, 7},
				  {6, 7, 8},
				  {7, 8, 9},
				  {8, 9}};

int64_t lunlun(int64_t keta, int64_t d, int64_t &cnt, int64_t K) {
  if (keta == 1) {
    cnt++;
    return cnt == K ? d : -1;
  }

  for (auto shita : nakama[d]) {
    int64_t num = lunlun(keta - 1, shita, cnt, K);
    if (num != -1) {
      return pow(10, keta - 1) * d + num;
    }
  }

  return -1;
}

int main() {
  int64_t K;
  cin >> K;

  int64_t keta = 1;
  int64_t cnt = 0;
  while (true) {
    for (int64_t d = 1; d <= 9; d++) {
      int64_t num = lunlun(keta, d, cnt, K);
      if (num != -1) {
	cout << num << endl;
	return 0;
      }
    }
    keta++;
  }

  return 0;
}


Measured memory_bytes: 384
N = int(input())
if N < 10:
	print(N)
elif N < 100:
	print(9)
elif N < 1000:
	print(9 + N - 99)
elif N < 10000:
	print(9 + 900)
elif N < 100000:
	print(9 + 900 + N - 9999)
else:
	print(90909)

Measured memory_bytes: 38624
/*
 _     _    ___  ___  __ __ 
| |   | |  |__ \|__ \/_ /_ |
| |__ | |__   ) |  ) || || |
| '_ \| '_ \ / /  / / | || |
| |_) | |_) / /_ / /_ | || |
|_.__/|_.__/____|____||_||_|

*/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll n,k;
		cin>>n>>k;
		string s;
		cin>>s;
		s+='#';
		// stack<char>st;
		// st.pb(s[0]);
		vi v;
		ll c=1;
		ll ans=0;
		rep(i,1,n+1)
		{
			if(s[i]!=s[i-1])
			{
				v.pb(c);
				ans+=c-1;
				c=1;
			}
			else
			{
				c++;
			}
		}
		// rep(i,0,v.size())
		// cout<<v[i]<<endl;
		ans+=min(n/2,k)*2;
		cout<<min(ans,n-1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1480
n,q = map(int,input().split())
s = input()

ac = [0] * (n - 1)
for i in range(n-1):
  if s[i] == 'A' and s[i+1] == 'C':
    ac[i] = 1

acc = [0] * n
for i in range(n-1):
  acc[i+1] = acc[i] + ac[i]

lr = [tuple(map(int,input().split())) for _ in range(q)]
for i in range(q):
  l = lr[i][0] - 1
  r = lr[i][1] - 1
  print(acc[r] - acc[l])

Measured memory_bytes: 22176
import sys

N, T = [int(item) for item in input().split()]

cs, ts = [], []
for i in range(N):
  c, t = [int(item) for item in input().split()]
  cs.append(c)
  ts.append(t)
    
ct = sorted(zip(cs, ts), key=lambda x:x)
for c, t in ct:
  if t <= T:
    print(c)
    sys.exit()

print("TLE")

Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 0
for i,b in enumerate(B):
    x = min(A[i], b)
    ans += x
    b -= x
    y = min(A[i+1], b)
    ans += y
    A[i+1] -= y
print(ans)

Measured memory_bytes: 18476
import sys
from decimal import Decimal, ROUND_HALF_UP
import math
input = sys.stdin.readline
#sys.setrecursionlimit(1e9)

def main():
    """code here"""
    N = int(input())
    for i in range(N+1):
        if int(math.floor(i*1.08))==N:
            print(i)
            exit()
    print(":(")
if __name__ == '__main__':
    main()

Measured memory_bytes: 5332
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

ll res;

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

    ll N,D;
    cin >> N >> D;
    vector<pair<ll,ll>> XY(N);
    for(int i = 0; i < N; i++ )
    {
     
       cin >> XY[i].first >> XY[i].second;
    }
    res = 0;
    for(int i = 0; i < N; i++ )
    {
        if(pow(XY[i].first,2)+pow(XY[i].second,2)<=pow(D,2)){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6296
N, M = map(int, input().split())
X1 = []
X2 = []
X3 = []
X4 = []
X5 = []
X6 = []
X7 = []
X8 = []
for i in range(N):
  A = [int(i) for i in input().split()]
  X1.append( A[0] + A[1] + A[2])
  X2.append( A[0] + A[1] - A[2])
  X3.append( A[0] - A[1] + A[2])
  X4.append( A[0] - A[1] - A[2])
  X5.append(-A[0] + A[1] + A[2])
  X6.append(-A[0] + A[1] - A[2])
  X7.append(-A[0] - A[1] + A[2])
  X8.append(-A[0] - A[1] - A[2])
print(max(
  sum(sorted(X1, reverse = True)[:M]),
  sum(sorted(X2, reverse = True)[:M]),
  sum(sorted(X3, reverse = True)[:M]),
  sum(sorted(X4, reverse = True)[:M]),
  sum(sorted(X5, reverse = True)[:M]),
  sum(sorted(X6, reverse = True)[:M]),
  sum(sorted(X7, reverse = True)[:M]),
  sum(sorted(X8, reverse = True)[:M])
  ))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define loop(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define len(a) (int)a.size()
#define allv(a) (a).begin(),(a).end()
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double err = 1e-9;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;



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

	int n,k;
	cin>>n>>k;
		
	cout<<n - k + 1<<endl;	
	
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }

    sort(a.begin(), a.end());

    int nearest_index = 0;
    if (a.at(n - 1) % 2 == 0) {
        for(int i = 0; i < n; i++)
        {
            if (abs(a.at(i) - a.at(n - 1) / 2) < abs(a.at(nearest_index) - a.at(n - 1) / 2)) nearest_index = i;
        }
    }  
    else {
        for(int i = 0; i < n; i++)
        {
            if (abs(a.at(i) - a.at(n - 1) / 2) < abs(a.at(nearest_index) - a.at(n - 1) / 2)) nearest_index = i;
            if (abs(a.at(i) - (a.at(n - 1) / 2 + 1)) < abs(a.at(nearest_index) - (a.at(n - 1) / 2 + 1))) nearest_index = i;
        }
    }
    cout << a.at(n - 1) << " " << a.at(nearest_index) << endl;
}

Measured memory_bytes: 640
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
c,d=100000,0
for i in range(n):
    if abs(a-(t-h[i]*0.006))<c:
        c=abs(a-(t-h[i]*0.006))
        d=i
print(d+1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(x,y,z) for (int x=y; x<=z; x++)
#define downrep(x,y,z) for (int x=y; x>=z; x--)
#define ms(x,y,z) memset(x,y,sizeof(z))
#define LL long long
#define repedge(x,y) for (int x=hed[y]; ~x; x=edge[x].nex)
inline int read(){
	int x=0; int w=0; char ch=0;
	while (ch<'0' || ch>'9') w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w? -x:x;
}
const int maxn=105;
const int maxm=15;
int n;
char s[maxn][maxm];
int eq(char *s1,char *s2){
	int n=strlen(s1); if (n!=strlen(s2)) return 0;
	rep(i,0,n-1) if (s1[i]!=s2[i]) return 0;
	return 1;
}
int check(){
	rep(i,1,n) {
		rep(j,1,i-1) if (eq(s[j],s[i])) return 0;
		if ((i!=1)&&(s[i][0]!=s[i-1][strlen(s[i-1])-1])) return 0;
	}
	return 1;
}
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%s",&s[i]);
	if (check()) puts("Yes"); else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

struct node {
	int id, parent, left, right;
	int getSibling(node *nds){
		if(this->parent == -1) return -1;
		node par = nds[this->parent];
		return par.left == this->id ? par.right : par.left;
	}
	int getDegree(node *nds){
		return (this->left == -1 ? 0 : 1) + (this->right == -1 ? 0 : 1);
	}
	int getDepth(node *nds, int bottom){
		if(this->parent == -1) return bottom;
		return nds[this->parent].getDepth(nds, bottom + 1);
	}
	int getHeight(node *nds){
		if(this->left == -1 && this->right == -1) return 0;
		return 1 + max(this->left == -1 ? -1 : nds[this->left].getHeight(nds), this->right == -1 ? -1 : nds[this->right].getHeight(nds));
	}
	const char* getType(){
		if(this->parent == -1) return "root";
		if(this->left == -1 && this->right == -1) return "leaf";
		return "internal node";
	}
};

int main() {
	int n;
	scanf("%d", &n);
	
	node *nds = new node[n];
	for(int i = 0; i < n; i++){
		nds[i].parent = nds[i].right = nds[i].left = -1;
	}
	
	for(int i = 0; i < n; i++){
		int id, r, l;
		scanf("%d %d %d", &id, &l, &r);
		nds[id].id = nds[l].parent = nds[r].parent = id;
		nds[id].left = l;
		nds[id].right = r;
	}
	
	for(int i = 0; i < n; i++){
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", nds[i].id, nds[i].parent, nds[i].getSibling(nds), nds[i].getDegree(nds), nds[i].getDepth(nds, 0), nds[i].getHeight(nds), nds[i].getType());
	}
	
	return 0;
}

Measured memory_bytes: 1196
#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=5e15;

int main() {
  ll n,m;
  cin >> n >> m;
  vector<map<ll,ll>> E(n);
  for(ll i=1;i<n;i++) E[i][i-1]=0;
  for(ll i=0;i<m;i++) {
    ll l,r,c;
    cin >> l >> r >> c;
    l--;r--;
    if(E[l][r]) {
      E[l][r]=min(E[l][r],c);
    }
    else {
      E[l][r]=c;
    }
  }
  priority_queue<pll,vector<pll>,greater<pll>> q;
  vec d(n,inf);
  q.push(pll(0,0));
  while(q.size()) {
    ll dis=q.top().first;
    ll f=q.top().second;
    q.pop();
    if(d[f]<dis) continue;
    d[f]=dis;
    for(auto p:E[f]) {
      ll ndis=dis+p.second;
      ll t=p.first;
      if(d[t]>ndis) {
        q.push(pll(ndis,t));
      }
    }
  }
  if(d[n-1]==inf) d[n-1]=-1;
  cout << d[n-1] << endl;
}

Measured memory_bytes: 18936