akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
#ARC98 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
l,r,tmp,ans = 0,0,0,0
while l < n and r < n:
    while tmp & a[r] == 0:
        tmp += a[r]
        r += 1
        ans += r - l
        if r == n:
            break
    if l == r:
        tmp += a[r]
        r += 1
    tmp -= a[l]
    l += 1
print(ans)


Measured memory_bytes: 71244
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if(abs(x-a) > abs(x-b)){
    print("B");
  } else print("A");
}


Measured memory_bytes: 888
N = int(input())
moti_list = []
count = 1
for i in range(N):
    moti_list.append(int(input()))

moti_list.sort(reverse=True)

for i in range(1,N,1):
    if moti_list[i-1] == moti_list[i]:continue 
    count += 1

print(count)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod =1e+9+7;

int main(){
    ll x; cin>>x;
    if(x>=400&&x<=599)cout<<8<<endl;
    if(x>=600&&x<=799)cout<<7<<endl;
    if(x>=800&&x<=999)cout<<6<<endl;
    if(x>=1000&&x<=1199)cout<<5<<endl;
    if(x>=1200&&x<=1399)cout<<4<<endl;
    if(x>=1400&&x<=1599)cout<<3<<endl;
    if(x>=1600&&x<=1799)cout<<2<<endl;
    if(x>=1800&&x<=1999)cout<<1<<endl;
}


























































































Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  vector<int> ans(n,0);
  rep(i,n-1){
    int d = in();
    ++ans[d-1];
  }
  foreach(i,ans)cout<<i<<endl;
  return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    map<string, ll> M;
    REP(i, N){
        string s;
        cin >> s;
        M[s]++;
    }
    cout << "AC x " << M["AC"] << endl;
    cout << "WA x " << M["WA"] << endl;
    cout << "TLE x " << M["TLE"] << endl;
    cout << "RE x " << M["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3628
# -*- coding: utf-8 -*-

N=int(input())
s_title=[]
time=[]
for i in range(N):
    s,t=input().split()
    s_title.append(s)
    time.append(int(t))
    #print(s,t)
#print(s_title)
#print(time)
X=input()
#print(X)

sleep=0
for j in range(len(s_title)):
  if X == s_title[j]:
    sleep = j
    #print(sleep)
    break

sum = 0
for k in range(sleep+1, N):
  sum = sum + time[k]

print(sum)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;
string s,sl,sr;
int main()  {
    ios::sync_with_stdio(0);
    ll n;
    cin>>n;
    ll l =0 ,r = n-1;
    cout<<l<<"\n";
    cout.flush();
    cin>>s;
    sl = s;
    if(s[0] == 'V'){
        return 0;
    }
    cout<<r<<"\n";
    cout.flush();
    cin>>s;
    sr = s;
    if(s[0] == 'V'){
        return 0;
    }
    while(l <= r){
        ll m = (l+r)/2;
        cout<<m<<"\n";
        cout.flush();
        cin>>s;
        if(s[0] == 'V'){
            return 0;
        }
        int r1 = m-l;
        if(sl != s){
            r1++;
        }
        r1 %= 2;
        if(r1 != 0){
            r = m;
            sr = s;
            continue;
        }
        l = m;
        sl = s;
    }
    return 0;
}


Measured memory_bytes: 852
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ans = MutableList(n + 1) { 0 }
    for (x in 1L..100L) {
        for (y in 1L..100L) {
            for (z in 1L..100L) {
                val p = x * x + y * y + z * z + x * y + y * z + z * x
                if (p <= n) {
                    ans[p.toInt()]++
                }
            }
        }
    }
    for (i in 0 until n) {
        println(ans[i + 1])
    }
}

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

using namespace std;

#define ll long long


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

    int a, b;
    cin >> a >> b;

    int ans = a / b;

    cout << (a > ans * b ? ans + 1 : ans);

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C;
    cin >> A >> B >> C;
    ll ans = min(C, B / A);
    cout << ans << endl;
}


Measured memory_bytes: 256
def factorization(n):
    factorization_list = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp //= i
            factorization_list.append([i, count])

    if temp != 1:
        factorization_list.append([temp, 1])

    if factorization_list==[]:
        factorization_list.append([n, 1])

    return factorization_list


if __name__ == "__main__":
    N = int(input())

    if N == 1:
        print(0)

    else:
        factorization_list = factorization(N)
        count = 0
        for factor in factorization_list:
            e = factor[1]
            i = 1
            while True:
                e -= i
                i += 1
                count += 1
                if e < i:
                    break
        print(count)

Measured memory_bytes: 9468
n = int(input())

def solve(n):
    if n <= 26:
        return chr(64 + n)
    elif n % 26 == 0:
        return solve(n // 26 - 1) + chr(90)
    else:
        return solve(n // 26) + chr(64 + n % 26)

print(solve(n).lower())

Measured memory_bytes: 9164
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll N;
    cin >> N;
    ll out = 0;
    ll sum = (N+1)*N/2;
    ll fizz = ((N/3)*3+3)*(N/3)/2;
    ll buzz = ((N/5)*5+5)*(N/5)/2;
    ll fizzbuzz = ((N/15)*15+15)*(N/15)/2;
    out = sum - fizz - buzz + fizzbuzz;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3632
A = int(input())
B = int(input())
C = int(input())
X = int(input())

res = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      y = 500*a + 100*b + 50*c
      if X == y:
        res += 1

print(res)


Measured memory_bytes: 3060
#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<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

string S;

signed main(){
	cin>>S;
	if(S=="AAA"||S=="BBB"){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, d;
    cin >> n >> d;
    cout << (n + (d * 2 + 1) - 1) / (d * 2 + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
using namespace std; 
typedef long long ll;
typedef unsigned long long int ull;
// PB-DS 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define ff first
#define ss second
#define pb push_back
#define Inf  1000000000000000000
#define inf -1000000000000000000
#define mod 1000000007

ll mulmod(ll x,ll y){
  return (x%mod*y%mod)%mod;
}
 
ll addmod(ll x,ll y){
  return (x%mod+y%mod)%mod;
}
 
long long  power(long long  x,long long  y) { 
    long long  res = 1;      
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x;  
        y = y>>1;  
        x = x*x;  
    } 
    return res; 
}

void testcases(int Case){
  int X,N;
  cin >> X >> N;
  set<int>S;
  int maxx = 0;
  for(int i = 1; i <= N;i ++){
    int c;
    cin >> c;
    maxx = max(maxx,c);
    S.insert(c);
  }
  int ans ;
  int minn = INT_MAX;
  
  for(int i = 0;i <= 101 ;i++){
    if(S.find(i)==S.end()){
    int dist = abs(X-i);
    if(dist<minn){
      minn = dist;
      ans = i; 
      }
    }
  }
  cout << ans << "\n";
}

  
int main()
{
 // sieve();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
    ll t;
    t = 1;
    //cin >> t;
    ll Case =1 ;
    while(t--)
    {
      testcases(Case++);
    }
}

Measured memory_bytes: 3648
# -*- coding: utf-8 -*-

# input
A = int(input())
B = int(input())
C = int(input())
X = int(input())

# solve
ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1

# output
print(ans)


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int a[200005];

int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	int sol = 0;
	for (int i=0 ; i<n ; i++) {
		scanf("%d", a+i);
		sol = max(sol, a[i]);
	}
	int jump = 1;
	while (jump<=sol) jump*=2;
	for ( ; jump ; jump/=2) {
		int nsol = sol-jump;
		if (nsol < 1) continue;
		int cnt = 0;
		for (int i=0 ; i<n ; i++) {
			cnt += (a[i]+nsol-1)/nsol-1;
			if (cnt > k) break;
		}
		if (cnt <= k) sol = nsol;
	}
	printf("%d\n", sol);
	return 0;
}

Measured memory_bytes: 4448
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}





int main(){
  int N;
  double T,A;
  cin>>N;
  cin>>T>>A;
  double H[N];
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  double temp[N];
  for(int i=0;i<N;i++){
    temp[i]=T-H[i]*0.006;
  }
  double tateru=0;
  double min=10000000;
  for(int i=0;i<N;i++){
    if(abs(temp[i]-A)<min){
      min=abs(temp[i]-A);
      tateru=i;
    }
  }
  cout<<tateru+1<<endl;



  



}


  
  

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1001001001;

template<class Type>
Type mod_pow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

void func(ll a, ll n, ll& x, ll& y)
{
	for (ll i = 0; i < a; i++) {
		//x *= (n - i) % mod;    // *=ではオーバーフロー
		//y *= (i + 1) % mod;    // *=ではオーバーフロー
		x = x * (n - i) % mod;
		y = y * (i + 1) % mod;
	}
	x %= mod;  // 二項係数の分子
	y %= mod;  // 二項係数の分母
	y = mod_pow(y, mod - 2, mod);  // 逆元
}

ll nCk(ll n, ll k)
{
	ll res = n;
	for (int i = 2; i <= k; i++) {
		res = res * (n - i + 1) / i;
		res %= mod;
	}
	return res;
}

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

	ll sum = mod_pow(2LL, n, mod) - 1;  // 二項係数の総和-1

	ll ax = 1;
	ll ay = 1;
	func(a, n, ax, ay);
	ll nCa = ax * ay % mod;  // 二項係数nCa

	ll bx = 1;
	ll by = 1;
	func(b, n, bx, by);
	ll nCb = bx * by % mod;  // 二項係数nCb

	/*ll nCa = nCk(n, a);
	ll nCb = nCk(n, b);*/

	sum = (sum - nCa + mod) % mod;
	sum = (sum - nCb + mod) % mod;
	cout << sum << endl;
}

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

void insertionSort(int *, int);

int main(){
  int N, *data,i;
  scanf("%d",&N);
  
  data=(int *)malloc(N*sizeof(data));
  
  for(i=0;i<N;i++){
    scanf("%d",&data[i]);
  }
  
  insertionSort(data,N);
  free(data);
  return 0;
}
void insertionSort(int *data, int N){
  int key,i,j;
  for(i=0;i<N;i++){
    printf("%d",data[i]);
    if(i!=N-1){
      printf(" ");
    }
  }
  printf("\n");
  
  for(j=1;j<N;j++){
    key=data[j];
    i=j-1;
    while(i>=0&&data[i]>key){
      data[i+1]=data[i];
      i=i-1;
      data[i+1]=key;
    }
    for(i=0;i<N;i++){
      printf("%d",data[i]);
      if(i!=N-1){
	printf(" ");
      }
    }
    printf("\n");
  }
}




Measured memory_bytes: 2064
def main():
  n, m = map(int, input().split())
  buf = [None] * m
  cnt = {k: [] for k in range(n + 1)}
  for i in range(m):
      p, y = map(int, input().split())
      cnt[p] += [(y, i)]
  for p, l in cnt.items():
      if not l:
          continue
      l.sort()
      for j, (y, i) in enumerate(l):
          buf[i] = '{:06d}{:06d}'.format(p, j + 1)

  print('\n'.join(buf))

if __name__ == '__main__':
  main()


Measured memory_bytes: 46872
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){

  string S; cin >> S;
  vector<int> keep(4,0);
  for(int i = 0 ; i < 4 ; i++){
    for(int j = 0 ; j < 4 ; j++){
      if(S[i] == S[j])  keep[i]++;
    }
  }

  if(keep[0] == 2 && keep[1] == 2 && keep[2] == 2 && keep[3] == 2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
    
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define mod 1000000007
ll solve(ll h) {
    if (h == 1) {
        return 1;
    }
    else {
        return 2 * solve(h / 2) + 1;
    }
}
int main() {
    ll h;
    cin >> h;
    cout << solve(h);
    return 0;
}

Measured memory_bytes: 3544
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')
from collections import deque


def solve():
    k = II()
    q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

    if k <= 9:
        print(q[k-1])
        return

    cnt = len(q)
    while 1:
    # for _ in range(1000000):
        a = q.popleft()
        # print(a)
        one = int(str(a)[-1])
        for i in range(one-1, one+2):
            # print(' ', i)
            if i < 0 or i > 9:
                continue
            num = int(str(a) + str(i))
            cnt += 1
            # print('  ', num, cnt)
            if cnt == k:
                print(num)
                return

            q.append(num)
        # print(q)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 5940
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
using namespace std;

vector<vector<int>> adj = {
    {1, 4},
    {0, 2, 5},
    {1, 3, 6},
    {2, 7},
    {0, 5},
    {1, 4, 6},
    {2, 5, 7},
    {3, 6}
};
map<vector<int>, int> d;

void solve() {
    vector<int> init = {0, 1, 2, 3, 4, 5, 6, 7};
    d[init] = 0;
    queue<vector<int>> q;
    q.push(init);
    while ( ! q.empty()) {
        vector<int> v = q.front();
        q.pop();
        int step = d[v];
        for (int i=0; i<8; ++i) {
            if (v[i] == 0) {
                for (int j=0; j<(int)adj[i].size(); ++j) {
                    swap(v[i], v[adj[i][j]]);
                    if (d.find(v) == d.end()) {
                        q.push(v);
                        d[v] = step + 1;
                    }
                    swap(v[i], v[adj[i][j]]);
                }
                break;
            }
        }
    }
}

int main() {
    solve();
    vector<int> v(8);
    while (1) {
        for (int i=0; i<8; ++i) {
            if (cin >> v[i]) { } else { return 0; }
        }
        cout << d[v] << endl;
    }
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;
int main(){
    int n;cin>>n;vector<ll>a(n),b(n);
    rep(i,n)cin>>a[i];rep(i,n)cin>>b[i];
    vector<ll>v;
    ll sum=0;
    ll ans=0;
    rep(i,n){
        if(b[i]>a[i]){ans++;sum+=b[i]-a[i];}
        else v.push_back(a[i]-b[i]);
    }
    sort(all(v),greater<ll>());
    ll com=0;
    ll count=0;
    rep(i,v.size()){
        if(sum<=com){break;}
        com+=v[i];
        count++;
    }
    if(sum>com)cout<<-1;
    else cout<<count+ans;
}

Measured memory_bytes: 2936
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
  
    void solve() throws IOException {
        int n=ni();
        int k=ni();
        int[]A=new int[n];
        for (int i=0;i<n;i++) A[i]=ni();
        
        int left=0;
        int right=1000000000;
        
        while (right-left>1) {
            int av=(right+left)/2;
            int ta=0;
            for (int i=0;i<n;i++) {
                //if (A[i]<=av) continue;
                ta=ta+(A[i]-1)/av;
            }
            if (ta>k) left=av;
            else right=av;
        }
        System.out.println(right);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}

Measured memory_bytes: 55564
#
import sys
n = int(input())
#素因数分解
def factorization(n):
    arr = []
    tmp = n
    #2から√n でnを割る ･･･割れた回数を指数として追加
    for i in range(2, int(n ** 0.5 // 1) + 1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            arr.append([i, cnt])
    if tmp != 1:  #割り切れなかったとき
        arr.append([tmp, 1])
    if arr == []: #素数の場合(割れなかった場合)
        arr.append([n, 1])
    return arr

p = factorization(n)
count = 0
#すべての素因数で分解する
for x in p:
    #割れなくなったら抜ける
    if n == 1:
        break
    #x[i][0]の１からp[i][1]乗で割る
    for j in range(1, x[1] + 1):
        if n % (x[0]**j) == 0:
            n /= x[0]**j
            count += 1
        else:#割れなくなったら抜ける
            break
print(count)

Measured memory_bytes: 9480
#include <stdio.h>
int main()
{
    int n, max;
    int h[20];
    int sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &h[i]);
    }
    for (int i = 0; i < n; i++)
    {
        max = 0;
        for (int j = 0; j <= i; j++)
        {
            if (max <= h[j])
                max = h[j];
        }
        if (max == h[i])
            sum++;
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,l,i;
    cin >> n >> l;
    string s[102];
    for(i=0; i < n; ++i) cin >> s[i];
    sort(s, s+n);
    for(i=0; i < n; ++i) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

int N;
int ar[101];

int main() {
  std::cin>>N;
  for (int i = 0; i < N; ++i)
    std::cin>>ar[i];
  ar[N] = -1;

  int cnt = 0;
  for (int i = 1; i < N; ++i) {
    if (ar[i] == ar[i-1]) {
      cnt++;
      ar[i] = -1;
    }
  }
  std::cout<<cnt<<"\n";

  return 0;
}


Measured memory_bytes: 256
object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val points = Array.fill(n){
    val Array(x, y) = readLine.trim.split(' ').map(_.toDouble)
    Point(x, y)
  }
  var minTurn = Double.MaxValue
  for (shops ← points.permutations) {
    minTurn = math.min(minTurn, shops.foldLeft((Point(-1, 0), Point(0, 0), 0d)){
      case ((prev, current, sum), next) ⇒ (current, next, math.acos((current - prev).angleFrom(next - current).cos) * 180 / math.Pi + sum)
    } match {case (prev, current, sum) ⇒ math.acos((current - prev).angleFrom((Point(0, 0) - current)).cos) * 180 / math.Pi + sum})
  }
  println(f"$minTurn%.10f")
}
case class Point(x: Double, y: Double) {
  def -(that: Point): Vector = Vector(x - that.x, y - that.y)
}
case class Vector(x: Double, y: Double) {
  def length: Double = math.sqrt(x * x + y * y)
  def dot(that: Vector): Double = x * that.x + y * that.y
  def cross(that: Vector): Double = x * that.y - y * that.x
  def angleFrom(that: Vector): Angle = length * that.length match {case len ⇒ Angle(cross(that) / len, dot(that) / len)}
}
case class Angle(sin: Double, cos: Double)


Measured memory_bytes: 88808
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

string S;
int dp[100010][2];

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

  cin >> S;
  dp[0][0] = 1;
  REP(i,S.size()) {
    (dp[i+1][1] += dp[i][1] * 3 % MOD) %= MOD;
    if (S[i] == '0') {
      (dp[i+1][0] += dp[i][0]) %= MOD;
    } else {
      (dp[i+1][0] += dp[i][0] * 2 % MOD) %= MOD;
      (dp[i+1][1] += dp[i][0]) %= MOD;
    }
  }
  cout << (dp[S.size()][0] + dp[S.size()][1]) % MOD << endl;

  return 0;
}

Measured memory_bytes: 2000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {

			String str = br.readLine();

			StringBuilder sb = new StringBuilder();
			for(char c : str.toCharArray()){
				if(Character.isUpperCase(c)){
					sb.append(Character.toLowerCase(c));
				}else if(Character.isLowerCase(c)){
					sb.append(Character.toUpperCase(c));
				}else{
					sb.append(c);
				}
			}
			System.out.println(sb.toString());

		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (br != null) {
					br.close();
				}
			} catch (IOException ioe) {
			}

		}
	}
}

Measured memory_bytes: 16884
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define It set<node>::iterator
#define endl '\n'
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int n,cnt;
map<int,bool> ext;

inline bool check(int x,int a){
	if(a==1) return false;
	if(x==n){
		while(x%a==0) x/=a;
		if(x%a==1) return true;
		return false;
	}else{
		return true;
	}
}

inline void divide(int x){
	for(int i=1;i*i<=x;++i){
		if(x%i==0){
			if(!ext[i]&&check(x,i)) ext[i]=true,++cnt;
			if(i!=x/i) if(!ext[x/i]&&check(x,x/i)) ext[x/i]=true,++cnt;
		}
	}
}

signed main(){
	cin>>n;
	divide(n);
//	for(map<int,bool>::iterator it=ext.begin();it!=ext.end();++it) if(it->second) cout<<it->first<<" ";
//	cout<<endl;
	divide(n-1);
//	for(map<int,bool>::iterator it=ext.begin();it!=ext.end();++it) if(it->second) cout<<it->first<<" ";
//	cout<<endl;
	cout<<cnt<<endl;
	return 0;
}

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

int main(){
    long long A, B, C;
    cin >> A >> B >> C;
    long long ans = 0;
    long long minv = min(B, C);
    ans += minv * 2;
    B -= minv;
    C -= minv;

    if(B == 0){
        minv = min(A, C);
        ans += minv;
        A -= minv;
        C -= minv;
    }else{
        ans += B;
    }
    if(C > 0){
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 768
n = int(input())
p_arr = list(map(int, input().split()))
min_i = 9999999999999999999999999
res = 0
for i in p_arr:
  if i == 1:
    res += 1
    break
  else:
    if i < min_i:
      res += 1
      min_i = i
print(res)

Measured memory_bytes: 75344
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] task = new int[n][2];
		for (int i = 0; i < n; i++) {
			task[i][1] = sc.nextInt();
			task[i][0] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(task, (a, b) -> Integer.compare(a[0], b[0]));
		long now = 0;
		boolean ans = true;
		for (int i = 0; i < n; i++) {
			now += task[i][1];
			if (now > task[i][0]) {
				ans = false;
				break;
			}
		}
		System.out.println(ans ? "Yes" : "No");
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 107604
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
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;}

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,Q,K;

vector<int> primes;
void set_primes(int max) {
    FOR(i,2,max+2) {
        bool is_p = true;
        for (int p:primes) {
            if (i%p==0) {
                is_p = false;
                break;
            }
        }
        if (is_p) primes.push_back(i);
    }
}

int calc(int n) {
    map<int,int> M;
    for (int p:primes) {
        if (p*p>n) break;
        if (n%p) continue;
        while(n%p==0) {
            M[p]++;
            n/=p;
        }
    }
    if (n!=1) M[n]++;
    int ret = 1;
    for (auto p:M) ret *= p.second+1;
    return ret;
}

void solve() {
    cin>>N;
    set_primes(1e4);
    int ans = 0;
    int start = 0;
    if (N>=1000000 ) { ans = 7235062807366; start = 1000000 ; }
    if (N>=2000000 ) { ans = 30326413365285; start = 2000000 ; }
    if (N>=3000000 ) { ans = 70058785460280; start = 3000000 ; }
    if (N>=4000000 ) { ans = 126850549017804; start = 4000000 ; }
    if (N>=5000000 ) { ans = 200992441246692; start = 5000000 ; }
    if (N>=6000000 ) { ans = 292711324081941; start = 6000000 ; }
    if (N>=7000000 ) { ans = 402188826344049; start = 7000000 ; }
    if (N>=8000000 ) { ans = 529581632274134; start = 8000000 ; }
    if (N>=9000000 ) { ans = 675021515919670; start = 9000000 ; }
    if (N>=10000000) { ans = 838627288460105; start = 10000000; }
    start += 1;
    FOR(i,start,N+1) {
        ans += i*calc(i);
        if (i%((int)1e6)==0) {
            debug("%lld: %lld %lld\n",i,calc(i), ans);
        }
    }
    cout << ans << endl;
}


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

using namespace std;

int dp[1005][20006];
//dp[n][깎은 체력] = val?

const int INF = 1e9;
int a[10005], b[10005];
int n, h;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin>>h>>n;

    for(int i=0;i<n;i++){
        cin>>a[i];
        cin>>b[i];
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=20005;j++)
        {
            dp[i][j] =INF;
        }
    }
    dp[0][0] = 0;
    int ans = INF;

    for(int i=1;i<=n;i++){
        dp[i][0] = 0;
        for(int j=0;j<=20005;j++){
            dp[i][j] = min(dp[i][j], dp[i-1][j]);
            if(j>=a[i-1])
                dp[i][j] = min(dp[i][j], dp[i][j-a[i-1]] + b[i-1]);
        }
    }
    for(int i=h;i<=20005;i++){
        ans = min(ans, dp[n][i]);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 78464
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)

int main()
{
    fast();

    using P = pair<int, int>; // (コスト, 進んだ回数)

    int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> grid(H);
    // d[0] : ひだり, d[1] : うえ, d[2] : みぎ, d[3] : した
    vector<vector<vector<P>>> d(H);

    for (int i = 0; i < H; i++)
    {
        d[i] = vector<vector<P>>(W, vector<P>(4, P(inf, inf)));
    }

    int sx, sy, gx, gy;

    cin >> sx >> sy >> gx >> gy;
    sx--, sy--, gx--, gy--;

    for (int i = 0; i < H; i++)
    {
        cin >> grid[i];
    }

    priority_queue<pair<P, pair<P, int>>, vector<pair<P, pair<P, int>>>, greater<pair<P, pair<P, int>>>> pq;

    for (int i = 0; i < 4; i++)
    {
        d[sx][sy][i] = P(1, 0);
        pq.push({d[sx][sy][i], {{sx, sy}, i}});
    }

    while (!pq.empty())
    {
        auto v = pq.top();
        pq.pop();
        int vx = v.second.first.first, vy = v.second.first.second, dir = v.second.second;

        if (d[vx][vy][dir] < v.first)
            continue;

        for (int i = 0; i < 4; i++) // 方向転換
        {
            P ncost = make_pair(d[vx][vy][dir].first + 1, 0);

            if (d[vx][vy][i] <= ncost)
                continue;

            d[vx][vy][i] = ncost;

            pq.push({ncost, {{vx, vy}, i}});
        }

        // 直進

        int nx = vx + dx[dir], ny = vy + dy[dir];

        if (nx < 0 || nx >= H || ny < 0 || ny >= W) // grid の外
            continue;

        if (grid[nx][ny] == '@') // 行き止まり
            continue;

        int df = d[vx][vy][dir].first, ds = d[vx][vy][dir].second;

        P ncost = make_pair(df + (ds + 1) / (K + 1), ds % K + 1);

        if (d[nx][ny][dir] <= ncost)
            continue;

        d[nx][ny][dir] = ncost;
        pq.push({ncost, {{nx, ny}, dir}});
    }

    int min_cost = inf;

    for (int i = 0; i < 4; i++)
    {
        min_cost = min(min_cost, d[gx][gy][i].first);
    }

    if (min_cost == inf)
    {
        cout << -1 << "\n";
    }
    else
    {
        cout << min_cost << "\n";
    }
}


Measured memory_bytes: 85368
from heapq import heappush, heappop
N, M, C = map(int, input().split())
G = [[] for i in range(N)]
E = []
for i in range(M):
    a, b, d = map(int, input().split()); a -= 1; b -= 1
    G[a].append((b, d))
    G[b].append((a, d))
    E.append((a, b, d))

INF = 10**18
dist = [INF]*N
dist[0] = 0
que = [(0, 0)]
while que:
    cost, v = heappop(que)
    if dist[v] < cost:
        continue
    for w, d in G[v]:
        if cost + d < dist[w]:
            dist[w] = cost + d
            heappush(que, (cost + d, w))

*I, = range(N)
I.sort(key = dist.__getitem__)
K = [0]*N
for i, e in enumerate(I):
    K[e] = i

Q = [0]*N
su = 0
for a, b, d in E:
    if K[a] < K[b]:
        Q[b] += d
    else:
        Q[a] += d
    su += d

ans = 10**18
cu = 0
for v in I:
    x = dist[v]
    cu += Q[v]
    ans = min(ans, C*x + (su - cu))
print(ans)



Measured memory_bytes: 96456
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int x, y;
  rd(x);
  rd(y);
  wt_L(x*y/2);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190715-1

// --- original code ---
// {
//   int x, y;
//   rd(x,y);
//   wt(x*y/2);
// }


Measured memory_bytes: 256
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1 << 30;
const int maxn=4e5+5;

int n;
int a[maxn],b[maxn];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=n;i>=1;i--){
		int c=0;
		for(int j=i;j<=n;j+=i)
			if(b[j])++ c;
		if(c%2!=a[i])b[i]=1;
	}
	int cnt=0;
	for(int i=1;i<=n;i++)
		if(b[i])++cnt;
	printf("%d\n",cnt);
	for(int i=1;i<=n;i++)
		if(b[i])printf("%d ",i);
	
	return 0;
}


Measured memory_bytes: 2432
A,B,C,X,Y=map(int,input().split())

hantei=0

#初期値
result=A*X+B*Y

for i in range(1,max(X,Y)+1):
    hantei=2*C*i +max((X-i),0)*A+max((Y-i),0)*B

    result=int(min(result,hantei))

print(result)


Measured memory_bytes: 3060
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):
    Points = [float(i) for i in N[l].split()]
    P = []
    for i in range(8):
        P.append(int(Points[i]*10**5))
    AB = [P[2]-P[0],P[3]-P[1]]
    CD = [P[6]-P[4],P[7]-P[5]]
    if AB[0]*CD[0] + AB[1]*CD[1] == 0:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

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

int main()
{
	ans = 100;
	cin >> s;
	REP(i, s.size())
	{
		vi v;
		REP(j, s.size())
		{
			if (s[j] == s[i]) {
				v.push_back(j);
			}
		}
		sum = 0;
		sum = max(sum, v[0]);
		REP(j, v.size() - 1)
		{
			sum = max(sum, v[j + 1] - v[j] - 1);
		}
		sum = max<ll>(sum, (s.size() - 1 - v[v.size() - 1]));
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
ll int dp[1000005];
ll int N;
vector<ll int> v;
ll int funct(int z)
{
  if(z==N-1)
    return 0;
  if(z>=N)
    return 999999999;
  if(dp[z+1]==-1)
    dp[z+1]=funct(z+1);
  if(dp[z+2]==-1)
    dp[z+2]=funct(z+2);
  dp[z]=min((abs(v[z+1]-v[z])+dp[z+1]),(abs(v[z+2]-v[z])+dp[z+2]));
  return dp[z]; 
}
int main()
{
  int i,x;
  for(i=0;i<1000005;i++)
    dp[i]=-1;
  cin>>N;
  for(i=0;i<N;i++)
  {
    cin>>x;
    v.pb(x);
  }
  dp[0]=funct(0);
  cout<<dp[0]<<endl;
  return 0;
}

Measured memory_bytes: 12148
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=int(l);i<int(r);i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define pp pop_back
#define int num
using namespace std;
typedef long long num;
typedef pair<int,int> point;
const int maxn=1e5+10;

int n,ans;
string s;
int32_t main(){
    cin>>s;
    n=s.size();
    ans=max(ans,n*9-9);
    int sum=0;
    rep(i,0,n){
	if(s[i]>'0') ans=max(ans,sum+s[i]-'1'+9*(n-i-1));
	sum+=s[i]-'0';
    }
    ans=max(ans,sum);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
def dfs(graph, start, visited):
    if visited[start] != -99999:
        return True

    stack = [start]
    visited[start] = 0#初期値を0に設定
    while stack:
        label = stack.pop()
        for nextnode, distance in graph[label]:
            if visited[nextnode] == -99999:#初めて訪れる場所なら座標を設定
                stack.append(nextnode)
                visited[nextnode] = visited[label] + distance
            elif visited[nextnode] != visited[label] + distance:#二回目以降なら一回目と同じかを確認，stackはとらない
                return False
    return True


N, M = (int(i) for i in input().split())

graph = [[] for i in range(N + 1)]#インデックス番号と実際の番号をあわせるためにN+1にする

for i in range(M):
    L, R, D = (int(i) for i in input().split())
    graph[L].append((R, D))
    graph[R].append((L, -1 * D))

visited = [-99999 for i in range(N + 1)]

flag = True
for i in range(1, N + 1):
    ans = dfs(graph, i, visited)
    if not ans:
        flag = False
        break

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 65956
n = int(input())
width = []
for _ in range(n):
  x,l = map(int,input().split())
  width.append([x+l,x-l])
width.sort()
ans = 0
wall = - 10 ** 10
for i in range(n):
  if wall <= width[i][1]:
    ans += 1
    wall = width[i][0]
print(ans)
#print(width)

Measured memory_bytes: 61016
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main(){
    long long int h, n, i;
    vector<long long int> v;
    long long int u[200000];
    
    cin >> n;
    
    for(i = 0; i < n; i++){
        cin >> h;
        v.push_back(h);
    }
    
    u[0] = 0;
    u[1] = abs(v[1] - v[0]);
    
    for(i = 2; i < n; i++){
        u[i] = min(u[i-2]+abs(v[i-2]-v[i]), u[i-1]+abs(v[i-1]-v[i]));
    }
    
    cout << u[n-1] << endl;
}


Measured memory_bytes: 1908