akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using DoP = pair<double, double>;

const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 10007;

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};
struct edge {int to; int index;};

vector<vector<edge>> e(100001);
vector<int> ans(100000);
int n, k = 0;

void dfs(int now, int par, int pre_c) {
  int c = 1;
  for(auto next : e[now]) {
    if(next.to == par) continue;
    if(c == pre_c) ++c;
    ans[next.index] = c;
    dfs(next.to, now, c);
    ++c;
  }
}

int main()
{
  cin >> n;
  rep(i, n-1) {
    int a, b; cin >> a >> b;
    edge x = {b, i};
    edge y = {a, i};
    e[a].push_back(x);
    e[b].push_back(y);
  }
  for(int i = 1; i <= n; ++i) chmax(k, SZ(e[i]));
  dfs(1, 0, 0);
  cout << k << endl;
  rep(i, n-1) cout << ans[i] << endl;
}

Measured memory_bytes: 9472
using System;
using System.Linq;

class Program
{
    public static void Main(string[] args) {
        double[] s = Console.ReadLine().Split().Select(double.Parse).ToArray();
        double x = Math.Sqrt(Math.Pow(s[2]-s[0], 2)+ Math.Pow(s[3]-s[1],2));
        Console.WriteLine(x);
    }
}


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

long long t,n,v[205];
long long b[205];
string s;
bool fine;

bool check(long long num){
	
	for(int i=62;i>=0;i--){
		if(num&(1ll<<i))num^=b[i];
	}
	
	return num==0;
}

void add(long long num){
	for(int i=62;i>=0;i--){
		if(num&(1ll<<i)){
			if(b[i]==0){
				b[i]=num;
				break;
			}
			else{
				num^=b[i];
			}
		}
	}
}

int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);

	cin>>t;
	
	while(t--){
		for(int i=0;i<205;i++)b[i]=0;
		fine=false;
		
		cin>>n;
		for(int i=0;i<n;i++)cin>>v[i];
		cin>>s;
		
		for(int i=n-1;i>=0;i--){
			if(s[i]=='0'){
				add(v[i]);
			}
			else{
				if(check(v[i])==false){
					cout<<"1\n";
					fine=true;
					break;
				}
			}
		}
		
		if(fine==false)cout<<"0\n";
	}

return 0;
}


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

namespace TOPSIC2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Console.ReadLine() == "ABC" ? "ARC" : "ABC");
        }
    }
}


Measured memory_bytes: 17180
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($var:expr) => { ewriteln!(">>> {} = {:?}", stringify!($var), $var) };
    ($($args:expr),*) => { trace!(($($args),*)) }
}
macro_rules! put {
    ($var:expr) => { println!("{}", $var) };
    ($var:expr, $($args:expr),*) => { println!("{} ", $var); put!($($args),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let k: usize = sc.cin();
    trace!(n,k);
    let xs: Vec<usize> = (0..n).map(|_|sc.cin()).collect();
    let mut dp: Vec<Vec<i64>> = vec![vec![0; 100000+10]; 102];
    dp[0][0] = 1;
    for i in 0..n {
        for j in 0..100002 {
            dp[i+1][j] += dp[i][j];
            if j+xs[i]+1 < dp[0].len(){
                dp[i+1][j+xs[i]+1] -= dp[i][j];
            }
        }
        let mut ac = 0;
        for j in 0..100002 {
            ac += dp[i+1][j];
            ac = (ac + M) % M;
            dp[i+1][j] = ac;
        }
    }
    put!(dp[n][k]);
}

use std::io::{ self, Write };
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 108796
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      int[] arr = new int[n];
      int idx = -1;
      for(int i = 0; i < n; i++) {
        arr[i] = sc.nextInt();
        if(arr[i] == 1) idx = i;
      }

      int cnt = 0;
      int i = 0;
      while(i < n - 1) {
        cnt++;
        i = i + k - 1;
      }

      System.out.println(cnt);
  }
}


Measured memory_bytes: 51160
var
n,i,s:longint;
a:array[0..100010] of longint;
begin
readln(n);
for i:=1 to n do read(a[i]);
a[0]:=0; a[n+1]:=0;
s:=0;
for i:=1 to n+1 do s:=s+abs(a[i]-a[i-1]);
for i:=1 to n do writeln(s-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]));
end.

Measured memory_bytes: 1408
#include <bits/stdc++.h>
    using namespace std;
     
    const int N = 50;
     
    int n, k;
    long long ans = -1;
    int xx[N + 10], yy[N + 10];
    pair <int, int> a[N*N + 10];
     
    int main()
    {
        //freopen("F:\\rush.txt", "r", stdin);
        scanf("%d%d", &n, &k);
        for (int i = 1; i <= n; i++)
            scanf("%d%d", &xx[i], &yy[i]);
        int nn = 0;
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                a[++nn] = make_pair(xx[i], yy[j]);
        for (int i = 1; i <= nn; i++)
        {
            for (int j = i+1; j <= nn; j++)
            {
                int x1 = min(a[i].first, a[j].first);
                int x2 = max(a[i].first, a[j].first);
                int y1 = min(a[i].second, a[j].second);
                int y2 = max(a[i].second, a[j].second);
                int num = 0;
                for (int kk = 1; kk <= n; kk++)
                    if (x1 <= xx[kk] && xx[kk] <= x2 && y1 <= yy[kk] && yy[kk] <= y2)
                        num++;
                if (num >= k)
                {
                    long long s = 1LL * (x2 - x1)*(y2 - y1);
                    if (ans == -1)
                        ans = s;
                    else
                        ans = min(ans, s);
                }
            }
        }
        printf("%lld\n", ans);
        return 0;
    }


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

int main() {
  int N, A, B, C, D;
  cin >> N;
  
  A = N / 1000;
  B = (N - 1000 * A) / 100;
  C = (N - 1000 * A - 100 * B) / 10;
  D = N - 1000 * A - 100 * B - 10 * C;
    
  if((A == B && B == C)||(B == C && C == D)){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
using namespace std;

const int MAX_N = 1e4 + 4;
int n, ans, a, b, c;
string s[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		for (int j = 0; j + 1 < s[i].size(); j++)
			ans += (s[i][j] == 'A' && s[i][j + 1] == 'B');

		if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A')
			a++;
		else
			if (s[i][0] == 'B')
				b++;
			else
				if (s[i][s[i].size() - 1] == 'A')
					c++;
	}

	if (b && c) {
		ans += min(b, c) + a;
		cout << ans << "\n";
		return 0;
	}
	
	if (a)
		ans += a - 1 + (b > 0) + (c > 0);
	cout << ans << "\n";
	return 0;
}


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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
// typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;
const lli mod = 1000000007;
const lli e3 = 1 << 12;
const lli INF = 1ll << 63;

lli n;
lli a[e5];
lli l = 0;

bool solve(lli x){
  map<lli,lli> mem;
  for(lli i = 1;i <= n;i++){
    if(a[i] <= a[i-1]){
      lli y = mem[a[i]];
      mem.erase(mem.find(a[i]),mem.end());


      mem[a[i]] = y+1;
      // cerr << " " << a[i] << endl;
      //
      // for(auto x : mem){
      //   cerr << x.first << " " << x.second << endl;
      // }
      for(lli j = a[i];mem[j] >= x;j--){
        if(j <= 1) return false;
        mem[j] = 0;
        mem[j-1]++;
      }
    }
  }
  return true;
}

int main(){
  cin >> n;
  for(lli i = 1;i <= n;i++) cin >> a[i];
  for(lli i = 1;i <= n;i++){
    if(a[i-1] >= a[i]) break;
    if(i == n){
      cout << 1 << endl;
      return 0;
    }
  }
  lli top = n;
  lli bottom = 1;
  while(top-bottom > 1){
    lli middle = (top+bottom)/2;
    cerr << middle << endl;
    if(solve(middle)) top = middle;
    else bottom = middle;

  }
  cout << top << endl;

}


Measured memory_bytes: 1920
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long ll;




// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    int N;
    cin >> N;
    map<int, int> A;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        A[a]++;
    }
    int ans = 0;
    for (auto x : A) {
        if (x.second % 2 != 0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8216
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
#include <iostream>
 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("x = %d\n", x);
#define debug2(x, y) printf("x = %d, y = %d\n", x, y);
#define debug3(x, y, z) printf("x = %d, y = %d, z = %d\n", x, y, z);
#define debug4(x, y, z, t) printf("x = %d, y = %d, z = %d, t = %d\n", x, y, z, t);
 
#pragma warning(disable : 6031)
#pragma warning(disable : 4101)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;
 
const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);
 
// Solution

const int MAXN = 3003;
const ll MOD = 1000000007ll;

ll n, m, A[MAXN], B[MAXN], DP[MAXN][MAXN];

void init() {
    for (int i = 0; i < MAXN; i++) {
        DP[0][i] = DP[i][0] = 1ll;
    }
}

int main() {
    init();

    scanf("%lld%lld", &n, &m);

    for (int i = 1; i <= n; i++) {
        scanf("%lld", &A[i]);
    }

    for (int i = 1; i <= m; i++) {
        scanf("%lld", &B[i]);
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (A[i] == B[j]) {
                DP[i][j] = (DP[i - 1][j] + DP[i][j - 1]) % MOD;
            } else {
                DP[i][j] = (DP[i - 1][j] + DP[i][j - 1] - DP[i - 1][j - 1] + MOD) % MOD;
            }
        }
    }

    printf("%lld\n", DP[n][m]);
    
    return 0;
}

Measured memory_bytes: 69760
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N = lread();
    N %= 10;
    writeln(N == 3 ? "bon" : (N.among(2, 4, 5, 7, 9) ? "hon" : "pon"));
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int n;
vector<int> a;

void show() {
	for (int i = 0; i < n; i++) {
		printf("%d%c", a[i], i != n - 1 ? ' ' : '\n');
	}
}


int main() {
	cin >> n;
	a.assign(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	show();

	for (int i = 1; i < n; i++) {
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
			a[j + 1] = v;
		}
		show();
	}
	return 0;
}

Measured memory_bytes: 1172
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count = 0
for i in range(N):
  A=list(map(int,input().split()))
  sum = 0
  for j in range(M):
    sum = sum + B[j]*A[j]
  else:
    if sum + C > 0:
      count += 1
print(count)


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

int digit(int n){
    int res =0;
    while(n>0){
        n /= 10;
        res++;
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    int max = 1;
    int maxl = (int)floor(sqrt(n));
    for(int i=2;i<=maxl;i++){
        if(n%i==0)max = i; 
    }
    cout << digit(n/max) << endl;
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop
def readinput():
    n,m=map(int,input().split())
    h=list(map(int,input().split()))
    nList=[]
    for i in range(n+1):
        nList.append([])
    for i in range(m):
        a,b=map(int,input().split())
        heappush(nList[a],-h[b-1])
        heappush(nList[b],-h[a-1])

    return n,m,h,nList

def main(n,m,h,nList):
    count=0
    for i in range(1,n+1):
        if len(nList[i])==0:
            count+=1
        else:
            hi=-heappop(nList[i])
            if h[i-1]>hi:
                count+=1
    return count

if __name__=='__main__':
    n,m,h,nList=readinput()
    ans=main(n,m,h,nList)
    print(ans)


Measured memory_bytes: 29460
import java.util.Arrays;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];;
		int tmp = 0;
		int ans = 0;

		
		for (int i=0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		for (int i = a[0]; i <= a[a.length-1]; i++) {
			tmp = 0;
			
			for (int j = 0; j < N; j++){
				tmp += (a[j] - i) * (a[j] - i);
			}
			

			if (i == a[0]){
				ans = tmp;
			}else {
				if (ans > tmp) ans = tmp;
			}
		}
		
		

		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 9672
/*
                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {   if(n % 2 ==1)
        result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
return result % M;
}      
bool isPrime(int n) 
{ 
if (n <= 1) 
    return false; 
if (n <= 3) 
    return true; 
if (n % 2 == 0 || n % 3 == 0) 
    return false; 
for (int i = 5; i * i <= n; i = i + 6) 
    if (n % i == 0 || n % (i + 2) == 0) 
        return false; 
return true; 
} 
signed main()
{   jaldi
    string str,ch,s;
    cin>>str>>ch;
    int x,y;
    cin>>x>>y;
    cin>>s;
    if(s==str)
    cout<<x-1<<" "<<y;
    else
    cout<<x<<" "<<y-1;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 100005
typedef long long LL;
template<class T>void tomax(T &x,T y){
	if(x<y)x=y;	
}
template<class T>void tomin(T &x,T y){
	if(x>y)x=y;	
}
int main(){
	int n;
	cin>>n;
	cout<<1LL*3*n*n;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define ULL unsigned long int
#define MOD (long int)10e9 + 7
#define LD long double


int main(){
    string s;
    cin >> s;
    string ans[10] = {"pon","pon","hon","bon","hon","hon","pon","hon","pon","hon"};
    cout << ans[s.back() - '0'] << endl;


    return 0;
}

Measured memory_bytes: 3628
import java.math.BigInteger;
import java.util.Scanner;
import java.io.PrintWriter;
import java.util.ArrayList;
public class Main{	
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int V = sc.nextInt();
		int E = sc.nextInt();
		ArrayList<Integer>[] g = new ArrayList[V];
		for (int i = 0; i < V; ++i) {
			g[i] = new ArrayList<>();
		}
		for (int i = 0; i < E; ++i) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			g[s].add(t);
		}
		vis = new boolean[V];
		sort(g);
		for(int i=lis.size()-1;i>=0;--i){
			System.out.println(lis.get(i));
		}
	}

	static boolean[] vis;
	static ArrayList<Integer> lis = new ArrayList<>();

	static void sort(ArrayList<Integer>[] g) {
		int n = g.length;
		for (int i = 0; i < n; ++i) {
			if (!vis[i]) {
				dfs(i, -1, g);
			}
		}
	}

	static void dfs(int cur,int pre, ArrayList<Integer>[] g) {
		vis[cur] = true;
		for (int to : g[cur]) {
			if (!vis[to]) {
				dfs(to, cur, g);
			}
		}
		lis.add(cur);
	}
}

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

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A - 1)*(B - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int N,M;
    cin >> N >> M;
    
    int x = 0;
    int y = 0;
    
    int X = 0;
    int Y = 0;
    int Z = 0;
    
    for(x=0;x<=N;x++){
        for(y=0;y<=(N-x);y++){
            if(M == x*10000+y*5000+(N-x-y)*1000){
                goto out;
            }
        }
    }
out:
    if(M == x*10000+y*5000+(N-x-y)*1000){
        
        X = x;
        Y = y;
        Z = (N-x-y);
    }else{
        X = -1;
        Y = -1;
        Z = -1;
    }
    
    cout << X << " " << Y << " " << Z << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll h;
    cin>>h;
    if(h==1)
        cout<<1<<endl;
    else if(h==2)
        cout<<3<<endl;
    else
    {
        int x=ceil(log2(h));
        double y=log2(h);
        if(x==y)
            x+=1;
        ll ans=1;
        ans=powl(2,x);
        cout<<ans-1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)

int compare(const void *b1, const void *b2){ // 昇順
  if(*(int*)b1 > *(int*)b2) return 1;
  else if(*(int*)b1 < *(int*)b2) return -1;
  else return 0;
}

int main(){
  char cs[200010];
  scanf("%s",cs);
  int n=strlen(cs);
  int a[n];
  F(i,0,n){
    char ss[2];
    strncpy(ss,cs+i,1);
    a[i]=atoi(ss);
  }
  int tmod[n+1];
  int t10[n+1];
  tmod[n]=0;
  t10[n]=1;
  for(int i=n-1; i>=0; i--){
    if(i==n-1) t10[i]=1;
    else t10[i]=(t10[i+1]*10)%2019;
    tmod[i]=(tmod[i+1]+t10[i]*a[i])%2019;
  }
  int count[n+1];
  F(i,0,n+1){
    count[i]=0;
  }
  int iter=0;
  qsort(tmod,n+1,sizeof(int),compare);
  F(i,0,n){
    if(tmod[i]==tmod[i+1]){
      count[iter]++;
    }else{
      iter++;
    }
  }
  int ans=0;
  F(j,0,n){
    ans+=(count[j]*(count[j]+1))/2;
  }
  printf("%d\n",ans);
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1e18

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; }

void solve_abc_a() {
	ll n, m;
	ll x, y;
	ll a, b, d;
	ll c;
	//char c;
	ll h, w;
	ll k;
	string s, t;
	//ll s, t;
	ll l_ans = 0;
	string s_ans = "NG";

	cin >> a >> b;
	if (a > b) {
		l_ans = a - 1;
	}
	else {
		l_ans = a;
	}

	cout << l_ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}


Measured memory_bytes: 3592
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define v_sum(a)         accumulate(a.begin(),a.end(),0)
#define v_max(a)         *max_element(a.begin(),a.end())
#define v_min(a)         *min_element(a.begin(),a.end())
#define v_uni(a)         a.erase(unique(a.begin(),a.end()),a.end())

using namespace std;




int main()
{
	Nayon;
	string s,t;
	int i,j,cnt=0,l,k,x=100000;
	cin>>s>>t;
	l=t.size();
	for(i=0;i<s.size()-l+1;i++){
		for(j=0;j<l;j++){
			if(s[i+j]!=t[j]){
				cnt++;
			}
		}
		x=min(x,cnt);
		cnt=0;
	}
	cout<<x<<nl;
	return 0;
}

//Happy Coding.........

Measured memory_bytes: 3656
S = list(input())
if S[0] != "A":
  S.insert(0,"A")
if len(S) < 5:
  print("NO")
  exit()
if S[4] != "A":
  S.insert(4,"A")
if len(S) < 7:
  print("NO")
  exit()
if S[6] != "A":
  S.insert(6,"A")
if len(S) < 5:
  print("NO")
  exit()
if len(S) < 8:
  print("NO")
  exit()
if S[-1] != "A":
  S.append("A")
s = ""
for i in S:
  s += i
print("YES" if s == "AKIHABARA" else "NO")

Measured memory_bytes: 3064
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpln(n)
for i in a:
    if i%2:
        print('first')
        break
else:
    print('second')

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

int N;
int A[200005],B[200005];
int C[200005],D[200005];

signed main(){
    cin>>N;
    for(int i=0;i<N;++i)cin>>A[i];
    for(int i=0;i<N;++i)cin>>B[i];
    for(int i=0;i<N;++i){
        C[A[i]]++;
        D[B[i]]++;
    }
    int ma=0;
    for(int i=1;i<=N;++i){
        if(C[i]+D[i]>N){
            cout<<"No\n";
            return 0;
        }
        C[i]+=C[i-1];
        D[i]+=D[i-1];
        chmax(ma,C[i]-D[i-1]);
    }
    cout<<"Yes\n";
    for(int i=0;i<N;++i){
        cout<<B[(i-ma+N)%N];
        if(i!=N-1)cout<<" ";
    }
    cout<<"\n";
}

Measured memory_bytes: 9856
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, c := nextInt(), nextInt(), nextInt()
	fmt.Println(min(b/a, c))
}


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

int main(){
    string S;
    cin >> S;
    int Y = 700; //ラーメンの値段
    if(S[0] == 'o') Y+=100;
    if(S[1] == 'o') Y+=100;
    if(S[2] == 'o') Y+=100;
    cout << Y << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int p;
	vector<int>list;

	cin >> p;

	for (int i = 0; i < p; i++) {
		int num;
		cin >> num;
		list.push_back(num);
	}

	int cnt = 0;

	for (int i = 1; i < p - 1; i++) {
		if (list[i] > list[i - 1] && list[i] < list[i + 1]) {
			cnt++;
		}
		else if (list[i] < list[i - 1] && list[i] > list[i + 1]) {
			cnt++;
		}
	}

	cout << cnt << endl;





	return 0;
}

Measured memory_bytes: 256
import math
def solve():
    a, b, x = map(int, input().split())

    if x / (a ** 2) <= b / 2:
        theta = math.atan(2 * x / (a * b ** 2))
        theta = math.degrees(theta)
        print(90 - theta)

    else:
        theta = 90 -math.degrees(math.atan(2 * b / a - 2 * x / (a ** 3)))
        print(90 - theta)
        

if __name__ == '__main__':
    solve()


Measured memory_bytes: 38384
int main(void){
	int week;
	int money = 100000;
	int i;

	scanf("%d", &week);

	for(i=0; i<week; i++){
		money += money * 0.05;
		if(money % 1000 > 0){
			money += 1000;
			money -= money%1000;
		}
	}
	printf("%d\n", money);
	return 0;
}

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

int N, Y;
int ans[3];

void solve() {
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N - i; j++){
      if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y){
        ans[0] = i;
        ans[1] = j;
        ans[2] = N - i - j;
      }
    }
  }
  if (ans[0] == 0 && ans[1] == 0 && ans[2] == 0){
    printf("%d %d %d", -1, -1, -1);
  } else {
    printf("%d %d %d", ans[0], ans[1], ans[2]);
  }
}

int main() {
  scanf("%d %d", &N, &Y);
  solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    struct edge {
        int next;
        int id;
    };
    vector<vector<edge>> graph(n);
    for (int i = 0; i < n-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        graph[a].push_back((edge){b, i});
        graph[b].push_back((edge){a, i});
    }

    int _max = 0;
    vector<int> ans(n-1);
    auto dfs = [&](auto &&dfs, int now, int before, int bcolor) -> void {
        int color = 1;
        for (int i = 0; i < graph[now].size(); i++)
        {
            if (before == graph[now][i].next) continue;

            if (bcolor == color) color++;
            ans[graph[now][i].id] = color;
            _max = max(_max, color);
            dfs(dfs, graph[now][i].next, now, color);
            color++;
        }
    };

    dfs(dfs, 0, 0, 0);
    cout << _max << endl;
    for (int i = 0; i < n-1; i++)
    {
        cout << ans[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long n;
  cin >> n;
  long a = 0;

  for (long i = sqrt(n); i > 0; i--){
    if(n % i == 0){
      a = i;
      break;
    }
  }
  long b = n / a;
  cout << a + b - 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll n,ans=-1*INF;
bool f[102][11],op[11];
ll p[102][11];

void cal(){
	bool ch=false;
	for(int i=0;i<10;i++){
		if(op[i]){
			ch=true;
			break;
		}
	}
	if(ch!=true){
		return;
	}
	ll SUM=0;
	for(int i=0;i<n;i++){
		ll sum=0;
		for(int j=0;j<10;j++){
			if(op[j]==true&&f[i][j]==true){
				sum++;
			}
		}
		SUM+=p[i][sum];
	}
	ans=max(ans,SUM);
	return;
}
void dep(ll d){
	if(d==10){
		cal();
		return;
	}
	op[d]=0;dep(d+1);
	op[d]=1;dep(d+1);
}
int main() {
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<10;j++){
			cin>>f[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<=10;j++){
			cin>>p[i][j];
		}
	}
	dep(0);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
class BEL{
	public:
	struct edge{
		Def to,cost;
	};
	vector<vector<edge> >G;
	Def n;
	vector<Def>d;//distance
	BEL(Def size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(Def a,Def b,Def c){
		edge e={b,c},ee={a,c};
		G[a].pb(e);
//		G[b].pb(ee);
	}
	ll bel(Def s){// return 1 -> negative cycle
		d=vector<Def>(n,inf);
		d[s]=0;
		ll q;
		rep(i,2*n+1){
			if(i==n)q=d[n-1];
			if(i==2*n){
				if(d[n-1]==q)return d[n-1];
				else return 1;
			}
			rep(j,n)rep(k,G[j].size()){
				edge e=G[j][k];
				if(d[j]!=inf&&d[e.to]>d[j]+e.cost){
					d[e.to]=d[j]+e.cost;
				}
			}
		}
		return d[n-1];
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	BEL bel(n);
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		bel.add_edge(a,b,-c);
	}
	ll a=bel.bel(0);
	if(a==1)cout<<"inf"<<endl;
	else cout<<-a<<endl;
}







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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

int fx[]={1,-1,0,0};
int fy[]={0,0,-1,1};

string S , T;

int main(){
    cin >> S >> T;
    for(int i = 1; i <= 101; i++){
        if(S == T){
            cout << "Yes" << '\n';
            return 0;
        }
        char ch = S[S.size() - 1];
        S.erase(S.size() - 1);
        S = ch + S;
    }
    cout << "No" << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////


int main() {
    ll h, w; cin >> h >> w;
    if(h%3 == 0 || w%3 == 0){co(0); return 0;}
    ll ans = min(h, w);

    ll d = h*w/3;
    ll a = d/w, b = d/h;
    ll s1, s2, s3;
    
    s1 = w*a; 
    if(w%2 == 0) s2 = (h-a)*(w/2), s3 = (h-a)*(w/2);
    else s2 = (h-a)*(w/2), s3 = (h-a)*(1+w/2);
    ll M = max({s1, s2, s3}), m = min({s1, s2, s3});
    chmin(ans, M-m);

    a++;
    s1 = w*a; 
    if(w%2 == 0) s2 = (h-a)*(w/2), s3 = (h-a)*(w/2);
    else s2 = (h-a)*(w/2), s3 = (h-a)*(1+w/2);
    M = max({s1, s2, s3}), m = min({s1, s2, s3});
    chmin(ans, M-m);

    s1 = h*b;
    if(h%2 == 0) s2 = (w-b)*(h/2), s3 = (w-b)*(h/2);
    else s2 = (w-b)*(h/2), s3 = (w-b)*(1+h/2);
    M = max({s1, s2, s3}), m = min({s1, s2, s3});
    chmin(ans, M-m);
    
    b++;
    s1 = h*b;
    if(h%2 == 0) s2 = (w-b)*(h/2), s3 = (w-b)*(h/2);
    else s2 = (w-b)*(h/2), s3 = (w-b)*(1+h/2);
    M = max({s1, s2, s3}), m = min({s1, s2, s3});
    chmin(ans, M-m);

    co(ans);

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> a(n+2, 0); FOR(i, 1, n+1) cin >> a[i];
  long long ans = 0;
  FOR(i, 1, n+2) ans += abs(a[i] - a[i-1]);
  FOR(i, 1, n+1) {
    if (a[i-1] < a[i] && a[i] > a[i+1] || a[i-1] > a[i] && a[i] < a[i+1]) cout << ans - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1]) << '\n';
    else cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<vector>
#define pb push_back
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<vector<int> > v;
    for(int i = 0;i<n;i++){
        int a,b,c;
        cin>>a>>b>>c;
        vector<int> t;
        t.push_back(a);
        t.push_back(b);
        t.push_back(c);
        v.push_back(t);
        t.clear();
    }
    int dp[3][100005];
    for(int i = 0;i<n;i++){
        dp[0][i] = v[i][0] + max(dp[1][i-1] , dp[2][i-1] );
        dp[1][i] = v[i][1] + max(dp[0][i-1] , dp[2][i-1] );
        dp[2][i] = v[i][2] + max(dp[0][i-1] , dp[1][i-1] );
    }
    cout<<max( dp[0][n-1] , max(dp[1][n-1], dp[2][n-1]));
    return 0;
}

Measured memory_bytes: 7600
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}


int main (){
    ll N,K;
    cin >> N >> K;
    vector<ll>d(K);
 
    d[K-1]=1;
    for(ll i=K; i>0; i--){
         ll sum=0;
        for(ll j=2*i; j<=K; j+=i){
            sum+=d[j-1];
        }
        ll z=rep_jijo(K/i,N);
        d[i-1]=z-sum;
    }
    ll ans=0;
    rep(i,K){
        ans+= d[i]*(i+1);
        ans%=mod;
    }
 
    cout<<ans%mod <<endl;
    return 0;
}


Measured memory_bytes: 4036
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n, m;
  cin >> n >> m;
  n == m ? cout << "Yes" : cout << "No";
  return 0;
} //good night.

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
    int n,R[MAX];
    cin >> n;
    for(int i = 0;i < n;i++)cin >> R[i];
    
    int maxv = -2000000000;
    int minv = R[0];

    for(int i = 1;i < n;i++){
     maxv = max(maxv,R[i] - minv);
     minv = min(minv,R[i]);
    }
  cout << maxv << endl;

  return 0;
}



Measured memory_bytes: 3880
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

/*ソートの時に使う
int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
}
    qsort (data,sizeof(data),sizeof(int),sort); 
*/

int main(void){
    int n,k,ans=0;
    scanf("%d%d",&n,&k);
    int t[n];
    for (int i=0; i<=n; i++){
        scanf("%d",&t[i]);
    }
    for (int i=0; i<n; i++){
        if (i==0){
            ans=0;
        } else if (t[i]-t[i-1]<k){
            ans+=t[i]-t[i-1];
        } else {
            ans+=k;
        }
    }
    printf("%d\n",ans+k);
	return 0 ;
}

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			long a = cin.Long();
			long b = cin.Long();
			long c = cin.Long();
			long d = cin.Long();

			long lcm = LCM(c, d);

			long cc = b / c - (a - 1) / c;
			long dd = b / d - (a - 1) / d;
			long ee = b / lcm - (a - 1) / lcm;

			long ans = b - a + 1 - cc - dd + ee;
			Console.WriteLine(ans);
		}


		public static long GCD(long a, long b)
		{
			if (a > b) {
				if (b == 0) {
					return a;
				}

				return GCD(b, a % b);
			} else {
				if (a == 0) {
					return b;
				}

				return GCD(a, b % a);
			}
		}

		public static long GCD(long[] values)
		{
			if (values.Length == 1) {
				return values[0];
			}

			long gcd = values[0];
			for (int i = 1; i < values.Length; ++i) {
				if (gcd == 1) {
					return gcd;
				}
				gcd = GCD(values[i], gcd);
			}

			return gcd;
		}

		public static long LCM(long a, long b)
		{
			return a / GCD(a, b) * b;
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


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

int main(void){
	int N,K;
	cin >> N >> K;
	long double ans = 0;
	if(N>(K-1)){
		ans += (long double)((N-K)+1)/(long double)N;
	}
	int range = N;
	if(N>=K)range = K-1;
	for(int i=1;i<=range;i++){
		long double ret = 1.0;
		int tempi=i;
		while(tempi<K){
			ret *= 0.5;
			tempi*=2;
		}
		ans += ret/(long double)N;
	}
	cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int a;
   string n;
 
   cin >> a >> n;
  
   int ans = 0;
  
   for(int i=0;i<a-2;i++){
     
     if(n[i]=='A'){
     //  cout << "aa" << endl;
       if(n[i+1]=='B'&&n[i+2]=='C'){
       
         ans++;
         i=i+2;
       }
     }
     
   }
  
   cout << ans << endl;
  
  return 0;
}

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

using namespace std;

typedef long long ll;

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

	int h, w, n;
	cin >> h >> w >> n;

	h = max(h, w);
	if(n % h == 0){
		cout << n / h << endl;
	}else{
		cout << n / h + 1 << endl;
	}
}


Measured memory_bytes: 256
N, K = map(int, input().split())
trees = [int(input()) for i in range(N)]
trees = sorted(trees)

min_dist = trees[K-1] - trees[0]
for i in range(N-K+1):
    dist = trees[i+K-1] - trees[i]
    if min_dist > dist:
        min_dist = dist

print(min_dist)


Measured memory_bytes: 8280
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int mi = Math.min(N,M);
        int ma = Math.max(N,M);
        if (mi == 1 && ma == 1) {
            System.out.println(1);
        } else if(mi == 1) {
            System.out.println(ma-2);
        }else{
            System.out.println((long)(N - 2) * (M - 2));
        }
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <cmath>
#include <cctype>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <unordered_set>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <queue>
#include <unordered_map>

int main() {
	int32_t a, b, c;
	std::cin >> a >> b >> c;
	if(c == a && b != a)
		std::cout << "Yes";
	else if(b == a && c != a)
		std::cout << "Yes";
	else if(c == b && a != b)
		std::cout << "Yes";
	else
		std::cout << "No";
	return 0;
}




Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[]
for i in range(n):
    A=list(map(int,input().split()))
    a.append(A)
z=c
ans=0
for i in range(n):
    for x,y in zip(b,a[i]):
        z+=x*y
    if z>0:
        ans+=1
        z=c
    else:
        z=c
print(ans)


Measured memory_bytes: 3064
//
//  main.cpp
//  C - Vacation
//
//  Created by Hashizo on 2019/06/12.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>

using namespace std;

#undef INT_MAX
#undef INT_MIN

#define INT_MAX	2147483647
#define INT_MIN	(-INT_MAX  -1)

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define REPLACE(s, f, t) regex_replace(s, regex(f), t)

int main(int argc, const char * argv[]) {
	int n;
	cin >> n;

	int activity[n][3];
	int dp[n+1][3];

	
	REP(i,n) {
		REP(j,3) {
			cin >> activity[i][j];
		}
	}
	
	REP(j,3) {
		dp[0][j] = 0;
	}
		
	REP(i, n) {
		dp[i+1][0] = activity[i][0] + max(dp[i][1], dp[i][2]);
		dp[i+1][1] = activity[i][1] + max(dp[i][0], dp[i][2]);
		dp[i+1][2] = activity[i][2] + max(dp[i][0], dp[i][1]);
//		dp[i+1][0] = dp[i][0] + max(activity[i][1], activity[i][2]);
//		dp[i+1][1] = dp[i][1] + max(activity[i][0], activity[i][2]);
//		dp[i+1][2] = dp[i][2] + max(activity[i][0], activity[i][1]);
	}

	int res=0;
	REP(j,3) {
		res = max(dp[n][j], res);
	}
	
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2560