akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int N = sc.nextInt();
        int i = 1;
        int result = 0;
        int term = (int)Math.pow(100, d);
      
      while (N != 0){
        result = term * i++;
          int tmp = result;
          int num = 0;
        while( (tmp%100) == 0){
            tmp/=100;
            num++;
          }
        if ( num > d){
          i++;
        }
        N--;
      }
      result = --i * term;
        System.out.println(result);

    }
}

Measured memory_bytes: 23124
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>

#define rep(i,n) for(int i = 0; i < n; ++i)
#define rec(i,m,n) for(int i = m; i < n; ++i)

using namespace std;

int main()
{

  int n ;

  while(cin >> n && n!=0)
    {

      int max = -1;
      int h,m,s;
      int start,end;
      vector<int> time(240001);

      fill(time.begin(),time.end(),0);

      rep(i,n){

        scanf("%d:%d:%d",&h,&m,&s);
        start = h*10000 + m*100 + s;
        scanf("%d:%d:%d",&h,&m,&s);
        end = h*10000 + m*100 + s;

        time[start]++;
        time[end]--;

      }

      rep(i,time.size())
        if(i > 0)
          time[i] += time[i-1];

      rep(i,time.size())
        if(max < time[i])
          max = time[i];

      cout << max << endl;

    }

  return 0;

}

Measured memory_bytes: 2176
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] F = new int[N][10];
		int[][] P = new int[N][11];
		int ans = Integer.MIN_VALUE;
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < 10; j++)
				F[i][j] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < 11; j++)
				P[i][j] = sc.nextInt();
		}
		for(int i = 1; i < 1 << 10; i++) {
			int sum = 0;
			for(int j = 0; j < N; j++) {
				int count = 0;
				for(int k = 0; k < 10; k++) {
					if((1 & (i >> k)) >= 1 && F[j][k] == 1)
						count++;
				}
				sum += P[j][count];
			}
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 27976
H, W = map(int, input().split())
pic = [str(input()) for _ in range(H)]
ans_list = str()
for i in range(1, 2*H+1):
  if i%2 == 0:
    ans_list += pic[int(i/2)-1]
  else:
    ans_list += pic[int((i+1)/2)-1]
for i in range(2*H):
  print(ans_list[i*W:(i+1)*W])

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
import collections
c =collections.Counter(a)
ln = [i[0] for i in c.items() if i[1] >= 2]
ln.sort(reverse = True)
if len(ln) < 1:
    print(0)
elif c[ln[0]] >= 4:
    print(ln[0] ** 2)
elif len(ln) <= 1:
    print(0)
else:
    print(ln[0] * ln[1])

Measured memory_bytes: 68632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  int ans=0;
  for(int i=1;i<=min(N,K);i++){
    int lim=K-i;
    for(int j=0;j<=i;j++){
      vector<int> opp(i);
      int A=j;
      int B=i-j;
      for(int a=0;a<A;a++){
        opp[a]=d[a];
      }
      for(int b=0;b<B;b++){
        opp[A+b]=d[N-1-b];
      }
      sort(opp.begin(),opp.end());
      for(int l=0;l<lim;l++){
        if(opp[l]>=0){
          break;
        }
        opp[l]=0;
      }
      int current=0;
      for(int k=0;k < i;k++){
        current+=opp[k];
      }
      ans=max(ans,current);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<int> time(5);
    int ans = 0;
    for (int i = 0; i < 5;i++){
        cin >> time[i];
        ans += ((time[i] - 1) / 10 + 1) * 10;
        time[i] = time[i] % 10;
    }
    sort(time.begin(), time.end());
    for (int i = 0; i < 5;i++){
        if(time[i]!=0){
            ans += time[i] - 10;
            break;
        }

    }
    cout << ans << endl;

    }

Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
#include <cstdlib>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, D;
    cin >> N >> D;
    int ans = 0;
    for(int i = 1; i <= N; i= i+2*D+1){
        ans++;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll N, Y;
  cin >> N >> Y;

  REP(i, N + 1) {
    REP(j, N - i + 1) {
      ll k = N - i - j;
      if (10000 * i + 5000 * j + 1000 * k == Y) {
        cout << i << " " << j << " " << k;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
//const long double EPS=1E-8;
////////////////////////////////////////


int main(){
    //ios::sync_with_stdio(false);cin.tie(0);
    
    ll n,m,s;cin>>n;
    if(n==1){
        cout<<"Hello World"<<endl;
    }else{
cin>>m>>s;
        cout<<m+s<<endl;
    }
    
    return 0;
}
 //ios::sync_with_stdio(false);cin.tie(0);


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;




int main() {
	ll x;
	cin >> x;

	ll ans = 0;
	ans += x / 500 * 1000;

	x %= 500;
	ans += x / 5 * 5;
	cout << ans << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x,y;
  cin>>x;
  cin>>y;
  if(x==1)
  {
    if(y==2)
      cout<<3;
    if(y==3)
      cout<<2;
  }
  else if(x==2)
  {
    if(y==1)
      cout<<3;
    if(y==3)
      cout<<1;
  }
  else if(x==3)
  {
    if(y==1)
      cout<<2;
    if(y==2)
      cout<<1;
  }
}

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

int main(){
	
	string s; cin >> s;
	
	if(s[0]==s[2]) cout << "Yes" << endl;
	else cout <<"No"<<endl;
	
	return 0;
}

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


int main() {
    string s;
    cin>>s;
    int ans = 0, ans1=0;
    for(int i=0; i<3; i++)
    {
        if(s[i] == 'R')
            ans1++;
        else
        {
            ans = max(ans, ans1);
            ans1 = 0;
        }
    }
    ans = max(ans, ans1);
    cout<<ans;
	return 0;
}


Measured memory_bytes: 3592
n, k = map(int, input().split())
p = list(map(lambda x: int(x) - 1, input().split()))
c = list(map(int, input().split()))

ans = -float('inf')
visited = [False] * n
for i in range(n):
    if not visited[i]:
        visited[i] = True
        loop = [i]
        cost = [c[i]]
        while not visited[p[loop[-1]]]:
            visited[p[loop[-1]]] = True
            cost.append(c[p[loop[-1]]])
            loop.append(p[loop[-1]])

        total_cost = sum(cost)
        # print(loop)
        # print(cost)
        # print(total_cost)

        m = len(loop)
        point = [-float('inf')] * m
        for j1 in range(m):
            s = 0
            for j2 in range(1, min(m, k) + 1):
                s += cost[(j1 + j2) % m]
                point[j1] = max(point[j1], s, s + total_cost * ((k - j2) // m))

        # print(point)
        ans = max(ans, max(point))

print(ans)


Measured memory_bytes: 69532
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
int main(){
    string s, ans;
    cin >> s;

    for(int i = 0; i < s.size(); ++i){
        if(s[i] =='0') ans.push_back('0');
        if(s[i] =='1') ans.push_back('1');

        if(ans.size() != 0){
            if(s[i] =='B') ans.pop_back();
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 768
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e18;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;

ll arr[200000];
bool visited[200000];
vector<ll> road;
vector<ll> loop;

int main() {
	cin >> N >> K;
	rep(i, N) {
		cin >> A; A--;
		arr[i] = A;
	}
	rep(i, N) {
		visited[i] = false;
	}
	road.push_back(0);
	visited[0] = true;
	int next = arr[0];
	while (!visited[next]) {
		visited[next] = true;
		road.push_back(next);
		next = arr[next];
	}
	int start = next;
	next = arr[next];
	loop.push_back(start);
	while (next != start) {
		loop.push_back(next);
		next = arr[next];
	}
	if (K < road.size() - 1) {
		cout << road[K]+1;
	}
	else {
		ll curr = K - road.size();
		cout << loop[curr % loop.size()]+1;
	}
}


Measured memory_bytes: 9404
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 123456;
VI edges[N];
ll c[N];

const ll inf = 1e14;
bool ok = true;
ll dfs(int v, int p) {
  int idx = edges[v].size();
  if (idx == 1 && p >= 0) {
    return c[v];
  }
  if (idx == 1) {
    ll q = dfs(edges[v][0], v);
    ok &= q == c[v];
    return q;
  }
  /*
  if (idx == 2) {
    int w1 = edges[v][0];
    int w = edges[v][1];
    return c[v] <= c[w1] && c[v] <= c[w];
    && dfs(w, v) && d;
  }
  */
  ll tot = 0;
  VL qs;
  for (auto w: edges[v]) {
    if (w == p) { continue; }
    ll q = dfs(w, v);
    //cerr << v << "==>" << w << " " << q << endl;
    tot += q;
    qs.push_back(q);
  }
  assert (qs.size() >= 1);
  ok &= tot <= 2 * c[v];
  ll ret = 2 * c[v] - tot;
  qs.push_back(ret);
  for (auto q: qs) {
    if (q > c[v]) {
      ok = false;
    }
  }
  return ret;
  
}

int main(void){
  int n;
  cin >> n;
  REP(i, 0, n) {
    cin >> c[i];
  }
  REP(i, 0, n - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  int l = -1;
  REP(i, 0, n) {
    if (edges[i].size() == 1) {
      l = i;
      break;
    }
  }
  dfs(l, -1);
  cout << (ok ? "YES" : "NO") << endl;
}


Measured memory_bytes: 19584
// ABC114_C
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
typedef long long ll;

ll N, res = 0;

bool is753(string S) {
    int three = (int)S.find("3", 0);
    int five = (int)S.find("5", 0);
    int seven = (int)S.find("7", 0);
    if (three >= 0 && five >= 0 && seven >= 0) {
        return true;
    }
    return false;
}

ll dfs(ll x) {
    if (N < x) return 0;
    // check
    if (is753(to_string(x))) res++;
    
    dfs(10*x + 3);
    dfs(10*x + 5);
    dfs(10*x + 7);
}

int main() {
    // input
    cin >> N;
    
    // calculation
    dfs(0);
    cout << res << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<"\n"
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{

	char c; cin >> c;
	if (isupper(c))
		cout << "A";
	else
		cout << "a";



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


	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//各種nil
template <class T>
constexpr T nil = static_cast<T>(-1);

constexpr int nil_i = nil<int>;
constexpr int nil_ll = nil<ll>;
constexpr double nil_d = nil<double>;

//vector
template <class T>
using vec = std::vector<T>;

struct Vec2D
{
    int x, y;
};

struct TimePos
{
    int time;
    Vec2D pos;
};

int ManhattanDistance(Vec2D v1, Vec2D v2)
{
    using namespace std;
    return abs(v1.x - v2.x) + abs(v1.y - v2.y);
}

void solve()
{
    using namespace std;
    int n, a;
    cin >> n >> a;

    if (n % 500 <= a)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

}

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

Measured memory_bytes: 256
N=int(input())
s_list=[]
for i in range(N):
    s_list.append(input())
s_list2=["".join(sorted(x)) for x in s_list]

dic={}
for s in s_list2:
    if s not in dic.keys():
        dic[s]=1
    else:
        dic[s]+=1
    
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

c=0
for x in dic.items():
    if x[1]>=2:
        c+=cmb(x[1],2)
print(c)

   
    

Measured memory_bytes: 26640
#include<bits/stdc++.h>
#define ll long long int
#define PB emplace_back
#define MP make_pair
#define F first
#define S second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main() {
    IOS;
//      freopen("input.txt","r",stdin);
//  		freopen("output.txt","w",stdout);
//ll t;
//cin>>t;
//while(t--){
    ll i,s=0;
    string n;
    cin>>n;
    for(i=0;i<n.size();i++){
        s=s+(n[i]-'0');
    }
    if(s%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
//}
	return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define init(c) memset(c,0,sizeof c)
#define S second
#define F first
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=20000005;
ll n,k,x,t,a,b,m;
string s;
vi v;
 
void solve(){
	cin >> n;
	n--;
	cout <<n*(n+1)/2; 	
 
}
 
int main(){

	t=1;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(void) {

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

		int max_p = 0, max_d = 0;
		for (int i = 0; i < n; i++) {
			int p, d1, d2;
			cin >> p >> d1 >> d2;

			if(max_d <= d1 + d2) {
				max_d = d1 + d2;
				max_p = p;
			}
		}
		cout << max_p << " " << max_d << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [0 for _ in range(n + 1)]
INF = 10 ** 9
for i in range(1, n + 1):
    c = [dp[i - b[aj]] for aj in a if i >= b[aj]]
    if len(c) > 0:
        dp[i] = max(c) + 1
    else:
        dp[i] = -INF

x = n
i = 0
ans = ''
while(True):
    for aj in a:
        if x - b[aj] >= 0 and dp[x - b[aj]] == dp[n] - i - 1:
            i += 1
            x -= b[aj]
            ans += str(aj)
            break
    if i == dp[n]:
        break
print(ans)


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

long long gcd(long long a, long long b){
    if(b==0) return a;
    return gcd(b,a%b);
}

int main(){
    int n;
    cin>>n;
    long long a[n];
    
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    long long b[n];
    long long g=a[0];
    b[0]=a[1];
    for(int i=1;i<n;i++){
        b[i]=g;
        g=gcd(g,a[i]);
    }
    g=a[n-1];
    for(int i=n-2;i>=0;i--){
        b[i]=gcd(b[i],g);
        g=gcd(g,a[i]);
    }
    sort(b,b+n);
    cout<<b[n-1]<<endl;


}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
    vector<string> c(3);
    for (int i = 0; i < 3; i++) {
        cin >> c[i];
    }

    string ans = "";
    ans += c[0][0];
    ans += c[1][1];
    ans += c[2][2];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();      
        int N = r.i();
        int[] a = r.ii();
        java.util.Arrays.sort(a);
        int sign = 1;
        int sum = 0;
        for(int i = 0; i < a.length; i++){
            sum += a[a.length-1-i]*sign;
            sign = -sign;
        }        
        println(sum);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int Int(String s){
            return Integer.parseInt(s);
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}

Measured memory_bytes: 21332
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC115C
int compare_int(const void *a, const void *b) {//sort
  return *(int*) a - *(int*) b;
}
int main(void) {
  int n, k, i, cou=0, tmp, min=1e9;
  scanf("%d %d", &n, &k);
  int h[n];
  for(i=0; i<n; i++){
    scanf(" %d", &h[i]);
  }qsort(h, n, sizeof(int), compare_int);//sort

  for(i=0; i<n-k+1; i++){
    if(min>h[i+k-1]-h[i]) min=h[i+k-1]-h[i];
  }
  printf("%d", min);
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int min = 753;
  rep(i,s.length()-2){
    string str = s.substr(i,3);
    int num = atoi(str.c_str());
    int sa = abs(753-num);
    if(min>sa){
      min = sa;
    }
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int M = scan.nextInt();
        UnionFind uf = new UnionFind(N);
        for (int i = 0; i < M; i++) {
            int x = scan.nextInt()-1;
            int y = scan.nextInt()-1;
            int z = scan.nextInt()-1;
            uf.merge(x, y);
        }
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(uf.parent(i));
        }
        System.out.println(set.size());
    }
    class UnionFind {
        private int[] parent;
        private int[] size;
        UnionFind(int N) {
            this.parent = new int[N];
            this.size = new int[N];
            Arrays.fill(this.parent, -1);
            Arrays.fill(this.size, 1);
        }
        int parent(int x) {
            if (this.parent[x] == -1)  {
                return x;
            }
            return this.parent[x] = this.parent(this.parent[x]);
        }
        int size(int x) {
            int parent = this.parent(x);
            return this.size[parent];
        }
        void merge(int x, int y) {
            int parent_x = this.parent(x);
            int parent_y = this.parent(y);
            if (parent_x == parent_y) {
                return;
            }
            int size_x = this.size(x);
            int size_y = this.size(y);
            if (size_y < size_x) {
                this.parent[parent_y] = parent_x;
                this.size[parent_y] = -1;
                this.size[parent_x] = size_x + size_y;
                return;
            }
            this.parent[parent_x] = parent_y;
            this.size[parent_x] = -1;
            this.size[parent_y] = size_x + size_y;
        }
    }
}


Measured memory_bytes: 92260
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    int sum=0;
        for(int i=0;i<N;i++){
            int r,l;
            cin>>l;
            cin>>r;
            
            sum+=(abs(l-r)+1);
        }
    
    cout<<sum<<endl;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

struct edge {
    int u, v;
    llong cost;
};

bool comp(const edge &e1, edge &e2) {
    return e1.cost < e2.cost;
}

const static int MAX_N = 200001;

int par[MAX_N + 1], rank_t[MAX_N + 1];

void init_union_find(int n) {
    for (int i = 0; i <= n; ++i) {
        par[i] = i;
        rank_t[i] = 0;
    }
}

int find_root(int x) {
    return par[x] == x ? x : par[x] = find_root(par[x]);
}

bool same(int x, int y) {
    return find_root(x) == find_root(y);
}

void unite(int x, int y) {
    x = find_root(x);
    y = find_root(y);
    if (x == y) return;

    if (rank_t[x] < rank_t[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rank_t[x] == rank_t[y]) rank_t[x]++;
    }
}

vector<edge> es;

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

    int n;
    cin >> n;
    vector<tuple<int, int, int> > XY(n), YX(n);
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        XY[i] = make_tuple(x, y, i);
        YX[i] = make_tuple(y, x, i);
    }

    sort(all(XY));
    sort(all(YX));

    rep(i, n - 1) {
        edge e;
        e.u = get<2>(XY[i]);
        e.v = get<2>(XY[i + 1]);
        e.cost = get<0>(XY[i + 1]) - get<0>(XY[i]);
        es.push_back(e);
    }

    rep(i, n - 1) {
        edge e;
        e.u = get<2>(YX[i]);
        e.v = get<2>(YX[i + 1]);
        e.cost = get<0>(YX[i + 1]) - get<0>(YX[i]);
        es.push_back(e);
    }

    sort(all(es), comp);

    init_union_find(n);

    llong res = 0;
    rep(i, es.size()) {
        edge e = es[i];
        if (! same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 8816
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

bool A[100100];
int main(){
    int N;
    cin >> N;
    ll ans = 0;
    bool last = false;
    REP(i,N){
        ll a;
        cin >> a;
        if(last && a > 0){
            ans++;
            a--;
        }
        ans += a/2;
        bool x = (a % 2 == 1);
        A[i] = x;
        last = A[i];
    }

    //last = false;
    //REP(i,N){
    //    if(A[i] & last){
    //        ans++;
    //        A[i] = false;
    //    }
    //    last = A[i];
    //}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  }
}

struct Scanner<R: BufRead> {
  reader: R,
  iter: std::vec::IntoIter<String>
}

#[allow(dead_code)]
impl<R: BufRead> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader, iter: vec![String::new()].into_iter() }
  }
  fn new_line(&mut self) {
    let mut line = String::new();
    self.reader.read_line(&mut line).ok();
    self.iter = line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>().into_iter();
  }
  fn get<T: FromStr>(&mut self) -> T {
    self.iter.next().unwrap().parse().ok().unwrap()
  }
  fn get_line(&mut self) -> String {
    let mut line = String::new();
    self.reader.read_line(&mut line).ok();
    line.trim().to_string()
  }
}

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut scanner = Scanner::new(cin);
  loop {
    let mut s = scanner.get_line();
    if s == "-" {
      break;
    }
    scanner.new_line();
    let m = scan!(scanner; i64);
    for _ in 0..m {
      scanner.new_line();
      let h = scan!(scanner; usize);
      let s_ = s.clone();
      let s0 = &s_[0..h];
      let s1 = &s_[h..];
      s = format!("{}{}", s1, s0);
    }
    println!("{}", s);
  }
}



Measured memory_bytes: 5040
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

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

    int ans = 0;
    rep(i, n){
        if(i == n - 1 && p[i] - 1 == i) ans++;
        else{
            if(p[i] - 1 == i) {
                swap(p[i], p[i + 1]);
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
//ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll n,k;
  cin>>n>>k;
  vi a(n);
  rep(i,n) cin>>a[i];
  rep(i,n-k) YesNo(a[i]<a[k+i]);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	string s;

	cin >> s;

	s = s.substr(0, s.size() - 8);

	cout << s << endl;
}

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

int main(){
    int N;
    int a[100000];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    int num[100001]={};
    int change=0;
    for(int i=0;i<N;i++){
        if(a[i]>100000){
            change++;
        }
        else{
            num[a[i]]++;
        }
    }
    for(int i=1;i<=100000;i++){
        if(num[i]){
            if(num[i]<i){
                change+=num[i];
            }
            else{
                change+=num[i]-i;
            }
        }
    }

    cout << change;
    return 0;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

struct R
{
	int i,v;
	inline bool operator<(const R b)const{return v<b.v;}
}a[233333];

int res[233333];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i].v);
		a[i].i=i;
	}
	sort(&a[1],&a[n+1]);
	for(int i=1;i<=n;i++)
	{
		if(i<=n/2)res[a[i].i]=a[n/2+1].v;
		else res[a[i].i]=a[n/2].v;
	}
	for(int i=1;i<=n;i++)
	{
		printf("%d\n",res[i]);
	}
	return 0;
}

Measured memory_bytes: 4480
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD1 998244353
#define INF LLONG_MAX
#define NINF LLONG_MIN
#define inf 1e18
#define all(v) v.begin(),v.end()
#define T ll test;cin>>test; while(test--)
#define rep(i,a,n) for(ll i=a;i<(long long)n;++i)
#define rep1(i,a,n) for(ll i=a;i<=(long long)n;++i)
#define rep2(i,n,a) for(ll i=n;i>(long long)a;--i)
#define rep3(i,n,a) for(ll i=n;i>=(long long)a;--i)
#define repi(i,a,n) for(int i=a;i<=(int)n;++i)
#define repl(i,a,n) for(int i=a;i<(int)n;++i)
#define PI 3.141592653589793238510
#define en '\n'
#define MAX 100005
#define LESSTIME ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug cout<<"HERE"<<en;
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define vc vector
#define vi vc<int>
#define mii unordered_map<int,int>
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int>
#define vll vector<long long>
#define pll pair<long long,long long>
#define pl pair<int,int>
#define eb emplace_back
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace std::chrono;
void lcs(string s1,string s2,int m,int n)
{
  int dp[m+5][n+5];
  repi(i,0,m)
  {
    repi(j,0,n)
    {
      if(i==0 || j==0)
      dp[i][j]=0;
      else if(s1[i-1]==s2[j-1])
      dp[i][j]=1+dp[i-1][j-1];
      else
      dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }
  int len=dp[m][n];
//  cout<<len<<en; //length of the lcs.

  //now print the lcs itself.
  char lcs[len+1];
  lcs[len]='\0';
  int i=m,j=n;
  while(i>0 && j>0)
  {
    if(s1[i-1]==s2[j-1])
    {
      lcs[len-1]=s1[i-1];
      i--;j--;len--;
    }
    else if(dp[i-1][j]>dp[i][j-1])
    i--;
    else
    j--;
  }
  cout<<lcs;
}
int main(){
    LESSTIME;
    string s1,s2;
    cin>>s1>>s2;
    lcs(s1,s2,s1.length(),s2.length());
return 0;
}


Measured memory_bytes: 35456
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long int64;

class BCountBalls {
 public:
  void solveOne(std::istream &in, std::ostream &out) {
    int64 a, b, c;
    in >> a >> b >> c;

    int64 d = a / (b + c);
    int64 e = a % (b + c);

    int64 ans = (d * b) + min(b, e);
    out << ans << endl;

  }
  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int i = 0; i < nt; ++i)
      solveOne(in, out);
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  BCountBalls solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define all(v) (v).begin(),(v).end()
#define clr(t,v) memset(t,(v),sizeof(t))
template<class T1, class T2>ostream& operator<<(ostream& os, const pair<T1, T2>&a)
{
   return os << "(" << a.first << "," << a.second << ")";
}
template<class T>void pv(T a, T b)
{
   for(T i = a; i != b; ++i)
      cout << (*i) << " ";
   cout << endl;
}
template<class T>void chmin(T&a, const T&b)
{
   if(a > b)
      a = b;
}
template<class T>void chmax(T&a, const T&b)
{
   if(a < b)
      a = b;
}

int nxint()
{
   int x;
   scanf("%d", &x);
   return x;
}

int a[100005], b[200005];
int main()
{
   int m, n;
   while(cin >> n) {
      rep(i, n){
      cin >> a[i];
      }
      sort(a, a + n);
      double maxc = 0.0;
      vector<int> v;
      for(int i = 1; i < n;  i++){
         int p = lower_bound(a, a + i, (a[i] + 1) / 2) - a;
         if(p > 0 && a[i] - a[p] <= a[p - 1])
            p--;
         if(i == n - 1)
           cout << a[i] << ' ' << a[p] << endl;
      }


   }

   return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main {

    private static int solver(String str){
        int oddZero = 0;
        int oddOne = 0;
        int evenZero = 0;
        int evenOne = 0;
        for(int i=0; i<str.length();i++){
            if(i%2 == 1) {
                if(str.charAt(i) == '0'){
                    oddZero++;
                }else{
                    oddOne++;
                }
            }else{
                if(str.charAt(i) == '0'){
                    evenZero++;
                }else{
                    evenOne++;
                }
            }
        }

        return Math.min(oddZero + evenOne, oddOne + evenZero);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        System.out.println(solver(in.next()));
    }
}


Measured memory_bytes: 26112
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    }
}


Measured memory_bytes: 35496
fun main(args: Array<String>) = abc164d()

@OptIn(ExperimentalStdlibApi::class)
fun abc164d() {
    val s = readLine()!!.reversed().map { Character.getNumericValue(it) }.toIntArray()

    val modded = IntArray(s.size)
    var digit = 1
    for (i in s.indices) {
        modded[i] = (s[i] * digit) % MOD
        digit *= 10
        digit %= MOD
    }

    val moddedCSum = modded.scan(0) { acc: Int, i: Int -> (acc + i) % MOD }.toIntArray()

    val appeared = mutableMapOf<Int, Int>()
    var answer = 0L

    for (mcs in moddedCSum) {
        val app = appeared.getOrDefault(mcs, 0)
        answer += app
        appeared[mcs] = app + 1
    }

    println(answer)
}

private const val MOD = 2019


Measured memory_bytes: 57172
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005, P = 1e9 + 7;
int n, k;
int a[maxn];
int c[maxn][maxn], dp[22][maxn];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> k;
	for(int i = 1; i <= k; ++i) {
		cin >> a[i];
	}
	c[0][0] = 1;
	for(int i = 1; i <= n; ++i) {
		c[i][0] = 1;
		for(int j = 1; j <= i; ++j) {
			c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % P;
		}
	}
	dp[0][0] = 1;
	for(int i = 0; i < k; ++i) {
		for(int j = 0; j <= n; ++j) {
			for(int l = 0; l + j <= n && l <= a[i + 1]; ++l) {
				dp[i + 1][j + l] = (dp[i + 1][j + l] + 1LL * dp[i][j] * c[n - j][l] % P * c[n - l][a[i + 1] - l] % P) % P;
			}
		}
	}
	cout << dp[k][n] << '\n';
	return 0;
}

Measured memory_bytes: 4224
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
A,B = map(int,read().split())
 
def test(n):
    x = n * 8 // 100
    y = n * 10 // 100
    return (x == A) and (y == B)
 
answer = -1
for n in range(20000):
    if test(n):
        answer = n
        break
print(answer)

Measured memory_bytes: 3064
#include <cstddef>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>


using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }



int main()
{
    using namespace std;

    int D;
    cin >> D;

    if (D == 25)
        cout << "Christmas" << endl;
    else if (D == 24)
        cout << "Christmas Eve" << endl;
    else if (D == 23)
        cout << "Christmas Eve Eve" << endl;
    else if (D == 22)
        cout << "Christmas Eve Eve Eve" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll a, b, c;
    cin >> a  >> b >> c;
    cout << (a*b)/2 << endl;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		Set<String> set = new HashSet<String>();
		List<String> candidate = new ArrayList<String>();
		StringBuilder sb = new StringBuilder();
		Collection<String> col = new ArrayList<String>();
		while (true) {
			int h = sc.nextInt(), w = sc.nextInt();
			if (h == 0 && w == 0) break;
			
			sc.nextLine();
			char[][] donut = new char[h][w];
			for (int i = 0; i < h; i++) {
				String s = sc.nextLine();
				for (int j = 0; j < w; j++)
					donut[i][j] = s.charAt(j);
			}
			
			int[] dx = {0, 0, 1, -1, 1, -1, 1, -1};
			int[] dy = {1, -1, 0, 0, 1, -1, -1, 1};
			
			set.clear();
			candidate.clear();
			
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					for (int k = 0; k < 8; k++) {
						sb.delete(0, sb.length());
						int x = i, y = j;
						do {
							sb.append(donut[x][y]);
							if (set.contains(sb.toString())) {
								if (candidate.isEmpty())
									candidate.add(sb.toString());
								else if (candidate.get(0).length() == sb.length())
									candidate.add(sb.toString());
								else if (candidate.get(0).length() < sb.length()) {
									candidate.clear();
									candidate.add(sb.toString());
									int l = sb.length();
									Iterator<String> it = set.iterator();
									while (it.hasNext()) {
										String s = it.next();
										if (s.length() < l)
											col.add(s);
									}
									set.removeAll(col);
									col.clear();
								}
								
							} else if (sb.length() > 1){
								set.add(sb.toString());
							}
							x = (x + dx[k] + h) % h;
							y = (y + dy[k] + w) % w;
						} while (x != i || y != j);
					}
				}
			}
			Collections.sort(candidate);
			if (candidate.size() == 0)
				out.println(0);
			else
				out.println(candidate.get(0));
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

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

#define fi first
#define se second
#define ll long long

vector<int> bulb[11];

int main(){
  
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    ll ans = 0;
    for(int i=0;i<=min(n,k);i++){
        int bhai_sahab = min(n,k)-i;
        for(int j=0;j<=bhai_sahab;j++){   
            ll val = 0;
            multiset<int,less<int> > ms;
            for(int k = 0;k<i;k++){
                val+=v[k];
                ms.insert(v[k]);
            }
            for(int k = n-1;k>=n-j;k--){
                val+=v[k];
                ms.insert(v[k]);
            }
            int rem = k-(i+j);
            while(!ms.empty()&&*ms.begin()<0&&rem--){
                val-=*ms.begin();
                ms.erase(ms.begin());
            }
            ans = max(ans,val);
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int cnt=0;
    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==t[i])
            cnt++;
        else
            break;
    }
    if(cnt==s.size() && cnt==t.size()-1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = 0, y = 0, z = 0, p;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			if (a >= p) {
				x++;
			} else if (p >= b + 1) {
				z++;
			} else {
				y++;
			}
		}
		p = Math.min(x, y);
		p = Math.min(p, z);
		System.out.println(p);
	}
}


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

int main(){
  int n, k, x, t = 0;
  cin >> n >> k;
  rep(i,n){
    cin >> x;
    if(2 * x < k)
      t += 2 * x;
    else
      t += 2 * (k - x);
  }
  cout << t << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<queue>
#include<string>
using namespace std;
using ll = long long;
int main(){
    ll n,k,s;
    cin >> n >> k >> s;
    for(ll i=0;i<n;i++){
        if(k>i) cout << s;
        else{
            if(s==1e9) cout << 900000000;
            else    cout << 1000000000;
        }
        if(i!=n-1)  cout << " ";
    }
}

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

using namespace std;

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

  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i * i <= n; ++i) {
    ans = i * i;
  }
  cout << ans << "\n";
}


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

int main(){
    int n;
    scanf("%d",&n);
    int a, b, c;
    a = 0; b = 0; c= 0;
    for(int i=0;i<n;i++){
        int aa, bb, cc;
        scanf("%d%d%d",&aa,&bb,&cc);
        int cal1 = abs(b-bb)+abs(c-cc);
        int cal2 = aa - a;
        if(cal1 <= cal2 && (cal2 - cal1) % 2 == 0){
            a = aa; b = bb; c = cc;
            continue;
        }
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll n=in();
    string foo=string(n,'a');
    do{
        cout<<foo<<endl;
        for(int i=foo.length()-1;i>=0;--i){
            if(accumulate(foo.begin(),foo.begin()+i,true,[foo,i](bool acc,char c){return acc&c<foo[i];})){
                foo[i]='a';
            }else{
                ++foo[i];
                break;
            }
        }
    }while(foo!=string(n,'a'));
}


Measured memory_bytes: 1536