akhauriyash/Code-Regression huggingface dataset:
// luogu-judger-enable-o2
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned
#define ull unsigned ll
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define y1 wzpakking
#define fi first
#define se second
#define BG begin
#define ED end
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define sqr(x) (1ll*x*x)
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
#define inf (1<<30)
using namespace std;
const int N=1000;
struct edge{
	int from,to,next,f;
	ll v;
}e[N*N];
int head[N],tot;
int nd,S,T,idx[N],idy[N];
void add(int x,int y,int f,ll v){
	e[++tot]=(edge){x,y,head[x],f,v};
	head[x]=tot;
	e[++tot]=(edge){y,x,head[y],0,-v};
	head[y]=tot;
}
ll dis[N];
int q[N*N],vis[N],from[N];
bool bfs(){
	For(i,1,nd) dis[i]=-(1ll<<62),vis[i]=0;
	int h=0,t=1;
	q[1]=S; dis[S]=0;
	while (h!=t){
		int x=q[++h]; vis[x]=0;
		for (int i=head[x];i;i=e[i].next)
			if (dis[e[i].to]<dis[x]+e[i].v&&e[i].f){
				dis[e[i].to]=dis[x]+e[i].v;
				from[e[i].to]=i;
				if (!vis[e[i].to]){
					vis[e[i].to]=1;
					q[++t]=e[i].to;
				}
			}
	}
	return dis[T]!=-(1ll<<62);
}
void del(){
	for (int i=from[T];i;i=from[e[i].from])
		e[i].f--,e[i^1].f++;
}
struct que{
	char s[10];
	int x,cnt;
}qq[N];
int n,Q;
int x[N],y[N];
int mn[N],mx[N];
ll v[N];
const int MX=100;
ll work(int cnt){
	nd=0; S=++nd; T=++nd; tot=1;
	memset(head,0,sizeof(head));
	For(i,1,MX) idx[i]=++nd,idy[i]=++nd;
	For(i,1,n) add(idx[x[i]],idy[y[i]],1,v[i]);
	{
		For(i,0,cnt+1) mx[i]=MX,mn[i]=1;
		For(i,1,Q){
			if (qq[i].s[0]=='L'&&cnt>=qq[i].cnt+1)
				mn[qq[i].cnt+1]=max(mn[qq[i].cnt+1],qq[i].x+1);
			if (qq[i].s[0]=='R'&&cnt>=qq[i].cnt+1)
				mx[cnt-qq[i].cnt]=min(mx[cnt-qq[i].cnt],qq[i].x-1);
		}
		For(i,1,cnt) mn[i]=max(mn[i],mn[i-1]);
		Rep(i,cnt,1) mx[i]=min(mx[i],mx[i+1]);
		For(i,1,cnt){
			int tmp=++nd;
			if (mn[i]>mx[i]) return 0;
			add(S,tmp,1,0);
			For(j,mn[i],mx[i])
				add(tmp,idx[j],1,0);
		}
	}
	{
		For(i,0,cnt+1) mx[i]=MX,mn[i]=1;
		For(i,1,Q){
			if (qq[i].s[0]=='D'&&cnt>=qq[i].cnt+1)
				mn[qq[i].cnt+1]=max(mn[qq[i].cnt+1],qq[i].x+1);
			if (qq[i].s[0]=='U'&&cnt>=qq[i].cnt+1)
				mx[cnt-qq[i].cnt]=min(mx[cnt-qq[i].cnt],qq[i].x-1);
		}
		For(i,1,cnt) mn[i]=max(mn[i],mn[i-1]);
		Rep(i,cnt,1) mx[i]=min(mx[i],mx[i+1]);
		For(i,1,cnt){
			int tmp=++nd;
			if (mn[i]>mx[i]) return 0;
			add(tmp,T,1,0);
			For(j,mn[i],mx[i])
				add(idy[j],tmp,1,0);
		}
	}//buildy
	ll ans=0;
	For(i,1,cnt){
		if (!bfs()) return 0;
		ans+=dis[T]; del();
	}
	return ans;
}
int main(){
	scanf("%d",&n);
	For(i,1,n) scanf("%d%d%lld",&x[i],&y[i],&v[i]);
	scanf("%d",&Q);
	For(i,1,Q) scanf("%s%d%d",qq[i].s,&qq[i].x,&qq[i].cnt);
	ll ans=0;
	For(i,1,n) ans=max(ans,work(i));
	printf("%lld\n",ans);
}

Measured memory_bytes: 4352
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,x,m=1,now;
  cin >> n >> x;
  now=x;
  for(int i=1; i<n; i++) {
    cin >> x;
    if(now>=x) {
      m++;
    }
    now=x;
  }
  cout << m << endl << n << endl;
}


Measured memory_bytes: 3216
#include <cstdio>
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

int main(){
		int G,D;
		cin >> D >> G;
		int p[D],c[D];
	   for(int i=0; i<D;i++){
			   cin >> p[i] >> c[i];	   
		}
	   int ans = 1e9;
	   for(int i=0;i< (1<<D);i++){ //1を左シフト
			   int cnt = 0;
			   int score=0;

			   for(int j=0;j<D;j++){
					   if(i >> j & 1){//iをjビット右シフト
							   //完答なら(j+1)*100とボーナスポイント
							   cnt += p[j];
							   score += p[j]*(j+1)*100;
							   score += c[j];
					   }
			   }
			   for(int j=D-1;j>=0;j--){
					   	if(~i >> j & 1){
						//完答しないところを配点多いところから埋めてゆく
			   				for(int k=0;k<p[j]-1 && score<G;k++){
					   		score += (j+1)*100;
					  		cnt++;
			   				}
			   			}	   
			   }
	   
	   if(score >= G){
					   ans = min(ans, cnt);
	   }
	   }

	   cout << ans << endl;
}




Measured memory_bytes: 256
n=int(input())
s=input()
s_li=list(s)
li=[chr(ord('A')+i) for i in range(26)]*2
ans_li=[]
for i in range(len(s_li)):
    a=li.index(s_li[i])
    ans_li.append(li[a+n])
ans=''
for i in ans_li:
    ans+=i
print(ans)

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

#define F first
#define S second
#define pb push_back
#define ll long long
#define int long long

using namespace std ;

const int MAXN = 101 * 1001 ;

int a[MAXN] , b[MAXN] ;

int32_t main()
{
    ios::sync_with_stdio(0) ; cin.tie(0) ;
    int n ;
    cin >> n ;
    for(int i = 0 ; i < n; i ++ )
        cin >> a[i] >> b[i] ;
    int m = 0 , ans = 0 ;
    for(int i = n - 1 ; i > -1 ; i -- )
    {
        a[i] += ans ;
        if(b[i]==1||a[i]%b[i]==0)
            continue ;
        ans += (b[i]-a[i]%b[i]) ;
    }
    cout << ans << '\n' ;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define ff first
#define ar array
#define ss second
#define ll long long int
#define mem(x) memset(x,0,sizeof(x))
#define setbits(x)  __builtin_popcount(x)
#define ull unsigned long long int
#define all(c) (c).begin(),(c).end()
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define db double
#define endl "\n"
#define  fbo(x) find_by_order(x)
#define  ook(x) order_of_key(x)
 
using namespace __gnu_pbds;
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair<ll,ll > iil;
typedef pair<ll,int> li;
typedef pair<int,int> ii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os1;
typedef tree<int, null_type, greater<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os2;

inline void fast()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
const ll pi=31;
const ll MOD[2] = {1187278649, 1149736019};//for double hashing
const ll mod=(ll)(1e9)+7;
ll pmod(ll x,ll n){
  ll r=1;
  while(n>0)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
    n%=mod;
  }
  return r;
}
ll pMod(ll x,ll n,ll mod)
{ ll r=1;
  while(n>0)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
    n%=mod;
  }
  return r;
 
}
 
//think recursively also;
const int mxn=1e6;
int n;
int a[mxn+1];
int spf[mxn+1];
int ct[mxn+1];
void pr()
{
  for(int i=1;i<=mxn;i++){
    spf[i]=i;
  }
  for(int i=2;i<=mxn;i++)
  {
    if(spf[i]==i)
    {
      for(int j=2*i;j<=mxn;j+=i)
      {
        if(spf[j]==j)
        {
          spf[j]=i;
        }
      }
    }
  }

}
void solve()
{ 
  pr();
cin>>n;
int cg=0;
for(int i=1;i<=n;i++)
{cin>>a[i];
  cg=__gcd(cg,a[i]);
}
if(cg>1)
{
  cout<<"not coprime\n";
  return;
}
else 
{  
   for(int i=1;i<=n;i++)
   {
       int x=a[i];
      set<int>s;
       while(x!=1)
       {
          s.insert(spf[x]);
          x/=spf[x];
       }
       for(int j:s)
        ct[j]+=1;
   }
   for(int i=2;i<=mxn;i++)
   {
    if(ct[i]>=2)
    {
      cout<<"setwise coprime\n";
      return;
    }
   }
   cout<<"pairwise coprime\n";
   return;
}

}
int main()
{
  fast();
   // int t;
   // cin>>t;
   // for(int casee=1;casee<=t;casee++)
  {//cout<<"Case #"<<casee<<": ";
    solve();
  }
 
 
 
}

Measured memory_bytes: 15228
/**
 *  author: mahfuzz
 *  created: 27.12.2019
**/
 
#include <iostream>
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    int a, b; cin >> a >> b;
    
    cout << 6 - (a+b) << "\n";
    
        
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const int INF=1e9+5;
typedef long long ll;

int main() {
  ll X,N;
  cin>>X>>N;
  ll a[N],sa=X,ans=X;
  bool judge;
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  
  for(int i=X;i>=0;i--){
    judge=true;
    for(int j=0;j<N;j++){
      if(a[j]==i){
        judge=false;
        break;
        
      }
    }
    if(judge){
      sa=X-i;
      ans=i;
      break;
    }
  }
  for(int i=X;i<X+sa;i++){
    judge=true;
    for(int j=0;j<N;j++){
      if(a[j]==i){
        judge=false;
        break;
      }
    }
    if(judge){
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
}

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

int main() {
  string s;
  cin >> s;
  bool r = true;
  stack<bool> t;
  int i;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'm') {
      t.push(false);
    } else if (s[i] == 'e') {
      if (!t.empty() && !t.top()) {
        t.pop();
        t.push(true);
      } else {
        r = false;
        break;
      }
    } else if (s[i] == 'w') {
      if (!t.empty() && t.top()) {
        t.pop();
        if (t.empty() && i < s.size() - 1) {
          r = false;
          break;
        }
      } else {
        r = false;
        break;
      }
    }
  }
  cout << (r ? "Cat" : "Rabbit") << endl;
  return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

using Facts = map<ll, int>; 
void factrize(ll n, Facts& mp) {
  if(n < 2) return;
  ll m = sqrt(n);
  REP(i, 2, m+1) {
    int cnt = 0;
    while(n%i == 0) {
      n /= i;
      ++cnt;
    }
    if(cnt != 0) mp[i] += cnt;
  }
  if(n != 1) mp[n]++;
}


int main(){
    ll a, b;
    cin >> a >> b;
    ll g = __gcd(a, b);
    Facts f;
    factrize(g, f);
    cout << f.size() + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if (a<b&&b<c&&a<c){
    cout << a << " " << b << " " << c << endl;
  }
  if (a<b&&c<b&&a<c){
    cout << a << " " << c << " " << b << endl;
  }
  if (b<a&&b<c&&a<c){
    cout << b << " " << a << " " << c << endl;
  }
  if (b<a&&b<c&&c<a){
    cout << b << " " << c << " " << a << endl;
  }
  if (c<a&&c<b&&b<a){
    cout << c << " " << b << " " << a << endl;
  }
  if (a<b&&c<a&&c<b){
    cout << c << " " << a << " " << b << endl;
  }
  if (a==b&&a<c){
    cout << a << " " << b << " " << c << endl;
  }
  if (a==c&&a<b){
    cout << a << " " << c << " " << b << endl;
  }
  if (c==b&&c<a){
    cout << b << " " << c << " " << a << endl;
  }
  
}


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

int d(long long n){
	int digit=1;
  while(n/10!=0){
    n/=10;
    digit++;
  }
  return digit;
}

int main() {
  long long N;
  cin>>N;
  int ans=12;
  for(long long i=1;i<=100000;i++){
    if(N%i!=0) continue;
    ans=min(ans,max(d(i),d(N/i)));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n,m;
  cin>>n>>m;
  vector<int> s(m),c(m);

  if(n==1){
    int result=-1;
    for(int i=0;i<m;i++){
      cin>>s[i]>>c[i];
      if(result==-1){
        result=c[i];
      }else{
        if(result!=c[i]){
          cout<<-1<<endl;
          return 0;
        }
      }
    }
    if(result==-1){
      result=0;
    }
    cout<<result<<endl;
    return 0;
  }

  for(int i=0;i<m;i++){
    cin>>s[i]>>c[i];
    if(s[i]==1){
      if(c[i]==0){
        cout<<-1<<endl;
        return 0;
      }
    }
  }
  vector<int> result(n+1,-1);
  for(int i=0;i<m;i++){
    if(result[s[i]]==-1){
      result[s[i]]=c[i];
    }else{
      if(result[s[i]]!=c[i]){
        cout<<-1<<endl;
        return 0;
      }

    }
  }
  if(result[1]==-1){
    result[1]=1;
  }
  for(int i=2;i<=n;i++){
    if(result[i]==-1){
      result[i]=0;
    }
  }

  for(int i=1;i<=n;i++){
    cout<<result[i];
  }
  cout<<endl;





  return 0;
}




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

int main() {
  int n,a,max=-1000000,min=1000000;
  cin >> n;
  long long int sum=0;
  for (int i=0;i<n;i++) {
    cin >> a;
    if (max<a) max=a;
    if (min>a) min=a;
    sum+=a;
  }
  cout << min << " " << max<< " " << sum << endl;
  return 0;
}

Measured memory_bytes: 3080
import numpy as np
N=int(input())
N-=1
s ='abcdefghijklmnopqrstuvwxyz'
b = []
while True:
    a = N % 26
    b.append(s[a])
    N = N // 26
    if N == 0:
        break
    N -= 1
for i in range(len(b)):
    a = len(b)-i-1
    print(b[a], end='')

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


//0058
int main(){
	double xA, yA, xB, yB, xC, yC, xD, yD;
	char ch;
	while(cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD){
		double x1,y1,x2,y2, d1,d2, e;
		y1=yB-yA;
		x1=xB-xA;
		y2=yD-yC;
		x2=xD-xC;

		if(-(y1*y2)-DBL_EPSILON < (x1*x2) 
			&& (x1*x2) < -(y1*y2)+DBL_EPSILON){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}

	}

}

Measured memory_bytes: 0
#![allow(unused)]
use proconio::*;

fn main() {
    input! {
    n: usize,
    f: [f64; n],
    }

    // log2(10^4 * 10^9)
    const P_MAX: usize = 45;

    let mut dp = vec![vec![0u64; P_MAX]; P_MAX];
    let mut ans = 0;
    for i in 0..n {
        let mut num = (f[i] * 1_000_000_000f64).round() as u64;
        let mut two = 0;
        let mut five = 0;
        while num % 2 == 0 {
            num /= 2;
            two += 1;
        }
        while num % 5 == 0 {
            num /= 5;
            five += 1;
        }
        // println!("{:?}", (two, five));
        for i in 0..P_MAX {
            for j in 0..P_MAX {
                if i + two >= 18 && j + five >= 18 {
                    ans += dp[i][j];
                }
            }
        }
        dp[two][five] += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6448
s = str(input())
x,y = map(int,input().split())
x_list,y_list = [],[]
l = s.split('T')

for i in range(0,len(l),2):
  x_list.append(len(l[i]))
for i in range(1,len(l),2):
  y_list.append(len(l[i]))

ans_x,ans_y = set(),set()

if s[0]=='F':
  ans_x.add(x_list[0])
  x_list=x_list[1:]
else:
  ans_x.add(0)
ans_y.add(0)

for i in x_list:
  ans = set()
  for j in ans_x:
    ans.add(i+j)
    ans.add(j-i)
  ans_x = ans
for i in y_list:
  ans = set()
  for j in ans_y:
    ans.add(i+j)
    ans.add(j-i)
  ans_y = ans
if x in ans_x and y in ans_y:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3816
K, N = map(int, input().split())
A = list(map(int, input().split()))
max = 0
for i in range(N-1):
    if abs(A[i]-A[i+1]) > max:
        max = abs(A[i]-A[i+1])
if abs(A[0]+(K-A[N-1])) > max:
    max = abs(A[0]+(K-A[N-1]))
print(K - max)

Measured memory_bytes: 25840
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)
#define MAX 999999999

typedef long long ll;

int n;
int xorMemo[5][5][5][5][5];
short dp[5][1<<25];

int solve(int bit){
  if(bit == 0) return 0;
  if(dp[n-1][bit] != -1) return dp[n-1][bit];

  int li,lj;
  for(li=0;li<n;li++){
    for(lj=0;lj<n;lj++){
      if((bit & (1<<(n*li+lj))) != 0){
        break;
      }
    }
    if(lj != n) break;
  }

  int res = MAX;
  REP(hi,li,n){
    REP(hj,lj,n){
      int next = (bit ^ xorMemo[n-1][li][lj][hi][hj]);
      res = min(res,solve(next)+1);
    }
  }
  return dp[n-1][bit]=res;
}

int main(){
  memset(xorMemo,0,sizeof(xorMemo));
  REP(m,1,6){
    rep(li,m){
      rep(lj,m){
        REP(hi,li,m){
          REP(hj,lj,m){
            REP(i,li,hi+1){
              REP(j,lj,hj+1){
                xorMemo[m-1][li][lj][hi][hj] |= (1<<(i*m+j));
              }
            }
          }
        }
      }
    }
  }

  memset(dp,-1,sizeof(dp));
  while(cin>>n,n){
    int bit = 0;
    rep(i,n){
      rep(j,n){
        int x;
        cin>>x;

        if(x == 1){
          bit |= (1<<(i*n+j));
        }
      }
    }

    int ans = solve(bit);
    rep(i,ans){
      cout<<"myon";
    }
    cout<<endl;
  }
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		Point[] xSortedPoints = new Point[n];
		Point[] ySortedPoints = new Point[n];
		for (int i = 0; i < n; i++) {
		    Point p = new Point(sc.nextInt(), sc.nextInt());
		    xSortedPoints[i] = p;
		    ySortedPoints[i] = p;
		}
		Arrays.sort(xSortedPoints, new Comparator<Point>() {
		    public int compare(Point p1, Point p2) {
		        return p1.x - p2.x;
		    }
		});
		Arrays.sort(ySortedPoints, new Comparator<Point>() {
		    public int compare(Point p1, Point p2) {
		        return p1.y - p2.y;
		    }
		});
		int left = 0;
		int right = k - 1;
		long minTotal = Long.MAX_VALUE;
		while (right < n) {
		    for (int i = 0; i + right < n; i++) {
		        int minX = xSortedPoints[left].x;
		        int maxX = xSortedPoints[i + right].x;
		        long width = maxX - minX;
		        int up = 0;
		        while (ySortedPoints[up].x < minX || ySortedPoints[up].x > maxX) {
		            up++;
		        }
		        int down = up;
		        for (int j = 0; j < k - 1; j++) {
		            down++;
		            while (ySortedPoints[down].x < minX || ySortedPoints[down].x > maxX) {
		                down++;
		            }
		        }
		        boolean flag = true;
		        while (flag) {
		            minTotal = Math.min(minTotal, width * (ySortedPoints[down].y - ySortedPoints[up].y));
		            up++;
    		        while (ySortedPoints[up].x < minX || ySortedPoints[up].x > maxX) {
    		            up++;
    		        }
    		        down++;
    		        if (down >= n) {
    		            break;
    		        }
    		        while (ySortedPoints[down].x < minX || ySortedPoints[down].x > maxX) {
    		            down++;
    		            if (down >= n) {
    		                flag = false;
    		                break;
    		            }
    		        }
		        }
		    }
		    left++;
		    right++;
		}
		System.out.println(minTotal);
    }
    
    static class Point {
        int x;
        int y;
        
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}



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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll X, Y; cin >> X >> Y;
    vector<ll> ans;
    ans.push_back(X);
    while(ans.back()*2 <= Y) ans.push_back(ans.back()*2);
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000009
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;
typedef unsigned short int usi;

// 昇順
int cmp(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main()
{
    int a, b;
    int count[5]={0};
    int i;

    for(i=0; i<3; i++) {
        scanf("%d %d",&a, &b);
        count[a]++;
        count[b]++;
    }
    for(i=1; i<=4; i++) {
        if(count[i]>2 || count[i]==0) {
            printf("NO");
            return 0;
        }
    }
    printf("YES");
    return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
   
      int a = sc.nextInt();
      int b = sc.nextInt();

	  if((a*b)%2 ==0){
        System.out.println("Even");
      } else{
        System.out.println("Odd");
      }
	}
}

Measured memory_bytes: 22736
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   string a,b;
   cin >> a >> b;
   string ab = a + b;

   int tmp = stoi(ab);
   bool is_square = false;
   for(int i = 1; i <= tmp; i++){
      if(tmp == i*i){
         is_square = true;
         break;
      }
   }

   if(is_square){
      cout << "Yes" << endl;
   }
   else{
      cout << "No" << endl;
   }

   return 0;
}

Measured memory_bytes: 256
while True:
      try:
            hand = sorted(map(int, raw_input().split(",")))
            kind = len(set(hand))
            ma = max([hand.count(i) for i in hand])
            if kind == 4:
                  print "one pair"
            elif kind == 3:
                  if ma == 2:
                        print "two pair"
                  else:
                        print "three card"
            elif kind == 2:
                  if ma==4:
                        print "four card"
                  else:
                        print "full house"
            else:
                  if hand==[1,10,11,12,13] or hand[4] - hand[0] == 4:
                        print "straight"
                  else:
                        print "null"
      except:
            break

Measured memory_bytes: 4220
#include <bits/stdc++.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) FOR(i,0,n)

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;

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

	int a, b, c, k;

	cin >> a >> b >> c >> k;

	int sum = a + b + c;
	int u = max(a, b);
	u = max(u, c);
	sum -= u;

	rep(i, k){
		u *= 2;
	}

	cout << sum + u << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  
 string s; cin >> s;
	if (s == "SSS") cout << 0 << endl;
	if (s == "SSR") cout << 1 << endl;
	if (s == "SRS") cout << 1 << endl;
	if (s == "SRR") cout << 2 << endl;
	if (s == "RSS") cout << 1 << endl;
	if (s == "RSR") cout << 1 << endl;
	if (s == "RRS") cout << 2 << endl;
	if (s == "RRR") cout << 3 << endl;
  
  return 0;
  
}
  


Measured memory_bytes: 3180
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int chosen[100] = {0} ;
int n ;
vector<int> permutation;
void search() {
if (permutation.size() == n) {
// process permutation
    for (int i = 0; i < n; i++) 
        {
            cout << permutation[i] << " ";
        }
        cout << endl ;
} else {
for (int i = 0; i < n; i++) {
if (chosen[i]) continue;
chosen[i] = true;
permutation.push_back(i);
search();
chosen[i] = false;
permutation.pop_back();
}
}
}
int main()
{
    int n , k , ans = 0 , h[101] = {0} , d ;
    cin >> n >> k ;
    for(int i = 0 ; i < k ; i++ )
    {
        cin >> d ;
        for(int j = 0 ; j < d ; j++)
        {
            int x ;
            cin >> x ;
            h[x] = 1 ;
        }
    }
    for(int i = 1 ; i < 101 ; i++)
    {
        if(h[i] == 1)
        {
            ans++ ;
        }
    }
    ans = n - ans ;
    cout << ans << endl ;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol n; cin >> n;
    lol k; cin >> k;
    FOR(i, k, n+1)
    {
        result += (i*(2*n+1-i))/2-(i*(i-1))/2+1;
        //cout << (i*(2*n+1-i))/2-(i*(i-1))/2+1 << endl;
        result %= MOD;
    }
    

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int main() {
    int x, y; cin >> x >> y;
    cout << x + y / 2 << endl;
    return 0;
}

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

typedef unsigned long long uLL;
typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
typedef pair <long long,long long> pll;
typedef pair <long long,pll> plll;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1000000007;

#define   Check( N , p )      ( !( ( N & ( 1 << p ) ) == 0 ) )
#define   ON( N , p )         ( N = N | ( 1 << p ) )
#define   OFF( N , p )        ( N = N & ~( 1 << p ) )

int n;
int a[ 100 ][ 100 ];
LL dp[ 30 ][ (1 << 21) + 5 ];

LL solve( int idx , int mask ) {
        //cout << idx << " " << bitset <10> (mask) << endl;
        if( idx > n ) {
                //cout << "here : " << __builtin_popcount( mask ) << endl;
                return __builtin_popcount( mask ) == n;
        }
        if( dp[idx][mask] != -1 ) return dp[idx][mask];
        LL ret = 0;
        for( int i = 1; i <= n; i++ ) {
                if( !Check( mask , i ) && a[idx][i] == 1 ) {
                        int cur = mask;
                        ON( cur , i );
                        ret = ( ret%MOD + solve( idx + 1 , cur )%MOD )%MOD;
                        ret %= MOD;
                }
        }
        return dp[idx][mask] = ret;
}
int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( NULL );
        cin >> n;
        for( int i = 1; i <= n; i++ ) {
                for( int j = 1; j <= n; j++ ) {
                        cin >> a[i][j];
                }
        }
        memset( dp , -1 , sizeof( dp ) );
        cout << solve( 1 , 0 ) << endl;
        return 0;
}












Measured memory_bytes: 491904
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>
#include <cmath>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    scanf("%d", &i);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    scanf("%lld", &i);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

constexpr char BR = '\n';

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

ll sn(ll n)
{
    return (ll)n * (n+1) / 2;
}

int main()
{
    int N;
    io >> N;

    ll ans = 0;
    int sqN = (int)sqrt(N);
    for (int k = 1; k <= sqN; ++k)
    {
        ans += (sn(N/k) - sn(k)) * k * 2 + k * k;
    }
    io << ans << BR;
}


Measured memory_bytes: 3784
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TupleSections #-}
import qualified Data.Bits                   as Bits
import qualified Data.Word                   as Word
import qualified Control.Arrow               as Arrow
import qualified Data.Foldable               as Foldable
import qualified Data.ByteString.Char8       as BSC8
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import           Unsafe.Coerce

getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString)
getI = fmap (Arrow.second BSC8.tail) . BSC8.readInt

getAN :: Int -> IO (VU.Vector Int)
getAN n = VU.unfoldrN n getI <$> BSC8.getLine

radixSortInt :: VU.Vector Int -> VU.Vector Int
radixSortInt = unsafeCoerce . radixSort64 . unsafeCoerce

{-# INLINE radixSort64 #-}
radixSort64 :: VU.Vector Word.Word64 -> VU.Vector Word.Word64
radixSort64 v = Foldable.foldl' step v [0, 16, 32, 48]
  where
    mask k x = fromIntegral $ Bits.unsafeShiftR x k Bits..&. 0xffff
    step v k = VU.create $ do
      pref <- VU.unsafeThaw
        . VU.prescanl' (+) 0
        . VU.unsafeAccumulate (+) (VU.replicate 0x10000 0)
        $ VU.map ((, 1) . mask k) v
      res <- VUM.unsafeNew $ VU.length v
      VU.forM_ v $ \x -> do
        let !masked = mask k x
        i <- VUM.unsafeRead pref masked
        VUM.unsafeWrite pref masked $ i + 1
        VUM.unsafeWrite res i x
      return res

solve :: Int -> VU.Vector Int -> Int
solve n (VU.reverse . radixSortInt -> xs) = snd . VU.foldl' step (1, mm) $ VU.tail xs
  where
    !mm = VU.head xs
    step (!cnt, !res) x
      | cnt == n - 1 = (cnt, res)
      | cnt == n - 2 = (cnt + 1, res + x)
      | otherwise    = (cnt + 2, res + 2 * x)

main :: IO ()
main = do
  n <- readLn :: IO Int
  xs <- getAN n
  print $ solve n xs

Measured memory_bytes: 15656
#include "bits/stdc++.h"

/************* Using *************/
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using graph_t = vector<vector<ll>>;

/*********** Constants ***********/
const auto INF  = static_cast<int>(1e10);
const auto INFL = static_cast<ll>(1e18);
const auto MOD  = static_cast<ll>(1e9 + 7);
const auto NIL  = nullptr;

/*********** Variables ***********/
ll N, MAX, NEXT;
vector<ll> A;
bool flag;

/************* Utils *************/

/*********** Functions ***********/
bool init() {
    cin >> N; A.resize(N);
    for (auto& item : A) cin >> item;
    flag = false;
    return true;
}

void solve() {
    MAX = *max_element(A.begin(), A.end());
    if (count(A.begin(), A.end(), MAX) > 1) {
        flag = true;
    }
    else {
        auto B = A;
        sort(B.begin(), B.end(), greater<>());
        NEXT = B[1];
    }
}

void output() {
    if (flag) {
        for (const auto& item : A) {
            cout << MAX << endl;
        }
    }
    else {
        for (const auto& item : A) {
            if (item != MAX) {
                cout << MAX << endl;
            }
            else {
                cout << NEXT << endl;
            }
        }
    }
}

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


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

int main(void)
{
	long long  n , k  ,ans ,t ; 
	scanf("%lld%lld",&n,&k) ;
	ans = n % k ;    
	if((ans == 0)||(n==0))
	  printf("0\n") ;
	else 
	{
	    t = abs(ans - k) ;  
		ans = min(ans,t)  ;
	    printf("%lld\n",ans) ;
    }
	
	
	 
	
	return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool is_prime[1500000];

int main(){
  int n, m = 1500000;
  fill(is_prime,is_prime+m,true);
  vector<int> P;
  for(int i = 2; i*i <= m; ++i){
    if(!is_prime[i]) continue;
    for(int j = i; i*j <= m; ++j){
      is_prime[i*j] = false;
    }
  }
  for(int i = 2; i < m; ++i)
    if(is_prime[i])
      P.push_back(i);
  while(cin >> n, n){
    if(is_prime[n]){
      cout << 0 << endl;
      continue;
    }
    int idx = upper_bound(P.begin(), P.end(), n) - P.begin();
    cout << P[idx] - P[idx-1] << endl;
  }
}



Measured memory_bytes: 4800
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "NO";
		if(s.substring(0, 7).equals("keyence") || s.substring(s.length()-7, s.length()).equals("keyence")) {
			ans = "YES";
		}else if(s.substring(0, 1).equals("k") && s.substring(s.length()-6, s.length()).equals("eyence")) {
			ans = "YES";
		}else if(s.substring(0, 2).equals("ke") && s.substring(s.length()-5, s.length()).equals("yence")) {
			ans = "YES";
		}else if(s.substring(0, 3).equals("key") && s.substring(s.length()-4, s.length()).equals("ence")) {
			ans = "YES";
		}else if(s.substring(0, 4).equals("keye") && s.substring(s.length()-3, s.length()).equals("nce")) {
			ans = "YES";
		}else if(s.substring(0, 5).equals("keyen") && s.substring(s.length()-2, s.length()).equals("ce")) {
			ans = "YES";
		}else if(s.substring(0, 6).equals("keyenc") && s.substring(s.length()-1, s.length()).equals("e")) {
			ans = "YES";
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n = 3;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = INF;
    do{
        int tmp = 0;
        rep(i, 0, n - 1) tmp += abs(a[i + 1] - a[i]);
        chmin(ans, tmp);
    }while(next_permutation(a.begin(), a.end()));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  int g=A[0];
  for(int i=1;i<N;i++){
    g=__gcd(g,A[i]);
  }
  cout<<g<<endl;
  return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define Little 1
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,w=0,n=0,m=0,o=0;
  std::cin >> x;
  std::cout << x*2*M_PI << '\n';
}


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

using namespace std;



void solver() {
    string s; cin >> s;
    int sum = 0;
    for(char x : s) sum += (x - '0');

    cout << ((sum%9==0) ? "Yes" : "No") << '\n';
}

int main() {

    ios_base :: sync_with_stdio(0); cin.tie(NULL);

    int t = 1;
    //cin >> t;
    
    while(t--)
        solver();

    return 0;
}

Measured memory_bytes: 3684
import numpy as np
s = input()
a = ["a","b","c"]
b = np.zeros(len(a))
for i in range(len(s)):
    if s[i] in a:
        b[a.index(s[i])]+=1
if max(b)-min(b)<=1:
    print("YES")
else:
    print('NO')

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

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

  // int max = 0;
  // ll tmp;
  // REP(i, n){
  //   tmp = floor(a*(i+1)/b) - a * floor((i+1)/b);
  //   if(max < tmp) max = tmp;
  // }

  ll x;
  if (b > n){
    x = n;
  }else{
    x = b - 1;
  }

  ll ans = floor(a*x/b) - a * floor(x/b);

  cout << ans << endl;
}

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

int main(){
  string s;
  int k;
  cin >> s >> k;
  set<string> ans;
  for(int i=1; i<k+1; i++){
    for(int j=0; j<s.size()-(i-1); j++){
      ans.insert(s.substr(j,i));
    }
  }
  for(int i=0; i<k-1; i++){
    ans.erase(*begin(ans));
  }
  cout << *begin(ans) << endl;
}


Measured memory_bytes: 1664
// Together
#include <cmath>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define total 100010

int main() {
    int N;
    cin >> N;
    vector<int> a(total);
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        a[x]++;
    }
    int count;
    int max_count = 0;
    for (int X = 1; X < total-1; X++) {
        max_count = max(max_count, a[X-1]+a[X]+a[X+1]);
    }
    cout << max_count << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int a[N];
  int i;

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

  int count=0,j,tmp,min;

  for(i=0; i<N; i++){
    min = i;

    for(j=i+1; j<N; j++){
      if(a[j] < a[min]){
        min = j;
      }
    }

    if(min != i){
      tmp = a[i];
      a[i] = a[min];
      a[min] = tmp;
      count++;
    }

  }
  for(i=0;i<N;i++){
    if(i != N - 1)printf("%d ",a[i]);
    else printf("%d", a[i]);  
  }
  printf("\n");
  printf("%d\n",count);

  return 0;
}



Measured memory_bytes: 2128
#include<cstdio>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<fstream>

#define rep(i,a,N) for(int i=0+a;i<N;i++)
#define lint long long int
#define SIZE 100005
#define pb push_back
#define MP make_pair

using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	cout<<(a+b)%24;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {

	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);

	if (a < b && b < c && a < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

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

res1 = 0
cum1 = 0

for i in range(N):
    cum1 += A[i]
    if i % 2 == 0 and cum1 <= 0:
        res1 += - cum1 + 1
        cum1 = 1
    if i % 2 != 0 and cum1 >= 0:
        res1 += cum1 + 1
        cum1 = -1

res2 = 0
cum2 = 0

for i in range(N):
    cum2 += A[i]
    if i % 2 != 0 and cum2 <= 0:
        res2 += - cum2 + 1
        cum2 = 1
    if i % 2 == 0 and cum2 >= 0:
        res2 += cum2 + 1
        cum2 = -1

print(min(res1, res2))

Measured memory_bytes: 14468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll m,n;cin >> m >> n;
    vector<bool> b(n);
    vector<ll> p(m),c(n),e(n);
    for(int i=0;i<m;i++){
        cin >> p[i];
    }
    sort(p.begin(),p.end(),greater<ll>());
    for(int i=0;i<n;i++){
        cin >> c[i] >> e[i];
    }
    vector<ll> dp(m+1,INF);
    dp[0]=0;
    for(int i=0;i<n;i++){
        vector<ll> t(m+1,INF);
        t[0]=0;
        for(int j=0;j<=m;j++){
            chmin(t[j],dp[j]);
            chmin(t[min(m,j+c[i])],dp[j]+e[i]);
        }
        for(int j=0;j<=m;j++){
            dp[j]=t[j];
        }
    }
    ll ans=0,sum=0;
    for(int i=0;i<m;i++){
        sum+=p[i];
        chmax(ans,sum-dp[i+1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3352
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc083.contest.atcoder.jp/tasks/arc083_b>
問題文============================================================
 かつて存在した高橋王国には N 個の都市があり、いくつかの都市の組は道路で双方向に結ばれていました。
 道路の構造は以下のようであったことがわかっています。
 
 都市間の移動は道路を通ってのみ行われ、
 どの都市からどの都市へも必要なら他の都市を経由することで移動できるようになっていた。
 
 道路の長さは道路によって異なっていたかもしれないが、全て正整数であった。
 考古学者のすぬけ君は、高橋王国の遺跡で整数からなる N×N の表 A を発見しました。
 すぬけ君は、この表は高橋王国における都市間の道路に沿った最短距離を表した表ではないかと考えました。
 
 すべての u,v について、A の u 行目 v 列目の整数 Au,v が都市 u から都市 v への最短経路の長さとなるような
 道路の構造が存在するかどうか判定してください。
 さらに、存在する場合、
 そのような道路の構造のうち、存在する道路の長さの和が最小となるようなものについて、その和を求めてください。
 
=================================================================

解説=============================================================

================================================================
*/
ll solve(){
    ll ret = -1;
    ll N; cin >> N;
    vector<vector<ll>> G(N,vector<ll>(N,0));
    for(int i = 0; i < N;i++) for(int j = 0; j < N;j++) cin >> G[i][j];
    
    auto tG = G;
    for(int i = 0; i < N;i++) for(int j = 0; j < N;j++) for(int k = 0; k < N;k++){
        G[j][k] = min(G[j][k],G[j][i] + G[i][k]);
    }
    for(int i = 0; i < N;i++) for(int j = 0; j < N;j++) if(G[i][j] != tG[i][j]) return ret;

    ret = 0;
    vector<vector<int>> use(N,vector<int>(N,1));
    
    for(int i = 0; i < N;i++) for(int j = 0; j < N;j++) for(int k = 0; k < N;k++){
        if(i == j || i == k || j == k) continue;
        if(G[j][k] == G[j][i] + G[i][k]) use[j][k] = 0;
    }

    for(int i = 0; i < N;i++) for(int j = 0; j < N;j++)if(use[i][j]) ret += G[i][j];
    ret /= 2;
    return ret;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define eb emplace_back
#define pb push_back
#define mp make_pair 
#define pii pair<int,int>
#define pli pair<lli,int> 
#define X first
#define Y second
const int N = 3050;
const long long INF = 1ll << 61;

vector <int> input;
int n;
lli dp[N][N];
bool vis[N][N];

lli solve(int i, int j) {
    if (j - i == 1) return n & 1 ? input[i] : -input[i];
    if (vis[i][j]) return dp[i][j];
    if ((n - j + i) & 1) {
        dp[i][j] = min(solve(i, j - 1) - input[j - 1], solve(i + 1, j) - input[i]);
    } else {
        dp[i][j] = max(solve(i, j - 1) + input[j - 1], solve(i + 1, j) + input[i]);
    }
    vis[i][j] = true;
    return dp[i][j];
}


int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    input.resize(n);
    fop (i,0,n) cin >> input[i];
    fop (i,0,N) fop (j,0,N) {
        dp[i][j] = -INF;
        vis[i][j] = false;
    }
    cout << solve(0, n) << endl;
}

Measured memory_bytes: 82176
#include<iostream>

using namespace std;

int main()
{
  int N,X;
  cin >> N >> X;
  int ans = 1;
  int d = 0;
  for( int i=0;i<N;i++ )
    {
      int tmp;
      cin >> tmp;
      d += tmp;
      if(d<=X)
	ans++;
    }
  cout << ans << endl;
    
}


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

long long oddsolve(long long a) { return (a+1)/2 % 2; }
long long solve(long long a) {
    if (a % 2 == 1){
        return oddsolve(a);
    }
    else return oddsolve(a+1) ^ (a+1);
}
int main() {
    long long A, B;
    cin >> A >> B;
    cout << (solve(B) ^ solve(A-1)) << endl;
}

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

// Problem https://atcoder.jp/contests/abc130/tasks/abc130_a

int main(void){
    int X,A;
    cin >> X >> A;
    if(X<A){
        cout << "0" << endl;
    }
    else{
        cout << "10" << endl;
    }

    return 0;
}

Measured memory_bytes: 256