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

#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) (v.size())
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

LL MOD = 1000000007; 

using namespace std;


bool endwith(string s, string end) {
    for (int i = 0; i < end.size(); ++i) {
        if (end[end.size() - 1 - i] != s[s.size() - 1 - i]) {
            return false;
        }
    }
    return true;
}

int main(int argc, char *argv[]) {
    
    string s;
    cin >> s;
    
    vector<string> v = { "dreamer", "dream", "eraser", "erase" }; 
    while (!s.empty()) {
        bool find = false;
        FOE(t, v) {
            if (endwith(s, t)) {
                FOR(_, 0, t.size()) {
                    s.pop_back();
                }
                find = true;
                break;
            }
        }
        if (!find) {
            break;
        }
    }
    
    if (s.empty()) {
        std::cout << "YES" << std::endl;
    }
    else {
        std::cout << "NO" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M, M2, pop, total;
  cin >> N >> M;
  total = 0;
  bool ans = true;
  
  vector<int> A(N);
  for(int i = 0;i < N;i++){
  cin >> A.at(i);
  total = total + A.at(i);
  }
  M2 = 4 * M;
  
  sort(A.begin(), A.end());
  
  for(int i = 0;i < M;i++){
    if(A.at(N - i - 1) * M2 < total){
    ans = false;
    }
  }
  
  if(ans){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
  
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	ll A=in<ll>(),B=in<ll>();
	if(B%2LL){
		ll N=(B+1LL)/2LL;
		if(N%2LL) B=1;
		else B=0;
	}
	else{
		ll N=(B)/2LL;
		if(N%2LL) B^=1LL;
		else B^=0LL;
	}
	A = max(A-1LL,0LL);
	if(A%2LL){
		ll N=(A+1LL)/2LL;
		if(N%2LL) A=1;
		else A=0;
	}
	else{
		ll N=(A)/2LL;
		if(N%2LL) A^=1LL;
		else A^=0LL;
	}

	out(A^B);
	return 0;
}


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

using namespace std;

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

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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 (b<a) { a=b; return true; } return false; }

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

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

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

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

ll calc(ll b,ll n){
    if(n<b){
        return n;
    } else{
        return calc(b,n/b)+n%b;
    }
}

ll f(ll n){

}

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

    ll n,s;
    cin>>n>>s;
    ll ans = INF;
    ll sqn = sqrt(n)+1;
    if(s==n){
        out(n+1);
        return 0;
    }
    if(s>n){
        out(-1);
        return 0;
    }
    REP(i,2,sqn+1){
        if(calc(i,n)==s){
            out(i);
            return 0;
        }
    }
    REP(p,1,sqn+1){
        if( (n-s)%p != 0)continue;
        ll b = (n-s)/p + 1;
        ll q = s-p;
        if(b>q && q>=0){
            chmin(ans,b);
        }
    }
    if(ans==INF){
        out(-1);
        return 0;
    }
    out(ans);
    return  0;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)44e12;//ごめん
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	llint n,K,i,j,ans=0,sro=0;cin>>n>>K;
	static int bla[1002][1002]={0};
	static int waP[1002][1002]={0};//右上
	static int waL[1002][1002]={0};//左下
	for(i=0;i<n;i++){
		int x,y;cin>>x>>y;
		x%=(2*K);
		y%=(2*K);
		char c;cin>>c;
		if(x>=K){c=(int)'B'+'W'-c;x-=K;}
		if(y>=K){c=(int)'B'+'W'-c;y-=K;}
		x++;y++;
		if(c=='B'){bla[x][y]++;}
		else{bla[x][y]--;sro++;}
	}
	for(i=1;i<=K;i++){
		for(j=1;j<=K;j++){
			waL[i][j]=waL[i-1][j]+waL[i][j-1]-waL[i-1][j-1]+bla[i][j];
		}
	}
	for(i=K;i>0;i--){
		for(j=K;j>0;j--){
			waP[i][j]=waP[i+1][j]+waP[i][j+1]-waP[i+1][j+1]+bla[i][j];
		}
	}
	for(i=0;i<K;i++){
		for(j=0;j<K;j++){
			int gen=waL[i][j]+waP[i+1][j+1];
			maxeq(ans,gen+sro);
			maxeq(ans,n-gen-sro);
		}
	}
	cout<<ans<<endl;
	RE;
}

Measured memory_bytes: 12160
process.stdin.resume();
process.stdin.setEncoding('utf8');

var input_string = "";
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  input_string = line;
});
reader.on('close', () => {
  var x = input_string;
  console.log(x*x*x);
});


Measured memory_bytes: 20324
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi first
#define se second
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
int main(){
	fastio;
	ll n;
	cin>>n;
	ll i=1;
	for(ll j=0;j<n;j++){
		ll x;
		cin>>x;
		if(x==i){
			i++;
		}
	}
	if(i==1) cout<<"-1\n";
	else cout<<n-i+1<<"\n";
}

Measured memory_bytes: 256
mod = 10 ** 9 + 7 
def cmb(n, r, mod):
    r = min(r, n -r)
    if r == 0: return 1
    over, under = 1, 1
    for i in range(1, r+1):
        over = over * (n-i+1) % mod
        under = under * i % mod
    inv = pow(under, mod-2, mod)
    return over * inv % mod

n, a, b = map(int, input().split())


ans = pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod)
print(ans % mod)

Measured memory_bytes: 38512
#include<iostream>
#define MOD 1000000007LL
typedef long long ll;
using namespace std;
int count=0;
int a[100001];
int b[100001];
void BinarySerch(int key,int l,int r){
  if(r-l<=1){
    if(a[r]==key||a[l]==key){
      count++;
    }
    return;
  }
  if(a[(l+r)/2]>key){
    BinarySerch(key,l,(l+r)/2);
  }else if(a[(l+r)/2]<key){
    BinarySerch(key,(l+r)/2,r);
  }else{
    count++;
    return;
  }

}

int main(){
  int n;
  cin >>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int b;
    cin>>b;
    BinarySerch(b,0,n-1);
  }
  cout<< count <<endl;
  return 0;
}



Measured memory_bytes: 3448
#include<bits/stdc++.h>
#define rpt(n) for(register int ttxyc=0;ttxyc<n;++ttxyc)//宏定义
using namespace std;
int ans;long long x,y;
main()
{
    scanf("%lld%lld",&x,&y);
    for(;x<=y;x<<=1,++ans);
    printf("%d\n",ans);
}/**/

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=9223372036854775806;
const int inf=2147483646;
ll a,b,c,d,s1=0,s2=0;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>a>>b>>c>>d;
	a--;
	s1+=a/c+a/d-a/(c/__gcd(c,d)*d);
	s2+=b/c+b/d-b/(c/__gcd(c,d)*d);
	cout<<b-s2-a+s1;
	return 0;
}

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

int main(int argc, char const *argv[])
{
	string str, cmd, repStr;
	int q, from, to;
	cin >> str >> q;
	for (int i = 0; i < q; ++i)
	{
		cin >> cmd >> from >> to;
		if(cmd.compare("print") == 0)
			cout << str.substr(from, to - from + 1) << endl;
		else if(cmd.compare("reverse") == 0)
		{
			string revStr = "";
			for (int j = from; j <= to; ++j)
			{
				revStr.insert(0, str.substr(j, 1));
			}
			str.replace(from, to - from + 1, revStr);
		}
		else if(cmd.compare("replace") == 0)
		{
			cin >> repStr;
			str.replace(from, to - from + 1, repStr);
		}
	}
	return 0;
}

Measured memory_bytes: 3192
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n string
	fmt.Scan(&n)
	n = strings.Replace(n, "9", "q", -1)
	n = strings.Replace(n, "1", "9", -1)
	n = strings.Replace(n, "q", "1", -1)
	fmt.Println(n)
}


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

#define int long long

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

int N;
int mod = 1e9 + 7;
map<pair<int, int>, int> mem;

int func(int S, int X) {
    if (S == 0) {
        return 1;
    }
    if (mem.find(make_pair(S, X)) == mem.end()) {
        if (S != 1) {
            mem[make_pair(S, X)] = ((func(S / 2, X / 2) + func((S - 1) / 2, (X - 1) / 2) % mod) + func((S - 2) / 2, X / 2)) % mod;
        } else {
            mem[make_pair(S, X)] = (func(S / 2, X / 2) + func((S - 1) / 2, (X - 1) / 2) % mod);
        }
    }
    return mem[make_pair(S, X)];
}

signed main() {
    cin >> N;
    cout << func(N, N) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void dfs(int v,int p ,int d,vector<vector<int> > &GRAPH ,vector<int>& dist)
{
  dist[v] = d;
  for (auto &&i : GRAPH[v])
  {
    if(i == p)continue;
    dfs(i,v,d+1,GRAPH,dist);
  }
  
  return;
}

void solve(void)
{
  int n;
  cin>>n;
  vector<vector<int> > GRAPH (n);
  for (int i = 0; i < n-1; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    GRAPH[A].push_back(B);
    GRAPH[B].push_back(A);
  }
  vector<int> dist(n,0);
  int sv = -1;
  int m = -1;
  dfs(0,-1,0,GRAPH,dist);
  for (int i = 0; i < n; i++)
  {
    if(chmax(m,dist[i]))
    {
      sv = i;
    }
  }
  dfs(sv,-1,0,GRAPH,dist);
  m = -1;
  for (size_t i = 0; i < n; i++)
  {
    chmax(m,dist[i]);
  }
  // DEBUG(m);
  m--;
  if(m%3 != 0)
  {
    cout<<"First"<<endl;
  }
  else
  {
    cout<<"Second"<<endl;
  }
  
  
  
  return;
}

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

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

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

Measured memory_bytes: 256
a,b,k = map(int,input().split())
da = {int(i) for i in range(1,a+1) if a%i == 0}
# print('aの正の約数です',da)
db = {int(i) for i in range(1,b+1) if b%i == 0}
# print('bの正の約数です',da)
dab = da & db
# print('aとbの正の公約数です',dab)
dabl = list(dab) 
# print('リスト化しました',dabl)
dabl.sort()
# print('ソートしました',dabl)
print(dabl[-k])

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

#define int long long int


signed main(){

  string n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n.length();i++){
    ans+=n[i]-48;
  }
  if(ans%9){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin >>H>>W;
  vector<string> pic(H);
  for(int i=0;i<H;i++){
    cin>>pic.at(i);
  }
  for(int k=0;k<W+2;k++){
    cout<<"#";
  }
  cout << endl;
  for(int i=0;i<H;i++){
    cout << "#";
    cout << pic.at(i);
    cout << "#" << endl;
  }
  for(int k=0;k<W+2;k++){
    cout<<"#";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
n,k = map(int, input().split())
a = list(map(int, input().split()))


a.sort()

if k==0:
    print(max(a))
    exit()

def solve(num):
    ret=0
    for tmp in a:
        ret+= tmp//num
        if tmp%num==0:
            ret-=1
    return k>=ret

l=0
r=10**18
while r-l>1:
    mid=(l+r)//2

    if solve(mid):
        r=mid
    else:
        l=mid

print(min(max(a),r))
#print(min(min(a),r))

Measured memory_bytes: 93948
#include<iostream>
#include<algorithm>
#include<string>
#include<stdio.h>
using namespace std;
int main(){

	string X,Y;
	cin >> X >> Y;
	if(X>Y)
		puts(">");
	else if(X<Y)
		puts("<");
	else
		puts("=");
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<llint,llint>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}

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

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
int max(int a, int b) {
	if (a < b)return b;
	return a;
}
int min(int b, int a) {
	if (a > b)return b;
	return a;
}

int main() {
	int ans,a,b;
	cin >> a >> b;
	ans = a + (b / 2);
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a/gcd(a, b))*b;}

ll n, ans, t[100];
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    rep(i, 0, (int)n) cin >> t[i];
    ans = t[0];
    rep(i, 1, n) {
        ans = lcm(ans, t[i]);
    }
    printf("%lld\n", ans);
    return 0;
}


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

bool flg(int x, int y) {
	if (x&(1 << y))return true;
	else return false;
}

int main() {
	int n, m;
	while (cin >> n >> m, n, m) {
		int s[12][10010];
		for (int i = 0;i < n;i++) {
			for (int j = 0;j < m;j++)cin >> s[i][j];
		}

		int bit = 1 << n;
		int ans = 0;
		for (int i = 0;i < bit;i++) {
			int ka[10020] = {};
			for (int j = 0;j < n;j++) {
				if (flg(i, j)) {
					for (int k = 0;k < m;k++) {
						if (s[j][k] == 0)ka[k]++;
					}
				}
				else {
					for (int k = 0;k < m;k++) {
						if (s[j][k] == 1)ka[k]++;
					}
				}
			}
			int a = 0;
			for (int l = 0;l < m;l++) {
				a += max(ka[l], n - ka[l]);
			}
			ans = max(ans, a);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3528
import sys, math
while True:
    n = int(input())
    if n == 0:
        sys.exit()
    s = list(map(int, input().split()))
    m = sum(s) / n
    S = 0
    for i in range(n):
        S += (s[i] - m) ** 2
    S /= n
    a = math.sqrt(S)
    print(a)


Measured memory_bytes: 5696
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,a,b,c,i,j,k,m,mp,ans=-1;
  cin>>n>>a>>b>>c;
  vector<int> l(n);
  for(i=0;i<n;i++) cin>>l.at(i);
  for(i=0;i<(1<<(2*n));i++){
    j=i;
    vector<int> d(3);
    mp=0;
    for(k=0;k<n;k++){
      m=j%4;
      j/=4;
      if(m<3){
        if(d.at(m)>0) mp+=10;
        d.at(m)+=l.at(k);
      }
    }
    if(d.at(0)>0&&d.at(1)>0&&d.at(2)>0){
      mp+=abs(a-d.at(0))+abs(b-d.at(1))+abs(c-d.at(2));
      if(ans==-1||mp<ans) ans=mp;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
def read():
	return [int(i) for i in input().split(' ')]
N, T = read()
A = read()
t_min = A[0]
cost = 1
profit = 0

for p in A:
	if(p < t_min):
		t_min = p
	elif(p - t_min == profit):
		cost += 1
	elif(p - t_min > profit):
		cost = 1
		profit = p - t_min
print(cost)


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

int main(){
  int N; cin >> N;
  string s; cin >> s;
  
  if(N%2==1){
    cout << "No\n";
  }else{
    int w = N/2;
    string a = s.substr(0,w);
    string b = s.substr(w,w);
    cout << ((a==b) ? "Yes\n" : "No\n");
  }
  
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=5005,mod=1000000007;
int f[N][N],ff[N],F[N],sz[N];
vector<int>g[N];
void dfs(int x,int p)
{
	f[x][1]=1;sz[x]=1;
	for(int i=0;i<g[x].size();i++)if(g[x][i]!=p)
	{
		dfs(g[x][i],x);
		for(int j=1;j<=sz[x];j++)ff[j]=f[x][j],f[x][j]=0;
		for(int j=1;j<=sz[x];j++)for(int k=0;k<=sz[g[x][i]];k++)f[x][j+k]=(f[x][j+k]+1ll*ff[j]*f[g[x][i]][k])%mod;
		sz[x]+=sz[g[x][i]];
	}
	for(int i=1;i<=sz[x];i++)f[x][0]=(f[x][0]+mod-1ll*f[x][i]*F[i]%mod)%mod;
}
int main()
{
	int n;scanf("%d",&n);F[0]=1;
	for(int i=2;i<=n;i+=2)F[i]=1ll*F[i-2]*(i-1)%mod;
	for(int i=1,u,v;i<n;i++){scanf("%d%d",&u,&v);g[u].push_back(v);g[v].push_back(u);}
	dfs(1,0);
	printf("%d\n",mod-f[1][0]);
	return 0;
}

Measured memory_bytes: 97408
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function eval(a::Tuple{Int,Int},b::Tuple{Int,Int})
	if a[2]<b[2]
		1
	elseif a[2]==b[2]
		0
	else
		-1
	end
end

function hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})
	push!(h,x)
	if length(h) > 1
		l = length(h)
		k = l>>1
		while eval(x,h[k])==1&&k>=1
			tmp = h[k]
			h[k] = x
			h[l] = tmp
			k = max(k>>1,1)
			l = l>>1
		end
	end
end

function hpop(h::Array{Tuple{Int,Int},1})
	x = h[1]
	z = pop!(h)
	if !isempty(h)
		h[1] = z
		k = 1
		l = length(h)
		while k <= l
			if 2*k>l
				break
			elseif 2*k+1>l
				if eval(h[2*k],z)>=0
					break
				else
					tmp = h[2*k]
					h[2*k] = z
					h[k] = tmp
					k = 2*k
				end
			else
				if eval(z,h[2*k])>=0&&eval(z,h[2*k+1])>=0
					break
				else
					t = eval(h[2*k],h[2*k+1])>=0?2*k:2*k+1
					tmp = h[t]
					h[t] = z
					h[k] = tmp
					k = t
				end
			end
		end
	end
	x
end
function main()
	n,m,p = readline() |> split |> parseMap
	e = Tuple{Int,Int,Int}[(0,0,0) for i in 1:m]
	gin = [Int[] for i in 1:n]
	gout = [Int[] for i in 1:n]
	for i in 1:m
		a,b,c = readline() |> split |> parseMap
		push!(gin[a],b)
		push!(gout[b],a)
		e[i] = (a,b,c-p)
	end
	dish = -ones(Int,n)
	h = Array{Tuple{Int,Int},1}()
	push!(h,(1,0))
	while !isempty(h)
		v,w = hpop(h)
		dish[v] = dish[v]<0?w:min(dish[v],w)
		for i in 1:length(gin[v])
			if dish[gin[v][i]]<0 || dish[gin[v][i]]>w+1
				dish[gin[v][i]] = w+1
				hpush(h,(gin[v][i],w+1))
			end
		end
	end
	disb = -ones(Int,n)
	h = Array{Tuple{Int,Int},1}()
	push!(h,(n,0))
	while !isempty(h)
		v,w = hpop(h)
		disb[v] = disb[v]<0?w:min(disb[v],w)
		for i in 1:length(gout[v])
			if disb[gout[v][i]]<0　|| disb[gout[v][i]]>w+1
				disb[gout[v][i]] = w+1
				hpush(h,(gout[v][i],w+1))
			end
		end
	end
	d = -10^18*ones(Int,n)
	d[1] = 0
	for i in 1:n-1
		for j in 1:m
			u = e[j][1]
			v = e[j][2]
			w = e[j][3]
			d[v]=max(d[v],d[u]+w)
		end
	end
	f = 0
	for j in 1:m		
		u = e[j][1]
		v = e[j][2]
		w = e[j][3]
		if d[v]<d[u]+w&&(dish[v]>-1&&disb[v]>-1)
			f = 1
			d[v] = max(d[v],d[u]+w)
		end
	end
	println(f==0?max(d[n],0):-1)
end

main()

Measured memory_bytes: 125116
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	n%=10;
	if (n==3) puts("bon"); else
	if (n==0 || n==1 || n==6 || n==8) puts("pon"); else puts("hon");
	return 0;
}


Measured memory_bytes: 3720
/**
*    author:  boutarou
*    created: 14.06.2020 20:53:23
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define fcout cout << fixed << setprecision(15)
using lint = long long;
using P = pair<int, int>;

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

const double PI = 3.1415926535897932;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	rep(i, 5) {
		int a;
		cin >> a;
		if(a==0) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
#define MOD 1000000007
using namespace std;
typedef long long ll;



int main(void) {
	int n; cin >> n;
	n %= 10;
	if (n == 3) {
		cout << "bon" << endl;
	}
	else if(n==0||n==1||n==6||n==8){
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
	return 0;
}


Measured memory_bytes: 3636
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above------------------------------------------------


int main()
{
	boost
	ll l,r;
	cin>>l>>r;
	ll mini=inf;
	for(ll i=l;i<=min(r,l+4019);i++)
	{
		for(ll j=i+1;j<=min(r,l+4019);j++)
		{
			mini=min(mini,(i*j)%2019);
		}
	}
	cout<<mini<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MIN(a,b) (a<b?a:b)
int cmp(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
 
int main()
{
    int n, k, i, h[100000];
    int min=1000000000;
    scanf("%d %d",&n, &k);
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    qsort(h,n,sizeof(int),cmp);
    for(i=0;i<=n-k;i++) {
        min = MIN(min, h[i+k-1]-h[i]);
    
    }
    printf("%d",min);
    return 0;
}

Measured memory_bytes: 892
a,b,w,n,i,t[31];
main(){
    for(i=1;i<=30;i++){
        t[i]=i;
    }
    scanf("%d%d",&w,&n);
    for(i=0;i<n;i++){
        scanf("%d,%d",&a,&b);
        t[a]^=t[b]^=t[a]^=t[b];
    }
    for(i=1;i<=w;i++){
        printf("%d\n",t[i]);
    }
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 1e5+23;
int a[N];

void solve() {
  int n; scanf("%d", &n);
  long long ans = 0, sum = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a+i);
    sum += a[i];
    if (a[i]) continue;
    ans += sum/2;
    sum = 0;
  }
  printf("%lld", ans+sum/2);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 4168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
const ll INF = 1e16;

void solver(int N, int K, map<int, int> const &A_dict, int &ans){

    int cnt{};
    vector<int> ball_num;
    for(auto p: A_dict){
        auto value = p.second;
        ++cnt;
        ball_num.push_back(value);
    }

    sort(ball_num.begin(), ball_num.end());

    int dif = cnt - K;
    if(dif <= 0) ans = 0;
    else{
        for(int i = 0; i != dif; ++i){
            ans += ball_num.at(i);
        }
    }

    return;
}

int main(){

    int N, K;
    cin >> N >> K;
    map<int, int> A_dict;
    for(int i = 0; i != N; ++i){
        int buf;
        cin >> buf;
        ++A_dict[buf];
    }

    int ans{};
    solver(N, K, A_dict, ans);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13548
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    ll a[n+1]={0};
    ll b[n]={0};
    rep(i,n){ll tmp;cin>>tmp;a[tmp]++;b[i]=tmp;}
    ll sum = 0;
    rep(i,n+1){
        sum+=a[i]*(a[i]-1)/2;
    }
    rep(i,n){
        ll ans = sum - a[b[i]] + 1;
        co(ans);
    }
}

Measured memory_bytes: 5760
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

struct state {
    string worm;
    int count;

    state(string a, int b): worm(a), count(b) {}
};

char change_to(char a, char b) {
    if (a > b) swap(a, b);
    if (a == 'b' && b == 'g') return 'r';
    if (a == 'b' && b == 'r') return 'g';
    return 'b';
}

int main() {
    string S;
    while (true) {
        cin >> S;
        if (S == "0") break;
        
        set<string> visited;
        queue<state> que;

        int ans = -1;

        que.emplace(S, 0);
        while (!que.empty()) {
            state st = que.front(); que.pop();

            if (visited.find(st.worm) != end(visited))
                continue;
            visited.insert(st.worm);

            string worm = st.worm;

            bool ok = true;
            for (int j = 1; j < worm.size(); ++j) {
                if (worm[j] != worm[0]) {
                    ok = false; break;
                }
            }
            
            if (ok) {
                ans = st.count;
                break;
            }

            visited.insert(worm);
            for (int j = 0; j < worm.size()-1; ++j) {
                if (worm[j] != worm[j+1]) {
                    char c1 = worm[j], c2 = worm[j+1];
                    worm[j] = worm[j+1] = change_to(worm[j], worm[j+1]);
                    que.emplace(worm, st.count+1);
                    worm[j] = c1, worm[j+1] = c2;
                }
            }
        }

        if (ans == -1) {
            cout << "NA" << endl;
        } else {
            cout << ans << endl;
        }
    }
    return 0;
}

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

int main(){
  int s;
  cin >> s;
  int N = 9999999;
  vector<int> a(N);
  a[0] = s;
  for(int i = 1; i < N; i++){
    if(a[i-1] % 2 == 0){
      a[i] = a[i-1] / 2;
    }
    else{
      a[i] = 3 * a[i-1] +1;
    }
  }

  for(int i = 0; i < N; i++){
    for(int j = i+1; j < N; j++){
      if(a[i] == a[j]){
        cout << j+1 << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 39296
def isOK(score):
    min_cost = sum_a - sum([min(A,score // F) for A,F in zip(a,f)])
    if min_cost <= k:
        return True
    else:
        return False


def binary_search():
    ok = 10 ** 12 + 100
    ng = -1
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if isOK(mid):
            ok = mid
        else:
            ng = mid
    return ok



n,k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse = True)
f = sorted(list(map(int, input().split())))

sum_a = sum(a)
ans = binary_search()
print(ans)

Measured memory_bytes: 137464
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define ft first
#define sc second
#define ppb pop_back
#define sz size
#define forn(i,a,n) for(i=a;i<n;i++)
#define M 1000000007
#define inf 2e18


int main() {


ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
    
      
 ll a,b;
 cin>>a>>b;
 ll ans = (a*b)/__gcd(a,b);
 cout<<ans;
 
return 0;
}

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

using namespace std;

#define int long long

const int INF = 1e17;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;
    vector <int> a(n);
    int mini = INF;
    for (int& it : a) {
    	cin >> it;
    	mini = min(mini, it);
    }
    vector <int> pref(n + 1, 0);
    for (int i = 0; i < a.size(); ++i) {
    	pref[i + 1] = pref[i];
    	if (a[i] == mini) {
    		++pref[i + 1];
    	}
    }
    int ans = 0;
    for (int i = 0; i < a.size(); i += k - 1) {
    	int r = min(i + k - 1, n - 1);
    	if (i == r) {
    		break;
    	}
    	if (pref[r + 1] - pref[i] < (r - i + 1)) {
    		++ans;
    	}
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((ll)1e9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)
#define y1 asdasdas

ll s;
ll x1=0,y1=0;
ll x2,x3,y2,y3;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	
	cin >> s;

	if(s == (ll)(1e18))
	{
		cout << 0 _ 0 _ 0 _ INF _ INF _ 0 << endl;
		return 0;
	}


	ll sq = sqrt(s) + 1;

	sq = min(sq,INF);

	x2 = sq;
	y2 = 1LL;

	x3 = (sq - (s%sq));
	y3 = (s+x3) / sq;



	assert(x1 <= INF);
	assert(x2 <= INF);
	assert(x3 <= INF);
	assert(y1 <= INF);
	assert(y2 <= INF);
	assert(y3 <= INF);

	cout << x1 _ y1 _ x2 _ y2 _ x3 _ y3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
static const int MAX_N = 1e5;
static const int MOD = 1000000007;
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	if (k == 1)
	{
		cout << 0 << endl;
		return 0;
	}
	else
	{
		cout << n - k << endl;
		return 0;
	}
}


Measured memory_bytes: 256
N = int(input())
X=[]
s = 0
for _ in range(N):
    x = int(input())
    s += x
    if x %10 != 0:
        X.append(x)
if s%10!=0:
    print(s)
elif len(X):
    print(s-sorted(X)[0])
else:
    print(0)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
  cin>>n;
  if(n%10==2 || n%10==4 ||n%10==5 ||n%10==7 ||n%10==9) cout<<"hon"<<endl;
  else if(n%10==0 || n%10==1 ||n%10==6 ||n%10==8 ) cout<<"pon"<<endl;
  else cout<<"bon"<<endl;
  return 0;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    int n,x,t;
    cin >> n >> x >> t;
    int times = (n + (x-1) ) / x ;
    cout << t * times << endl;

    return 0;
}

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

int main() {
	int n; cin >> n;
	int p[100010];
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}int count = 0;
	for (int i = 0; i < n - 1; i++) {
		if (p[i] == i + 1) {
			swap(p[i], p[i + 1]);
			count++;
		}
	}
	if (p[n - 1] == n) {
		count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<queue>
#include<utility>
using namespace std;
int main() {
  int N,M;
  cin >> N >> M;
  vector<vector<int>> E(N);
  int i,j,a,b;
  for(i=0;i<M;i++) {
    cin >> a >> b;
    E[a-1].push_back(b-1);
    E[b-1].push_back(a-1);
  }
  vector<int> d(N,2000000000);
  d[0] = 0;
  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q;
  q.push(pair<int,int>(d[0],0));
  while(!q.empty()) {
    pair<int,int> p = q.top();
    q.pop();
    if(p.first > d[p.second])continue;
    for(i=0;i<E[p.second].size();i++) {
      if(d[p.second]+1 < d[E[p.second][i]]) {
        d[E[p.second][i]] = d[p.second] + 1;
        q.push(pair<int,int>(d[E[p.second][i]],E[p.second][i]));
      }
    }
  }
  cout << "Yes" << endl;
  for(i=1;i<N;i++) {
    for(j=0;j<E[i].size();j++) {
      if(d[E[i][j]] == d[i]-1) {
        cout << E[i][j]+1 << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 10840
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int A[200010],B[200010],num[200010];
int N,M,W,C,D,E,G,K;
int ans,ans2,sum,sum2,cnt,cnt2,Max=0,Min=INF;
string S,T;
vector<int> V;
set<int> U;
map<int,int> H;
bool F,Q[200010];

signed main(){
	cin>>N>>K;
	REP(i,N){
		cin>>A[i];
	}
	sort(A,A+N);
	REP(i,N-K+1){
		int t=abs(A[i]-A[i+K-1]);
		DEB(A[i])DEB(A[i+K-1])END
		if(t<Min){
			Min=t;
		}
	}
	cout<<Min<<endl;
	return 0;
}


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



class UnionFind
{
public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL)
    {
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_)
    {
        siz.assign(sz_, 1LL); // assign: 再代入
        par.resize(sz_);      // resize: 再確保
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x)
    { // 根の検索
        while (par[x] != x)
        {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y])
            swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y)
    { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x)
    { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main()
{
    // input
    ll N, M;
    ll node1, node2;
    cin >> N >> M;
    vector<pair<ll,ll>> A(M);
    for (ll i = 0; i < M; i++)
    {
        cin >> node1 >> node2;
        --node1, --node2;
        A[i].first = node1;
        A[i].second = node2;
    }

    // calculation
    vector<ll> ans(M);
    ans[M - 1] = (N * (N - 1)) / 2; // 全ての頂点が孤立している状態

    UnionFind uf(N);
    for (ll i = M - 1; i >= 1; --i)
    {
        node1 = A[i].first, node2 = A[i].second;
        if (uf.issame(node1, node2))
        {
            ans[i - 1] = ans[i];
        }
        else
        {
            // 根が異なるとき，それぞれのサイズの積（頂点の組み合わせ）を引く．
            ans[i - 1] = ans[i] - (uf.size(node1) * uf.size(node2));
            uf.merge(node1, node2);
        }
    }

    REP(i, M)
    {
        cout << ans[i] << "\n";
    }

    return 0;
}


Measured memory_bytes: 5248
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int [] [] a = new int[n][m];
        int [] b = new int [m];
        for (int x = 0; x < n; x++){
            for (int y = 0; y < m; y++){
                a[x] [y] = scan.nextInt();
            }
        }
        for (int y = 0; y < m; y++){
            b[y] = scan.nextInt();
        }
        for(int x = 0; x < n; x++){
            int answer = 0;
            for(int y = 0; y < m; y++) {
                answer = answer + (a[x] [y] * b[y]);
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 40588
# coding: utf-8
# Your code here!

S = int(input())
mae = S//100
ato = S%100

if 1<= mae <= 12:
    if 1 <= ato <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= ato <= 12:
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 2940
import java.util.ArrayList;
import java.util.*;
import java.lang.Math;
 class Main{
     public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
      // List<Integer> l=new ArrayList<>();
      // set<Integer> s=new LinkedSet();
      // int n=sc.nextInt();
      // int flag=0;
      // for(int i=0;i<n;i++){
      //       int j=sc.nextInt();      
      //       l.add(j);      
      // }
      // s.addAll(l);
      // if(l.size()==s.size()){
      //             System.out.println("No");
      //             System.exit(0);
      //       }else{
      //             System.out.println("Yes");
      //             System.exit(0);
      //       }     
      
            int total=sc.nextInt();
            int act=sc.nextInt();
            int count=0;
            if(total==1){
                  System.out.println(total);
                  System.exit(0);
            }else if(act==1){
                  System.out.println(total);
                  System.exit(0);
            }else{
                  while(total>0){
                        total-=act;
                        count++;
                  }
            }     
            System.out.print(count);
      }
}  

Measured memory_bytes: 35812
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7


class UnionFind(val N: Int) {
    private var dt = arrayOf<Int>()
    init {
        this.dt = Array<Int>(N+1){-1}
    }
    tailrec fun root(key: Int): Int {
        if (this.dt[key] < 0) {
            return key
        } else {
            this.dt[key] = this.root(this.dt[key])
            return this.dt[key]
        }
    }
    fun unite(KX: Int, KY: Int): Boolean {
        var kx = this.root(KX); var ky = this.root(KY)
        if (kx == ky) {
            return false
        }
        if (this.size(kx) < this.size(ky)) {
            val tmp = kx
            kx = ky
            ky = tmp
        }
        this.dt[kx] += this.dt[ky]
        this.dt[ky] = kx
        return true;
    }
    fun size(key: Int): Int {
        val rk = this.root(key)
        return -this.dt[rk]
    }
    fun isConnect(kx: Int, ky: Int): Boolean {
        return this.root(kx) == this.root(ky)
    }
}


fun solveD(N: Int, M: Int, AB: Array<Pair<Int,Int>>): Array<Long> {
    val uf = UnionFind(N)
    val ans = Array<Long>(M+1){0L}
    ans[M] = N.toLong()*(N-1)/2

    for(i in M-1 downTo 0) {
        val pr = AB[i]
        if (uf.isConnect(pr.first, pr.second)) {
            ans[i] = ans[i+1]
        } else {
            ans[i] = max(0L, ans[i + 1] - uf.size(pr.first).toLong() * uf.size(pr.second))
            uf.unite(pr.first, pr.second)
        }
    }

    return ans
}


fun main(args: Array<String>) {
    val (N, M) = readListInt()
    val AB = Array(M){Pair(0,0)}
    for(i in 0 until M) {
        val (A,B) = readListInt().map { it -1 }
        AB[i] = Pair(A,B)
    }

    val ans = solveD(N, M, AB)

    for (i in 1..M) {
        println(ans[i])
    }
}


Measured memory_bytes: 84856