akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        var ret = 0;
        for(int i=1; i<=n; i+=2) {
            var c = 0;
            for(int j=1; j<=i; j++) {
                if (i % j == 0) c++;
            }
            if (c == 8) ret++;
        }

        return ret;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
#define NMAX 100005

vector<ll>  tab[NMAX];
int main(){
    ll nombre = 10000;
    cin>>nombre;
    for(ll i=0 ; i<=1000; ++i){
        for (ll j =0; j <= 1000; ++j)
        {
            if((ll)pow(i,5)-(ll)pow(j,5) == nombre){
                cout<<i<<" "<<j<<endl;
                return 0;
            }
            else if((ll)pow(i,5)+(ll)pow(j,5) == nombre){
                cout<<i<<" "<<-j<<endl;
                return 0;
            }
            else if(-(ll)pow(i,5)-(ll)pow(j,5) == nombre){
                cout<<-i<<" "<<j<<endl;
                return 0;
            }
            else if(-(ll)pow(i,5)+(ll)pow(j,5) == nombre){
                cout<<-i<<" "<<-j<<endl;
                return 0;
            }
        }
    }
    cout<<"not found";
    return 0;
}


Measured memory_bytes: 6352
#include <stdio.h>
int main()
{
        int n;
        scanf("%d", &n);
        switch(n%10) 
        {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                        printf("hon\n");
                        break;
                case 0:
                case 1:
                case 6:
                case 8:
                        printf("pon\n");
                        break;
                case 3:
                        printf("bon\n");
        }

        return 0;
}

Measured memory_bytes: 1652
#include<stdio.h>


int main(void)


{


 int a,b,d,r;


 double f;


 scanf("%d %d",&a,&b);


 d=a/b;


 r=a%b;


 f=(double)a/(double)b;


 printf("%d %d %lf\n",d,r,f);


 return 0;


}

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

int main()
{
    int n,maxx=0,x[100005];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&x[i]),maxx=max(maxx,x[i]);
    int minn=1e9,mid=maxx/2,mina;
    for(int i=0;i<n;i++)
        if(x[i]!=maxx&&fabs(x[i]-mid)<minn)
        {
            minn=fabs(x[i]-mid);
            mina=x[i];
        }
    printf("%d %d\n",maxx,mina);
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#define LEN 100005

/* プロセスを表す構造体 */
typedef struct pp {
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue() {
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b) { return a < b ? a : b; } // 最小値を返す

int main(void) {
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    /* 全てのプロセスをキューに順番に追加する */
    for ( i = 1; i <= n; i++ ) {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1; tail = n + 1;

    /* シュミレーション */
    while ( head != tail ) {
        u = dequeue();
        c = min(q, u.t); // qまたは必要な時間u.tだけ処理を行う
        u.t -= c; //残りの必要時間を計算
        elaps += c; //経過時間を加算
        if ( u.t > 0 ) enqueue(u); //処理が鑑賞していなければキューに追加
        else {
            printf("%s %d\n", u.name, elaps);
        }
    }

    return 0;
}


Measured memory_bytes: 11876
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num = in.nextInt();
		int d = num % 10;
		num /= 10;
		int c = num % 10;
		num /= 10;
		int b = num % 10;
		num /= 10;
		int a = num;
		
		if(a+b+c+d==7) System.out.println(a+"+"+b+"+"+c+"+"+d+"=7");
		else if(a+b+c-d==7) System.out.println(a+"+"+b+"+"+c+"-"+d+"=7");
		else if(a+b-c+d==7) System.out.println(a+"+"+b+"-"+c+"+"+d+"=7");
		else if(a-b+c+d==7) System.out.println(a+"-"+b+"+"+c+"+"+d+"=7");
		else if(a-b-c+d==7) System.out.println(a+"-"+b+"-"+c+"+"+d+"=7");
		else if(a-b+c-d==7) System.out.println(a+"-"+b+"+"+c+"-"+d+"=7");
		else if(a+b-c-d==7) System.out.println(a+"+"+b+"-"+c+"-"+d+"=7");
		else if(a-b-c-d==7) System.out.println(a+"-"+b+"-"+c+"-"+d+"=7");
		
		in.close();

	}

}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define all(c) (c).begin(), (c).end()
const int INF = 1e9 + 1;
const ll LINF = 1e18 + 1;
const ll MOD = 1e9 + 7;

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

  int M;
  cin >> M;

  ll ans = 0;
  ll rest = 0;

  for (int i = 0; i < M; ++i) {
    ll d, c;
    cin >> d >> c;
    ll tmp = rest + c * d;
    ans += c;
    ans += tmp / 9;
    rest = tmp % 9;
    if (rest == 0) {
      --ans;
      rest = 9;
    }
  }
  --ans;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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 Bit {
    vector<ll> bit[2];
    int N;
    void init(int n) {
        for (int i = 0; i < 2; i++) bit[i].assign(n + 2, 0);
        N = n + 1;
    }

    ll sub_sum(int p, int i) {
        ll s = 0;
        while (0 < i) {
            s += bit[p].at(i);
            i -= i & -i;
        }
        return s;
    }
    // 1-indexed
    ll sum(int i) { return sub_sum(0, i) + sub_sum(1, i) * i; }
    // [a, b]
    ll sum(int a, int b) { return sum(b) - sum(a - 1); }

    void sub_add(int p, int i, ll v) {
        while (i <= N) {
            bit[p].at(i) += v;
            i += i & -i;
        }
    }
    //[a, b] 1-indexed
    void add(int a, int b, ll v) {
        sub_add(0, a, -v * (a - 1));
        sub_add(1, a, v);
        sub_add(0, b + 1, v * b);
        sub_add(1, b + 1, -v);
    }
};  

int main() {
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<pair<ll, ll>> m(n);
    for (int i = 0; i < n; i++) {
        int x, h;
        cin >> x >> h;
        m.at(i) = make_pair(x, h);
    }
    sort(m.begin(), m.end());
 
    auto binary_search = [&](ll x){
        int ng = n;
        int ok = -1;
 
        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
 
            if (m.at(mid).first <= x) ok = mid;
            else ng = mid;
        }
        return ok;
    };
    
    Bit bit;
    bit.init(n + 1);
    for (int i = 0; i < n; i++) {
        bit.add(i + 1, i + 1, m.at(i).second);
    }

    ll cnt = 0;
    for (int l = 0; l < n; l++) {
        ll h = bit.sum(l + 1, l + 1);
        if (h <= 0) continue;

        int r = binary_search(m.at(l).first + d * 2);
        ll c = (h + a - 1) / a;
        cnt += c;
        bit.add(l + 1, r + 1, c * -a);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 6528
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int num[100001];
int main() {
    int N;
    scanf("%d",&N);

    int i,c = N,x = 0;
    while (!(c & 1)) c /= 2,x++;
    if (c == 1) {
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n",N+1,N+1,N+2,N+2,N+3);
    num[2] = 2;
    for (i = 4; i+1 <= N; i += 2) {
        printf("%d %d\n%d %d\n%d %d\n%d %d\n",1,i,i,i+1,1,i+1+N,i+1+N,i+N);
        num[i] = i,num[i+1] = i+1+N;
    }
    if (!(N & 1)) {
        int x = N^(N-1)^1;
        printf("%d %d\n%d %d\n",N,num[N-1],num[x],2*N);
    }

    return 0;
}



Measured memory_bytes: 2688
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

const INF: usize = 1 << 60;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let c = sc.chars();
    let mut r = 0;
    let mut w = 0;
    for i in 0..N {
        if c[i] == 'R' {
            r += 1;
        }
    }
    let mut ans = r;
    for i in 0..N {
        if c[i] == 'W' {
            w += 1;
        } else {
            r -= 1;
        }
        ans = min(ans, max(r, w));
    }
    println!("{}", ans);
}


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

int main() {
  double W,H,x,y;
  cin >> W >> H >> x >> y;
  cout << W * H / 2 << ' ';
  if (x*2 == W && y * 2 == H) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;

    string res = s;
    bool found = false;

    rep(i, s.size() - t.size() + 1) {
        bool ok = true;
        rep (j, t.size()) {
            if ('?' != s[i + j] && s[i+j] != t[j]) {
                ok = false;
                break;
            }
        }

        if (ok) { 
            string S = s;
            rep (j, t.size()) {
                S[i + j] = t[j];
            }
            rep (j, S.size()) {
                if (S[j] == '?') S[j] = 'a';
            }
            if (!found || S < res) {
                res = S;
                found = true;
            }
        }
    }

    if (found) {put(res)}
    else {put("UNRESTORABLE")}
    

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define OK puts("OK");
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define rep(i,n) for (i=0;i<(n);++i)
#define rep1(i,n) for (i=1;i<=(n);++i)
#define ret return
#define int long long
#define scan1(a) scanf("%lld",&(a));
#define scan2(a,b) scanf("%lld %lld",&(a),&(b));
#define scan3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c));
#define nemeshay ios::sync_with_stdio(0),cin.tie(0);
const int INF=1e9+7,N=2e5+12;
int dp[4][N],a[N],b[N],c[N];
main(){
    int n,i,j,k;
    scan1(n)
    rep(i,n)
        scan3(a[i],b[i],c[i]);
    dp[1][0]=a[0];
    dp[2][0]=b[0];
    dp[3][0]=c[0];
    for (i=1;i<=n;++i){
        dp[1][i] += max(dp[2][i-1],dp[3][i-1])+a[i];
        dp[2][i] += max(dp[1][i-1],dp[3][i-1])+b[i];
        dp[3][i] += max(dp[2][i-1],dp[1][i-1])+c[i];
    }
    cout <<max(max(dp[1][n],dp[2][n]),dp[3][n]);
}










Measured memory_bytes: 7680
import java.io.*;
public class Main{
	public static void main(String [] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] st=br.readLine().split(" ");
		int[] in=new int[3];
		for(int i=0;i<3;i++){
		in[i]=Integer.parseInt(st[i]);}
		for(int i=0;i<2;i++){
			for(int j=i+1;j<3;j++){				
				if(in[i]>in[j]){int tmp=in[i];
					in[i]=in[j];
					in[j]=tmp;
				}
			}
		}System.out.println(in[0]+" "+in[1]+" "+in[2]);
	}}

Measured memory_bytes: 16896
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
int main()
{
    int n;
    cin >> n;
    int m = n % 10;
    if (m == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    n /= 10;
    m = n % 10;
    if (m == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    n /= 10;
     m = n % 10;
    if (m == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(void)
{
int  i,j,k,sum=0;
scanf("%d %d %d",&i,&j,&k);
sum=i*100+j*10+k;
if(sum==100||sum==10||sum==0){
printf("Close\n");
}
if(sum==110||sum==1){
printf("Open\n");
}
return 0;
}

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

int N, D;
int X[10 + 10][10 + 10];

int main() {
    cin >> N >> D;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < D; j++) {
            cin >> X[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N-1; i++) {
        for (int j = i + 1; j < N; j++) {
            double d = 0;
            for (int k = 0; k < D; k++) {
                d += (X[i][k] - X[j][k])*(X[i][k] - X[j][k]);
            }
            d = sqrt(d);

            int c_d = (int)d;
            if (c_d == d) ans++;
        }
    }  

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


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  vl time(5); ll sum = 0; ll h = 10;
  
  rep(i,5) cin >> time[i];
  
  rep(i,5){
    if(time[i] % 10 != 0) h = min(h,time[i] % 10);
    sum += (time[i] + 9)/10 * 10;
  }
  
  cout << sum - 10 + h;
  
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n; cin>>n;
    string s; cin>>s;
    int w[n]={},cnt=0;
    for(int i=0;i<n;i++){
        if(s[i]=='#') cnt++;
        w[i]=cnt;
    }
    int b[n]={};
    cnt=0;
    for(int i=n-1;i>=0;i--){
        if(s[i]=='.') cnt++;
        b[i]=cnt;
    }
    int ans=min(b[0],w[n-1]);
    for(int i=0;i<n-1;i++){
        ans=min(ans,w[i]+b[i+1]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2180
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextLong();
        }
        long l = a[0];
        long r = 0;
        for (int i = 1 ; i < n ; i++) {
            r += a[i];
        }

        long min = Math.abs(l - r);
        for (int i = 1 ; i < n - 1 ; i++) {
            l += a[i];
            r -= a[i];
            min = Math.min(min, Math.abs(l - r));
        }
        System.out.println(min);

    }

}

Measured memory_bytes: 73188
import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    n = sc.intarr()[0]
    array = sc.intarr_ver(n)

    minimum = array[0]
    ans = -1000000001
    for i in range(1, n):
        if array[i] - minimum > ans:
            ans = array[i] - minimum
        if array[i] < minimum:
            minimum = array[i]

    print(ans)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()



Measured memory_bytes: 13676
def getinputdata():
    # 配列初期化
    array_result = []

    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if (data != ""):

                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result


arr_data = getinputdata()

n = int(arr_data[0][0])
t = int(arr_data[0][1])

arr = [int(x) for x in arr_data[1]]

mysum = 0
# print(n, t, arr)

for i in range(0, n-1):

    if arr[i + 1] - arr[i] >= t:

        mysum += t
    else:

        mysum += arr[i + 1] - arr[i]

print(mysum+t)


Measured memory_bytes: 25836
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

#define MOD 1000000007


int n;
string s;


int dp[3001][3001];


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

	cin >> n >> s;

	
	rep(i, n)dp[0][i] = 1;

	rep(i, s.size()){
		rep(j, n) if (dp[i][j]) {
			if (s[i] == '<') {
				int nl = n - i - j - 1;
				(dp[i + 1][j + 1 - 1] += dp[i][j]) %= MOD;
				(dp[i + 1][j + nl - 1 + 1] -= dp[i][j]) %= MOD;
			}
			else {
				int ns = j;
				(dp[i + 1][ns - ns] += dp[i][j]) %= MOD;
				(dp[i + 1][ns - 1 + 1] -= dp[i][j]) %= MOD;
			}
		}


		int imos = 0;
		rep(j, n) {
			imos += dp[i + 1][j];
			imos = (imos %MOD + MOD) % MOD;
			dp[i + 1][j] = imos;
		}
	}


	cout << dp[s.size()][0] << endl;


	return 0;
}


Measured memory_bytes: 35456
#include<iostream>

using namespace std;

int main(){
  string s;
  cin >> s;
  
  string ans;
  for(int i=0;i<s.length();i+=2){
    //ans[i]=s[2*i];
    //cout<<ans[i];
    cout << s[i];
  }
  
  
  
  return 0; 
}

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll a,b;cin>>a>>b;
  ll tmp;
  ll x = a * b;

  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  /* ユークリッドの互除法 */
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  out(x/b);


  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)
using P = pair<int,int>;

int main(){
	int N;
	cin >> N;
	vector<int> d(N);
	rep(i, N) cin >> d[i];
	int ans = 0;
	for(int i = 0; i < N; ++i){
		for(int j = i+1; j < N; ++j){
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    long long n;
    long long hasil = 1;

    scanf("%lld", &n);
    long long input[n];

    for(int i=0; i<n; i++){
        scanf("%lld", &input[i]);
    }
    for(int i=0; i<n; i++){
        if(input[i] == 0){
            printf("0\n");
            return 0;
        }
    }
    for(int i=0; i<n; i++){
        if(input[i] <= 1000000000000000000/hasil){
            hasil *= input[i];
        } else {
            printf("-1\n");
            return 0;
        }

    }
    printf("%lld\n", hasil);
    return 0;
}

Measured memory_bytes: 2500
#include <stdio.h>
int main()
{
    int M=0,N=0,P=0,count=0;
    scanf("%d",&M);
    for(int i=1;i<=M;i++)
    {
        N=i;
        while(N!=0)
        {
            N=N/10;
            ++P;
        }
        if(P%2!=0)
        {
            count++;
        }
        P=0;
    }

    printf("%d",count);
    return 0;
}

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

int main()
{
        int n;
        cin >> n;
        int ans = 0;
        
                for(int i = 1; i<= n;i+=2)
                {
                        int yaku = 0;
                        for(int j= 1; j<= i; j++)
                        {
                                if(i % j == 0)
                                {
                                        yaku++;
                                }
                        }
                        if(yaku == 8)
                        {
                                ans++;
                        }
                }

        cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector< pair<int,int> >v;
  int n,a,b;
  cin>>n;
  while(n--){
    cin>>a>>b;
    v.push_back(make_pair(a,b));
  }
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++)
  cout<<v[i].first<<' '<<v[i].second<<endl;

return 0;;
}



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

int main() {
  int n,m;
  cin>>n>>m;
  vector<bool> ans(n,0);
  int ac_cnt=0;
  vector<int> pn_cnt(n,0);
  rep(i,m){
    int p;
    string s;
    cin>>p>>s;
    p--;
    if(!ans[p]){
      if(s=="AC"){
        ans[p]=1;
        ac_cnt++;
      }else{
        pn_cnt[p]++;
      }
    }
  }
  int pn=0;
  rep(i,n){
    if(ans[i]){
      pn+=pn_cnt[i];
    }
  }
  cout<<ac_cnt<<" "<<pn<<endl;
}

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

int main() {
    
    int n, a, b; cin >> n >> a >> b;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int tmp = i;
        int sum = 0;
        while (tmp > 0) {
            sum += tmp % 10;
            tmp /= 10;
        }
        if (a <= sum && sum <= b) ans += i;
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
     
    using namespace std;
     
    int main()
    {
        int n;
        cin >> n;
        long long int sum = 0;
        for (long long int i = 0; i <= n; i++)
        {
            if (i % 3 == 0 || i % 5 == 0)
            {
                continue;
            }
            sum += i;
        }
        cout << sum << "\n";
        return 0;
    }

Measured memory_bytes: 3624
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    one_time = M * 1900 + (N-M) * 100

    print(one_time * (2**M) )


    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import sys
from collections import defaultdict

s, t = sys.stdin.read().split()
n = len(s)

def main():
    correspondence = defaultdict(str)
    for i in range(n):
        if not correspondence[s[i]]:
            correspondence[s[i]] = t[i]
        else:
            if correspondence[s[i]] != t[i]:
                return 'No'

    v = correspondence.values()
    return 'Yes' if len(v) == len(set(v)) else 'No'
    
if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 4084
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  int N, K;
  std::cin >> N >> K;
  
  std::vector<int> H(N, 0);
  for (int i=0; i<N; ++i) std::cin >> H.at(i);
  
  std::sort(H.begin(), H.end());
  
  while (!H.empty() && K-- > 0) {
    H.pop_back();
  }
  
  long long result = 0;
  
  for (const auto & e : H) {
    result += e;
  }
  
  std::cout << result << "\n";
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N[] = new int[100];
    int n = sc.nextInt();
    int m = 0;
    for (int i = 0; i < n; i++) N[i] = sc.nextInt();
    for (int i = 0; i < n-1; i++) {
        int min = i;
        for (int j = i+1; j < n; j++) {
            if (N[j] < N[min]) {
                min = j;
            }
        }
        if (min != i) m++;
        int temp = N[i];
        N[i] = N[min];
        N[min] = temp;
    }
    for (int i = 0; i < n; i++) {
      if (i == 0) System.out.printf("%d", N[i]);
      else System.out.printf(" %d", N[i]);
    }
    System.out.printf("\n");
    System.out.println(m);
  }
}



Measured memory_bytes: 26480
#include <iostream>
#include<bits/stdc++.h>
#define pb(x) push_back(x

using namespace std;


int main() {
    int n, x, t;
  	cin>>n>>x>>t;
  	int rem = n/x;
  	int ans= rem*t;
  	if(n%x != 0)
      ans+=t;
 	cout<<ans;
	return 0;
}


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


void solve(long long N, long long M, std::vector<long long> p, std::vector<std::string> S){
    vector<long long> ac(N+1, 0);
    vector<long long> wa(N+1, 0);
    for(int i = 0; i < M; ++i){
        if(ac[p[i]] == 0){
            if(S[i] == "AC") ac[p[i]] = 1;
            else wa[p[i]] += 1;
        }
    }
    //for(auto i : ac) cout << "AC: " << i << endl;
    //for(auto i : wa) cout << "WA: " << i << endl;
    long long cnt_wa = 0;
    for(int i = 0; i < N + 1; ++i){
        if(ac[i] == 1) cnt_wa += wa[i]; 
    }
    cout << accumulate(ac.begin(), ac.end(), 0LL) << " " << cnt_wa << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        std::cin >> S[i];
    }
    solve(N, M, std::move(p), std::move(S));
    return 0;
}


Measured memory_bytes: 8744
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    int a[n];
    rep(i,n){
        cin >> a[i];
    }
    sort(a, a + n);
    if(a[0] == a[n - 1]){
        if(a[0] == n - 1 || (1 <= a[n - 1] && a[n - 1] <= n / 2)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        return 0;
    }
    if(a[n - 1] - a[0] != 1){
        cout << "No" << endl;
        return 0;
    }
    int s = 0, l = 0;
    rep(i,n){
        if(a[i] == a[0]) s++;
        else l++;
    }
    if(s + 1 <= a[n - 1] && a[n - 1] <= s + l / 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
import java .util.Scanner;
 
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		if(S.equals("ABC")) {
			System.out.println("ARC");
		} else {
			System.out.println("ABC");
		}
	}
}

Measured memory_bytes: 35472
h,n = map(int,input().split())
dp = [[10000000000 for i in range(h+1)] for j in range(n+1)]
dp[0][0] = 0


for i in range(n):
    a,b = map(int,input().split())
    for j in range(h+1):
        if dp[i+1][j] > dp[i][j]:
            dp[i+1][j] = dp[i][j]
        nex = min(h,j+a)
        if dp[i+1][nex] > dp[i+1][j] + b:
            dp[i + 1][nex] = dp[i + 1][j] + b


# for line in dp:
#     print(line)

print(dp[-1][h])

Measured memory_bytes: 126964
# 2019/12/01
# 三井住友信託銀行プログラミングコンテスト2019 - C

# Input
x = int(input())

# Calc
wk_v = x % 100
if wk_v <= int(int(x / 100) * 100 * 0.05):
    ans = 1
else:
    ans = 0

# Output
print(ans)

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

namespace ProconTemplate
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_d
    class abc140_c
    {
        public static void Main(string[] args)
        {
            string[] asInput = Console.ReadLine().Split(' ');
            int N = int.Parse(asInput[0]);
            int K = int.Parse(asInput[1]);
            string s = Console.ReadLine();

            //int Q = int.Parse(asInput[2]);
            //int[] aiAns = new int[N];
            //for (int i = 0; i < Q; i++)
            //{
            //    aiAns[ int.Parse(Console.ReadLine()) - 1 ] ++;
            //}
            //int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            //int[] B = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            //int[] C = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            //int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();


            int iCnt = 0;

            //1回の操作で、幸せな人を最大二人増やせる
            //幸せにできる最大の人数はN-1人

            for (int i = 0; i < N-1; i++)
            {
                if (s[i] == s[i + 1]) iCnt++;
            }

            Console.WriteLine( Math.Min( iCnt + K * 2, N - 1 ) );

        }
    }
}


Measured memory_bytes: 13280
#!/usr/bin/env python
# -*- coding:utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
F=0
X=10000
for i in range(N-1):
     if A[i]==A[i+1]:
         A[i+1] = X
         F=F+1
         X=X-1
print(F)


Measured memory_bytes: 2940
import sys

input = sys.stdin.readline


def main():
    K, T = map(int, input().split())
    A = list(map(int, input().split()))

    prev_idx = -1
    ans = 0
    for _ in range(K):
        cur_idx = -1
        max_num = 0
        for i, a in enumerate(A):
            if i == prev_idx:
                continue
            if a > max_num:
                max_num = a
                cur_idx = i
        if max_num == 0:
            ans = A[prev_idx]
            break
        A[cur_idx] -= 1
        prev_idx = cur_idx

    print(ans)


if __name__ == "__main__":
    main()


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

#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define for1(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define clr(x) memset((x), 0, sizeof((x)));
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long i64;
typedef unsigned long long ull;

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

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

int nxt() {
    int x;
    scanf("%d", &x);
    return x;
}

ll nxtll() {
    ll x;
    scanf("%" PRId64, &x);

    return x;
}

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

typedef ll ptdata;

struct pt {
    ptdata x, y;

    pt() {}

    pt(ptdata x, ptdata y) : x(x), y(y) {}

    inline pt operator-(const pt &r) const {
        return pt(x - r.x, y - r.y);
    }

    inline pt operator+(const pt &r) const {
        return pt(x + r.x, y + r.y);
    }

    inline pt operator*(const ld &r) const {
        return pt(x * r, y * r);
    }

    inline ptdata sqlen() const {
        return abs(x * x + y * y);
    }

    inline bool operator<(const pt &r) const {
        if (x != r.x) return x < r.x;
        return y < r.y;
    }

    inline bool operator==(const pt &r) const {
        return x == r.x && y == r.y;
    }
};

ostream &operator<<(ostream &os, const pt &p) {
    return os << "(" << p.x << "," << p.y << ")";
}

inline ptdata cross(const pt &l, const pt &r) {
    return l.x * r.y - l.y * r.x;
}

inline ptdata dot(const pt &l, const pt &r) {
    return l.x * r.x + l.y * r.y;
}


ll pwmod(ll a, ll n, ll mod) {
    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

template<typename T>
inline T sqr(T x) {
    return x * x;
}


void solve() {
    int n = nxt();
    vector<ll> a(n), b(n);
    forn(i, n) {
        a[i] = nxt();
        b[i] = nxt();
    }
    ll add = 0;
    ll ans = 0;
    ford(i, n) {
        a[i] += add;
        ll q = (a[i] + b[i] - 1) / b[i];
        q *= b[i];
        add += q - a[i];
        ans += q - a[i];
    }
    cout << ans << "\n";
}

void prepare() {

}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    prepare();

    int t = 1;//nxt();
    forn(i, t) {
        solve();
    }

    //cerr << "Time " << clock() / (double) CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k, h, g;
  in2(n, k);
  h = 0;
  vector<pair<ll, ll>> c(n);
  rep(i, n)
    in2(c[i].first, c[i].second);
  sort(all(c));
  g = 0;
  while(h < k){
    h = h + c[g].second;
    g++;
    if(h >= k){
      out(c[g - 1].first);
      memi;
    }
  }
}

Measured memory_bytes: 1792
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let s: Vec<&str> = s.trim().split(' ').collect();
    let n: i32 = s[0].parse().unwrap();

    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let a: Vec<&str> = a.trim().split(' ').collect();
    let a: Vec<i32> = a.into_iter().map(|x| x.parse::<i32>().unwrap()).rev().collect();

    let sum = a.into_iter().fold(0, |x, y| x+y);

    let days = if n >= sum { n-sum } else { -1 };

    println!("{}", days);
}

Measured memory_bytes: 2360
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  ll n;
  cin>>n;
  vector<ll> a(n),b(n);
  rep(i,n) cin>>a[i]>>b[i];
  reverse(ALL(a));
  reverse(ALL(b));
  ll ans=0;
  ll tmp=0;
  rep(i,n){
    a[i]+=ans;
    if(a[i]%b[i]==0) tmp=0;
    else tmp=(b[i]-a[i]%b[i]);
    a[i]+=tmp;
    ans+=tmp;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
int main(void){
    int i,j;
    char s[11];
    long long ans = 0;
    scanf("%s",s);
    for(i=0;i<1<<(strlen(s)-1);i++){
        long long tmp=s[0]-'0';        
        for(j=0;j<strlen(s)-1;j++){
            if(i&(1<<j)){
                ans += tmp;
                tmp=(s[j+1]-'0');
            }
            else{
                tmp = tmp*10+(s[j+1]-'0');
            }
        }
        ans += tmp;
    }
    printf("%lld",ans);
}

Measured memory_bytes: 1712
H, W = map(int, input().split())
S = [input() for i in range(H)]
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            cnt = 0
            for k in range(8):
                if(i+dy[k] >= 0 and i+dy[k] < H and j+dx[k]>=0 and j+dx[k] < W and S[i+dy[k]][j+dx[k]]=='#'):
                    cnt+=1
            print(cnt, end='')
        else:
            print(S[i][j], end='')
    print('')




Measured memory_bytes: 3444
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader tec = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		for (String line; (line = tec.readLine()) != null;) {
			int n = Integer.parseInt(line.trim());
			int[] arr = new int[n];
			StringTokenizer st = new StringTokenizer(tec.readLine());
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(st.nextToken());
			if (n == 1) {
				out.println(1);
				break;
			}
			int cont = 1;

			for (int indice = 0; indice < arr.length; indice++) {

				boolean bool = true;
				boolean decidido=false;
				// true ascendente
				boolean cambio=false;
				for (int i = indice; i < arr.length - 1; i++) {
					if(arr[i]<arr[i+1]&&!decidido){
						decidido=true;
						bool=true;						
					}
					if(arr[i]>arr[i+1]&&!decidido){
						decidido=true;
						bool=false;						
					}					
					if (arr[i] < arr[i + 1] && !bool&&decidido) {
						cont++;
						bool = !bool;
						indice=i;
						cambio=true;
						break;
					}
					if (arr[i] > arr[i + 1] && bool&&decidido) {
						cont++;
						bool = !bool;
						indice=i;
						cambio=true;
						break;
					}
				}
				if(!cambio){
					break;
				}
			}
			out.println(cont);
		}
		out.close();
	}
}

Measured memory_bytes: 36384
#include <stdio.h>

int main(void) {
	int a, b;
	int N;
	int s, f;
	int i;
	if (scanf("%d%d", &a, &b) != 2) return 1;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d%d", &s, &f) != 2) return 1;
		if (s < b && a < f) {
			puts("1");
			return 0;
		}
	}
	puts("0");
	return 0;
}



Measured memory_bytes: 2140
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
const int mod = 1000000009;

ll a,b,c,k,ret;

int main(){
    cin >> a >> b >> c >> k;
    k = k&1;
    for (ll i = 0; i<k; i++){
        ll ai = b+c;
        ll bi = a+c;
        ll ci = a+b;
        a = ai;
        b = bi;
        c = ci;
    }
    cout << a-b << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = intRead();
        int ans = 0;
        int box, max = 0;
        for (int i = 0; i < N; i++)
        {
            box = intRead();
            max = Math.Max(max, box);
            ans += box;
        }
        Console.WriteLine(ans - max / 2);
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static long LCM(long a, long b)
    {
        long c = a * b;
        if (a < b) Swap(ref a, ref b);
        long d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }
    public static string ToConvertBit(int N, int e)
    {
        string ret = "";
        int r = 0;
        while (N != 0)
        {
            r = N % e;
            ret += r.ToString();
            N -= r;
            N /= e;
        }
        ret = strReverce(ret);
        return ret;
    }

}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N, K;
long long h[505];

int main(){
	cin >> N >> K;
	long long h;
	long long num = 0;
	rep(i, N) {
		cin >> h;
		if(h >= K) num++;
	}
	cout << num << endl;
}

Measured memory_bytes: 3616