akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define MAXN 100005
#define MP make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define SQ(a) (a)*(a)
#define nl "\n"
#define INF std::numeric_limits<int>::max()
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
ll mod=1000000009;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n,a,b;
	cin>>n>>a>>b;
	if(a==0 && b==0){
		cout<<"0"<<nl;
	}
	else 
	cout<<( (n/(a+b))*a + min(n%(a+b),a))<<nl;
	return 0;
}






Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

import java.util.Arrays;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int[] data = new int[10];
        
        for(int i = 0; i < 10; i++){
            data[i] = Integer.parseInt(br.readLine());
        }

        Arrays.sort(data);

        for(int i = 9; i >= 7; i--){
            System.out.println(data[i]);
        }

    }
}

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

struct data{
	int x,y,step,sisa;
	
	data(int x, int y, int step, int sisa){
		this->x = x;
		this->y = y;
		this->step = step;
		this->sisa = sisa;
	}
	
	bool operator < (const data &b) const{
		return step > b.step;
	}
	
};

int h,w,k;
int ms;
char fi[805][805];

//int vis[805][805][405];
//bool pern[805][805][405];
//priority_queue<data> pq;
int vis[805][805];
int tand[805][805];

queue<data> qd;
bool is_exit(int x, int y){
	return (x==1) || (y==1) || (x==h) || (y==w);
}

int p[4] = {1,0,-1,0};
int q[4] = {0,1,0,-1};

int dij(int x, int y){
	memset(vis,-1,sizeof(vis));
	vis[x][y] = 0;
	data cur = data(x,y,0,0);
	qd.push(cur);
	int cnt = 0;
	while(1){
		cnt++;
		queue<data> sisa;
//		cout << ">> " << cnt << endl;
		int isi = qd.size();
		while(isi--){
			cur = qd.front(); qd.pop();
			if(cur.sisa != vis[cur.x][cur.y]) continue;
			cur.step = k;
			if(cnt != 1){
				cur.sisa += k;
				cur.sisa = min(cur.sisa,1600);
			}
			qd.push(cur);
		}
//		int tmp = qd.size();
		while(!qd.empty()){
			cur = qd.front(); qd.pop();
			int itung = 0;
			for(int i=0;i<4;i++){
				data lol = cur;
				lol.x+=p[i];
				lol.y+=q[i];
//				cout << "TRY " << lol.x << " " << lol.y << endl;
				if(tand[lol.x][lol.y] != 0 && tand[lol.x][lol.y] != cnt) continue;
				lol.step--;
				if(fi[lol.x][lol.y] == '#'){
					lol.sisa--;
				}
				if(lol.sisa < 0 || lol.step < 0){
					itung++;
					continue;
				}
				tand[lol.x][lol.y] = cnt;
				if(is_exit(lol.x,lol.y)) return cnt;
				if(vis[lol.x][lol.y] >= lol.sisa) continue;
//				pern[lol.x][lol.y][lol.sisa] = 1;
				vis[lol.x][lol.y] = lol.sisa;
//				cout << "PUSH " << lol.x << " " << lol.y << endl;
//				system("PAUSE");
				qd.push(lol);
			}
			if(itung>0) sisa.push(cur);
		}
		while(!sisa.empty()){
//			printf("SISA %d %d\n",sisa.front().x,sisa.front().y);
			qd.push(sisa.front()); sisa.pop();
		}
	}
	return -1;
}

int main(){
	scanf("%d%d%d",&h,&w,&k);
	int sx,sy;
	for(int i=1;i<=h;i++){
		getchar();
		for(int j=1;j<=w;j++){
			scanf("%c",&fi[i][j]);
			if(fi[i][j] == 'S'){
				sx = i;
				sy = j;
			}
		}
	}
	ms = (min(h,w)+k-1)/k + 1;
	int ans = dij(sx,sy);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 7296
import numpy
N,K=map(int,input().split())

if K==1:
    print(0)
    exit(0)

A=list(map(int,input().split()))
S=[0]+list(numpy.cumsum(A)) #累積和
S2=[(S[i]-i)%K for i in range(N+1)]

d = {}
ans = 0
for j in range(1,N+1):
    if j>K-1:
        if S2[j-K] in d:
            d[S2[j-K]] -= 1
        
    if S2[j-1] in d:
        d[S2[j-1]] += 1
    else:
        d[S2[j-1]] = 1
        
    if S2[j] in d:
        ans += d[S2[j]]
print(ans)

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

int main(void) {
    ll H; cin >> H;
    ll count=0;
    while(H!=1) {
        H/=2;
        count++;
    }
    ll ans = pow(2,count)*2-1;
    cout << ans << endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl "\n"
#define p_b push_back
#define m_p make_pair
#define fastIO ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
template <class T> 
using _ost = tree<
		T, 
		null_type, 
		less<T>, 
		rb_tree_tag, 
        tree_order_statistics_node_update>;


int32_t main(){
 	fastIO;
	string s;cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 1e5 + 5, INF = 1e9 + 5, M = N + N;
int a[N], pref[N], t[M];
int n;

int que(int x) {
	x += N;
	int s = 0;
	for (; x >= 0; x = (x & (x + 1)) - 1)
		s += t[x];
	return s;
}

void upd(int x, int y) {
	x += N;
	for (; x < M; x |= x + 1) {
		t[x] += y;
	}
}

ll get_ct_at_least_p(ll p) {
	ll ans = 0;

	for (int i = 0; i < n; i++) {
		pref[i + 1] = pref[i] + (a[i] < p);
	} 

	fill(t, t + M, 0);

	for (int i = 0; i <= n; i++) {
		int x = i - 2 * pref[i];
		ans += que(x);
		upd(x, 1);
	}

	return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;

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

    ll all_pairs_ct = n * (ll)(n + 1) / 2;

    ll l = 0, r = INF;
    while (r - l > 1) {
    	ll p = (l + r) >> 1;

    	if ((all_pairs_ct - get_ct_at_least_p(p)) * 2 <= all_pairs_ct) {
    		l = p;
    	}
    	else {
    		r = p;
    	}
    }

    cout << l;

    return 0;   
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define rep(i, x, n) for(int i = (x); i < (n); i++)
#define rrep(i, x, n) for(int i = (x); i >= (n); i--)
#define int long long
#define endl "\n"
#define mod 1000000007
#define mxx 100005
#define pb push_back
#define vll vector<long long>
#define vs vector<string>
#define pll pair<long long, long long>
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
int fact[1000005];
void factorial(){
	fact[0] = 1;
	rep(i, 1, 1000002)fact[i] = (fact[i-1]*i) % mod;
}

int power(int a, int b ,int m){
	int res = 1;
	a = a % m;
	while ( b > 0){
	if (b & 1) res = (res * a) % m;
	b = b>>1;
	a = (a * a) % m;
	}
	return res % m;
}

int mod_in(int n){
	return ( power(n, mod-2,mod) % mod);
}

int ncr(int n, int r){
	return ( fact[n] * ((mod_in(fact[r]) * mod_in(fact[n-r])) % mod) % mod);
}

class dsu{
	public:
	vll v,size;
	dsu(int n){
		for(int i=0;i<n;i++){
			v.pb(i);
			size.pb(1);
		}
	}
	int par(int a){
		if(v[a]!=a) v[a] =  par(v[a]);
		return v[a];
	}

	int comp(int a,int b) {return par(a)==par(b);}
	
	void unio(int a, int b){
		int pa=par(a);
		int pb=par(b);
		if(pa!=pb){
			if(size[pb]>size[pa]) swap(pa,pb);
			v[pb]=pa;
			size[pa]+=size[pb];
		}
	}
};


signed main()
{
	int t=1;
	// cin >> t;
	while(t--){
		int n; cin >> n;
		int arr[n];
		rep(i,0,n) cin >> arr[i];
		int curmax=0;
		int ans=0;
		rep(i,0,n){
			if(arr[i]<=curmax) ans+=curmax-arr[i];
			else curmax=arr[i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 5184
n = int(input())
l = [int(i) for i in input().split()]

orderd = [i for i in range(1,n+1)]
ans = 0
for i in range(n-1):
    if l[i]== orderd[i]:
        l[i],l[i+1] = l[i+1],l[i] 
        ans += 1

print(ans + 1 if l[-1] == n else ans)

Measured memory_bytes: 13880
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a)+min(b)
for i in range(M):
    x,y,c = map(int,input().split())
    ans = min(ans,a[x-1]+b[y-1]-c)
print(ans)

Measured memory_bytes: 18648
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn a() {
    let s = read!(String);
    let t = read!(String);

    let c_s: Vec<char> = s.chars().collect::<Vec<char>>();
    let t_s: Vec<char> = t.chars().collect::<Vec<char>>();
    let mut ans = 0;
    for i in 0..c_s.len() {
        if c_s[i] == t_s[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn b() {
    let (a, b) = read!(usize, usize);
    if b == 1 {
        println!("0");
        return;
    }
    let mut ans = 1;
    let mut cnt = a;
    while cnt < b {
        ans += 1;
        cnt += a - 1;
    }
    println!("{}", ans);
}

fn c() {
    let n = read!(usize);
    let h: Vec<usize> = read![[usize]];

    // 最長部分減少列（ただし連続）の長さを求める その長さ-1が答え
    let mut max_len = 0;
    let mut len = 0;
    let mut prev_h = 0;
    for i in 0..n {
        if prev_h >= h[i] {
            prev_h = h[i];
            len += 1;
        } else {
            prev_h = h[i];
            if max_len < len {
                max_len = len;
            }
            len = 1;
        }
    }
    if max_len < len {
        max_len = len;
    }
    println!("{}", max_len - 1);
}

fn d() {
    unimplemented!();
}

fn e() {
    unimplemented!();
}

fn f() {
    unimplemented!();
}

fn main() {
    c();
}


Measured memory_bytes: 8444
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=3e5+5;


int main()
{ 

IOS;

ll n;cin>>n;

string s;cin>>s;

vl ch(26);

ll tot=0;
ll p=1e9+7;

for(int i=0;i<n;i++){
  ll temp=1;
  for(int j=0;j<26;j++){
    if(j==s[i]-'a')continue;
    temp=temp*(ch[j]+1)%p;
    //temp%=p;
  }
  ch[s[i]-'a']++;
  tot=(tot+temp)%p;
}

d1(tot);

return 0;
 
}



Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,nn;
int main()
{
	scanf("%d",&n);for(nn=1;nn<n;nn<<=1);
	if(nn==n){puts("No");return 0;}else puts("Yes");
	int a[6]={1,n+2,3,n+1,2,n+3};
	for(int i=1;i<6;i++)printf("%d %d\n",a[i-1],a[i]);
	for(int i=4;i<n;i+=2)
	{
		printf("%d %d\n",i,1);printf("%d %d\n",i,n+i+1);
		printf("%d %d\n",i+1,1);printf("%d %d\n",i+1,n+i);
	}
	if(~n&1)
	{
		for(int i=2;i<n;i++)if((n^i^1)<n)
		{
			printf("%d %d\n",n,i);
			printf("%d %d\n",n+n,n^i^1);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==0)
    {
        cout<<"0";
        return 0;
    }
    int a[60];
    memset(a,0,sizeof(a));
    int top=0;
    while(n!=0)
        if(n>0)
        {
            a[++top]=n%(-2);
            n/=-2;
        }
        else
        {
            a[++top]=fabs(n%(-2));
            if(n%(-2)==-1)
                n=n/(-2)+1;
            else
                n=n/(-2);
        }
    for(int i=top;i>=1;--i)
        cout<<a[i];
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 1000000

int parent(int i){ return i/2; }
int left(int i){ return 2*i; }
int right(int i){ return 2*i+1; }

int main(){
  int H, i, A[MAX + 1];

  scanf("%d",&H);
  for ( i = 1; i <= H; i++ )scanf("%d",&A[i]);

  for ( i = 1; i <= H; i++ ){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i) >= 1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i) <= H)printf("left key = %d, ",A[left(i)]);
    if(right(i) <= H)printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2040
import math

LI = lambda: list(map(int, input().split()))

N, K = LI()
A = LI()


def judge(x):
    k = 0
    for a in A:
        if a <= x:
            continue
        if a % x == 0:
            k += a // x - 1
        else:
            k += a // x
    if k <= K:
        return True
    else:
        return False


def solve():
    left, right = 0, max(A)
    while right - left > 1:
        x = (left + right) // 2
        if judge(x):
            right = x
        else:
            left = x
    return right


def main():
    ans = solve()
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 93868
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    let mut arr = Vec::new();

    arr.push(a * c);
    arr.push(a * d);
    arr.push(b * c);
    arr.push(b * d);

    arr.sort_unstable();

    println!("{}", arr.last().unwrap())
}


Measured memory_bytes: 2204
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }

        public static long C(long n,long k)
        {
            long x=1;
            for (long i = 1; i <=k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            var d = new long[5];
            for(int i = 0; i < n; i++)
            {
                var s = ReadLine();
                if (s[0] == 'M') d[0]++;
                if (s[0] == 'A') d[1]++;
                if (s[0] == 'R') d[2]++;
                if (s[0] == 'C') d[3]++;
                if (s[0] == 'H') d[4]++;
            }
            long ans = 0;
            for (int i = 0; i < 5; i++)
            {
                for (int j = i+1; j < 5; j++)
                {
                    for (int k = j+1; k < 5; k++)
                    {
                        ans += d[i] * d[j] * d[k];
                    }
                }
            }
            WriteLine(ans);
            


            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 21544
a={'m':1000,'c':100,'x':10,'i':1}
for _ in range(int(input())):
    b,s,t=input().replace(' ',''),0,1
    for x in b:
        if x in a:s+=a[x]*t;t=1
        else:t=int(x)
    d=''
    for k in ['m','c','x','i']:
        c,s=divmod(s,a[k])
        if c:d+=['',str(c)][c!=1]+k
    print(d)

Measured memory_bytes: 7648
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

r,g,b = iim()
num = 100*r+10*g+b
if num%4 == 0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3064
# https://atcoder.jp/contests/abc063/tasks/arc075_b
# 問題文あなたが散歩していると、突然 N 体の魔物が出現しました。
# それぞれの魔物は 体力 という値を持ち、i 体目の魔物の出現時の体力は hi です。
# 体力が 0以下となった魔物は直ちに消滅します。
# 幸い、あなたは熟練の魔法使いであり、爆発を引き起こして魔物を攻撃できます。
# 一回の爆発では、以下のように魔物の体力を減らすことができます。
# 生存している魔物を一体選び、その魔物を中心に爆発を引き起こす。
# 爆発の中心となる魔物の体力は A 減り、
# その他の魔物の体力はそれぞれ B 減る。
# ここで、A と B はあらかじめ定まった値であり、A>B である。
# すべての魔物を消し去るためには、最小で何回の爆発を引き起こす必要があるでしょうか？
# 制約入力値はすべて整数である。
# 1≤N≤10^5
# 1≤B<A≤10^9
# 1≤hi≤10^9

# N A B
# h1
# h2
# :
# hN

# 4 5 3
# 8
# 7
# 4
# 2

# 2

# 2 10 4
# 20
# 20

# 4

# 5 2 1
# 900000000
# 900000000
# 1000000000
# 1000000000
# 1000000000

# 800000000

N, A, B = gets.split.map(&:to_i)
H = []
N.times { H << gets.to_i }

A_B = A - B

class Integer
  def able?
    counter = self
    bself = B * self
    H.each do |value|
      next if value <= bself
      counter -= ((value - bself + A_B - 1)/(A_B)).ceil
      break if counter < 0
    end
    counter >= 0
  end
end

# T回で倒しきれるか？ を二分探索
# ng = 0, ok = h.max
ng = 0
ok = 10**9
mid = 0
while (ok - ng) > 1
  mid = (ng + ok)/2
  if mid.able?
    ok = mid
  else
    ng = mid
  end
end
puts ok

Measured memory_bytes: 3836
import heapq

N,M=map(int,input().split())
A=list(map(int,input().split()))

D={}
for _ in range(M):
    B,C=map(int,input().split())
    if -C in D:
        D[-C]+=B
    else:
        D[-C]=B

H=list(D.items())
heapq.heapify(H)

G=[]
Y=0
while Y<N and H:
    (a,k)=heapq.heappop(H)
    a=-a
    k=min(k,N-Y)
    A+=[a]*k
    Y+=k

A.sort(reverse=True)
print(sum(A[:N]))

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

int main()
{
	int S = 0;
	cin >> S;

	int h = (int)(S / 3600);
	int m = (int)( (S % 3600) / 60 );
	int s = (int)( (S % 3600) % 60 );

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}

Measured memory_bytes: 3092
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();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static T[] Recursion<T>(int n, T v, Func<int, T, T> f) { var a = new T[n]; a[0] = v; for (var i = 1; i < n; i++) a[i] = f(i, a[i - 1]); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G;
		int N = I[0], X = I[1];
		var S = G;
		Array.Sort(S, (p, q) => q.CompareTo(p));
		var dp = new Dictionary<int, long>[2];
		dp[0] = new Dictionary<int, long> { [X] = 1 };
		for (var i = 0; i < N; i++)
		{
			var inv = Inverse(N - i);
			var i2 = i % 2;
			var j2 = (i + 1) % 2;
			dp[j2] = new Dictionary<int, long>();
			foreach (var t in dp[i2])
			{
				var x = t.Key;
				var y = x % S[i];
				if (!dp[j2].ContainsKey(y)) dp[j2][y] = 0;
				if (!dp[j2].ContainsKey(x)) dp[j2][x] = 0;
				dp[j2][y] = (dp[j2][y] + t.Value * inv % MOD) % MOD;
				dp[j2][x] = (dp[j2][x] + dp[i2][x] * (1 - inv + MOD) % MOD) % MOD;
			}
		}
		var s = dp[N % 2].Sum(t => t.Key * t.Value % MOD) % MOD;
		for (var i = 1; i <= N; i++) s = s * i % MOD;
		WriteLine(s);
	}
	public static long Inverse(long a, long mod = MOD)
	{
		if (a < 0) { a %= mod; if (a < 0) a += mod; }
		var t = SolveLinear(a, mod);
		return t.Item1 > 0 ? t.Item1 : t.Item1 + mod;
	}
	public static Tuple<long, long> SolveLinear(long n, long m)
	{
		if (n < 0) { var p = SolveLinear(-n, m); return p == null ? p : new Tuple<long, long>(-p.Item1, p.Item2); }
		if (m < 0) { var p = SolveLinear(n, -m); return p == null ? p : new Tuple<long, long>(p.Item1, -p.Item2); }
		if (n < m) { var p = SolveLinear(m, n); return p == null ? p : new Tuple<long, long>(p.Item2, p.Item1); }
		long a = 1, b = 0, c = 0, d = 1;
		while (m > 0)
		{
			var r = n % m;
			var q = n / m;
			n = m;
			m = r;
			var tmp = a;
			a = -a * q + b;
			b = tmp;
			tmp = c;
			c = -c * q + d;
			d = tmp;
		}
		return n != 1 ? null : new Tuple<long, long>(d, b);
	}
}

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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int q;
    cin >> q;
    multiset<int> st;
    int l = 0,r = 0,cen;
    ll ans = 0;
    auto it = st.find(0);
    for (int i = 0;i < q;++i) {
        int a,b,c;
        scanf("%d",&c);
        if (c == 1) {
            scanf("%d%d",&a,&b);
            ans += b;
            st.insert(a);
            if (i == 0) {
                cen = a;
                it = st.find(a);
            } else {
                if (a < cen) {
                    if (st.size()%2 == 0) {
                        --it;
                        r++;
                        ans += (ll)(cen-*it)*(r-l);
                        cen = *it;
                    } else l++;
                    ans += cen-a;
                } else {
                    if (st.size()%2 == 1) {
                        ++it;
                        l++;
                        ans += (ll)(*it-cen)*(l-r);
                        cen = *it;
                    } else r++;
                    ans += a-cen;
                }
            }
        } else printf("%d %lld\n",cen,ans);
    }
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x,a; cin>>x>>a;
    if(x<a) cout<<0<<endl;
    else cout<<10<<endl;




}


Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


template <class T>
T digitSum(T num) {
    ll sum = 0;
    while (num != 0) {
        sum += num%10;
        num /= 10;
    }
    return sum;
}

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

    // input
    int A, B;
    cin >> A >> B;
    
    // calculation
    int sum = 0, tmp;
    for (int i = A; i <= B; ++i) {
        int one, ten, thou, ten_thou;
        tmp = i;
        one = tmp%10; tmp/=10;
        ten = tmp%10; tmp/=10;
        tmp/=10;
        thou = tmp%10; tmp/=10;
        ten_thou = tmp%10;
        if (one == ten_thou && ten == thou) {
            sum++;
        }
        
    }
    cout << sum << "\n";
    
    return 0;
}


Measured memory_bytes: 256
from collections import Counter 
N = int(input())
Alist = list(map(int,input().split()))
num = ['NU'] + [0] * 100000
ans = sum(Alist)
cnt = Counter(Alist)
Q = int(input())

for i in range(1,100001):
    num[i] = cnt[i]

for i in range(Q):
    B,C = map(int,input().split())
    ans += num[B]*(C-B)
    num[C] += num[B]
    num[B] = 0
    print(ans)

Measured memory_bytes: 21324
N = int(input())
A = map(int, input().split())

all_price = 0
pre1 = 0
pre2 = 0
B = []

for ai in A:
    all_price += abs(pre1 - ai)
    B += [abs(ai - pre2) - abs(pre1 - pre2) - abs(ai - pre1)]
    pre2, pre1 = pre1, ai

all_price += abs(pre1 - 0)
B += [abs(0 - pre2) - abs(pre1 - pre2) - abs(0 - pre1)]
B = B[1:]

for bi in B:
    print(all_price + bi)

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

int main() {
  ll n, k;
  cin >> n >> k;

  ll total = 0;
  vector<ll> a(n);
  vector<ll> b(n);

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

  set<ll> divisors;
  for (ll i = 1; i*i <= total; i++) {
    if (total % i == 0) {
      divisors.insert(i);
      divisors.insert(total/i);
    }
  }

  ll ans = 1;
  for (auto x : divisors) {
    for (ll i = 0; i < n; i++) b[i] = a[i] % x;
    sort(b.begin(), b.end());

    ll total = 0;
    ll cnt = 0;
    ll i = 0, j = n - 1;
    while (i <= j) {
      if (total <= 0) {
        total += b[i];
        cnt += b[i];
        i++;
      } else {
        total -= x - b[j];
        j--;
      }
    }
    cnt += (total + x) % x;
    if (cnt <= k) ans = x;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  vector<int> arr[26];
  for(int i=0;i<26;++i) arr[i].clear();
  for(int i=0;i<S.size();++i) arr[S[i]-'a'].push_back(i);
  queue<vector<int> > que;
  int num = -1;
  for(int i=0;i<26;++i) {
    if(arr[i].size()==0) {
      cout<<(char)('a'+i)<<endl;
      return 0;
    }
    if(num<arr[i][0]) {
      que.push(vector<int> {arr[i][0]});
      num = arr[i][0];
    }
  }
  vector<int> tmparr;
  int index;
  int last;
  string ans;
  while(true) {
    tmparr = que.front();que.pop();
    last = tmparr[tmparr.size()-1];
    for(int i=0;i<26;++i) {
      index = upper_bound(arr[i].begin(), arr[i].end(), last)-arr[i].begin();
      ans.clear();
      if(index==arr[i].size()) {
        for(int j=0;j<tmparr.size();++j) {
          ans += S[tmparr[j]];
        }
        ans += (char)('a'+i);
        cout<<ans<<endl;
        return 0;
      }
      if(arr[i][index]<=num) continue;
      num = arr[i][index];
      tmparr.push_back(arr[i][index]);
      que.push(tmparr);
      tmparr.pop_back();
    }
  }
}



Measured memory_bytes: 4980
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

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 long long LINF = 1e18;

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

    vector<int> H(N);
    vector<bool> Ans(N, true);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }

    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        if (H[A - 1] <= H[B - 1]) {
            Ans[A - 1] = false;
        }

        if (H[B - 1] <= H[A - 1]) {
            Ans[B - 1] = false;
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (Ans[i]) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3420
package main

import (
	"fmt"
)

func main (){
	var X int
	fmt.Scan(&X)
	for i := X ; ;i++ {
		for j := 2 ; j < i; j++{
			if i % j == 0 {
				goto F1
			}
		}
		fmt.Println(i)
		return 
	F1:
	}
}





Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int w,a,b;cin >> w >> a >> b;
	if(a<=b) cout << max(b-(a+w),0) << endl;
	else cout << max(a-(b+w),0) << endl;
}

Measured memory_bytes: 256
import bisect
from itertools import accumulate
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ac_A = list(accumulate(A))
ac_B = list(accumulate(B))

#left = 0
max_book_num = bisect.bisect_right(ac_B, k)

for left_book_num in range(n):
    if ac_A[left_book_num] > k:
        break
    else:
        max_book_num = max(max_book_num, left_book_num + 1 + bisect.bisect_right(ac_B, k - ac_A[left_book_num]))
print(max_book_num)

Measured memory_bytes: 126480
using System;

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var items = Console.ReadLine().Split();

            var min = 1000000;
            var max = -1000000;
            long sum = 0;

            foreach (var s in items)
            {
                var x = int.Parse(s);
                min = Math.Min(min, x);
                max = Math.Max(max, x);
                sum += x;
            }

            Console.WriteLine($"{min} {max} {sum}");
        }
    }
}



Measured memory_bytes: 19864
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,A,B = map(int,input().split())
min=0
if N*A < B:
    min = N*A
else:
    min = B

print(min)


Measured memory_bytes: 4328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<vector<int> > in(1000), out(1000);
		int idmax=0;
		for(int i=0; i<n; i++){
			string date,time,io,id;
			cin >> date >> time >> io >> id;
			int min = stoi(date.substr(0,2))*50000 +stoi(date.substr(3,2))*1440
						+stoi(time.substr(0,2))*60 +stoi(time.substr(3,2));
			if(io=="I"){
				in[stoi(id)].push_back(min);
			}else{
				out[stoi(id)].push_back(min);
			}
			idmax = max(idmax, stoi(id));
		}
		
		int ans=0;
		for(int i=1; i<=idmax; i++){
			int sum=0;
			for(int j=0; j<(int)in[0].size(); j++){
				for(int k=0; k<(int)in[i].size(); k++){
					if((in[0][j]<=in[i][k] && in[i][k]<=out[0][j]) || (in[i][k]<=in[0][j] && in[0][j]<=out[i][k])){
						sum += abs(max(in[0][j], in[i][k]) -min(out[0][j], out[i][k]));
					}
				}
			}
			ans = max(ans, sum);
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  std::vector<int> A(N);
  rep(i,N) cin >> A[i];
  
  vector<int>::iterator minIt = min_element(A.begin(), A.end());
  size_t minIndex = distance(A.begin(), minIt);
  
  int r = (N-1) - minIndex;
  int l = minIndex;
  
  int x = r+l;
  int cnt = 0;
  while(true){
    x = x-(K-1);
    cnt++;
    if(x <= 0){
      cout << cnt << endl;
      return 0;
    }
  }

 return 0; 
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,M=1e9+7;
    cin>>n;
    map<long,long> mp;
    for(int i = 0; i < n; i++){
        long t;
        cin>>t;
        if(mp.find(t)==mp.end()){
            mp[t]=1;
        }
        else
            mp[t]++;
    }
    if((n%2==0&&mp.find(0)!=mp.end()||mp[0]>1)){
        cout<<"0";
        return 0;
    }
    long sum=1;
    for(auto x:mp){
        if(x.first!=0&&x.second!=2){
            cout<<"0";
            return 0;
        }
        if(x.first==0)
            continue;
        sum=sum*2%M;
    }
    cout<<sum;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<min({a+b,b+c,c+a})<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
A1,A2,A3,A4,A5,A6,A7,A8=[],[],[],[],[],[],[],[]
for i in range(n):
  x,y,z=map(int,input().split())
  a1=x+y+z
  a2=-x+y+z
  a3=x-y+z
  a4=x+y-z
  a5=x-y-z
  a6=-x+y-z
  a7=-x-y+z
  a8=-x-y-z
  A1.append(a1)
  A2.append(a2)
  A3.append(a3)
  A4.append(a4)
  A5.append(a5)
  A6.append(a6)
  A7.append(a7)
  A8.append(a8)
A1.sort(reverse=True)
A2.sort(reverse=True)
A3.sort(reverse=True)
A4.sort(reverse=True)
A5.sort(reverse=True)
A6.sort(reverse=True)
A7.sort(reverse=True)
A8.sort(reverse=True)
m1=sum(A1[:m])
m2=sum(A2[:m])
m3=sum(A3[:m])
m4=sum(A4[:m])
m5=sum(A5[:m])
m6=sum(A6[:m])
m7=sum(A7[:m])
m8=sum(A8[:m])
print(max([m1,m2,m3,m4,m5,m6,m7,m8]))

Measured memory_bytes: 3432
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  
  if (A <= 8 && B <= 8){
    cout << "Yay!" << endl;
  }
  else if (A < 9 || B < 9){
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}
const ll N=1e5+5;
ll h[N];
vector<ll>v[N];
int32_t main()
{   
     IOS;
     ll n,m,i,j,k;
     cin>>n>>m;
     for(i=1;i<=n;i++) cin>>h[i];
     while(m--)
     {
       ll x,y;
       cin>>x>>y;
       v[x].pb(h[y]);
       v[y].pb(h[x]);
     }
     ll ans=0;
     for(i=1;i<=n;i++)
     {
       if(v[i].empty()) ans++;
       else
       {
         sort(all(v[i]),greater<ll> ());
         if(h[i]>v[i][0]) ans++;
       }
     }
     cout<<ans;

     
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 10400
#include<cstdio>
#include<cstring>
using namespace std;
int n,m;char S[16],T[16];
int main()
{
	scanf("%s%s",S,T);
	printf("%s\n",((strlen(T)==strlen(S)+1)&&(memcmp(S,T,strlen(S))==0))?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1592
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	let a = parseInt(input[0], 10);
	let b = parseInt(input[1], 10);
	let c = parseInt(input[2], 10);
	let d = parseInt(input[3], 10);
	let e = parseInt(input[4], 10);
    let f = '0';
 
  if (a==0) {
    f='1';
  } 
  if (b==0) {
    f='2';
  } 
  if (c==0) {
    f='3';
  } 
  if (d==0) {
    f='4';
  } 
  if (e==0) {
    f='5';
  } 
 
 	//出力
	console.log(f);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

ll conta(ll a, ll b, ll x){
	return ((a*x)/b) - a*(x/b);
}

int main(){
	ll a, b, n;
	cin >> a >> b >> n;
	/*
	for(ll i = 1; i <= n; i++){
		printf("%lld: %lld\n", i, conta(a,b,i));
	}
	*/
	if(n >= b-1){
		cout << conta(a, b, b-1) << endl;
	} else {
		cout << conta(a, b, n) << endl;
	}
	return 0;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        
        for (int i = 1; i < s.length() / 2 + 1; i++) {
            String s1 = s.substring(0, i);
            String s2 = s.substring(i, i + i);
            if(s1.equals(s2)){
                if(!s.equals(s1 + s2)) {
                    ans = i * 2;
                }
            }
        }
        
        System.out.println(ans);
        
    }
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    if(n%2==1){
        cout <<0<<endl;
        return 0;
    }
    else {
        ll ans=0;
        ll f=5;
        ll k=n/f;
        ans+=k/2;
        while(k>0){
            f*=5;
            k=n/f;
            ans+=k/2;
        }
        cout <<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=i2()
d=[0 for i in range(10**5)]
for i in range(n):
 d[a[i]]+=1
 if a[i]<n-1:d[a[i]+1]+=1
 if a[i]>0:d[a[i]-1]+=1
print(max(d))

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

using namespace std;

const int MD = 1000000007;

int main() {
	long long n, k; cin >> n >> k;
	long long x = n - (k - 1) + 1, ans = (x * x * n * 3 + x * x * 6 - x * x * k * 6 + x * k * n * 6 - x * n * 3 - x * k * k * 6 + x * k * 12 - x * x * x * 2 + x * 2) / 6 % MD;
	while (ans < 0)
		ans += MD;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <cmath>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int ll;

int main() {
  int N, A[100];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 == 0 && A[i] % 3 != 0 && A[i] % 5 != 0) {
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


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

int main()
{
    long long n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
    } else {
        long long m = 5, ans = 0;
        while ((n / 2) / m) {
            ans += (n / 2) / m;
            m *= 5;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, a = int(input()), input().split()
ta = list((int(c[1]), i, c) for i, c in enumerate(a))
ca = sorted(ta)

ba = ta[:]
for i in range(n):
    for j in range(n - 1, i, -1):
        if ba[j][0] < ba[j - 1][0]:
            ba[j], ba[j - 1] = ba[j - 1], ba[j]

print(*[t[2] for t in ba])
print(('Not s' if ba != ca else 'S') + 'table')

sa = ta[:]
for i in range(n):
    minj = i
    for j in range(i, n):
        if sa[j][0] < sa[minj][0]:
            minj = j
    if minj != i:
        sa[i], sa[minj] = sa[minj], sa[i]

print(*[t[2] for t in sa])
print(('Not s' if sa != ca else 'S') + 'table')

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    string s, ans;
    cin >> s;

    rep(i, 8) {
        ans = s.substr(0, i) + s.substr(s.size() - (7 - i), 7 - i);
        if (ans == "keyence") {cout << "YES" << endl; return 0;}
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;

namespace AtCoder
{
    class AC
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        static int[] dx = { 0, 1, 0, -1 };
        static int[] dy = { 1, 0, -1, 0 };



        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            var s = Console.ReadLine();
            long K = long.Parse(Console.ReadLine());
            List<long> a = new List<long>();
            long c = 0;
            long ans = 0;

            for(var i = 0; i < s.Length; i++)
            {
                c++;
                if (i < s.Length - 1 && s[i] != s[i + 1]) 
                {
                    a.Add(c);
                    c = 0;
                }
                if (i == s.Length - 1)
                {
                    a.Add(c);
                }
            }

            if (a.Count() == 1)
            {
                Console.WriteLine((s.Length * K) / 2);
                return;
            }
            for(var i = 0; i < a.Count(); i++)
            {
                if (i == 0 || i == a.Count() - 1)
                {
                    ans += a[i] / 2;
                }
                else
                {
                    ans += (a[i] / 2) * K;
                }
            }
            if (a.Count() >= 2) 
            {
                if (s[0] == s[s.Length - 1])
                {
                    ans += ((a[0] + a[a.Count - 1]) / 2) * (K - 1);
                }
                else
                {
                    ans += (a[0] / 2) * (K - 1) + (a[a.Count() - 1] / 2) * (K - 1);
                }
            }
            /*foreach(var x in a)
            {
                Console.Write($"{x} ");
            }*/

            Console.WriteLine(ans);
            //Console.Out.Flush();
        }

        
    }
    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
        static public long Modulo(long value, long mod)
        {
            long r = value % mod;

            if (r * mod < 0)
            {
                r += mod;
            }
            return r;
        }
    }

    

}






Measured memory_bytes: 13268