akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
//const int inf = 0x3f3f3f3f;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define pc putchar
//#define gc getchar
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
#define gc getchar
#define rank __RANK
inline ll read(){
    register ll x=0,f=1;register char c=gc();
    for(;!isdigit(c);c=gc())if(c=='-')f=-1;
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
void Max(ll &x,ll y){x=x<y?y:x;}
void Min(ll &x,ll y){x=x>y?y:x;}

const ll N=500010;
ll cqz[N],a[N],sum[N],Mx[3][N],Mn[3][N],mx[3][N],mn[3][N],n,answ=2e18;
signed main(){
	n=read();
	Rep(i,1,n)cqz[i]=read(),sum[i]=cqz[i]+sum[i-1];
	ll pos=0;
	Rep(i,2,n){
		for(;sum[pos]<sum[i]-sum[pos];++pos);
		mx[1][i]=max(sum[pos],sum[i]-sum[pos]);
		mn[1][i]=min(sum[pos],sum[i]-sum[pos]);
		--pos;
		mx[2][i]=max(sum[pos],sum[i]-sum[pos]);
		mn[2][i]=min(sum[pos],sum[i]-sum[pos]);
		++pos;
	}
	reverse(cqz+1,cqz+n+1);
	Rep(i,1,n)sum[i]=sum[i-1]+cqz[i];
	pos=0;
	Rep(i,2,n){
		for(;sum[pos]<sum[i]-sum[pos];++pos);
		Mx[1][i]=max(sum[pos],sum[i]-sum[pos]);
		Mn[1][i]=min(sum[pos],sum[i]-sum[pos]);
		--pos;
		Mx[2][i]=max(sum[pos],sum[i]-sum[pos]);
		Mn[2][i]=min(sum[pos],sum[i]-sum[pos]);
		++pos;
	}
	Rep(i,2,n-2)Rep(a,1,2)Rep(b,1,2){
		Min(answ,max(Mx[a][n-i],mx[b][i])-min(Mn[a][n-i],mn[b][i]));
	}
	writeln(answ);
}

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

int main(void){
	map<string,int> m;
	int q;
	int x,y;
	string s;
	cin>>q;
	while(q--){
		cin>>x>>s;
		if(!x){
			cin>>x;
			m[s]=x;
		}else{
			cout<<m[s]<<endl;
		}
	}
}



Measured memory_bytes: 27648
#include<iostream>

using namespace std;
int main()
{
    int i,a,sc=0,fc=0;
    for(i=0;i<3;i++)
    {
cin>>a;
if(a==5)
fc++;
if(a==7)
sc++;
    }
    if((fc==2)&&(sc==1))
    cout<<"YES";
    else
    {
        cout<<"NO";
    }
    

return 0;
}

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

int main(){
  int n; cin >> n;
  
  if(n<=111) cout << 111 << endl;
  else if(n>111 && n<=222) cout << 222 << endl;
  else if(n>222 && n<=333) cout << 333 << endl;
  else if(n>333 && n<=444) cout << 444 << endl;
  else if(n>444 && n<=555) cout << 555 << endl;
  else if(n>555 && n<=666) cout << 666 << endl;
  else if(n>666 && n<=777) cout << 777 << endl;
  else if(n>777 && n<=888) cout << 888 << endl;
  else cout << 999 << endl;
 
    return 0;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))

diff = H[:-1] - H[1:]

ans = 0
tmp = 0
for d in diff:
    if d>=0:
        tmp += 1
        if ans<tmp:
            ans = tmp
    else:
        tmp = 0

print(ans)

Measured memory_bytes: 23388
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const long long int MOD = 1000000007;
const int INF = 1000000000;

int n, m;
int x[128][11];
map<string,int> dp;

int dfs(string str){
    //cout << str << endl;
    if(dp.count(str)){
        return dp[str];
    }
    int cnt = 0;
    rep(i,n){
        if(str[i]=='1') cnt++;
    }
    if(cnt == 1){
        return 0;
    }
    int ret = INF;
    rep(i,m){
        string a, b;
        bool oka = false, okb = false;
        rep(j,n){
            if(str[j] == '0'){
                a.push_back('0');
                b.push_back('0');
            } else{
                if(x[j][i]){
                    a.push_back('1');
                    b.push_back('0');
                    oka = true;
                } else{
                    a.push_back('0');
                    b.push_back('1');
                    okb = true;
                }
            }
        }
        if(oka == false || okb == false) continue;
        ret = min(ret,max(dfs(a),dfs(b))+1);
    }
    //cout << ret << endl;
    dp[str] = ret;
    return ret;
}

void solve(){
    dp.clear();
    rep(i,n) rep(j,m){
        char hoge;
        cin >> hoge;
        if(hoge == '1') x[i][j] = 1;
        else x[i][j] = 0;
    }
    if(n == 1){
        cout << 0 << endl;
        return;
    }
    string hoge;
    rep(i,n) hoge.push_back('1');
    cout << dfs(hoge) << endl;
}

int main(){
    while(cin >> m >> n){
        if(n == 0 && m == 0) break;
        solve();
    }
}

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

long long mon[100005],hero[100005];
long long n,total=0;

int main()
{
	cin>>n;
	for (int i=1;i<=n+1;i++)  cin>>mon[i];
	for (int i=1;i<=n;i++)  cin>>hero[i];
	for (int i=1;i<=n;i++)
	{
		if (hero[i]>=mon[i])
		{
			total+=mon[i];
			hero[i]-=mon[i];
			mon[i]=0;
			if (mon[i+1]>=hero[i])
			{
				mon[i+1]-=hero[i];
				total+=hero[i];
				hero[i]=0;
			}
			else
			{
				hero[i]-=mon[i+1];
				total+=mon[i+1];
				mon[i+1]=0;
			}
		}
		else
		{
			total+=hero[i];
			mon[i]-=hero[i];
			hero[i]=0;
		}
	}
	cout<<total<<endl;
	return 0;
} 

Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val (a, b) = getInts()

    println(if (a == b) "Yes" else "No")
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }


Measured memory_bytes: 37788
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#define ll long long
using namespace std;
struct city{
	int fa,ti;
}c[100009];
int read(){
	char c;int num,f=1;
	while(c=getchar(),!isdigit(c))if(c=='-')f=-1;num=c-'0';
	while(c=getchar(), isdigit(c))num=num*10+c-'0';
	return f*num;
}
int n,m,u,t;
vector<int>g[100009];
bool cmp(int a,int b){return a<b;}
int fd(int a,int b){
	int l=0,r=g[a].size(),mid;
	while(l<=r){
		mid=(l+r)>>1;
		if(g[a][mid]==b)return mid+1;
		if(g[a][mid]>b)r=mid-1;
		else l=mid+1;
	}
	return -1;
}
int main()
{
	n=read();m=read();
	for(int i=1;i<=m;i++){
		u=read();t=read();
		c[i].fa=u;c[i].ti=t;
		g[u].push_back(t);
	}
	for(int i=1;i<=n;i++)
		sort(g[i].begin(),g[i].end(),cmp);
	for(int i=1;i<=m;i++)
		c[i].ti=fd(c[i].fa,c[i].ti);
	for(int i=1;i<=m;i++)
		printf("%06d%06d\n",c[i].fa,c[i].ti);
	return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll i,a,b,d,k,l1,r1,l2,r2,bi[101];
int main(){
	scanf("%lld%lld",&b,&a);
	if(a==b)return puts("1"),0;
	bi[0]=1;
	for(i=1;i<=60;i++)bi[i]=bi[i-1]*2;
	d=60;
	while((a&bi[d])==(b&(bi[d])))d--;
	a&=bi[d+1]-1;
	b&=bi[d+1]-1;
	k=d-1;
	while(k>=0&&!(a&(bi[k])))k--;
	l1=b;r1=bi[d]+bi[k+1]-1;
	l2=bi[d]+b;r2=bi[d+1]-1;
	l2=max(l2,r1+1);
	printf("%lld",r1-l1+1+max(0ll,r2-l2+1));
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner scanner = new Scanner(System.in)) {
			String data1 = scanner.nextLine();
			String data2 = scanner.nextLine();

			String[] arr1 = data1.split(" ");
			String[] arr2 = data2.split(" ");

			int syurui = Integer.parseInt(arr1[0]);
			int sentaku = Integer.parseInt(arr1[1]);

			List<Integer> list = new ArrayList<Integer>();
			for (String str : arr2) {
				list.add(Integer.parseInt(str));
			}

			Collections.sort(list);

			int total = 0;
			for (int i = 0; i < sentaku; i++) {
				total += list.get(i);
			}

			System.out.println(total);
		}
	}
}

Measured memory_bytes: 37364
#include<stdio.h>
#include<string.h>
int main(){
    char a[201],b[200];
    int m,i,h,c,j;
    while(1){
        scanf("%s",a);
        c=strlen(a);
        if(a[0]=='-'){
            break;
        }
        scanf("%d",&m);
        for(i=0;i<m;i++){
            scanf("%d",&h);
            for(j=0;j<h;j++){
                b[j]=a[j];
            }
            for(j=h;j<c;j++){
                a[j-h]=a[j];
            }
            for(j=0;j<h;j++){
                a[c-h+j]=b[j];
            }
        }
        for(i=0;i<c;i++){
            printf("%c",a[i]);
        }
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 2060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int ans = 0;
		
		for(int i=0; i<s.length(); i++) {
			if(s.charAt(i) == '+') ans++;
			else ans--;
		}
		
		System.out.println(ans);		
	}
}

Measured memory_bytes: 23636
/*
AizuOnline A1153
Equal Totaol Score
*/
#include <stdio.h>
#include <limits.h>
int n=0 , m=0 ;
int taro[100];
int hanako[100];
main() 
{
  int taro_c,hanako_c,diff;
  int i,j;
  int minval;


  while(EOF != scanf(" %d",&n) &&
	EOF != scanf(" %d",&m) && (m||n)) 
    {
      taro_c=0;hanako_c=0;

      for(i=0;i<n;i++)
	scanf(" %d",&(taro[i]));
      for(i=0;i<m;i++)
	scanf(" %d",&(hanako[i]));

      for(i=0;i<n;i++)
	taro_c += taro[i];
      for(i=0;i<m;i++)
	hanako_c += hanako[i];

      diff = taro_c-hanako_c;
      minval = INT_MAX;
      if(diff % 2)
	goto NA;

      for(i=0;i<n;i++)
	for(j=0;j<m;j++)
	  {
	    if(taro[i]-hanako[j] == diff/2 && taro[i] < minval)
	      minval = taro[i];
	  }

 NA:
      if(minval < INT_MAX)	  
	printf("%d %d\n",minval,minval-diff/2);
      else
	printf("-1\n");
    }

return(0);
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

int N;
ll A[100005];

ll sum(int a, int b) {
    ll res = 0;
    for(int i=a;i<b;++i)res += A[i];
    return res;
}

int main() {
    
    cin>>N;
    for(int i=0;i<N;++i)cin>>A[i];
    sort(A, A+N);

    if(N%2==0) {
        ll ans;

        ans = 2*sum(N/2+1, N) + A[N/2];
        ans -= 2*sum(0, N/2-1) + A[N/2-1];

        cout << ans << endl;
    }else {
        ll lsl;

        lsl = 2*sum(N/2+2, N) + A[N/2+1] + A[N/2];
        lsl -= 2*sum(0, N/2);

        ll sls;

        sls = 2*sum(N/2+1, N);
        sls -= 2*sum(0, N/2-1) + A[N/2-1] + A[N/2];

        if(lsl>sls)cout << lsl << endl;
        else cout << sls << endl;
    }

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define ll long long
int main() {
	string s;
	cin>>s;
	if(s=="SUN")
	 cout<<7;
	else if(s=="MON")
	cout<<6;
	 else if(s=="TUE")
	 cout<<5;
	 else if(s=="WED")
	 cout<<4;
	 else if(s=="THU")
	 cout<<3;
	 else if(s=="FRI")
	 cout<<2;
	 else if(s=="SAT")
	 cout<<1;
	 return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int s(int x,int y)
{
    if(x<=y) return y-x;
        else return x-y+2;
}
int main()
{
    int x,y;
    scanf("%d %d",&x,&y);
    printf("%d\n",min(s(x,y),min(s(-x,y)+1,min(s(x,-y)+1,s(-x,-y)+2))));
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    int n;
    cin >> n;
    REP(i,n){
	int k,p;
	cin >> k >> p;
	int ans = k % p;
	if(ans == 0 ) ans = p;
	cout << ans << endl;
    }
    return 0;
}

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

int main(){
  while(1){
    long int a,b,dab,count=0;
    cin >> a >> b;
    if(a==0 && b == 0) break;
    if(a<b) swap(a,b);
    while(1){
      dab=a%b;
      a=b;
      b=dab;
      count++;
      if(dab==0) break;
    }
    cout << a << " " << count << endl;
  }
  return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string S;
    cin >> N;

    vector<ll> a(N);
    REP(i, N)
        cin >> a.at(i);

        ll count_4 = 0, count_2 = 0, count_odd = 0;
    REP(i,N){
        ll tmp = a.at(i) % 4;
        if(tmp==0){
            count_4++;
        }
        else if(tmp==2){
            count_2++;
        }
    }
    count_odd = N - count_4 - count_2;

    if(count_2==0){
        if (count_odd> count_4+1)
        {
            cout << "No" << endl;
        }
        else
        {
            cout << "Yes" << endl;
        }
    }
    else{
        if (count_odd  > count_4)
        {
            cout << "No" << endl;
        }
        else
        {
            cout << "Yes" << endl;
        }
    }



}


Measured memory_bytes: 1024
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as BS

main = do
  n <- readLn :: IO Int
  as <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let bs = sort $ zipWith (\a b -> (a, b)) as [1..]
   in putStrLn $ foldr (\x acc -> (show $ snd x) ++ " " ++ acc) "" bs

Measured memory_bytes: 30204
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;


typedef long long int lli;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<float, float> ff;
typedef vector<ii> vii; 
typedef vector<ff> vff;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    lli n;
    cin>>n;
    lli k = (n*(n-1))/2;
    cout<<k<<endl;
    return 0;
}

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

int main(void)
{
	int ans, num[15][15];
	int w, h;
	int i, j;
	int map[15][15];
	
	while (1){
		scanf("%d%d", &w, &h);
		
		if (w + h == 0){
			break;
		}
		memset(map, -1, sizeof(map));
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				scanf("%d", &map[i][j]);
			}
		}
		
		memset(num, 0, sizeof(num));
		for (i = 0; i < w; i++){
			if (map[0][i] != 1){
				num[0][i] = 1;
			}
		}
		for (i = 1; i < h; i++){
			for (j = 0; j < w; j++){
				if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){
					num[i][j] += num[i - 1][j - 1];
				}
				if (map[i - 1][j] == 0){
					num[i][j] += num[i - 1][j];
				}
				if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){
					num[i][j] += num[i - 1][j + 1];
				}
				if (i > 1 && map[i - 2][j] == 2){
					num[i][j] += num[i - 2][j];
				}
			}
		}
		ans = 0;
		for (j = 0; j < w; j++){
			if (map[h - 1][j] != 1){
				ans += num[h - 1][j];
			}
			if (h > 1 && map[h - 2][j] == 2){
				ans += num[h - 2][j];
			}
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include<stdio.h>

int main(void) {

	int n[3] ;
	int	i, a, j;

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

	a = n[1];

	for (i = 0; i <= 1; i++) {
		for (j = i + 1; j <= 2; j++) {
			if (n[j] > n[i]) {
				a = n[j];
				n[j] = n[i];
				n[i] = a;
			}
		}
	}

	printf("%d\n", n[1] + n[2]);


	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define p(x) cout << x << endl;

#define MOD 1000000007
#define PI 3.14159265359

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

    ll n;
    cin >> n;

    int num = 1;
    for(ll i = 1; i <= n; i++){
        num = ((num % MOD) * (i % MOD)) % MOD;
    }

    p(num);
}

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

int main(){
    string S;
    cin >> S;
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
        return 0;
    }else if(S == "Cloudy"){
        cout << "Rainy" << endl;
        return 0;
    } else if(S == "Rainy"){
        cout << "Sunny" << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    cnt = 0
    for i in range(len(s)):
        if s[i] == "1":
            cnt += 1
        else:
            break
    print(1 if cnt >= k else s[cnt])


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();

    let sum: u8 = line
        .trim()
        .split(' ')
        .map(|s| s.parse::<u8>().unwrap())
        .sum();
    if sum == 17 {
        println!("YES");
    } else {
        println!("NO");
    }
}

Measured memory_bytes: 4352
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,d,w,h,i,j,k,l,m,n,x,y,z;
	ll		ans = 0;
	string	s;
	cin >> x >> k >> d;

	a = abs(x);

	if (k < a/d) {
		ans = a - k*d;
	} else {
		i = a % d;
		j = abs(i - d);
		c = k - a / d;
		if (c%2==0) ans = i;
		else ans = j;
	}
	cout << ans << endl;
	return 0;
}


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

long long MOD = 1e9+7;
int MAX_INT = 1e9;

// 最大公約数
long long gcd(long long a, long long b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
// 最小公倍数
long long lcm(long long a, long long b) {
  return a / gcd(a, b) * b;
}

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

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

  int ans = INT_MAX;
  for (int i = -100; i <= 100; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      cnt += (a[j]-i)*(a[j]-i);
    }
    ans = min(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;
public class Main
{
    public static void main(String[] args)
    {
        try
        {
          Scanner scan = new Scanner(System.in);
          long a=scan.nextLong();
          long b=scan.nextLong();
          long x=scan.nextLong();
          long count=0;
          count=(b/x)-(a/x);
            if(a%x==0)
            {
                count++;
            }
          System.out.println(count);
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void){
    int n;
    int key, p=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++) {
        for(int j=n-1;j>i;j--) {
            if(a[j] < a[j-1]) {
                key = a[j-1];
                a[j-1] = a[j];
                a[j] = key;
                p++;
            }
        }
    }
    for(int i=0;i<n;i++) {
        cout << a[i];
        if(i == n-1) {
            cout << endl;
        } else {
            cout << " ";
        }
    }
    cout << p << endl;
}

Measured memory_bytes: 3096
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	n,a,b,k=MI()

	m=998244353

	C=[1]
	for i in range(n):
		t=C[-1]*(n-i)*pow(i+1,m-2,m)
		C.append(t%m)
	#print(C)

	ans=0

	for x in range(n+1):
		if (k-a*x)%b==0:
			y=(k-a*x)//b
			if 0<=y<=n:
				ans+=C[x]*C[y]
				ans%=m
	print(ans)

























if __name__ == "__main__":
	main()


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

using namespace std;

const int inf = 1e5 + 9;
const int mod = 1e9 + 7;

typedef long long ll;

int ten[inf];
ll memo[inf][13];
string s;

ll solve(int here, int rem) {
    if (here == s.size()) {
        if (rem == 5) return 1LL;
        else return 0LL;
    }
    ll &ret = memo[here][rem];
    if (ret != -1LL) return ret;
    if (s[here] != '?') return ret = solve(here + 1, (rem + ten[here] * (s[here] - '0')) % 13);
    else {
        ret = 0;
        for (int i = 0; i < 10; i++) {
            ret += solve(here + 1, (rem + ten[here] * i) % 13);
            ret %= mod;
        }
        return ret;
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    fill(&memo[0][0], &memo[inf - 1][13], -1);
    cin >> s;
    reverse(s.begin(), s.end());
    ten[0] = 1;
    for (int i = 1; i < inf; i++) ten[i] = (ten[i - 1] * 10) % 13;
    cout << solve(0, 0) << '\n';
}


Measured memory_bytes: 18896
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <math.h>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll INF = 1000000000000000000LL;
using namespace std;

const int MOD = 1000000007;

int main(){
    ll N;
    cin >> N;
    string s1;
    cin >> s1;
    string s2;
    cin >> s2;
    //X:縦, Y:横
    string s = "";
    for(int i = 0; i < N; ++i)
    {
        if(i == N-1)s+= "X";
        else
        {
            if(s1[i] == s1[i+1])
            {
                s += "Y";
                ++i;
            }
            else 
            {
                s += "X";
            }
        }
    }

    ll res = 1;
    //最初の1個
    if(s[0] == 'X')
    {
        res *= 3;
    }
    else
    {
        res *= 6;
    }
    for(int i = 0; i < s.size() - 1; ++i)
    {
        if(s[i] == 'X' && s[i+1] == 'X')
        {
            res *= 2;
        }
        else if(s[i] == 'X' && s[i+1] == 'Y')
        {
            res *= 2;

        }
        else if(s[i] == 'Y' && s[i+1] == 'X')
        {
            res *= 1;

        }
        else//YY
        {
            res *= 3;
        }
        res %= MOD;
    }

    cout << res << endl;




    return 0;

}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

ll M=1000000007;

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  //vector<vector<ll>> As(N, vector<ll>(N));
  vector<ll> Sums(N);
  ll ans=0;
  rep(i,N) {
    cin >> A.at(i);
  }

  for(int i = N-2; i >= 0; --i){
    Sums.at(i) = (Sums.at(i+1) + A.at(i+1)) % M;
  }


  rep(i,N){
    ans = (ans + Sums.at(i) * A.at(i))%M;
  }
  cout << ans << endl;
}


Measured memory_bytes: 6432
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define rev(a,b,c) for(int a=b;a>=c;a--)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define F first
#define S second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define get(a) cin>>a
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n";
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll ncr(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%mod;
    }
    return C[k];
}
void solve()
{
    ll a,b;
    cin>>a>>b;
    cout<<(6-a-b);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
       // nextl;
    }
    return 0;
}


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

#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)

int main(){
    double X;
    cin >> X;
    X += 0.0000001;
    int ans=0;
    for(double i=2.0;i<30;i++){
        ans = max(ans, int(pow(int(pow(X, 1/i)), i)));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main()
{
 int n, x, i, j, k, a = 0;

 while(1)
 {
     scanf("%d %d\n", &n, &x);
     if(n == 0 && x == 0)
     {
         break;
     }
     for(i = 1; i <= n - 2; i++)
     {
         for(j = i + 1; j <= n - 1; j++)
         {
             for(k = j + 1; k <= n; k++)
             {
                 if((i + j + k) == x)
                 {
                     a++;
                 }
             }
         }
     }
     printf("%d\n", a);
     a = 0;
 }

 return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int n;

struct query{
  int L,R,I;
};

int block;

bool cmp(query a, query b){
if (a.L/block != b.L/block)
 return a.L/block < b.L/block;
else return a.R<b.R;
}


int main() {
 ios_base::sync_with_stdio(false);
 int m;
 scanf ("%i", &n);
 scanf ("%i",&m);
 block = sqrt(n);
 vector <int> a(n);
 for (int i = 0; i < n; i++)
  scanf ("%i",&a[i]);
 vector <query> kveriz(m);
 vector <int> odg(m);
 for (int i = 0; i < m; i++){
   scanf ("%i",&kveriz[i].L);
   scanf ("%i",&kveriz[i].R);
   kveriz[i].L--;
   kveriz[i].R--;
   kveriz[i].I = i;
 }
 sort (kveriz.begin(),kveriz.end(),cmp);
 int curl = 0, curr = -1, bdif = 0;
 vector <int> bb(500001,0);
 for (int i = 0; i < m; i++){
   int l = kveriz[i].L, r = kveriz[i].R;
   while (curl < l){
     bb[a[curl]]--;
     if (!bb[a[curl]])
       bdif--;
     curl++;
   }
   while (curr < r){
     bb[a[curr+1]]++;
     if (bb[a[curr+1]] == 1)
      bdif++;
     curr++;
   }
   while (curr > r){
     bb[a[curr]]--;
     if (!bb[a[curr]])
       bdif--;
     curr--;
   }
   while (curl > l){
     bb[a[curl-1]]++;
     if (bb[a[curl-1]] == 1)
       bdif++;
     curl--;
   }
  odg[kveriz[i].I] = bdif;
 }
 for (int i = 0; i < m; i++){
   printf("%i \n", odg[i]);
 }
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, 0, n) cin >> h[i];

    vector<int> move(n, 0);
    int cnt = 0;
    rep(i, 0, n - 1)
    {
        move[i] = cnt;
        if (h[i + 1] <= h[i])
            ++cnt;
        else
            cnt = 0;
    }
    move[n - 1] = cnt;

    int ans = 0;
    rep(i, 0, n)
        ans = max(ans, move[i]);

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define F (110000)

int n,c[100000],d[300000],cnt;

int main(){
	while(scanf("%d",&n),n){
		for(int i=0;i<n;i++) scanf("%d",&c[i]);
		fill(d,d+300000,0);
		d[F]=1;
		cnt=F;
		for(int i=1;i<n;i++){
			if(c[i]!=c[i-1]) cnt++;
			d[cnt]++;
			if(i%2==1&&c[i]!=c[i-1]&&cnt>=2){
				cnt-=2;
				d[cnt]+=d[cnt+1]+d[cnt+2];
				d[cnt+1]=d[cnt+2]=0;
			}
		}
		int res=0;
		for(int i=cnt-c[n-1];i>=0;i-=2) res+=d[i];
		printf("%d\n",res);
	}
}

Measured memory_bytes: 2748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k,x=0, l, r, ans=900000000;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; i++) {
        cin >> a[i];
    }
    for(int l=0; l<=a.size()-k; l++) {
        r=l+k-1;
        if(a[r]<0) ans=min(ans,abs(a[l]));
        else if(a[l]<0 && a[r]>=0) ans=min(ans, a[r]-a[l]+min(a[r],abs(a[l])));
        else ans=min(ans, a[r]);
    }
    cout << ans;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

struct UnionFind
{
	vector<int> parent;
	vector<int> rank;

	UnionFind(int N) :parent(N, 0), rank(N, 0)
	{
		rep(i, 0, N)
		{
			parent[i] = i;
		}
	}

	int find(int x)
	{
		if (parent[x] == x)
		{
			return x;
		}
		else
		{
			return parent[x] = find(parent[x]);
		}
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (x == y)
		{
			return;
		}

		if (rank[x] < rank[y])
		{
			parent[x] = y;
		}
		else
		{
			parent[y] = x;
			if (rank[x] == rank[y])
			{
				rank[x]++;
			}
		}
	}

	bool same(int x, int y)
	{
		return find(x) == find(y);
	}
};

int P[100010];

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

	int N, M;
	cin >> N >> M;

	int cnt = 0;
	int A;
	rep(i, 0, N)
	{
		cin >> A;
		A--;
		P[A] = i;
	}

	UnionFind uf(N);

	int s, t;
	rep(i, 0, M)
	{
		cin >> s >> t;
		s--, t--;
		uf.unite(s, t);
	}

	int ans = 0;
	rep(i, 0, N)
	{
		if (uf.same(P[i], i))
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    string s; cin >>s;
    string t; cin >>t;

    int count = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == t[i]) {
            count++;
        } 
    }

    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end());
#define fill(a,x) memset(a,x,sizeof(a))
#define zero(a) fill(a,0)
#define minus(a) fill(a,-1)
#define dbg(x) cout << #x"=" << x << endl

struct Node{
  Node* l;
  Node* r;
  Node* p;
  int key;
};

vi num_array;
Node *root;
Node *nil;

void ins(int num){
  Node *n_node;
  n_node=(Node*)malloc(sizeof(Node));
  n_node->key=num;
  n_node->l=NULL;
  n_node->r=NULL;
  Node *x=root;
  Node *y=NULL;
  while(x!=NULL){
    y=x;
    if(x->key < num) x=x->r;
    else x=x->l;
  }
  n_node->p=y;
  if(y==NULL) root = n_node;
  else{
    if(num > y->key) y->r = n_node;
    else y->l = n_node;
  }
}

void array_generator(Node *d){
  if(d==NULL) return;
  if(d->r != NULL){
    num_array.pb(d->r->key);
    array_generator(d->r);
  }
  if(d->l != NULL){
    num_array.pb(d->l->key);
    array_generator(d->l);
  }
}

void del(Node *d){
  array_generator(d);
  if(d->p->l->key == d->key) d->p->l = NULL;
  else d->p->r = NULL;
  free(d);
  rep(i,num_array.size()) ins(num_array[i]);
  num_array.clear();
}

Node* find(Node *p,int num){
  if(p==NULL) return nil;
  if(p->key==num) return p;
  if(p->key < num) find(p->r,num);
  else find(p->l,num);
}

void preorder(Node *p){
  if(p==NULL) return;
  cout << " " << p->key;
  preorder(p->l);
  preorder(p->r);
}

void inorder(Node *p){
  if(p==NULL) return;
  inorder(p->l);
  cout << " " << p->key;
  inorder(p->r);
}

int main(){
  int total,num;
  cin >> total;
  string cmd;
  rep(i,total){
    cin >> cmd;
    if(cmd=="insert"){
      cin >> num;
      ins(num);
    }else if(cmd=="print"){
      inorder(root); cout<<endl;
      preorder(root); cout<<endl;
    }else if(cmd=="find"){
      cin >> num;
      Node *t = find(root,num);
      if(t==nil) cout << "no" << endl;
      else cout << "yes" << endl;
    }else if(cmd=="delete"){
      cin>>num;
      del(find(root,num));
    }
  }
}



Measured memory_bytes: 21944
#include<bits/stdc++.h>
using namespace std; 
int main() { 
long long a ,b ; 
long long x , n ;
scanf("%lld %lld %lld", &a , &b , &x) ;
 

if (a>0 ) {
 
a-=1;
n=(b/x)-(a/x) ;

}

else{
n=(b/x) ;
++n ;
}

printf("%lld", n);




return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;

int main(void) {
    int a,b, c;
    cin >>a>>b >> c;
    cout << a * b / 2<<endl;
    return 0;
}


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

using namespace std;

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

    vector<int> R, G, B;
    for(int i=0; i<N; i++) {
        if(S[i] == 'R') {
            R.push_back(i);
        } else if(S[i] == 'G') {
            G.push_back(i);
        } else {
            B.push_back(i);
        }
    }

    int64_t ans = R.size() * G.size() * B.size();
    for(int i=0; i<N; i++) {
        for(int j=1; j<N; j++) {
            if(i-j<0 || i+j>=N) continue;
            if(S[i] != S[i-j] && S[i] != S[i+j] && S[i-j] != S[i+j]) --ans;
        }
    }

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


Measured memory_bytes: 3648
#include<bits/stdc++.h> 
     
    using namespace std ; 
     
    long long n , m; 
     
    int main(){
        //freopen("in.in" , "r" , stdin ) ; 
        cin>>n>>m; 
        if(n==1||m==1){
            return cout<<1 , 0 ; 
        }
        long long A = (n+1) /2 ; 
        long long B = (m+1) /2 ; 
        long long a = n/2 ; 
        long long b = m/2  ; 
        cout<<fixed<<setprecision(0)<<A*B + a*b ; 
        return 0 ; 
    }

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>

int getdigit(unsigned long n){
  return log10(double(n))+1;
}

int main(){
  unsigned long N;
  std::cin>>N;
  int mindigit = 11;
  for(unsigned long i=1;i*i<=N;++i){
    if(N%i==0){
      int digit = std::max(getdigit(i),getdigit(N/i));
      if(digit<mindigit) mindigit = digit;
    }
  }
  std::cout<<mindigit<<std::endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
const double PI = 3.14159265358979323846264338;
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

void solve() {
    lli n, a, m, k;
    cin >> n >> m >> k;
    vector<lli> v1, v2;

    for (lli i = 0; i < n; i++) {
        cin >> a;
        v1.pb(a);
    }

    for (lli i = 1; i < n; i++) {
        v1[i] += v1[i - 1];
    }

    for (lli i = 0; i < m; i++) {
        cin >> a;
        v2.pb(a);
    }

    lli ans = 0, no = k;
    auto it = lower_bound(v1.begin(), v1.end(), no);
    lli ind = 0;
    if (it != v1.end() && *it == no) {
        ind = it - v1.begin();
        ind++;
    } else if (it != v1.begin()) {
        it--;
        ind = it - v1.begin();
        ind++;
    }

    ans = ind;

    lli val = 0;
    for (lli i = 0; i < m; i++) {
        val += v2[i];
        if (val > k) {
            break;
        }
        lli no = k - val;
        lli p = i + 1;
        auto it = lower_bound(v1.begin(), v1.end(), no);
        lli ind = 0;
        if (it != v1.end() && *it == no) {
            ind = it - v1.begin();
            ind++;
        } else if (it != v1.begin()) {
            it--;
            ind = it - v1.begin();
            ind++;
        }
        p += ind;
        ans = max(ans, p);
    }

    cout << ans << endl;
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

Measured memory_bytes: 7952
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline--------------------------------------------
    A,B = map(int,input().split())
    print(max(A+B,A-B,A*B))
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 5680
n = int(input())
li = [int(input()) for _ in range(n)]
li.sort()
tmp = 0
new_li = []
for l in li:
    if l != tmp:
        tmp = l
        new_li.append(1)
    elif l == tmp:
        new_li[-1] += 1
count = 0
for n in new_li:
    if n%2 != 0:
        count += 1
print(count)

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

using namespace std;

class UnionFind
{
    vector<int> par;

public:
    UnionFind(int n) : par(n, -1) {}

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

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

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

void solve()
{
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    priority_queue<pair<long, pair<int, int>>> es;
    while (m--)
    {
        int s, t;
        long w;
        cin >> s >> t >> w;
        es.push(make_pair(-w, make_pair(s, t)));
    }
    long ans = 0;
    while (!es.empty())
    {
        auto p = es.top();
        es.pop();
        if (uf.merge(p.second.first, p.second.second))
        {
            ans -= p.first;
        }
    }
    cout << ans << endl;
}

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



Measured memory_bytes: 4896
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int a,b,c;cin>>a>>b>>c;
  int ans=0;
  if(b/a>c)ans=c;
  else ans=b/a;
 
  cout<<ans<<endl;
 
  return 0;
}

Measured memory_bytes: 125568
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, i;
    cin >> n;
    int mx = INT_MIN, mn = INT_MAX;
    for(i=0; i<n; i++){
        int input;
        cin >> input;
        mx = max(mx, input);
        mn = min(mn, input);
    }
    cout << mx - mn << '\n' ;
    return 0;
}


Measured memory_bytes: 256
n,m = input().split()
plist = []
ylist = []
n = int(n)
m = int(m)
anslist = [0 for i in range(m)]
list = [[] for i in range(n+1)]
for i in range(m):
    p,y = input().split()
    p = int(p)
    y = int(y)
    plist.append(p)
    ylist.append(y)
    list[p-1].append([ylist[i],i])
for i in range(n):
    list[i].sort()
    for j in range(len(list[i])):
        mtem = list[i][j][1]
        ans1 = str(plist[mtem])
        while len(ans1) < 6:
            ans1 = "0" + ans1
        ans2 = str(j+1)
        while len(ans2) < 6:
            ans2 = "0" + ans2
        anslist[mtem] = ans1 + ans2
for i in range(m):
    print(anslist[i])
            

Measured memory_bytes: 43788
import math
N = int(input())
d = list(map(int,input().split()))
ABC = []
ARC = []
d.sort()
pivot = (len(d)-1) / 2
left = math.floor(pivot)
right = math.ceil(pivot)
if d[left] == d[right]:
    K = d[left]

elif d[left] !=  d[right]:
    lists = list(range(d[left]+1,d[right]+1))
    K = lists[0]
for i in range(len(d)):
    if K <= d[i]:
        ARC.append(d[i])
    elif K > d[i]:
        ABC.append(d[i])
if len(ABC) == len(ARC):
    print(len(lists))
else:
    print("0")

Measured memory_bytes: 14524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

ll numup(ll x, ll y)
{
	if (x%y == 0)
	{
		return x/y;
	}else
	{
		return x/y + 1;
	}
}

int main()
{
	ll a, b, c, d, e;
	ll N;
	
	cin >> N >> a >> b >> c >> d >> e;

	//////AからEの中で一番小さい値を探す/////////

	ll key_num = min({a, b, c, d, e});
	ll ans = 4 + numup(N, key_num);

	

	

	cout << ans << endl;


}

Measured memory_bytes: 256
import sys, os, re
from pprint import pprint

a = int(sys.stdin.readline().strip())

if a%10 in [2, 4, 5, 7, 9]:
    print("hon")
elif a%10 in [0, 1,6, 8]:
    print("pon")
elif a%10 in [3]:
    print("bon")


Measured memory_bytes: 68248