akhauriyash/Code-Regression huggingface dataset:
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod    998244353
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 500000
int dirx[] = {1, -1,0, 0, 1, 1, -1, -1}, diry[] = {0, 0, 1, -1, 1, -1, 1, -1};



//=============================================ASIFAZAD==============================================//

ll fun(ll x)
{
    return x*(x+1)/2;
}

int32_t main()
{
    io;
    int n, k;
    cin>>n>>k;
    int l[k], r[k];
    for(int i = 0; i< k; i++)
        cin>>l[i] >> r[i];
    ll dp[n+5] = {};
    ll pre[n+5] = {};
    dp[1] = pre[1] = 1;
    for(int i = 2; i<= n ;i++)
    {
        for(int j = 0; j< k ;j++)
        {
            if(l[j] >= i)
                continue;
            int left = min(r[j] , i-1);
            ll val = (pre[i-l[j]] - pre[i-left-1] + mod)%mod;
            dp[i] = (dp[i] + val)%mod;
        }
        pre[i] = (pre[i-1] + dp[i])%mod;
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 6732
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))

dp = [0 for _ in range(5050)]

def getdp(i):
    return dp[2550+i]
def setdp(i,val):
    dp[2550+i]=val

setdp(0,1)
for i in range(N):
    diff = X[i]-A
    #print(diff)
    #print(dp[2530:2570])
    #for j,val in enumerate(dp):
    tmpdp = [0 for _ in range(5050)]
    for j in range(5050):
        val = dp[j]
        if val and 0 <=j+diff<5050:
            #print(i,j,val)
            tmpdp[j+diff]+=val
    for i in range(5050):
        dp[i]+=tmpdp[i]


print(dp[2550]-1)

Measured memory_bytes: 3316
n,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
m = a.index(1)
ans = 0
a = m//(k-1)
ans += a+1
s = (k-1-m%(k-1))+m
l = n-1-s
if l!=0:
  ans += (l-1)//(k-1)+1
if m == 0:
  ans = (n-2)//(k-1)+1
if n==k:
  ans = 1
print(ans)

Measured memory_bytes: 13880
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

 ll digit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }

void solve()
{
	ll n;
	cin>>n;
	n%=10;
	if(n==2 || n==4 || n==5|| n==7 ||n==9)
		cout<<"hon";
	else if( n==0 || n==6 || n==8 || n==1)
		cout<<"pon";
	else
		cout<<"bon";
	return;
}

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

Measured memory_bytes: 3628
//use std::io::{stdout, Write, BufWriter}

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    println!("{}",
         (b - a + 1) - multiples(a..b, c) - multiples(a..b, d) + multiples(a..b, lcm(c, d))
    );
}

fn gcd<T>(x: T, y: T) -> T
where T: PartialEq + Copy + std::ops::Rem<Output = T> + std::convert::From<u8>
{
    if y == T::from(0u8) {
        x
    } else {
        gcd(y, x % y)
    }
}

fn lcm<T>(x: T, y: T) -> T
where T: PartialEq
        + Copy
        + std::ops::Rem<Output = T>
        + std::ops::Mul<Output = T>
        + std::ops::Div<Output = T>
        + std::convert::From<u8>
{
    x * y / gcd(x, y)
}

// 区間r(両端含む)に含まれるnの倍数の個数を求める
use std::ops::Range;
fn multiples<T>(r: Range<T>, n: T) -> T
where T: Copy
    + std::ops::Add<Output = T>
    + std::ops::Sub<Output = T>
    + std::ops::Div<Output = T>
    + std::convert::From<u8>
 {
    (r.end / n) - (((r.start + n - T::from(1u8))/ n) - T::from(1u8))
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<ll> a(N);
    REP(i,N) cin>>a[i];
    ll sum = 0;
    ll ans = 0;
    int right=0;
    for(int left=0;left<N;++left){
        while(right<N && (sum^a[right])==(sum+a[right])){
            sum+=a[right];
            ++right;
        }
        ans+=right-left;
        if(right==left) ++right;
        else sum-=a[left];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<algorithm>
using namespace std;

#define N 100

int main(){

  int n, p[N + 1], m[N + 1][N + 1];
  int i, j, k, l;
  
  scanf("%d", &n);
  
  for(i = 1; i <= n; i++){
    scanf("%d", &p[i - 1]);
    scanf("%d", &p[i]);
  }
  
  for(i = 0; i <= n; i++){
    m[i][i] = 0;
  }
  
  for(l = 2; l <= n; l++){
    for(i = 1; i <= n - l + 1; i++){
      int j = i + l - 1;
      m[i][j] = (1 << 21);
      
      for(k = i; k <= j - 1; k++){
        m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j]);
      }
    }
  }
  
  printf("%d\n", m[1][n]);
  
  return 0;
}

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

template<i64 M>
struct modint {
    i64 x;

    constexpr modint(const i64 y = 0) noexcept : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}

    constexpr modint operator-() const noexcept { return modint(-x); }
    constexpr modint operator+(const modint &rhs) const noexcept { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept { return modint(*this) /= rhs; }

    constexpr modint &operator+=(const modint &rhs) noexcept {
        x += rhs.x;
        if (x >= M) x -= M;
        return *this;
    }

    constexpr modint &operator-=(const modint &rhs) noexcept {
        if (x < rhs.x) x += M;
        x -= rhs.x;
        return *this;
    }

    constexpr modint &operator*=(const modint &rhs) noexcept {
        x = x * rhs.x % M;
        return *this;
    }

    constexpr modint &operator/=(const modint &rhs) noexcept {
        i64 a = rhs.x, b = M, u = 1, v = 0;
        while (b > 0) {
            i64 t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        *this *= u;
        return *this;
    }

    friend ostream &operator<<(ostream &os, const modint &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, modint &a) {
        i64 t;
        is >> t;
        a = modint(t);
        return is;
    }
};

constexpr i64 MOD = 1e9 + 7;
using m64 = modint<MOD>;

void solve() {
    i64 n;
    cin >> n;
    vector<i64> cnt(26);
    for (i64 i = 0; i < n; i++) {
        char c;
        cin >> c;
        cnt[c - 'a']++;
    }

    m64 ans = 1;
    for (i64 i = 0; i < 26; i++) ans *= cnt[i] + 1;
    cout << ans - 1 << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>
int main(void);

int main(void){

  int i, j;
  int height, width;

  while(1){

    scanf("%d", &height); scanf("%d", &width);

    if(height == 0 && width == 0){
      break;
    }

    for (i = 1; i <= height; i++) {

      for (j = 1; j <= width; j++) {
        printf("#");
      }

      printf("\n");
    }
    printf("\n");
    
  }

  return 0;
  
}



Measured memory_bytes: 2100
import scala.annotation.tailrec
object Main extends App {

  @tailrec
  def rec(e:Int ,cnt:Int): Int = {
    if((e & 1) == 1) cnt
    else rec(e>>1, cnt+1)
  }

  val n = io.StdIn.readLine.toInt
  val a = io.StdIn.readLine.split(" ").map(e => rec(e.toInt, 0))

  println(a.min)
}

Measured memory_bytes: 25412
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a) 0<=a&&a<n
using namespace std;
int d[13][3]={{1,0,0},{0,1,0},{0,0,1},
	{1,1,0},{1,-1,0},{1,0,1},{1,0,-1},{0,1,1},{0,1,-1},
	{1,1,1},{1,-1,1},{1,1,-1},{1,-1,-1}
};
int main(){
	int n,m,p,f[7][7][7],nz[7][7],ans,mv;
	while(cin>>n>>m>>p,n){
		rep(i,n)rep(j,n){
			nz[i][j]=0;
			rep(k,n)f[i][j][k]=0;
		}
		ans=0;
		rep(i,p){
			int x,y,z;cin>>x>>y;x--,y--;
			if(!ans){
				f[x][y][z=nz[x][y]++]=i&1?-1:1;
				rep(dr,13){
					int c=1;
					for(int s=1;s>-2;s-=2)
					for(int cx=x+s*d[dr][0],cy=y+s*d[dr][1],cz=z+s*d[dr][2];
						ck(cx)&&ck(cy)&&ck(cz)&&f[x][y][z]==f[cx][cy][cz];
						cx+=s*d[dr][0],cy+=s*d[dr][1],cz+=s*d[dr][2])c++;
					if(c>=m)ans=i&1?-1:1,mv=i+1;
				}
			}
		}
		cout<<(ans?ans>0?"Black":"White":"Draw");
		if(ans)cout<<" "<<mv;
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    pii t1, t2;
    int k;

    cin >> t1.ff >> t1.ss >> t2.ff >> t2.ss >> k;

    int tm = (t2.ff * 60 + t2.ss) - (t1.ff * 60 + t1.ss);

    cout << max(0, tm - k) << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
int n,A[50];
int Exhaustive_Search(int,int);
int main(){
  int q,i,M;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&M);
  if(Exhaustive_Search(0,M)) printf("yes\n");
  else printf("no\n");
  }
    return 0;
}
int Exhaustive_Search(int i,int m){
  int restart;
  if(m==0) return 1;
  if(i>=n) return 0;
  restart= Exhaustive_Search(i+1,m)|| Exhaustive_Search(i+1,m-A[i]);
  return restart;
}



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

int main(){
    int N;
    cin >> N;
    int A[N];
    for (auto& a : A) cin >> a;
    int cnt = 0;
    bool flag = true;
    for (int i = N - 1; flag; i--) {
        flag = false;
        for (int j = 0; j < i; j++) {
            if (A[j] > A[j+1]) {
                swap(A[j], A[j+1]);
                flag = true;
                cnt++;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        cout << A[i] << (i < N - 1 ? " " : "\n");
    }
    cout << cnt << endl;
    return 0;
}

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

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int X = ReadInt();
        int cnt = X / 100;
        if (X <= 105 * cnt)
        {
            return "1";
        }
        return "0";
    }


    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string n;
    cin >> n;

    if (n[0] == '9' || n[1] == '9')
    {
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int N,A,B,max,min;
  scanf("%d%d%d",&N,&A,&B);
  
  if(A>B){
    max=B;
  }else{
    max=A;
  }
  
  if(A+B-N>0){
    min=A+B-N;
  }else{
    min=0;
  }
  
  printf("%d %d",max,min);
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size()-1;i++){
		if(s[i]=='A' && s[i+1]=='C'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << 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;
using ll = long long;
using P = pair<int,int>;

const int INF = 1001001001;

int main(){
 int W,H,N;
 cin>>W>>H>>N;
 int x[N];
 int y[N];
 int a[N];

 for(int i=0;i<N;i++){
     cin>>x[i]>>y[i]>>a[i];
 }
 int minx=0; int miny=0;
 int maxx=W; int maxy=H;
 for(int i=0;i<N;i++){
     if(a[i]==1){if(x[i]>=minx){minx=x[i];}}
     if(a[i]==2){if(x[i]<=maxx){maxx=x[i];}}
     if(a[i]==3){if(y[i]>=miny){miny=y[i];}}
     if(a[i]==4){if(y[i]<=maxy){maxy=y[i];}}
 }
 if((maxx-minx)<0||(maxy-miny)<0){cout<<0<<endl;}
 else{cout<<(maxx-minx)*(maxy-miny)<<endl;}
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double i,j,n,m=999,k,l,t,b,a,c;
string s;
int main()
{
  for(cin>>n>>t>>a;i<n;i++){
    cin>>b;
    k=abs(a-(t-b*0.006));
    if(k<m)m=k,l=i+1;
  }
  cout<<l;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int test=1;
    //cin>>test;
    while(test--){
      int n,k;
      cin>>n>>k;
      int a[n];
      for(int i=0;i<n;i++){
        cin>>a[i];
      }
      sort(a,a+n);
      int s=0;
      for(int i=0;i<k;i++) s+=a[i];
      cout<<s;
    }
    

    return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<cmath>
#include<iomanip>
#include<vector>

using namespace std;

int main()
{
	int n;

	while (true) {
		cin >> n;
		if (n == 0) break;

		double* s = new double[n];
		double m = 0.0;
		for (int i = 0; i < n; i++) {
			int temp;
			cin >> temp;
			m += temp;
			s[i] = temp;
		}
		m = m / static_cast<double>(n);

		double a = 0.0;
		for (int i = 0; i < n; i++) {
			a += (s[i] - m)*(s[i] - m);
		}

		a = a / static_cast<double>(n);
		cout << fixed << setprecision(8) << sqrt(a) << "\n";

		delete[] s;
	}

	return 0;
}

Measured memory_bytes: 1272
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int i,j,N;
  int R[2000000];
  int maxv=-1000000000,minv;

  scanf("%d", &N);

  for (i = 0; i < N; i++) {
    /* code */
    scanf("%d", &R[i]);
  }

  minv=R[0];

    for (j = 1; j <= N-1; j++) {
      /* code */
          if(maxv < R[j]-minv){
            maxv=R[j]-minv;
          }
          if (minv>R[j]) {
            /* code */
            minv=R[j];
          }
    }


  printf("%d\n", maxv);
  return 0;
}



Measured memory_bytes: 2548
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

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

// constexpr inline ll mod = 1'000'000'007;
// constexpr int max_n = 200'000 + 5;

// ((A*x - (A*x % B) - A * (x - (x % B))) / B
// = (A * y - (A * y) % B) / B  where y = x % B
// = floor (A * y / B)
// max = (A * (B - 1 or N)) / B

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    ll a,b,n; cin>>a>>b>>n;
    ll res = a * min(b-1, n) / b;
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 3656
import itertools
H, W = map(int, input().split())
pic = [input() for i in range(H)]
for i, j in itertools.product(range(H), range(W)):
    if pic[i][j] == "#":
        S = set()
        if i > 0:
            S.add(pic[i-1][j])
        if i < H-1:
            S.add(pic[i+1][j])
        if j > 0:
            S.add(pic[i][j-1])
        if j < W-1:
            S.add(pic[i][j+1])
        if not "#" in S:
            print("No")
            exit()
else:
    print("Yes")



Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] number = line.split(" ");
        int[] n = {Integer.parseInt(number[0]), Integer.parseInt(number[1])};
        int b1;
        int b2;
        int b3;
        int max;
        int min;
        if(n[0] % 3 == 0 || n[1] % 3 == 0){
            System.out.println("0");
        } else {
            int r1;
            int r2;
            int r3;
            b1 = ((((n[0] - n[0] % 3) / 3) * 2) + 1) * ((n[1] - n[1] % 2) / 2);
            b2 = ((((n[0] - n[0] % 3) / 3) * 2) + 1) * (((n[1] - n[1] % 2) / 2) + (n[1] % 2));
            b3 = (n[0] * n[1]) - b1 - b2;
            max = Math.max(b2, b3);
            min = Math.min(b1, b3);
            r1 = Math.abs(max - min);
            b1 = ((((n[1] - n[1] % 3) / 3) * 2) + 1) * ((n[0] - n[0] % 2) / 2);
            b2 = ((((n[1] - n[1] % 3) / 3) * 2) + 1) * (((n[0] - n[0] % 2) / 2) + (n[0] % 2));
            b3 = (n[0] * n[1]) - b1 - b2;
            max = Math.max(b2, b3);
            min = Math.min(b1, b3);
            r2 = Math.abs(max - min);
            r3 = Math.min(n[0], n[1]);
            System.out.println(Math.min(r1, Math.min(r2, r3)));
        }
	}
}

Measured memory_bytes: 23124
//??£?????°????????¨??????
#include <iostream>
#include <vector>
using namespace std;

int n, m;
vector<int> et[100000];

bool visited[100000];
int parent[100000];
int lowest[100000];
int prenum[100000];
int timer;

//???????????°??????????????????
int dfs(int u, int prev) {
	prenum[u] = timer;
	lowest[u] = timer;
	visited[u] = true;
	parent[u] = prev;
	timer++;
	
	int childNum = 0;
	for (int i = 0; i < et[u].size(); i++) {
		int v = et[u][i];
		if (!visited[v]) {
			dfs(v, u);
			lowest[u] = min(lowest[u], lowest[v]);
			childNum++;
		}
		else if (v != prev) {
			//u --> v????????????
			lowest[u] = min(lowest[u], prenum[v]);
		}
	}
	return childNum;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int src, dst;
		cin >> src >> dst;
		et[src].push_back(dst);
		et[dst].push_back(src);
	}
	
	//??¢??????????±???????
	timer = 0;
	for (int i = 0; i < n; i++) visited[i] = false;
	
	static bool isArtP[100000] = {false};
	
	if (dfs(0, -1) >= 2) {
		isArtP[0] = true;
	}
	
	for (int i = 1; i < n; i++) {
		if (prenum[parent[i]] <= lowest[i] && parent[i] != 0) {
			isArtP[parent[i]] = true;
		}
	}
	
	for (int i = 0; i < n; i++) {
		if (isArtP[i]) {
			cout << i << endl;
		}
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> X(n), A(n);
    for(int i = 0; i < n; i++){
        cin >> X[i];
        A[i] = X[i];
    }
    
    sort(A.begin(), A.end());
    
    for(int i = 0; i < n; i++){
        if(X[i] <= A[n / 2 - 1]){
            cout << A[n / 2] << endl;
        }else{
            cout << A[n / 2 - 1] << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int n;
    // int v[100001]={};
    int o[100001]={};
    int e[100001]={};
    int of=0;
    int os=0;
    int ef=0;
    int es=0;
    int tmp=0;
    int ans=0;
    
    cin >> n;
    
    for(int i=1; i<=n/2; i++){
        
        cin >> tmp; // odd
        o[tmp] += 1;
        
        if(o[tmp]>=o[of]&&tmp!=of){
            
            os = of;
            of = tmp;
            
        } else if(o[tmp]>o[os]&&tmp!=of){
            
            os = tmp;
            
        }
        
        cin >> tmp; // even
        e[tmp] += 1;
        
        if(e[tmp]>=e[ef]&&tmp!=ef){
            
            es = ef;
            ef = tmp;
            
        } else if(e[tmp]>e[es]&&tmp!=ef){
            
            es = tmp;
            
        }
        
    }
    
    if(of==ef){
        
        if(o[os]>e[es]){
            
            ans = n - e[ef] - o[os];
            
        } else {
            
            ans = n - o[of] - e[es];
            
        }
        
    } else {
        
        ans = n - o[of] - e[ef];
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

constexpr int ushi = 100000000;

int main() {
    int n;
    cin >> n;
    vector<int> P(n, ushi);
    vector<vector<int>> G(n);
    REP(i, n - 1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int k;
    cin >> k;
    REP(i, k) {
        int v, p;
        cin >> v >> p;
        --v;
        P[v] = p;
    }
    
    vector<int> par(n, -1), vec;
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : G[u]) {
            if (v != par[u]) {
                par[v] = u;
                q.push(v);
            }
        }
        vec.push_back(u);
    }
    reverse(ALL(vec));
    
    vector<pair<int, int>> range(n, {-ushi, ushi});
    for (int u : vec) {
        if (P[u] != ushi) range[u] = {P[u], P[u]};
        for (int v : G[u]) {
            if (v == par[u]) continue;
            if (range[v].first == -ushi) continue;
            if ((range[u].first & 1) == (range[v].first & 1) && range[u].first != -ushi) {
                cout << "No\n";
                return 0;
            }
            range[u].first = max(range[u].first, range[v].first - 1);
            range[u].second = min(range[u].second, range[v].second + 1);
            if (range[u].first > range[u].second) {
                cout << "No\n";
                return 0;
            }
        }
    }
    
    vector<int> ans(n, ushi);
    reverse(ALL(vec));
    for (int v : vec) {
        if (v == 0) {
            ans[v] = range[v].first;
        } else {
            if (ans[par[v]] + 1 >= range[v].first && ans[par[v]] + 1 <= range[v].second) {
                ans[v] = ans[par[v]] + 1;
            } else {
                ans[v] = ans[par[v]] - 1;
            }
        }
    }
    
    cout << "Yes\n";
    REP(i, n) cout << ans[i] << "\n";
    return 0;
}


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

int main(){
  int K, N;
  cin >> K >> N;
  
  vector<int> house(N);
  for(int i = 0; i < N; i++){
    cin >> house.at(i);
  }
  
  vector<int> length(N);
  length.at(0) = house.at(0) + K - house.at(N-1);
  for(int i = 1; i < N; i++){
    length.at(i) = house.at(i) - house.at(i-1);
  }
  
  int mymax = 0;
  for(int i = 0; i < N; i++){
    mymax = max(mymax, length.at(i));
  }
  
  cout << K - mymax << endl;
}

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

const int bits = 20;
int pre[bits];

signed main()
{
	int N;
	cin >> N;
	for (int i = 0; i < bits; ++i) {
		pre[i] = -1;
	}
	long long ans = 0;
	int offset = -1;
	for (int i = 0; i < N; ++i) {
		int X;
		cin >> X;
		bitset<bits> cur(X);
		int mxpos = offset;
		for (int j = 0; j < bits; ++j) {
			//cout << cur[j];
			if (cur[j]) {
				if (pre[j] > mxpos) {
					mxpos = pre[j];
					offset = pre[j];
				}
				pre[j] = i;
			}
		}
		/*cout << " ";
		for (int j = 0; j < bits; ++j) {
			cout << " " << pre[j];
		}
		cout << "    " << i-mxpos << endl;*/
		ans += i-mxpos;
	}
	cout << ans << endl;
}


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

int main(void)
{
  char s[10];
  char S[10] = "Sunny";
  char C[10] = "Rainy";
  scanf("%s", &s);
  if (strcmp(s, S) == 0) {
    printf("Cloudy\n" );
    return 0;
  }else if (strcmp(s, C) == 0){
    printf("Sunny\n");
    return 0;
  }else printf("Rainy\n" );
  return 0;
}


Measured memory_bytes: 128
package main

import (
	"fmt"
	"math"
)

func main() {
	var x,a,b float64
	fmt.Scan(&x,&a,&b)
	if math.Abs(a-x) < math.Abs(b-x) {
		fmt.Println("A")
	} else {
		fmt.Println("B")
	}
}

Measured memory_bytes: 512
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int T = sc.nextInt();
    int c[] = new int[n];
    int t[] = new int[n];
    int answer =100000000;
    for(int i=0;i<n;i++){
      c[i]=sc.nextInt();
      t[i]=sc.nextInt();
    }
    for(int i=0;i<n;i++){
      if(t[i]<=T){
        answer = Math.min(answer,c[i]);
      }
    }
    if(answer!=100000000){
      System.out.println(answer);
    }else{
      System.out.println("TLE");
    }
        
      
  }
  

  
}

Measured memory_bytes: 23764
#include <stdio.h>
#include <stdlib.h>
int main(){

	char c,
	     tim[20];
	int a,
		h,
		m,
		s;
	long l;


	for(a = 0;a < 19 && (c = getchar()) != '\n';a++  ){
		tim[a] = c;
	}tim[a] = 0;

	l = strtol(tim,NULL,10);

	
		h = l/3600;
		m = l%3600/60;
		s = l%3600%60;
	
	printf("%ld:%ld:%ld\n",h,m,s);
	return 0;
}

Measured memory_bytes: 524
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()
    C = S()

    wi, ri = 0, N-1
    ans = 0

    while ri >= 0 and wi < N:
        while wi < N and C[wi] != "W":
            wi += 1
        while ri >= 0 and C[ri] != "R":
            ri -= 1
        if wi >= ri:
            break
        if wi < N and ri >= 0:
            C[wi], C[ri] = C[ri], C[wi]
        wi += 1
        ri -= 1
        ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 82380
#include<stdio.h>
#define N 10000

int main(){
  int n, q;
  int i, j, num=0;
  int s[N]={0}, t[N][2]={0};

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

  for( i = 0 ; i < n ; i++){
    for( j = 0; j < q ; j++){
      if( s[i] == t[j][0] ){
        t[j][1] = 1;
      }
    }
  }

  for( j=0 ; j < q ; j++){
    if(t[j][1]==1){
      num++;
    }
  }

  printf("%d\n" ,num);
  return 0; // Don't forget return 0
}

Measured memory_bytes: 724
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	int n;
	string a[100][100];
	int p[100],co[100],run[100];
	cin >> n;

	for (int j = 0; j < n; j++)
	{
		p[j] = 0;
		co[j] = 0;
		run[j] = 0;
		for (int i = 0; i < 100; i++)
		{
			cin >> a[j][i];

			if (a[j][i] == "OUT")
			{
				p[j] += 1;
			}
			if (p[j] == 3)
			{
				break;
			}

			if (a[j][i] == "HIT")
			{
				run[j] += 1;
				if (run[j] == 4)
				{
					co[j] += 1;
					run[j] = run[j] - 1;
				}
			}
			else if (a[j][i] == "HOMERUN")
			{
				co[j] += run[j] + 1;
				run[j] = 0;
			}
		}

		cout << co[j] << endl;
	}
}



Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
ll mpow(ll x, ll n){ //x^n(mod mo) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mo;
        x = x*x % mo;
        n = n >> 1;
    }
    return ans;
}
 
//const int mod = 998244353;
const int mod = 1000000007;
class mint {
public:
    long long x;
    mint(long long 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;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
int main(){
    ll N;
    string S;
    cin >> S;
    N = S.size();
    vector<vector<mint>> dp(100010,vector<mint>(13));
    dp[0][0]=1;
    rep(i,N){
        if(S[i] != '?'){
            ll n = S[i] - '0';
            rep(j,13){
                dp[i+1][(j*10+n)%13] += dp[i][j];
            }
        }else{
            rep(n,10){
                rep(j,13){
                    dp[i+1][(j*10+n)%13] += dp[i][j];
                }
            }
        }
    }
    cout << dp[N][5] << endl;
}

Measured memory_bytes: 13696
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void) {

	string s;
	char a = 'a';

	cin >> s;

	for (int i = 0; i < 3; i++) {
		if (s.find(a) == string::npos) {
			cout << "No" << endl;
			return 0;
		}
		a++;
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=100000000;
int main()
{
  int n;cin>>n;
  vector<int>x(n);vector<int>y(n);
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i];
  }
  vector<int>ord;
  for(int i=0;i<n;i++)ord.push_back(i);

  long double sm=0;
  do{
    for(int i=0;i<n-1;i++){
      int a=ord[i];
      int b=ord[i+1];

      long double dx=x[a]-x[b];
      long double dy=y[a]-y[b];

      sm+=sqrt(dx*dx+dy*dy);
    }
  }while(next_permutation(ord.begin(),ord.end()));

  for(int i=0;i<n;i++)sm/=(i+1);
  printf("%.10Lf\n",sm);
}

Measured memory_bytes: 256
//by kcz 1552920354@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
char readc()
{
	char c;
	while(gc<'-');
	return c;
}
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

#define mid ((l+r)/2)
ll a,b;
#define F(l) (r1-(l))*(l2+(l))
bool check(ll l1,ll r1,ll l2)
{
	int l=0,r=r1-l1;
	while(l!=r)
	{
		if(F(mid)>F(mid+1))r=mid;
		else l=mid+1;
	}
	return F(l)<a*b;
}
bool ok(int n)
{	
	int r2=n+(n>=b);
	if(n<a)return 1;
	if(a>1)
	{
		int l2=r2-(a-1)+1;
		if(l2>b||r2<b)
		{
			if(!check(1,a-1,l2))return 0;
		}
		else
		{
			int len=r2-b;
			if(!check(1,len,b+1))return 0;
			int len2=a-1-len;
			if(!check(len+1,a-1,b-len2))return 0;
		}
	}
	if(r2>b&&r2-(a-1)<=b)--r2;
	r2-=a-1;
	int len=n-(a-1);
	if(r2<b||r2-len+1>b)
	{
		if(!check(a+1,n+1,r2-len+1))return 0;
	}
	else
	{
		int len1=r2-b;
		if(!check(a+1,a+len1,r2-len1+1))return 0;
		int len2=len-len1;
		if(!check(a+len1+1,n+1,b-len2))return 0;
	}
	return 1;
}		
int main()
{
	//freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
	int tt;cin>>tt;
	while(tt--)
	{
		cin>>a>>b;
		if(a>b)swap(a,b);
		ll l=0,r=2e9+5;
		while(l+1!=r)
		if(ok(mid))l=mid;
		else r=mid;
		cout<<l<<endl;
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); 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; }


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n) {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    ll ma, mb;
    if(n % 2 == 1) {
        ma = a[n/2];
        mb = b[n/2];
        cout << mb - ma + 1 << endl;
    }
    else {
        ma = (a[n/2-1] + a[n/2]);
        mb = (b[n/2-1] + b[n/2]);
        cout << (mb - ma) + 1 << endl;
    }
}

Measured memory_bytes: 6420
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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

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

vector<int> as;
vector<int> ranks(9, 0);

int calc_min(const int N) {
    int cnt = 0;

    for (int i = 0; i < 8; i++) {
        if (ranks[i] > 0) {
            cnt++;
        }
    }

    if (cnt == 0) {
        cnt += min(1, ranks[8]);
    }
    // cnt += max(0, ranks[8] - cnt);

    return cnt;
}

int calc_max(const int N) {
    int cnt = 0;

    for (int i = 0; i < 8; i++) {
        if (ranks[i] > 0) {
            cnt++;
        }
    }

    cnt += ranks[8];

    return cnt;
}

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

    as.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> as[i];
        ranks[min(as[i], 3200) / 400]++;
    }

    cout << calc_min(N) << " " << calc_max(N) << endl;

    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N), H(N);
    int h_t = 0;
    for (int i = 0; i < N; i++) {
        int x, y, h;
        cin >> x >> y >> h;
        if (h != 0) h_t = i;
        X[i] = x, Y[i] = y, H[i] = h;
    }

    for (int x = 0; x <= 100; x++) {
        for (int y = 0; y <= 100; y++) {
            int h = abs(X[h_t] - x) + abs(Y[h_t] - y) + H[h_t];

            bool flag = true;
            for (int i = 0; i < N; i++) {
                if (max(h - abs(X[i] - x) - abs(Y[i] - y), 0) != H[i]) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                cout << x << " " << y << " " << h << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<set>
using namespace std;
int s,a;
set<int> b;
int main(){
    scanf("%d",&s);
    b.insert(s);
    a=s;
    for(int i=2;i<=1000000;i++){
        if(a%2){
            a=a*3+1;
        }
        else{
            a/=2;
        }
        decltype(b)::iterator it =b.find(a);
        if(it!=b.end()){
            printf("%d\n",i);
            return 0;
        }
        else{
            b.insert(a);
        }
    }
}

Measured memory_bytes: 256
loop{
  h, w = gets.split.map &:to_i
  break if h == 0 && w == 0
  h.times{|i|
    if i == 0 || i == h-1
      puts '#' * w
    else
      print '#' if w > 1
      puts '.' * [w-2, 0].max + '#'
    end
  }
  puts
}

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

using namespace std;

long long s(long long n) {
    long long ans = 0;

    while (n) {
        ans += n % 10;
        n /= 10;
    }

    return ans;
}

long long f(long long n) {
    long long d = 0, tmp = n;
    while (tmp) {
        tmp /= 10;
        d++;
    }

    long long x, ans = n;
    // cout << ans << endl;
    for (int i = 0; i < d; i++) {
        x = (long long)(pow(10, i+1)) * (n / (long long)(pow(10, i+1)) + 1) - 1;
        // cout << x << endl;
        if (x * s(ans) < ans * s(x)) {
            ans = x;
        }
    }

    return ans;
}

int main() {
    int k;
    cin >> k;
    long long n = 1;
    cout << n << endl;
    for (int i = 1; i < k; i++) {
        cout << f(n+1) << endl;
        n = f(n+1);
    }
    // cout << f(12345) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define pb push_back 
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sz(v) (int((v).size()))
const ll INF = 1e18;
const int MOD = 1e9+7;
const int N = 5e5+5;
int main(){
	ll a,b,c,k;
	cin >> a >> b >> c >> k;
	if(k%2 == 0)
		cout << a-b << '\n';
	else
		cout << b-a << '\n';
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll a,b,c,d,e;
 string s,t;
 cin>>a>>b>>c>>d>>e;
 ll aa = 60*a+b;
 ll bb = 60*c+d;
 cout<<max(0ll, bb-aa-e)<<endl;

    return 0;
}


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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> ans;
    for(int i = 1; i < 101; ++i) {
        if(a % i == 0 and b % i == 0) ans.push_back(i);
    }
    reverse(ans.begin(), ans.end());
    cout << ans[k - 1] << '\n';
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
// utility
#include <bitset>
#include <tuple>
#include <typeinfo>
// error handling
#include <cassert>
// string
#include <cctype>
#include <cstring>
#include <string>
// container
#include <array>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// algorithm
#include <algorithm>
// iterator
#include <iterator>
// math
#include <cmath>
#include <complex>
#include <numeric>
#include <random>
// i/o
#include <cstdio>
#include <iomanip>
#include <iostream>

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]) == typeid(INF) and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N, K;
  cin >> N >> K;
  vector<int> v(K), w(v);
  rep(i, 1, N + 1) { v[i % K]++; }

  int ans = 0;
  rep(i, 1, N + 1) {
    int x = i % K;
    if ((K - x) * 2 % K == 0)
      ans += v[(K - x) % K] * v[(K - x) % K];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    string a, b;
    cin >> a >> b;
    string s, t;
    int a_num = atoi(a.c_str());
    int b_num = atoi(b.c_str());

    rep(i, a_num){
        s += b;
    }
    rep(i, b_num){
        t += a;
    }
    if(s >= t) cout << t << endl;
    else cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
MAX = 1000000
ROOT = 1000
MOD = 1000000007
is_prime = [True] * (MAX + 1)
is_prime[0] = is_prime[1] = False
for i in range(2, ROOT + 1):
  if is_prime[i]:
    for j in range(i * i, MAX + 1, i):
      is_prime[j] = False

n = int(input())
qlst = list(map(int, input().split()))
total1 = 0#next is kisuu or sisuu
total2 = 1#next is kisuu only(pre is index)
last_prime = 0
dic = {}
dic[(last_prime, 0)] = total1
dic[(last_prime, 1)] = total2
for q in qlst:
  new_dic = defaultdict(int)
  for k, v in dic.items():
    last_prime, t = k
    if is_prime[q]:
      if t == 0:
        if last_prime < q:
          new_dic[(q, 0)] = (new_dic[(q, 0)] + v) % MOD
          new_dic[(last_prime, 1)] = (new_dic[(last_prime, 1)] + v) % MOD
        else:
          new_dic[(last_prime, 1)] = (new_dic[(last_prime, 1)] + v) % MOD
      else:
        if last_prime < q:
          new_dic[(q, 0)] = (new_dic[(q, 0)] + v) % MOD
    
    if not is_prime[q]:
      if t == 0:
        new_dic[(last_prime, 1)] = (new_dic[(last_prime, 1)] + v) % MOD
  dic = new_dic
print(sum(dic.values()) % MOD)


Measured memory_bytes: 25528
/* ファイル名：ITP1_8_A.c	*/
/* 内容：与えられた文字列の小文字と大文字を入れ替える	*/

/* include	*/
#include <stdio.h>
#include <ctype.h>

/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:与えられた文字列の小文字と大文字を入れ替える	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力・処理・出力	*/
	char str[1200];	/* 入力される文字列	*/
	
	/* 処理	*/
	int i;	/* ループ用変数	*/
	scanf("%[^\n]%s",str);	/* 文字列の取得		*/
	
	/* 1文字ずつ処理していく	*/
	for(i = 0; str[i] != '\0'; i++){
		/* アルファベットの場合	*/
		if(isalpha(str[i])){
			/* 大文字の場合	*/
			if(isupper(str[i])){
				str[i] = tolower(str[i]);/* 小文字に変換	*/
			}
			/* 小文字の場合	*/
			else if(islower(str[i])){
				str[i] = toupper(str[i]);/* 大文字に変換	*/
			}
			else{
				/* 処理なし	*/
			}
		}
		/* アルファベット以外の場合	*/
		else{
			/* 処理なし(そのまま出力)*/
		}
	}
	
	/* 結果出力	*/
	printf("%s\n",str);
	return 0;
}



Measured memory_bytes: 2132