akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n,k=MI()
u=[]
lis=sorted([I() for i in range(n)])
for i in range(n-k+1):
    u.append(lis[i+k-1]-lis[i])
print(min(u))

Measured memory_bytes: 11248
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6
const lli MAX=1e9+7;
 
int main()
{
    fast;
    lli n, k;
    cin>>n>>k;
    vector<lli> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    lli l=1, r=*max_element(a.begin(), a.end());
    while(l!=r){
        lli m=(l+r)/2;
        int sum=0;
        for(int i=0; i<n; i++){
            sum+=(a[i]-1)/m;
        }
        if(sum<=k) r=m;
        else l=m+1;
    }
    cout<<l<<"\n";
    return 0;
}

Measured memory_bytes: 4784
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll V,E; cin >> V >> E;
    vector<vector<ll>> G(V);
    for(int i = 0; i < E;i++){
        ll u,v; cin >> u >> v;
        G[u].push_back(v);
    }
    vector<ll> dist(V,0);
    for(int i = 0; i < V;i++){
        for(int j = 0; j < V;j++){
            for(auto k:G[j]){
                ll u = j;
                ll v = k;
                if(dist[v] > dist[u] - 1){
                    dist[v] = dist[u] - 1;
                    if(i == V-1){
                        cout << 1 << endl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << 0 << endl;
    return 0;
}



Measured memory_bytes: 3236
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int a = sc.nextInt();
        int b = sc.nextInt();

        int ans = a - b * 2;
        System.out.println(ans < 0 ? 0 : ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 22612
N,W = map(int, input().split())
val_i = [0]*(W+1)
for i in range(1,N+1):
    v,w = map(int, input().split())
    copy = val_i[:] ##i-1번째줄의 val_i
    for j in range(1,W+1):
        if (w <= j):
            val_i[j] = max((v + copy[j-w]), copy[j])
print(val_i[-1])


Measured memory_bytes: 6512
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main() => new Program().Solve();

	void Solve()
	{
		var s = Console.ReadLine();
		var t = Console.ReadLine();
		var c = 0;
		for(var i = 0; i < s.Length; i++) {
			if (s[i] != t[i]) c++;
		}
		Console.WriteLine(c);
	}

	#region Console.Read 関係
	long[] ReadLongArray() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
	long ReadLong() => long.Parse(Console.ReadLine());
	#endregion
}


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

void maxl(int *,int );
void build(int *);
int n;

int main(){
	int *H,i;
	scanf("%d",&n);
	H=(int *)malloc(sizeof(int)*(n+1));
	for(i=1;i<=n;i++){
		scanf("%d",&H[i]);
	}
	build(H);
	for(i=1;i<=n;i++){
		printf(" %d",H[i]);
	}
	printf("\n");
	free(H);
	return 0;
}

void build(int *H){
	int i;
	for(i=n/2;i>0;i--){
		maxl(H,i);
	}
}

void maxl(int *H,int i){
	int l=2*i,r=2*i+1,lar;
	if(l<=n && H[l]>H[i])lar=l;
	else lar=i;
	if(r<=n && H[r]>H[lar])lar=r;
	
	if(lar!=i){
		l=H[i];
		H[i]=H[lar];
		H[lar]=l;
		maxl(H,lar);
	}
}


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

int main() {
  int n;
  cin >> n;
  int n4 = ((n%1000)%100)%10;
  int n3 = ((n%1000)%100-n4)/10;
  int n2 = (n%1000-(n3*10+n4))/100;
  int n1 = (n-(n2*100+n3*10+n4))/1000;
  if ((n1 == n2 && n2 == n3)||(n2 == n3 && n3 == n4)){
    cout << "Yes " << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    ll n,m;
    cin >> n >> m;
    string s,t;
    cin >> s >> t;
    ll o=__gcd(n,m);
    ll q=n*(m/o);
    rep(i,o){
        if (s.at(i*(n/o))!=t.at(i*(m/o))) {cout << -1 << endl;return 0;}
    }
    cout << q << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF 1000000000000007LL
using namespace std;

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

int n,k,s;
vector<P> G[2001];
bool flag[2001];
int x[2001],y[2001],z[2001];
int cnt=0;
ll sum=0;

bool check(int i,int j){
	if(x[i]+s<=x[j] || x[j]+s<=x[i])return false;
	if(y[i]+s<=y[j] || y[j]+s<=y[i])return false;
	if(z[i]+s<=z[j] || z[j]+s<=z[i])return false;
	return true;
}

void dfs(int v,int p){
	flag[v]=true;
	for(int i=0;i<G[v].size();i++){
		if(G[v][i].first!=p){
			if(flag[G[v][i].first])sum-=(ll)G[v][i].second;
			else{
				if(cnt<k){
					sum+=(ll)6*s*s-G[v][i].second;
					cnt++;
					dfs(G[v][i].first,v);
				}
			}
		}
	}
}

int main(void){
	while(1){
		scanf("%d%d%d",&n,&k,&s);
		if(n==0 && k==0 && s==0)return 0;
		for(int i=0;i<n;i++){
			G[i].clear();
			scanf("%d%d%d",&x[i],&y[i],&z[i]);
		}
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(check(i,j)){
					int v1=s-abs(x[i]-x[j]);
					int v2=s-abs(y[i]-y[j]);
					int v3=s-abs(z[i]-z[j]);
					ll cost=2*(v1*v2+v2*v3+v3*v1);
					G[i].push_back(P(j,cost));
					G[j].push_back(P(i,cost));
				}
			}
		}
		ll res=INF;
		for(int i=0;i<n;i++){
			if(k==1){
				res=min(res,(ll)6*s*s);
				continue;
			}
			for(int j=0;j<G[i].size();j++){
				memset(flag,false,sizeof(flag));
				flag[i]=true;
				flag[G[i][j].first]=true;
				cnt=2;
				sum=12*s*s-G[i][j].second;
				dfs(G[i][j].first,i);
				if(cnt==k)res=min(res,sum);
			}
		}
		printf("%lld\n",res==INF?-1:res);
	}
	return 0;
}

Measured memory_bytes: 3204
#include <stdio.h>
#include <stdlib.h>
#define A 100

int bubbleSort(int *,int);

int main(){
  int a[A],n,i,count;

  scanf("%d",&n);
  
  if(n < 1 && n >100)exit(2);

  for(i = 0 ; i < n ; i++){
    scanf("%d",&a[i]);
  }
  count = bubbleSort(a,n);
  for(i = 0 ; i < n-1 ; i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[i]);
  printf("%d\n",count);
  return 0;
}

int bubbleSort(int *a,int n){
  int i,j;
  int flag = 1;
  int num,count=0;
    
  while(flag == 1){
    flag = 0;
    for(j = n - 1; j >= 1 ; j--){
      if(a[j] < a[j-1]){
	num = a[j-1];
	a[j-1] = a[j];
	a[j] = num;
	flag = 1;
	count++;
      }
      i++;
    }
  }
  return count;
}



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

#define int long long

using namespace std;

const int maxn = 1e4 + 10, maxl = 110, mod = 1e9 + 7;
int dp[maxn][maxl], d;
string s;

signed main()
{
    ios::sync_with_stdio(false);
    cin >> s >> d;

    dp[0][0] = 1;
    for (int i = 0; i < maxn - 5; i++)
        for (int j = 0; j < d; j++)
            for (int x = 0; x < 10; x++)
                (dp[i + 1][(j + x) % d] += dp[i][j]) %= mod;

    int ans = 0;
    for (int i = 0, S = 0; i <= s.size(); S += s[i++] - '0')
    {
        if (i == s.size())
        {
            ans += S % d == 0;
            continue;
        }
        int x = s[i] - '0';
        for (int now = 0; now < x; now++)
            (ans += dp[s.size() - i - 1][(maxn * d - now - S) % d]) %= mod;
    }

    cout << (ans - 1 + mod) % mod;

    return 0;
}


Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
int main(){
  for(int i=0;i<9;i++){
    for(int j=0;j<9;j++){
      cout<<i+1<<"x"<<j+1<<"="<<(i+1)*(j+1)<<endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3004
import java.util.Scanner;

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

        String str = sc.next();
        if(str.matches(".*2$") || str.matches(".*4$") || str.matches(".*5$") || str.matches(".*7$") || str.matches(".*9$")){
            System.out.println("hon");
        }
        else if(str.matches(".*0$") || str.matches(".*1$")  || str.matches(".*6$") || str.matches(".*8$")){
            System.out.println("pon");
        }
        else{
            System.out.println("bon");
        }
    }
}

Measured memory_bytes: 35592
#include<stdio.h>

int main(){

	int i=0;
        int j=0;
    for(i=1; i<10;i++)
    {
          for(j=1; j<10;j++)
           {
                   printf("%dx%d=%d\n", i, j, i*j);
            }
     }
    return 0;
}

Measured memory_bytes: 1684
import java.util.Scanner;

public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int p = scan.nextInt();
int q = scan.nextInt();
int x = p / q;
int y = p % q;
double w = (double) p / q;
System.out.format("%d %d %f", x, y, w);
}
}


Measured memory_bytes: 26436
use text_io::*;
use std::process::exit;

fn main(){
    let mut a:f64 = read!();
    let mut b:f64 = read!();
    let mut h:f64 = read!();
    let mut m:f64 = read!();
    let mut deg:f64 = ((h*60.0+m)*5.5)%360.0;
    if deg>180.0 {
        deg = 360.0-deg;
    }
    let mut c:f64 = (a*a + b*b - 2.0*a*b*deg.to_radians().cos()).sqrt();
    println!("{}",c);
}

Measured memory_bytes: 3024
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    int N, R;
    cin >> N >> R;
    PRINT(R + 100 * max(0, 10 - N));
    return 0;
}

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

#define LL long long

LL arr[1009][3];

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n,m;
	cin>>n>>m;

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

	vector<LL> v;
	LL res=LLONG_MIN;
	for(int i=0;i<8;i++){
		for(int j=0;j<n;j++){
			LL s=0;int a = i;
			for(int k=2;k>=0;k--){
				if(a>=(1<<k)){
					//if(i==0){cout<<"exe"<<endl;}
					a-=(1<<k);
					s-=arr[j][k];
				}else{
					s+=arr[j][k];
				}
			}
			v.push_back(s);
		}
		
		sort(v.begin(),v.end());
		reverse(v.begin(),v.end());
		LL ans=0;
		for(int j=0;j<m;j++){
			ans += v[j];
		}
		res = max(res,ans);
		v.clear();
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
import sys

s = list(input())
set_s = set(s)
new_s = list(set_s)
new_s.sort()
for i in range(26):
    if ord(new_s[i]) != 97+i:
        print(chr(97+i))
        sys.exit()
    if len(new_s) == i+1:
        if i == 25:
            break
        print(chr(98+i))
        sys.exit()
print('None')

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

int main(){
    int n, m;
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++) {
        int num;
        scanf("%d",&num);
    }
    int ans=ceil((double)(n-1)/(m-1));
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr double INF       = 1e+20;
constexpr int MODULO    = 1000000007;

#define int long

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

constexpr int evx[4] = { 1, 0, -1, 0 };
constexpr int evy[4] = { 0, 1, 0, -1 };

//----------------------------------
//----------------------------------
//

inline double distance(pair<double,double> a, double r, pair<double,double> b, double br)
{
        double tmp = sqrt((a.first-b.first)*(a.first-b.first) + (a.second-b.second)*(a.second-b.second)) - r - br;
        return tmp <= 0 ? 0 : tmp;
}


signed main()
{
    ios::sync_with_stdio(false);
        int sx, sy, tx, ty;
        cin >> sx >> sy >> tx >> ty;
        int n;
        cin >> n;
        vector<double> x, y, r;
        for(int i = 0; i < n; ++i)
        {
                double a, b, c;
                cin >> a >> b >> c;
                x.push_back(a);
                y.push_back(b);
                r.push_back(c);
        }

        vector<vector<double>> dis;
        for(int i = 0; i < n; ++i)
        {
                dis.push_back(vector<double>());
                for(int j = 0; j < n; ++j)
                {
                        dis[i].push_back(distance({x[i],y[i]}, r[i], {x[j], y[j]}, r[j]) );
                }
        }

        for(int k = 0; k < n; ++k)
                for(int i = 0; i < n; ++i)
                        for(int j = 0; j < n; ++j)
                                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);

        /* for(int i = 0; i < n; ++i) */
        /*      for(int j = 0; j < n; ++j) */
        /*              cerr << i << ',' << j << ":" << dis[i][j] << '\n'; */

        for(int i = 0; i < n; ++i)
                for(int j = 0; j < n; ++j)
                {
                        /* cerr  << i << ',' << j << ":: " << distance({x[i], y[i]}, r[i], {tx, ty}, 0) */
                        /*                      + distance({x[j], y[j]}, r[j], {sx, sy}, 0) << '\n'; */

                        dis[i][j] += distance({x[i], y[i]}, r[i], {tx, ty}, 0)
                                                + distance({x[j], y[j]}, r[j], {sx, sy}, 0);
                }
        double min_dis = distance({sx,sy}, 0, {tx,ty}, 0);

        for(int i = 0; i < n; ++i)
                min_dis = min(min_dis , *min_element(dis[i].begin(), dis[i].end()));
        cout <<scientific << setprecision(10) <<  min_dis << '\n';

}


Measured memory_bytes: 8448
#include<stdio.h>
int main()
{
   int A,B;
    scanf("%d %d",&A,&B);
    if(A+B>=A-B && A+B>=A*B)
    {
        printf("%d",A+B);
    }
    else if(A-B>=A+B && A-B>=A*B)
    {
        printf("%d",A-B);
    }
    else if(A*B>=A+B && A*B>=A-B)
    {
        printf("%d",A*B);
    }
    return 0;
}



Measured memory_bytes: 128
# coding: utf-8

num = int(input())
count = 0
str = input().split()
table = [int(i) for i in str]
#全探索
for j in range(num): #ループ1
    for k in range(j+1, num): #ループ2
        for l in range(k+1, num): #ループ3
            if table[j] != table[k] and table[k] != table[l] and table[j] != table[l]:
                len = table[j] + table[k] + table[l] #周の長さ
                ma = max(table[j], max(table[k], table[l])) #一番長い辺
                rest = len - ma #残りの2辺の合計
                if ma < rest: #最大の辺が残り2辺より小さければ三角形は成立する
                    count += 1
print(count)


Measured memory_bytes: 9216
use proconio;

#[proconio::fastout]
fn main() {
    proconio::input! {
        x: usize,
        y: usize,
    }

    let result = (0..=x).map(|i| 2 * i + 4 * (x - i)).any(|v| v == y);
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2140
'use strict'
function Main(input){
    var w=input.split("\n")[1].split(" ").map((w)=>Number(w));
    var ans=10001;
    var sum1=0;
    var sum2=0;
    for(var i=0;i<w.length;i++){
        sum1+=w[i];
    }
    for(var i=0;i<w.length-1;i++){
        sum2+=w[i];
        sum1-=w[i];
        ans=Math.min(ans,Math.abs(sum1-sum2));
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#!/usr/bin/env python3

def main():
    n, m = map(int, input().split())
    dm = dividor_of(m)
    res = 1
    for d in dm:
        if d <= m / n:
            res = d
    print(res)

def dividor_of(m):
    res = set()
    for i in range(1, 10 ** 5):
        if m % i == 0:
            res.add(i)
            res.add(m // i)
        if i ** 2 >= m:
            return sorted(list(res))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

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

void solve() {
    int n;
    cin >> n;
    VVI a(n ,VI(n)), b(n, VI(n));
    REP(i,0,n) REP(j,0,n) {
        cin >> a[i][j];
        b[i][j] = a[i][j];
    }
    REP(k,0,n) REP(i,0,n) REP(j,0,n) {
        if (i == j || j == k || k == i) continue;
        if (b[i][j] > b[i][k] + b[k][j]) {
            cout << -1 << endl;
            //cerr << i << " " << j << " " << k << endl;
            //cerr << b[i][j] << " " << b[i][k] << " " << b[k][j] << endl;
            return;
        } else if (b[i][j] == b[i][k] + b[k][j]) {
            a[i][j] = 0;
        }
    }
    LL ans = 0;
    REP(i,0,n) REP(j,i+1,n) ans += a[i][j];
    cout << ans << endl;
}

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

Measured memory_bytes: 1024
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int x, t;
    cin >> x >> t;

    cout << max((Int)0, x - t) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  string s;
  cin>>s;
  int ans=10000;
  for(int i=0;i<s.size()-2;i++){
    int a=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
    ans=min(ans,abs(a-753));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <string>
#include <set>
using namespace std;
const long D = 1000000007;

int main()
{
  int n, T;
  cin >> n >> T;
  long t[n];
  for (int i = 0; i < n; i++)
    cin >> t[i];

  int ans = T, now = T;
  for (int i = 1; i < n; i++)
  {
    if (now <= t[i])
    {
      ans += T;
      now = t[i] + T;
    }
    else
    {
      ans += t[i] + T - now;
      now = t[i] + T;
    }
  }
  cout << ans << endl;
  return 0;
}

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

main(){
    int x, y;
    while ( cin >> x >> y && x && y){
	if ( y > x ) swap(x, y);
	int step = 0;
	while(y){
	    int t = x % y;
	    x = y;
	    y = t;
	    step++;
	}
	cout << x << " " << step << endl;
    }
}

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

    int a = scan.nextInt();
    int b = scan.nextInt();

    int division = a / b;
    int remainder = a % b;
    double Floatingpoint = (double)a / (double)b;

    String str = String.format("%.16f",Floatingpoint);
    System.out.println(division + " " + remainder + " " + str);
 }
}

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

using namespace std;

// Define a struct that holds a string and also a in
struct each_set
{
    int total_val;
    string string_val;
};

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

    struct each_set * arr = new each_set[N];

    int total = 0;
    for(int i = 0; i < N ;i++)
    {
        int val;
        cin >> arr[i].string_val;
        cin >> val;
        total += val;
        arr[i].total_val = total;

    }

    cin >> X;


    for(int i = 0; i < N ;i++)
    {
        if(arr[i].string_val == X)
        {
            cout << arr[N - 1].total_val - arr[i].total_val << endl;

            break;
        }
    }



    return 0;
}

Measured memory_bytes: 256
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
  }

  return sum;
}

/*考えを書くスペース

*/
//main.cpp----------------------------
#define max_n 100

void solve();

ll n, a, b;

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

  solve();

  return 0;
}

void solve() {

  if(a>b || (n<2&&a!=b)) {
    cout << 0 << endl;
    return;
  }

  ll min = (a+b) + (n-2)*a;
  ll max = (a+b) + (n-2)*b;

  cout << max - min + 1 << endl;


}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  ll a;
  string b;
  cin>>a>>b;
  string s = {b[0], b[2], b[3]};
  int t = stoi(s);
  cout << (a*t)/100 << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

bool check_num(int N, vector<bool> nums){
	while(N>0){
		if(not nums[N%10])return false;
		N/=10;
	}
	return true;
}

signed main()
{
	int N, K;
	vector<bool> nums(10, true);
	cin >> N >> K;
	REP(i, K){
		int tmp;
		cin >> tmp;
		nums[tmp] = false;
	}
	while(not check_num(N, nums)){
		N++;
	}
	cout << N << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G;
		int X = I[0], Y = I[1], N = I[2];
		var ls = new int[X];
		for (var x = 0; x < X; x++) ls[x] = Y;
		for (var i = 0; i < N; i++)
		{
			I = G;
			int x = I[0] - 1, y = I[1] - 1;
			ls[x] = Min(ls[x], y);
		}
		var R = 0;
		for (var x = 0; x < X - 1; x++)
		{
			// (x,0)~(x,R) で下に行けるか
			if (ls[x + 1] <= R) { WriteLine(x + 1); return; }
			if (ls[x + 1] > R + 1) R++;
		}
		WriteLine(X);
	}
}


Measured memory_bytes: 18016
// D - Handstand
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int solve(int N, int K, string &S){

	S += S[N-1]=='0'? "1":"0";

	vi sumC;//累積和
	sumC.push_back(0);
	if(S[0] == '0') sumC.push_back(0);

	int count = 0;
	int n;
	rpz(l, N){
		count++;
		if(S[l] != S[l+1]){
			n = sumC.size() - 1;
			sumC.push_back(count + (n<0? 0: sumC[n]));
			count = 0;
		}
	}

	n = sumC.size() - 1;
	if(S[N-1] == '0') sumC.push_back(sumC[n]);
	n = sumC.size();

	// puts("--");//
	// rpz(i,C.size()){
	// 	printf("%d) z|o %d count %d sum %d\n",i,ZO[i], C[i],sumC[i]);
	// }puts("---");//

	int width = K*2 + 1;
	int ans = 1;
	if(width >= n) ans = N;
	else for(int l=0, r=width; r<n; r+=2, l+=2) ans = max(ans, sumC[r]-sumC[l]);
	return ans;

}

int main(){
	int N,K; cin>>N>>K;
	string S; cin>>S;
	cout<< solve(N, K, S) <<endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,K;
  cin>>N>>K;
  vector<ll>h(N);
  for(int i=0;i<N;i++)cin>>h[i];
  vector<ll>dp(N,INF);
  dp[0]=0;
  for(int i=1;i<N;i++){
    for(int j=1;j<=K;j++){
      if(i-j>=0)dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
    }
  }
  cout<<dp[N-1]<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
  int a,b,c;
  int count=0;
  scanf("%d %d %d",&a,&b,&c);
  for(int i=a;i<=b;i++)
  {
    if(c%i==0)
      count+=1;
  }
  printf("%d\n",count);
}

Measured memory_bytes: 1820
#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: 636
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int N;
	std::cin >> N;
	std::map<int, int> count;
	std::vector<int> vec(N);
	for (auto& v : vec)
	{
		std::cin >> v;
		++count[v];
	}
	int result = 0;
	for (auto&& v : vec)
	{
		int c = 0;
		for (auto i = 1; i * i <= v; ++i)
		{
			if (v % i == 0)
			{
				auto j = v / i;
				if (count.count(i))
				{
					c += count[i];
				}
				if (i != j && count.count(j))
				{
					c += count[j];
				}
			}
		}
		if (c == 1)
		{
			++result;
		}
	}
	std::cout << result << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 13456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,c=0;
  cin>>a>>b;
  for(ll i=a;i<=b;i++)
  {
      string s= to_string(i);
      if(s[0]==s[4]&&s[1]==s[3])
      {
          c++;
      }
  }
  cout<<c<<endl;
   return 0;
}


Measured memory_bytes: 3704
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		string ans = "Yes";
		if(str.Substring(2,1)!=str.Substring(3,1) || str.Substring(4,1)!=str.Substring(5,1)){
			ans = "No";
		}
		Console.WriteLine(ans);
	}
}

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

int main() {
  int N,tmp;
  scanf("%d", &N);
  int ord[N + 1];
  for (int i=1; i <= N; i++) {
    cin >> tmp;
    ord[tmp] = i;
  }
  for (int i=1; i <= N; i++) {
  cout << ord[i] << " ";
  }
}

Measured memory_bytes: 1152
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll t1,t2;
int i,j,k,n,a,b,c,d,flag;
int main(){
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	n--;
	for (i=flag=0;!flag&&i<=n;i++){
		t1=(ll)i*(ll)c-(ll)(n-i)*(ll)d;
		t2=(ll)i*(ll)d-(ll)(n-i)*(ll)c;
		if (b-a>=t1&&b-a<=t2) flag=1;
	}
	puts(flag?"YES":"NO");
	return 0;
}

Measured memory_bytes: 128
<?php
 fscanf(STDIN,"%s",$o);
 fscanf(STDIN,"%s",$e);

 for($i=0;$i<strlen($e);$i++){
   echo $o[$i];
   echo $e[$i];
 }

 if(isset($o[strlen($e)])){
   echo $o[strlen($o)-1];
 }

echo "\n";

Measured memory_bytes: 4856
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>
#include<vector>
//#include<Windows.h>
using namespace std;
#define ll long long int
#define LL ll
#define INF 0x3f3f3f3f
const int maxm = 1e4 + 10;
int main() {
	int a, b;
	cin >> a >> b;
	int ans = 3 * a + b;
	ans = ans / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}
ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    int ans = n/3;
    ct(ans);
}



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

int main() {
    int X;
    cin >> X;
    int maxValue = 1;
    vector<bool> expo(X + 1);

    expo[1] = true;
    for (int i = 2; i <= X; i++) {
        int tmp = i * i;
        while (tmp <= X) {
            expo[tmp] = true;
            tmp *= i;
        }
    }

    for (int i = X; 1 <= i; i--) {
        if (expo[i]){
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> arr(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	vector<int> dp(n);
	dp[n - 1] = 0;
	dp[n - 2] = abs(arr[n - 2] - arr[n - 1]);
	for (int i = n - 3; i >= 0; i--) {
		dp[i] = min(abs(arr[i + 1] - arr[i]) + dp[i + 1], abs(arr[i + 2] - arr[i]) + dp[i + 2]);
	}
	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 1024
a,b=map(int,input().split())
A=str(a)*b
B=str(b)*a
for i in range(min(len(A),len(B))):
  if int(A[i])>int(B[i]):
    print(B)
    break
  elif int(A[i])<int(B[i]):
    print(A)
    break
  if i==min(len(A),len(B))-1:
    print(A)

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

int main() {
  int N;
  int cnt=0;
  int kai=1;
  cin >> N;
  
  vector<int> v(N);
  for(int i=0;i<v.size();i++){
    cin >> v.at(i);
  }
  
  while(1){
    kai = v.at(kai-1);
    cnt++;
    if(kai==2) break;
    if(cnt>N){
      cnt=-1;
      break;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    string ans;
    if (a <= 8 && b <= 8)
        ans = "Yay!";

    else
    {
        ans = ":(";
    }
    cout
        << ans << endl;
}


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


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	
	while (1) {
		int x, y; char c;

		cin >> x >> c >> y;

		if (c == '?')break;

		int ans = 0;
		if (c == '+')ans = x + y;
		if (c == '-')ans = x - y;
		if (c == '*')ans = x * y;
		if (c == '/')ans = x / y;

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


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

int main(int argc, char *argv[]) {
	int n, higher, temp, res=1;
	cin >> n >> higher;

	for(int i = 0; i < n-1; i++){
		cin >> temp;
		if(temp >= higher){
			res++;
			higher = temp;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main
{
    static class Len
    {	
	int a[]; //= new int[2000010];
	int b[]; //= new int[2000010];
	
	Len(int n)
	{
	    a = new int[n+1];
	    b = new int[n+1];
	}
	

    }

    public static void main(String args[])
    {
	int n;
	int i, j, k;

	String line = new String();
	BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));

	//Read ----------------
	//Read n
	try{
	    line=line=bin.readLine();
	}	
	catch(IOException e){
	    System.out.println("Error");
	}

	n=Integer.parseInt(line);
	Len len = new Len(n);
	j=0;
	//Read A[]
	try{
	    line=bin.readLine();
	    //System.out.println(line);
	    StringTokenizer str = new StringTokenizer(line);   
	    for(i=0; i<n; i++)
		{
		    len.a[i]=Integer.parseInt(str.nextToken());
		    if(j<len.a[i])j=len.a[i];
		}
	}
	catch(IOException e){
	    System.out.println("Error");
	}

	bin=null;

	//Read end------------


	//sort
	countingSort(len, j, n);

	//print
	StringBuffer s = new StringBuffer(1000);
	for(i=1; i<=n; i++)
	    {
		s.append(len.b[i]);
		if(i!=n)s.append(" ");
	    }
	System.out.println(s);

    }

    static void countingSort(Len len, int max, int n)
    {
	int i, j, k;
	int[] c = new int[max+1];

	for(i=0; i<n; i++)c[len.a[i]]++;

	for(i=0; i<=max; i++)
	    {
		if(i!=0)c[i]+=c[i-1];
	    }

	for(i=n-1; i>=0; i--)
	    {
		len.b[c[len.a[i]]]=len.a[i];
		c[len.a[i]]--;
	    }
    }
}

Measured memory_bytes: 101000
mode = []
count = [0 for i in range(100)]
while(1):
	try:
		n = int(input())
		count[n-1] = count[n-1] + 1
	except EOFError:
		max_ = max(count)
		for i in range(100):
			if count[i] == max_:
				mode.append(i+1)
		for i in mode:
			print(i)
		break


Measured memory_bytes: 5596
def solve(a, b, c, k):
    if k <= a:
        return 1 * k
    if k <= a+b:
        return 1 * a
    rest = k - a - b
    return (1*a) - (1*rest)

a, b, c, k = map(int, input().split())
print(solve(a, b, c, k))


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;



int main() {
    string S;
	cin >> S;
	int wh = 0;
	long long ans=0;
	for (size_t i = 0; i < S.size(); i++)
	{
		if (S.at(i) == 'W') {
			ans += i - wh;
			wh++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 640
#include<stdio.h>


int main()
{
	int N;
	int A[100];
	int ans = 0;
	int ans2 = 0;
	int ans3 = 0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			ans = A[i] - A[j];
			if (ans < 0) ans *= -1;
			
			if (ans>ans2) ans2 = ans;
		}
		if (ans2>ans3) ans3 = ans2;
	}
	printf("%d\n",ans3);
}

Measured memory_bytes: 128
n, m = [int(elem) for elem in input().split()]
a_lst = [int(elem) for elem in input().split()]

bd = sum(a_lst) / (4 * m)
cnt = 0

for a in a_lst:
    if bd <= a:
        cnt += 1

if cnt >= m:
    print("Yes")
else:
    print("No")

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

int main() {
	int N;
	std::cin >> N;

	std::string S;
	std::cin >> S;

	int result = 1;
	for(int i = 0; i < N - 1; i++) {
		if(S[i] != S[i + 1]) {
			result++;
		}
	}

	std::cout << result << std::endl;

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

// class ReconstructNumber {
// public:
//     string smallest(string);
// };

// string ReconstructNumber::smallest(string s) {
// }

int n, k;
ll C[5010][5010];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    C[0][0] = 1;
    FOR(i,1,5000)
        FOR(j,0,i)
            if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = (C[i-1][j] + C[i-1][j-1]) % MODBASE;
    cin >> n >> k;
    int m = n - k;
    FOR(i,1,k) {
        int mid = i-1;
        if (m < mid) {
            cout << 0 << "\n";
            continue;
        }
        ll g = C[k-1][mid];
        ll e = mid + 2;
        ll w = m - mid;
        cout << g * C[w+e-1][e-1] % MODBASE << "\n";
    }
    return 0;
}

Measured memory_bytes: 194176
#include <stdio.h>


int main()

{
   char S[4]=""; 
   
   
scanf("%s",S); 
 
    
    
if(S[0]==S[1]||S[1]==S[2]||S[2]==S[3])
   { printf("Bad");}
   
else 
    {printf("Good");}
    
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
map<int,int> ans;
vector<bool> vu(200010);
vector<vector<int>> adj(200010);
vector<int> add(200010);

void dfs(int node,int sum){
	for (auto& i:adj[node]){
		if (!vu[i]){
			vu[i] = true;
			sum += add[i];
			ans[i] = sum;
			dfs(i,sum);
			sum -= add[i];
		}
	}
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,q;
	cin >> n >> q;
	for (int i=0; i<n-1; ++i){
		int a,b;
		cin >> a >> b;
		adj[a].emplace_back(b);
		adj[b].emplace_back(a);
	}
	for (int i=0; i<q; ++i){
		int a,b;
		cin >> a >> b;
		add[a] += b;
	}
	ans[1] = add[1];
	vu[1] = true;
	dfs(1,add[1]);
	for (auto i:ans) cout << i.second << ' ';
	return 0;
}


Measured memory_bytes: 43008
def main():
    n, m = map(int, input().split())
    uf = [-1] * (n+1)

    def uf_find(a):
        if uf[a]<0:
            uf[a] = a
            return a
        elif uf[a]==a:
            return a
        uf[a] = uf_find(uf[a])
        return uf[a]
    def uf_union(a, b):
        if uf_find(a)==uf_find(b):
            return
        ua, ub = uf_find(a), uf_find(b)
        if ua>ub:
            ua, ub = ub, ua
        uf[ub] = ua
    def uf_leaders():
        return set([uf_find(v) for v in range(1,n+1)])

    for _ in range(m):
        a, b = map(int, input().split())
        uf_union(a, b)

    # print(uf)
    # print(uf_leaders())
    
    ans = len(uf_leaders())-1
    print(ans)

main()

Measured memory_bytes: 19180
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const char y[4][20] = {"Positive", "Negative", "Zero"};
int a, b;
int main() {
	cin >> a >> b;
	if(a > 0 && b > 0) puts(y[0]);
	if(a < 0 && b > 0) puts(y[2]);
	if(a < 0 && b < 0) {
		int det = b-a;
		puts(y[(det&1)^1]);
	} 
}


Measured memory_bytes: 256
console.log((args=>{
  const [[N],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  A.sort((a,b)=>a-b);
  const MAX = A[N-1];
  const ex = Array(MAX+1).fill(false);
  let count = 0;
  for ( let i = 0; i < N; i++ ) {
    if ( ex[A[i]] ) continue;
    for ( let j = A[i]; j <= MAX; j+=A[i] ) {
      ex[j] = true;
    }
    if ( A[i] !== A[i+1] ) count++;
  }
  return `${count}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 58580
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  cout<<max({A,B,C})-min({A,B,C});
return 0;}

Measured memory_bytes: 3616