akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d/ %d/ %d/",&a,&b,&c);
	if(2019<a || (a<=2019 && 5<=b)){
		printf("TBD\n");
	}
	else{
		printf("Heisei\n");
	}
	return 0;
}

Measured memory_bytes: 256
while True:
	n = int(input())
	if n == 0: break
	l = []
	for _ in range(n):
		l.append(int(input()))

	sum = 0
	sums = [0]
	for i in range(n):
		sum += l[i]
		sums.append(sum)

	maximum_sum = -99999999999999
	for e in range(1, n+1):
		for s in range(1, e+1):
			sum = sums[e] - sums[s-1]
			if maximum_sum < sum:
				maximum_sum = sum

	print(maximum_sum)

Measured memory_bytes: 7796
#include<iostream>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main(){
	long long int x,k,d;
	cin>>x>>k>>d;
	if(x<0)x=-x;
	long long int a = x/d,b = x%d;
	if(k>a){
		if((a-k)%2==0){
			cout<<b<<endl;
		}else{
			cout<<d-b<<endl;
		}
	}else{
		cout<<x-k*d<<endl;
	}

	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(void)
{
	int a, b, c, d, e, k;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	scanf("%d", &e);
	scanf("%d", &k);

	if (k < e - a)
		printf(":(");
	else
		printf("Yay!");

	return 0;
}

Measured memory_bytes: 256
// AtCoder Beginner Contest 130
// https://atcoder.jp/contests/abc130
import * as fs from "fs";

const stdin = fs.readFileSync("/dev/stdin", "utf8");
const split = stdin.split("\n");
Main(split);

function Main(inputLines: string[]) {
  const tmp = inputLines[0].split(" ");
  const N = Number(tmp[0]);
  const X = Number(tmp[1]);
  const input = inputLines[1].split(" ").map(ele=>Number(ele));
  Sub(N, X, input);
}
function Sub(N: number, X: number, input: number[]) {
  let point = 0;
  let count = point <= X ? 1 : 0;
  for (const l of input) {
    point += l;
    if (point <= X) {
      count += 1;
    }
  }
  console.log(count);
}


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

const ll MOD = 1e9 + 7;

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

  vector<int> l(n, 0), r(n, 0);
  rep(i, n) rep(j, n) {
    if (a[i] <= a[j]) continue;
    if (j < i) ++l[i];
    if (i < j) ++r[i];
  }

  ll cl = (ll)k * (k-1) / 2 % MOD;
  ll cr = (ll)k * (k+1) / 2 % MOD;
  ll ans = 0;
  rep(i, n) {
    ans += cl * l[i] + cr * r[i];
    ans %= MOD;
    if (ans < 0) ans += MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int a,b,d,r;
	double f;
	cin>>a>>b;

	d=a/b;
	r=a%b;
	f=1.0*a/b;
	cout << d << " " << r << " ";
	printf("%.8lf\n",f);



    return 0;
}








Measured memory_bytes: 3252
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

string S;
int main(){
    cin>>S;
    if(S[S.length()-1]=='s'){
        cout<<S+"es"<<endl;   
    }else{
        cout<<S+"s"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
N=int(input())

Restaurants =[]

for i in range(N):
    Rest,score =input().split()
    Restaurants.append([i+1,Rest,int(score)])

Restaurants.sort(key=lambda x: x[2],reverse = True)
Restaurants.sort(key=lambda x: x[1])

for j in Restaurants:
    print(j[0])

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

using namespace std;
typedef long long ll;

ll a[100000+100];
ll vis[100000+100];
int main()
{
    ll n,m;
    cin>>n>>m;
    memset(vis,0,sizeof(vis));
    int x=0,y=0;
    while(m--)
    {
        int num;
        string str;
        cin>>num>>str;
        if(str=="AC")
        {
            if(!vis[num])
            {
                vis[num]=1;
                x++;
                y+=a[num];
            }
        }
        else
        {
            if(!vis[num])
            {
                a[num]++;
            }
        }
    }
    cout<<x<<" "<<y;
    return 0;
}


Measured memory_bytes: 1792
{-# LANGUAGE BangPatterns #-}

import           Data.List (intersperse)
import           Data.Maybe (fromJust)
import           Control.Monad (foldM_)
import           Control.Applicative ((<$>))
import           Data.Vector.Unboxed (Vector, unsafeFreeze, (!))
import           Data.Vector.Unboxed.Mutable (IOVector, unsafeWrite, unsafeRead)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main   =   getLine
       >>  map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
       >>= countingSort
       >>= putStrLn . unwords . map show

countingSort :: [Int] -> IO [Int]
countingSort !inputs
    =   MV.replicate 10001 0
    >>= \counts  -> foldM_ inc counts inputs
    >>  unsafeFreeze counts
    >>= \counts' -> return $ concatMap (\pos -> replicate (counts' ! pos) pos) [0..10000]
  where
    inc !cs !p =   unsafeRead  cs p
               >>= unsafeWrite cs p . (+1)
               >>  return cs



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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

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

    int b[n];
    for (int i = 0; i < n; ++i) {
      b[i] = count(a, a + n, i);
    }

    const int mx = *max_element(a, a + n);

    bool f = true;
    for (int i = 0; i < mx/2; ++i) {
      f = f && (b[i] == 0);
    }

    int mid = (mx + 1) / 2;
    for (int i = mid + 1; i <= mx; ++i) {
      b[i] -= 2;
    }
    if (mx % 2) b[mid] -= 2;
    else        b[mid] -= 1;
    f = f && (0 <= *min_element(b, b + n));
    
    f = f && (b[mid] == 0);
    
    cout << (f ? "Possible" : "Impossible") << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int binarySearch(int);
int A[100000], n;
int main() {
  int i, a, b, count = 0;

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

  scanf("%d", &a);
  for ( i = 0; i < a; i++ ) {
    scanf("%d", &b);
    if ( binarySearch( b ) ) count++;
  }
  printf("%d\n", count);

  return 0;
}

int binarySearch(int key) {
  int left = 0;
  int right = n;
  int mid;
  while ( left < right ) {
    mid = (left + right) / 2;
    if ( key == A[mid] ) return 1;
    if ( key > A[mid] ) left = mid + 1;
    else if ( key < A[mid] ) right = mid;
  }
  return 0;
}




Measured memory_bytes: 2184
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int x,r;
		Dice d=new Dice();
		while((x=s.nextInt())!=0) {
			d.reset();
			r=1;
			for(int i=0;i<x;i++) {
				d.turn(s.next());
				r+=d.u;
			}
			System.out.println(r);
		}
	}
}
class Dice{
	int n,e,w,s,u,d;
	Dice() {
	}
	void turn(String str){
		int b;
		switch (str) {
		case "North":
			b=u;
			u=s;
			s=d;
			d=n;
			n=b;
			break;
		case "South":
			b=u;
			u=n;
			n=d;
			d=s;
			s=b;
			break;
		case "East":
			b=u;
			u=w;
			w=d;
			d=e;
			e=b;
			break;
		case "West":
			b=u;
			u=e;
			e=d;
			d=w;
			w=b;
			break;
		case "Right":
			b=n;
			n=w;
			w=s;
			s=e;
			e=b;
			break;
		case "Left":
			b=n;
			n=e;
			e=s;
			s=w;
			w=b;
			break;
		}
	}
	void reset() {
		n=5;
		e=3;
		w=4;
		s=2;
		u=1;
		d=6;
	}
}

Measured memory_bytes: 33992
#include <iostream>
#include <algorithm>
using namespace std;
int a[100001];
int main()
{
    bool f=false;
    int n,q,save;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
        for(int j=0;j<n;j++)
        {
            if(a[j]==save)
                continue;
            if(f==true)
                cout<<" "<<a[j];
            else
            {
                f=true;
                cout<<a[j];
            }
            save=a[j];
        }
        cout<<"\n";
}



Measured memory_bytes: 3488
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve()
{
	int n;
	
	cin >> n;
	
	int a[n];
	
	//map<int,int> f;
	
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	int ans = 0;
	
	for(int i = 0; i < n; ++i) {
		if(a[i] == i+1) {
			ans++;
			i++;
		}
	}
	
	cout << ans;
}

signed main() {
    fast;
    
    int t = 1;
    
	//cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 4316
#include <iostream>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int ans = 0;
  switch (n) {
  case 25:
    cout << "Christmas" << "\n";
    break;
  case 24:
    cout << "Christmas Eve" << "\n";
    break;
  case 23:
    cout << "Christmas Eve Eve" << "\n";
    break;
  case 22:
    cout << "Christmas Eve Eve Eve" << "\n";
    break;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
tpred = 1
apred = 1

for i in range(n):
  t, a = map(int, input().split())
  tpred = t*max(-(-tpred//t), -(-apred//a))
  apred = a*max(-(-tpred//t), -(-apred//a))

print(tpred+apred)

Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define read(arr,n)	for(int i=0;i<n;i++) cin>>arr[i];
#define print(arr,n) for(int i=0;i<n;i++) cout << arr[i]<<' ';cout << endl;
typedef int int32;
#define int ll

using namespace std;

typedef long long ll;

void solve() {
	ll n;
	cin >> n;

	ll sum = 0;

	for (int i = 1; i <= n; i++) {
		for (int j =1; j <= n; j++) {
			ll g = __gcd(i,j);
			for (int k = 1; k <= n; k++) {
				sum += __gcd(k,g);
			}
		}
	}
	
	cout << sum << endl;
}

int32 main() {
	int t = 1;
	//cin >> t;
	int c = 0;
	while (c < t) {
		solve();
		c++;	
	}
	return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] lines = sc.nextLine().split(" ");
        
        String num = "";
        for (String line: lines) {
            num += line;
        }

        if (isSquareNumber(Integer.parseInt(num))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    public static boolean isSquareNumber(int number) {
        double sn = Math.sqrt(number);
        int num1 = (int)sn;
        if (sn - num1 == 0) {
            return true;
        } else {
            return false;
        }
    }
}


Measured memory_bytes: 24276
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    String S = sc.next();
	    
	    String[] a = S.split("");
	    
	    if (a[0].equals(a[1]) || a[1].equals(a[2]) || a[2].equals(a[3]))
	    
	    	 System.out.println("Bad");
	    
	    else 
	    	 System.out.println("Good");
	    
	   sc.close();
	}

}

Measured memory_bytes: 23508
MOD = pow(10, 9) + 7

h, w = map(int, raw_input().strip().split())
dp = [[0 for i in xrange(w + 1)] for j in xrange(h + 1)]

grid = [['.' for i in xrange(w)] for j in xrange(h)]
for i in xrange(h):
    s = raw_input()
    for j in xrange(len(s)):
        if s[j] == '#': grid[i][j] = '#'

dp[h - 1][w - 1] = 1
for i in xrange(h - 1, -1, -1):
    for j in xrange(w - 1, -1, -1):
        if i == h - 1 and j == w - 1: continue
        if grid[i][j] == '#': continue
        dp[i][j] = dp[i + 1][j] + dp[i][j + 1]
        if dp[i][j] >= MOD: dp[i][j] -= MOD

print dp[0][0]

Measured memory_bytes: 48284
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cctype>
#include <numeric>
#include <cstdio>
#include <math.h>
#include <functional>
using namespace std;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define na(a, n) rep(i, n) cin >> a[i];
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
vb d(10);
int ans(int x)
{
    while (x)
    {
        if (d[x % 10])
            return 0;
        x /= 10;
    }
    return 1;
}
//ここからメイン
int main()
{
 string a,b;
  cin >> a;
  cout << (a[0]==a[2]?"Yes":"No");
    }

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		double T = stdIn.nextInt();
		double A = stdIn.nextInt();
		double[] H = new double[N];
		int h;
		for (int i = 0; i < N; i++) {
			h = stdIn.nextInt();
			H[i] = Math.abs(T - h * 0.006 - A);
		}
		double a = H[0];
		int b = 0;
		for (int j = 1; j < N; j++) {
			if (a > H[j]) {
				a = H[j];
				b = j;
			}
		}
		System.out.println(b + 1);
	}
}

Measured memory_bytes: 23508
#include<stdio.h>
int main(){
  int f[100][10],p[100][11],n,i,j,k,l,t,x=(1<<30)*-1;
  scanf("%d",&n);
  for(i=0;i<n;i++)for(j=0;j<10;j++)scanf("%d",&f[i][j]);
  for(i=0;i<n;i++)for(j=0;j<11;j++)scanf("%d",&p[i][j]);
  for(i=1;i<1<<10;i++){t=0;for(j=0;j<n;j++){l=0;for(k=0;k<10;k++)l+=f[j][k]&&i&1<<k;t+=p[j][l];}x=x<t?t:x;}
  printf("%d",x);
}


Measured memory_bytes: 1740
n, k = gets.split.map(&:to_i)
hs = []
n.times do |_i|
  hs << gets.to_i
end

hs.sort!
deltas = []
(0..(n - k)).each_with_index do |i, j|
  deltas << hs[j + k - 1] - hs[j]
end

puts deltas.min


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

int n;
long long sum;

int main() {
    cin >> n;
    int a[n];
    for (int i=0; i < n; i++) cin >> a[i];
    sort (a , a + n);
    for (int j=0; j < n; j++) sum += a[j];
    cout << a[0] << " " << a[n-1] << " " << sum << endl;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
int n,m,a[1000001],x;
bool ch(int mid){
  int res=1,now=0;
  for(int i=0;i<n;i++){
    now+=a[i];
    if(now>mid)res++,now=a[i];
    if(a[i]>mid)return 0;
  }
  return res<=x;
}
int main(){
  cin>>n>>x;
  for(int i=0;i<n;i++)cin>>a[i];
  int l=0,r=1e9;
  while(l<r){
    int mid=(l+r)/2;
    if(ch(mid))r=mid;
    else l=mid+1;
  }
  cout<<l<<endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a,s;
    s=0;
    ll ans=0;
    map<ll,ll> m;
    m[s]++;
    for(ll i=1;i<=n;i++){
        cin>>a;
        s+=a;
        ans+=m[s];
        m[s]++;
    }
    cout << ans<<endl;
    

    return 0;
}


Measured memory_bytes: 12800
n=int(input())
l=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
dp=[i for i in range(n+1)]
for i in range(1,n+1):
	for j in l:
		if j > i:
			break
		dp[i] = min(dp[i],dp[i-j]+1)
print(dp[n])

Measured memory_bytes: 7064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  string ans="No";
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){  
      if(i*j==N){ans="Yes";break;}
    }
  }
  cout<<ans<<endl;
      return 0;}

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

using namespace std;
int main()
{
   /* vector<int>v;
    vector<int>v1;
    vector<int>v2;
    set <char>s;
    int t,coun1=0,a,ans3,coun2=0,x,y=0,ans1=0,b,sum=0,flag=0,ans2;*/

    long double li=1;
    long long ai,n,a;

    cin >> n;

    while(n!=0)
   {
      a=n%10;
      if(a == 2 ||a==4|| a==5 || a==7 || a==9)
        {cout << "hon";
        break;}
      if(a == 0 ||a==1|| a==6 || a==8 )
        {cout  << "pon";
        break;}
       if(a == 3)
        {cout << "bon";
        break;
        }
        n=n/10;
   }



return 0;
}



Measured memory_bytes: 3600
#(43)平均点
a=[]
for i in range(5):
     n=int(input())
     a.append(n)
for _ in range(5):
     if a[_]<40:
          a[_]=40
sum=0
for l in range(5):
     b=a[l]
     sum+=b
av=sum//5
print(av)


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

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - b) <= d && abs(b - c) <= d) {
    cout << "Yes";
  } else if (abs(a - c) <= d) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}


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

using namespace std;

int a, b, c, d;

int min(int a, int b) {
    if (a > b) return b;
    return a;
}


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


Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,K=get_i
if K==N
    puts 1
    exit
end
now=K
ans=1
while now<N
    now+=K-1
    ans+=1
end
puts ans

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
typedef	long long int ll;
    
int main(){
    int n, m;
    cin >> n >> m;
    ll x[n], y[n], z[n];
    ll s[n];
    ll tsum = -100000000000000000;
    ll sum = 0;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i] >> z[i];
    }
    for(int i = 0; i < n; i++){
        s[i] = x[i] + y[i] + z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = x[i] - y[i] + z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = x[i] + y[i] - z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = (-1)*x[i] + y[i] + z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = x[i] - y[i] - z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = (-1)*x[i] - y[i] + z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = (-1)*x[i] + y[i] - z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;

    for(int i = 0; i < n; i++){
        s[i] = (-1)*x[i] - y[i] - z[i];
    }
    sort(s, s+n);
    sum = 0;
    for(int i = n-1; i >= n-m; i--){
        sum += s[i];
    }
    if(tsum < sum) tsum = sum;
    cout << tsum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

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

  int A,B,K; cin>>A>>B>>K;

  vector<int> v;
  reps(i, 1, min(A,B)+1) {
    if(!(A%i==0 && B%i==0))continue;
    v.push_back(i);
  }
  reverse(ALL(v));

  int res = v[K-1];
  cout <<res <<endl;

  return 0;
}


Measured memory_bytes: 256
h, w, a, b = map(int, input().split())

for i in range(h):
    tmp = []
    for j in range(w):
        if i < b and j < a:
            tmp.append('1')
        elif b <= i and j < a:
            tmp.append('0')
        elif i < b and a <= j:
            tmp.append('0')
        elif b <= i and a <= j:
            tmp.append('1')

    print(''.join(tmp))


Measured memory_bytes: 3956
D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
M[9][9][9],q[2];main(n,m,p,I,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,I=0,sizeof(M)),c=1;I++<p;c*=-1){
		for(scanf("%d%d",&x,&y),z=1;;z++)if(!M[x][y][z]){M[x][y][z]=c;break;}
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(q[j]=0;;q[j]+=2*j-1)if(M[x+D[d][0]*q[j]][y+D[d][1]*q[j]][z+D[d][2]*q[j]]!=c)break;
			if(q[1]-q[0]-1>=m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;I++<p;)scanf("%d%d",&x,&y);
}exit(0);}

Measured memory_bytes: 608
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int D, G, p[11], c[11];
    int ans = 1000;
    cin >> D >> G;
    G /= 100;
    for (int i = 0; i < D; ++i) {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }
    for (int m = 0; m < (1 << D); ++m) {
        int remain = G, count = 0;
        for (int i = 0; i < D; ++i) {
            if ((1 << i) & m) {
                remain -= (i + 1) * p[i] + c[i];
                count += p[i];
            }
        }
        for (int i = D - 1; i >= 0 && remain > 0; --i) {
            if ((1 << i) & m) {
                continue;
            }
            int cnt = (remain + i) / (i + 1);
            if (cnt >= p[i]) {
                cnt = p[i] - 1;
            }
            remain -= (i + 1) * cnt;
            count += cnt;
        }
        if (remain <= 0) {
            ans = min(ans, count);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <tuple>
#include <deque>
using namespace std;

typedef pair<int,int> P;//駅id,会社id(0は改札外)
map<P,map<P,int>> G;//エッジリスト(キモい)
map<P,int> memo;
const int INF = 1000000000;
typedef tuple<int,int,int> T;//cost,駅id,会社id
//priority_queue<T,vector<T>,greater<T>> que;
deque<T> que;
#define mygc(c) (c)=getchar_unlocked()
void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;} }for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}

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

    int N,M;
    //cin>>N>>M;
    reader(&N); reader(&M);
    for(int i=1;i<=N;i++) memo[P(i,0)]=INF;
    for(int i=0;i<M;i++){
        int p,q,c;
        //cin>>p>>q>>c;
        reader(&p); reader(&q); reader(&c);
        G[P(p,c)][P(q,c)]=0;
        G[P(p,c)][P(p,0)]=0;
        G[P(p,0)][P(p,c)]=1;
        G[P(q,c)][P(p,c)]=0;
        G[P(q,c)][P(q,0)]=0;
        G[P(q,0)][P(q,c)]=1;
        memo[P(p,c)]=memo[P(q,c)]=INF;
    }
    memo[P(1,0)]=0;
    //que.emplace(0,1,0);
    que.emplace_back(0,1,0);
    while(!que.empty()){
        //T t = que.top(); que.pop();
        T t = que.front(); que.pop_front();
        int cost=get<0>(t), station=get<1>(t), company=get<2>(t);
        if(station==N){
            cout<<cost<<endl;
            return 0;
        }
        if(cost>memo[P(station,company)]) continue;
        for(auto &g:G[P(station,company)]){
            const P &p = g.first; int fee=g.second;
            if(cost+fee<memo[p]){
                memo[p]=cost+fee;
                //que.emplace(cost+fee,p.first,p.second);
                if(fee){
                    que.emplace_back(cost+fee,p.first,p.second);
                }else{
                    que.emplace_front(cost+fee,p.first,p.second);
                }
            }
        }
    }
    cout<<-1<<endl;
    return 0;
}

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


int D[100][6];
//?????¢?????????
void spin(int n,char c)
{
    if(c=='E'){
        swap(D[n][0],D[n][3]);swap(D[n][3],D[n][5]);swap(D[n][5],D[n][2]);
    }
    else if(c=='W'){
        swap(D[n][0],D[n][2]);swap(D[n][2],D[n][5]);swap(D[n][5],D[n][3]);
    }
    else if(c=='S'){
        swap(D[n][0],D[n][1]);swap(D[n][0],D[n][4]);swap(D[n][4],D[n][5]);
    }
    else if(c=='N'){
        swap(D[n][0],D[n][1]);swap(D[n][1],D[n][5]);swap(D[n][5],D[n][4]);
    }
}

int main() {
    //?????????????????¬??§??\???
    int ans = 0;
    int n;
    cin >> n;
    for (int i = 0; i < n ; i++) {
        for (int j = 0; j < 6; j++) {
            cin >> D[i][j];
        }
    }
    for (int i = 0; i < n ; i++) {
        for (int j = i+1 ; j <=  n ; j++) {
            //i????????????????????¨j???????????????????????????
            //?????¢???????????¢???????????????
            char SWS[10]={"SSSSWSSSS"};
            for(int k=0;k<10;k++){
                if(D[i][1] == D[j][1])break;
                spin(j,SWS[k]);
            }
            //?????¢???????????¢???????????????
            for(int k=0;k<4;k++){
                if(D[i][0] == D[j][0]){
                    if(D[i][1] == D[j][1] && D[i][2]== D[j][2] && D[i][3]==D[j][3] && D[i][4] == D[j][4] && D[i][5] == D[j][5])
                        ans++;
                }
                spin(j,'W');
            }
        }
    }
    //??????

    if (ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1160
def resolve():
    (N, M) = list(map(int, input().split(" ")))
    ABs = [list(map(int, input().split(" "))) for i in range(N)]
    sortedABs = sorted(ABs, key=lambda x: x[0])
    cost = 0
    num = 0
    for ab in sortedABs:
        if ab[1] < M-num:
            num = num + ab[1]
            cost = cost + ab[0]*ab[1]
        else:
            cost = cost + ab[0]*(M-num)
            break
    print(cost)

if '__main__' == __name__:
    resolve()

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

int main(){
	int N,D,A;
	cin >> N >> D >> A;
	vector<pair<long long,long long>> XH;
	for(int i=0;i<N;i++){
		long long x,h;
		cin >> x >> h;
		XH.push_back(make_pair(x,(h+A-1)/A));
	}
	sort(XH.begin(),XH.end());
	
	queue<pair<long long,long long>> que;
	long long ans=0,d=0;
	
	for(int i=0;i<N;i++){
		long long X=XH[i].first,H=XH[i].second;
		
		while(!que.empty()){
			if(que.front().first>=X)break;
			d-=que.front().second;
			que.pop();
		}
		
		H=max(0LL,H-d);
		ans+=H;
		d+=H;
		if(H>0)que.push(make_pair(X+D*2,H));
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
	return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
	mem(isprime,true);
	for(ll p=2;p*p<=n;p++)
	{
		if(isprime[p]==true)
		{
			for(ll i=p*p;i<=n;i+=p)
				isprime[i]=false;
		}
	}
}
ll lcm(ll a,ll b)
{
	return (a/__gcd(a,b))*b;
}
pll find(ll n)
{
	ll b=n%10;
	ll a=n;
	while(n!=0)
	{
		a=n;
		n=n/10;
	}
	return {a,b};
}
void solve()
{
	ll h;
	cin>>h;
	ll cnt=1;
	ll ans=0;
	while(h!=0)
	{
		ans=ans+cnt;
		cnt=cnt*2;
		h=h/2;
	}
	cout<<ans;
}	

int main()
{
	IOS
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

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

  std::vector<i64> nC2;
  for (i64 i = 0; i * (i + 1) / 2 <= 100000; ++i) {
    nC2.push_back(i * (i + 1) / 2);
  }

  const auto it = std::find(nC2.begin(), nC2.end(), N);
  if (it == nC2.end()) {
    std::cout << "No" << std::endl;
    return 0;
  }

  const i64 n = std::distance(nC2.begin(), it);
  std::vector<std::vector<bool>> subsets(n + 1, std::vector<bool>(N, false));
  for (i64 i = 0, k = 0; i < n; ++i) {
    for (i64 j = i + 1; j < n + 1; ++j, ++k) {
      subsets[i][k] = true;
      subsets[j][k] = true;
    }
  }

  std::cout << "Yes" << std::endl;
  std::cout << n + 1 << std::endl;
  for (const std::vector<bool>& subset : subsets) {
    std::cout << n;
    for (i64 i = 0; i < N; ++i) {
      if (subset[i]) {
        std::cout << ' ' << (i + 1);
      }
    }
    std::cout << std::endl;
  }

  return 0;
}

Measured memory_bytes: 6912
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int n = vs[0];
			int a = vs[1];
			int b = vs[2];

			long ans = ModPow(2, n, mod) - 1;
			long x = Combination(n, a, mod);
			long y = Combination(n, b, mod);
			//System.Diagnostics.Debug.WriteLine($"{ans} {x} {y}");
			ans = Mod(ans - x - y, mod);
			//System.Diagnostics.Debug.WriteLine($"{ans}");
			Console.WriteLine(ans);
		}

		#region 場合の数 long Combination(long n, long r, long mod)
		static long Combination(int n, int r, long mod)
		{
			if (n < r) { return 0; }
			if (n == r) { return 1; }
			// nCr = (n * (n-1) * ... * (n-(r-1))) / (r * r-1 * ... * 2 * 1)
			long a = 1;
			long b = 1;
			for (int i = 0; i < r; i++) {
				a = Mod(a * (n - i), mod);
				b = Mod(b * (i + 1), mod);
			}
			return Mod(a * ModInv(b, mod), mod);
		}
		#endregion

		#region 逆元(拡張Euclidの互除法) long ModInv(long a, long mod)
		static long ModInv(long a, long m)
		{
			long b = m, x = 1, y = 0;
			while (b > 0) {
				long t = a / b;
				a = Mod(a, b);
				x = x - t * y;
				(a, b) = (b, a);
				(x, y) = (y, x);
			}
			x = Mod(x, m);
			return x;
		}
		#endregion

		#region 繰り返し二乗法 long ModPow(long x, long y, long mod)
		static long ModPow(long x, long y, long mod)
		{
			long result = 1;
			while (y > 0) {
				if (y % 2 != 0) {
					result = Mod(result * x, mod);
				}
				x = Mod(x * x, mod);
				y /= 2;
			}
			return result;
		}
		#endregion

	}
}


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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        long cnt1 = 0;
        long cnt2 = 0;
        bool even = false;

        while (true)
        {
            int c = Console.Read();
            if (even)
            {
                if (c == '0')
                {
                    cnt1++;
                }
                else if (c == '1')
                {
                    cnt2++;
                }
                else
                {
                    break;
                }
            }
            else
            {
                if (c == '0')
                {
                    cnt2++;
                }
                else if (c == '1')
                {
                    cnt1++;
                }
                else
                {
                    break;
                }
            }
            even = !even;
        }
        
        Console.WriteLine(Math.Min(cnt1, cnt2));
    }
}

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

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

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }

    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 13140
import math
A, B, H, M = map(int, input().split())
h = (H+M/60)/12
m = M/60
ans = min(abs(h - m), 1 - abs(h - m))
ans = (A*A + B*B - 2*A*B*math.cos(ans*math.pi*2))**0.5
print(ans)

Measured memory_bytes: 9508
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll ans;
    if (A == B)
        ans = 0;
    else if ((B - A) % 2 == 0)
        ans = (B - A) / 2;
    else {
        ll can1 = A + (B - A - 1) / 2;
        ll can2 = N - B + (B - A - 1) / 2 + 1;
        ans = min(can1, can2);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3592
def li():
    return [int(x) for x in input().split()]
INF = 10**18
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N, A, B, C = li()
l = [int(input()) for x in range(N)]

def dfs(index, a, b, c, none):
    # 終端
    if index == N:
        if min(a, b, c) > 0:
            return abs(a - A) + abs(b - B) + abs(c - C)
        else:
            return INF
    # ツリー構造
    v1 = dfs(index+1, a + l[index], b, c, none) + (10 if a > 0 else 0)
    v2 = dfs(index+1, a, b + l[index], c, none) + (10 if b > 0 else 0)
    v3 = dfs(index+1, a, b, c + l[index], none) + (10 if c > 0 else 0)
    v4 = dfs(index+1, a, b, c, none+1)
    return min(v1, v2, v3, v4)

ans = dfs(0, 0, 0, 0, 0)
print(ans)

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    REP(i,1,10){
        REP(j,1,10){
            if(i*j==n){
                Yes(true)
                return 0;
            }
        }
    }
    Yes(false)
    return  0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
int N,A,B;
 scanf("%d" , &N);
 scanf("%d" , &A);
 scanf("%d" , &B);
if(1<=N && N<=20 && 1<=A && A<=50 && 1<=B && B<=50)
{
	if((A*N)>B)
	{
	 printf("%d\n",B);
	}
	else if((A*N)<B)
	{
	 printf("%d\n",A*N);
	}
	else
	{
	 printf("%d\n",B);
	}
}
else
{
	printf("制約を守っていません。\n");
}
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (ll)(k); i < (ll)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
const ll MOD = 1000000007;
const ll INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	ll w, h;
	cin >> w >> h;
	vector<pii> v;
	REP(i, w)
	{
		ll a; cin >> a;
		v.emplace_back(a, 0);
	}
	REP(i, h)
	{
		ll a; cin >> a;
		v.emplace_back(a, 1);
	}
	sort(ALL(v));
	ll cnt1 = 0, cnt2 = 0;
	ll ans = 0;
	for (auto t : v)
	{
		ll a = t.first, b = t.second;
		if (b == 0)
		{
			ans += (h + 1 - cnt2) * a;
			cnt1++;
		}
		else
		{
			ans += (w + 1 - cnt1) * a;
			cnt2++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4464
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; i++) 

using namespace std;

int main() {
    int s, w;
    cin >> s >> w;
    if (s > w) {
        cout << "safe" << endl;
    } else {
        cout << "unsafe" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
fun main(args: Array<String>) {
    println(timeFromSecond(readLine()!!.toInt()))
}

fun timeFromSecond(second: Int): String {
    val minitSeconds = 60
    val hourSeconds = 60 * 60

    val outputSecond = second % minitSeconds
    val outputMinit = (second % hourSeconds) / minitSeconds
    val outputHour = second / hourSeconds

    return "$outputHour:$outputMinit:$outputSecond"
}


Measured memory_bytes: 25204
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	double a,ans[11]={},ss;
	while(cin>>a){
		ss=0;
		ans[1]=a;
		fu(1,11){
			if(i==1) ss=ans[1];
			else if(i%2==0){
				ans[i]=ans[i-1]*2;
				ss+=ans[i];
			}
			else{
				ans[i]=ans[i-1]/3;
				ss+=ans[i];
			}
		}
		printf("%.8lf\n",ss);
	}
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(ll i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << "\n"
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T, class U> inline bool chmin(T& a, const U& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T, class U> inline bool chmax(T& a, const U& b){ if(a < b){ a = b; return 1; } return 0; }
template<class T, class U> inline bool change(T& a,U& b){if(a > b){swap(a,b);return 1;}return 0;}
//0の場合のアレンジに注意
template<class T>
T gcd(T a,T b){
    if(a == 0)return b;
    else if(b == 0)return a;
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
template<class T>
T lcm(T a,T b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
template<class T>
inline bool isp(T n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
vector<ll> fac(cmax),finv(cmax),inv(cmax);

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if(fac[0] == 0)COMinit();
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}
template<class T = ll>
T in(){T x;cin >> x;return x;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll N = in();
    dou D;
    cin >> D;
    vector<dou> X(N),Y(N);
    rep(i,N){
        cin >> X[i] >> Y[i];
    }
    ll ans = 0;
    rep(i,N){
        dou dist = sqrt(X[i] * X[i] + Y[i] * Y[i]);
        if(dist <= D)ans++;
    }
    cout << ans << "\n";
}

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

int main (){
	int n, m, k, i;
	scanf("%d%d%d", &n, &m, &k);
	for(i = 0; i <= m; ++i){
		int p = i * n;
		int q = m - i * 2;
		if(q == 0) continue;
		int r = (k - p) / q;
		if((k - p) == q * r && 0 <= r && r <= n){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 3776