akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define rep(countName, left, right, up) for (ll countName = left; countName < right; countName += up)
#define rev(countName, right, left, down) for (ll countName = right - 1; countName >= left; countName -= down)

auto solve1(int n, int k, string s)
{
    string str = s;
    str[k - 1] += 'a' - 'A';
    return str;
}

auto solve2(int n, int k, string s)
{
    string str = s;

    if (str[k - 1] == 'A')
    {
        str[k - 1] = 'a';
    }
    else if (str[k - 1] == 'B')
    {
        str[k - 1] = 'b';
    }
    else if (str[k - 1] == 'C')
    {
        str[k - 1] = 'c';
    }

    return str;
}

auto solve3(int n, int k, string s)
{

    for (int i = 0; i < n; i++)
    {
        if (i == (k - 1))
        {
            cout << (char)(s[i] + ('a' - 'A'));
        }
        else
        {
            cout << s[i];
        }
    }
    cout << endl;
}

int main(void)
{

    int n, k;
    string s;

    cin >> n >> k >> s;

    //cout << solve1(n, k, s) << endl;
    cout << solve2(n, k, s) << endl;
    //solve3(n, k, s);

    return 0;
}


Measured memory_bytes: 256
/* Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define debug(x) cout << #x << " " << x <<endl;
#define set_bits __builtin_popcount
typedef long long ll;
typedef unsigned long long ull;
/*---------------------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod)
{ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
ll combination(ll n, ll r, ll m, ll* fact) {ll val1 = fact[n]; ll val2 = mminvprime(fact[r], m); ll val3 = mminvprime(fact[n - r], m); return ((val1 * val2) % m * val3) % m;}
/*--------------------------------------------------------------------------------------------------------------------------*/
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	vector<ll> ans;
	ll y = 26;
	ll x = 26;
	while (true)
	{
		ans.pb(x);
		y = y * 26;
		x += y;
		if (x > 1e16)
			break;
	}
	ll n;
	cin >> n;
	auto index = lower_bound(ans.begin(), ans.end(), n);
	int index1 = index - ans.begin();
	int characters = index1 + 1;
	n -= index1 > 0 ? ans[index1 - 1] : 0;
	ll t = pow(26, characters - 1);
	n -= 1;
	string s = "";
	while (n > 0)
	{
		int char1 = n / t;
		s += (char1 + 97);
		n = n % t;
		t = t / 26;
	}
	while (s.length() < characters)
		s += 'a';
	cout << s << endl;
	// }
	return 0;
}

Measured memory_bytes: 4000
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    long long int N,i,sum=0;
    int a[20],j=0,k;
    cin>>N;
    i=N;
    while(N!=0)
    {
      a[j]=N%10;
      N=N/10;
      j++;
    }
    for(k=0;k<j;k++)
        sum=sum+a[k];
     if(i%sum==0)
     cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3616
import std;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, M, Q;
    scan(N, M, Q);
    auto a = new long[](Q);
    auto b = new long[](Q);
    auto c = new long[](Q);
    auto d = new long[](Q);
    foreach (i; 0 .. Q)
        scan(a[i], b[i], c[i], d[i]);
    a[] -= 1;
    b[] -= 1;

    long dfs1(long[] A)
    {
        if (A.length == N)
        {
            // writeln(A);
            long ret;
            foreach (i; 0 .. Q)
            {
                if (A[b[i]] - A[a[i]] == c[i])
                    ret += d[i];
            }
            return ret;
        }
        long m = A.length == 0 ? 1 : A[$ - 1];
        long ret = long.min;
        foreach (x; m .. M + 1)
        {
            ret = ret.max(dfs1(A ~ x));
        }
        return ret;
    }

    writeln(dfs1([]));
}


Measured memory_bytes: 4580
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll modpow(ll a, ll n){
  if(n==0)return 1;
  if(n%2==0){
    ll t=modpow(a,n/2);
    return t*t%MOD;
  }
  return a*modpow(a,n-1)%MOD;
}
ll modinv(ll a){
  return modpow(a,MOD-2);
}
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
 
    UnionFind(int n = 1) {
        init(n);
    }
 
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }
 
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
 
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
 
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  COMinit();
  
  ll n;
  cin >> n;
  ll num=0;
  exrep(i,1,n){
    if(i*(i+1)/2>=n){
      num=i;
      break;
    }
  }
  for(ll i=num;i>=1;i--){
    if(n-i>=0){
      cout << i << endl;
      n-=i;
    }
  }
  
}


Measured memory_bytes: 12288
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ll long long
#define ull unsigned long long int
#define db double
#define fi first
#define se second
#define pb push_back
#define vec vector<ll>
#define pr pair<ll,ll>
#define pq priority_queue<ll,vector<ll> >
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
typedef priority_queue<ll,vector<ll>,greater<ll>> pqlg;
#define GS(s)   string s; getline(cin,s);
#define lll __int128_t
#define endl "\n"

struct compare_queue
{
    bool operator()(const ll& a, const ll& b)
    {
        return a>b;
    }
};

// ll gcd(ll u,ll v)
// {
// 	if(v==0)
// 	return u;
	
// 	else
// 	return gcd(v,u%v);
// }

    // ll power(ll x,ll y){
    //     ll i;
    //     ll ans=1;
    //     for(i=0;i<y;i++){
    //         ans=ans*x;
    //     }
    //     return ans;
    // }

// // // #define MAX 1000000
// int primes[100009],cnt=0;
// // vector<int> factors[1000009];
// char str[1000009];
// void pre()
// {
//     // calcualting primes
//     int n=1000000;
//     for(int i=2; i*i<=n; i++)
//         if(str[i]==0)
//             for(int j=i; j*i<=n; j++)
//                 str[i*j]=1;
//     for(int i=2; i<=n; i++)
//         if(str[i]==0)primes[cnt]=i,cnt++;
// }


// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
// vector<ll> getFactorization(ll x) 
// { 
//     vector<ll> ret; 
//     while (x != 1) 
//     { 
//         ret.push_back(spf[x]); 
//         x = x / spf[x]; 
//     } 
//     return ret; 
// } 

// C:\Users\A\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\lambda

ll power(ll x,ll y,ll p) 
{ 
	ll res = 1;	

	x = x % p; 

	if (x == 0) return 0;

	while (y > 0) 
	{ 
		
		if (y & 1) 
			res = (res*x) % p; 

		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
} 

// struct node{
// int val;
// node* left;
// node* right;
// };

// node* getNode(int k){
//     node* temp =new node;
//     temp->left=NULL;
//     temp->right=NULL;
//     temp->val=k;
// }



void Function(){
ll n,m,s=0;
m=pow(10,9)+7;
cin >> n;
vec a(n);
repn(i,n){
cin >> a[i];
s=((s%m)+ (a[i]%m))%m;
}

ll ans=0;

repn(i,n){
    s=((s%m)-a[i] + m)%m;
    ans=((ans%m) + (((a[i]%m)*(s%m))%m))%m;
}

cout << ans << endl;

}

int main(){ 
fast;
ll t=1,i=0,j=0,k=0,h,n;
// pre();
// cin >> t;
for(h=1;h<=t;h++){
Function();
}
return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define mod 1000000007
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
void make_unique(vector<ll> vec)
{
sort(all(vec));
vec.resize(unique(all(vec)) - vec.begin());
}


int main() 
{   ios;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--)
    {ll q,k,h,p,a,b,v,c,t,n,m,i,j,flag=0,count=0,move=0;
     ld di,ti,sp;
     cin>>di>>ti>>sp;
     ld tt=di/sp;
     if(tt<=ti)
     cout<<"Yes"<<endl; 
     else
     {
      cout<<"No"<<endl;
     }
     
    }
	return 0;
}


Measured memory_bytes: 3748
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL a,b,c,d;
int main(){
    cin>>a>>b>>c>>d;

    cout<<min(b,a)*c+max((LL)0,a-b)*d;
        
    return 0;
}


Measured memory_bytes: 256
(setq s(read-line))
(setq f 0)
(loop for i from 0 to (1-(length s))do
	  (loop for j from (1+ i)to(1-(length s))do
			(if(char=(char s i)(char s j))(incf f))))
(princ(if(> f 0)"no""yes"))


Measured memory_bytes: 13156
import java.util.Scanner;

 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        String str=in.next();
        if(n%2!=0)
            System.out.println("No");
        else{
            int i=0,j=n/2;
            boolean flag=false;
            for(;i<j && j<n;i++,j++){
                if(str.charAt(i)!=str.charAt(j)){
                    flag=true;
                    break;
                }
            }
            if(flag)
                System.out.println("No");
            else
                System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 23508
# /usr/bin/env python3
# https://atcoder.jp/contests/abc042/tasks/arc058_a

n, k = [int(x) for x in input().split()]
d = [x for x in input().split()]
while True:
    if len(set(str(n)) & set(d)) == 0:
        print(n)
        break
    n += 1


Measured memory_bytes: 2940
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>

using namespace std;

template<class T> void gc(T &x)
{
    char c;
    int s = 0;
    x = 0;

    c = getchar_unlocked();

    if (c == '-') s = 1;
    else if ('0' <= c && c <= '9')  x = c - '0';

    while (true)
    {
        c = getchar_unlocked();

        if (c < '0' || c > '9') break;
        x = x * 10 + (c - '0');
    }

    if (s) x = -x;
}

int main()
{
    int N;

    gc(N);

    vector<int> P(N);

    for (int i = 0; i < N; i++)
    {
        int tmp;
        gc(tmp);

        P[i] = tmp;
    }

    int cnt = 0;
    for (int i = 0; i < N - 1; i++)
    {
        if (P[i] == i + 1)
        {
            swap(P[i], P[i + 1]);
            cnt++;
        }
        else if (P[i + 1] == i + 2)
        {
            if (i + 2 <= N - 1 && P[i + 2] == i + 3)
            {
                swap(P[i + 1], P[i + 2]);
                cnt++;
            }
            else
            {
                swap(P[i], P[i + 1]);
                cnt++;
            }
        }
    }

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


Measured memory_bytes: 640
n = int(input())
res = [0] * n
for i in range(1, n):
  c, s, f = map(int, input().split())
  res[i-1] += s + c
  for j in range(i-1):
    if res[j] < s:
      res[j] = s + c
    elif res[j] == s:
      res[j] += c
    else:
      if (res[j] - s) % f == 0:
        res[j] += c
      else:
        res[j] = s + (((res[j] - s) // f) + 1) * f + c
for elem in res:
  print(elem)

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	int count = 0;
	for (int i = 0; i < 2; i++) {
		if (A >= B) {
			count += A;
			A -= 1;
		}
		else {
			count += B;
			B -= 1;
		}
	}
	cout << count << endl;

}






Measured memory_bytes: 3588
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll d,n;
    cin>>d>>n;
    ll ans;
    if(d==0){
        ans=n;
    }else if(d==1){
        ans = 100*n;
    }else if(d==2){
        ans = 10000*n;
    }
    if(n==100){
        ans+=pow(100,d);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long c,d,x,flag=0,flag2=0,count=0,n,m,y,sum=0;
  cin>>n>>m;
  vector<pair<long,long> > pairs;
  string s;
  rep(i,n){
    cin>>c>>d;
    pairs.push_back(make_pair(c,d));
  }
  sort(all(pairs));
  rep(i,n){
    if(m<=pairs[i].second){
      count+=pairs[i].second-(pairs[i].second-m);
      sum+=count*pairs[i].first;
      break;
    }
    else{
      sum+=pairs[i].first*pairs[i].second;
      m-=pairs[i].second;
    }
  }   
  cout<<sum<<'\n';
  return(0);
}


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

int main(){
    int N;
    cin >> N;
    
    vector <int> vec(N+1);

    for(int i=1;i<=N;i++){
        cin >> vec[i];
    }

    int count = 0;
    for(int i=1;i<=N;i++){
        if(i%2 == 1 && vec[i]%2 == 1)
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3600
a = []
for i in range(3):
    a.append([int(i) for i in (input().split())])


x = a[0][0] - a[0][1]
y = a[0][1] - a[0][2]

for i in range(3):
    if a[i][0] - a[i][1] != x or a[i][1] - a[i][2]!=y:
        print("No")
        break
    if i == 2:
        print("Yes")

Measured memory_bytes: 3064
N, M = map(int, input().split(' '))

if N > 1 and M > 1:
    print(N * M - (N - 1) * 2 - (M - 1) * 2)
elif N == 1 and M == 1:
    print('1')
elif N == 1:
    print(M - 2)
else:
    print(N - 2)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int a,b,n;
	scanf("%d",&a);
	scanf("%d",&b);
	n=a*b;
	if(n%2==0){
		printf("Even\n");
	}
	else{
		printf("Odd\n");
	}
	
	return 0;
}


Measured memory_bytes: 128
a = int(input())
if 100 <= a <= 999:
    n = str(a)
    nlist = list(n)
    rev = []
    for i in range(len(nlist)):
        rev.append(nlist[2 - i])
    print('Yes' if nlist == rev else 'No')
else:
    print('hoge!')

Measured memory_bytes: 3060
#include<bits/stdc++.h> 
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
bool isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int main()
{
	ll n,i;
	cin>>n;
	ll d[n];
	for(i=0;i<n;i++)
	{
		cin>>d[i];
	}
	//ll min1=*min_element(d,d+n);
	ll max1=*max_element(d,d+n);
	sort(d,d+n);
	ll e=d[n/2],ctr1=0,ctr2=0,ctr=0;
	ll d1=abs(d[(n/2)-1]-d[n/2]);
	cout<<d1;
	return 0;
}

Measured memory_bytes: 1024
import sys
import math
def three(n,p):
    m=float(n)-((math.pow(n,3)-p)/(3*math.pow(n,2)))
    if((math.fabs((m*m*m)-p))<0.00001*p):
        return m
    else:
        return (three(m,p))
i=0
while i<50:
    q=int(input())
    if(q==-1):
        break
    a=float(q)/2
    three_pow=three(a,q)
    print(str('{:.06f}'.format(three_pow)))



Measured memory_bytes: 5728
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        k: usize,
        p: [usize; n],
    }

    let mut s = vec![0; 1000];
    let mut st = 0;
    for i in 0..1000 {
        st += i + 1;
        s[i] = st;
    }

    let mut ps = 0.0;
    for i in 0..k {
        ps += s[p[i] - 1] as f64 / p[i] as f64;
    }
    let mut ans = 0.0;
    for i in 0..n {
        if ps > ans {
            ans = ps;
        }
        ps -= s[p[i] - 1] as f64 / p[i] as f64;
        if i + k < n {
            ps += s[p[k + i] - 1] as f64 / p[i + k] as f64;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6524
def check_number(ans):
    ans = map(int,list(str(ans)))
    for i in range(len(ans)):
        for j in range(K):
            if ans[i]==number[j]:
                return 0
    return 1

if __name__ == '__main__':
    N,K = map(int,raw_input().split())
    number = map(int,raw_input().split())

    ans = N
    count = 0
    while(count == 0):
        count = check_number(ans)
        if (count == 0):
            ans += 1

    print ans


Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <iterator>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
#include <cassert>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;

int main(){
    ll n;
    cin>>n;
    vector<ll> even(100001, 0), odd(100001,0);
    REP(i,n){
        ll a;
        cin>>a;
        if(i%2==0){
            even[a]++;
        }else{
            odd[a]++;
        }
    }
    ll even_max=MAX(even);
    ll odd_max=MAX(odd);
    auto even_dis=distance(even.begin(), max_element(even.begin(),even.end()));
    auto odd_dis=distance(odd.begin(), max_element(odd.begin(),odd.end()));

    sort(ALL(even),greater<ll>());
    sort(ALL(odd),greater<ll>());
    ll ans;
    if(even_dis!=odd_dis){
        ans=n-even_max-odd_max;
    }else{
        ans=n-max(even[0]+odd[1], even[1]+odd[0]);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4808
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	string S;
	cin >> S;
	int N = S.size();
	int ans = 0;

	REP(i, 1 << (N - 1)) {
		int sum = 0;
		int a = S[0] - '0';
		REP(j, N - 1) {
			if (i&(1 << j)) {
				sum += a;
				a = 0;
			}
			a = a * 10 + S[j + 1] - '0';
		}
		sum += a;
		ans += sum;
	}

	cout << ans << endl;
	return 0;

}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<numeric>
#include<climits>
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }
using namespace std;

int main(void) {
	int a,b;
	cin >> a >> b;
	if (a >= 13) {
		cout << b << endl;
	}
	else if (a >= 6 && 12 >= a) {
		cout << b / 2 << endl;
	}
	else if (a <= 5) {
		cout << 0 << endl;
	}
}

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

int main()
{
    int n;
    double m;
    cin>>n>>m;
    int arr[n+5];
    int sum=0;
    for(int i=0;i<n;i++)cin>>arr[i],sum+=arr[i];
    double k=1/(m*4);
    k=sum*k;
    sort(arr,arr+n);
    reverse(arr,arr+n);
    int flag=0;
    for(int i=0;i<m;i++)
    {
       if(arr[i]<k)flag++;
    }
    if(flag==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

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

    bool flag = true;
    rep(i, 3) flag = (a[i] == b[2-i]) && flag;

    if(flag){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct edge
{
    int to;
    int cost;
};
int n;
vector<edge> v[100001];
int color[100001];

void dfs(int node)
{
    for (int i = 0; i < v[node].size(); i++)
    {
        edge s = v[node][i];
        if (color[s.to] != 0)
        {
            continue;
        }
        if (s.cost % 2 == 0)
        {
            color[s.to] = color[node];
            dfs(s.to);
        }
        else
        {
            color[s.to] = color[node] * -1;
            dfs(s.to);
        }
    }
}

int main()
{
    cin >> n;
    for (int i = 0; i < n - 1; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        edge s;
        s.to = a;
        s.cost = c;
        v[b].push_back(s);
        s.to = b;
        v[a].push_back(s);
    }
    color[1] = 1;
    dfs(1);
    for (int i = 1; i <= n; i++)
    {
        cout << max(0, color[i]) << endl;
    }
}


Measured memory_bytes: 8320
import math
import decimal

if __name__ == "__main__":
    a, b = input().split()
    a = int(a)
    b = decimal.Decimal(b)

    #ans = a * b
    #ans = math.floor(ans)

    #print(ans)

    ans = a * b
    ans = math.floor(ans)

    print(ans)

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

const int MAX = 2000000;
const int VMAX = 10000;
int A[MAX+1], B[MAX+1], C[10000+1];
int n;

void countingsort(int a[], int b[], int k){
  for(int i=0;i<k;i++){
    C[i] = 0;
  }
  for(int j=0;j<k;j++) C[a[j]]++;
  for(int i=1;i<VMAX;i++) C[i] += C[i-1];
  // for(int i=0;i<VMAX;i++){
  //   if(i != n-1) cout << C[i] << " ";
  //   else cout << C[i] << endl;
  // }

  for(int j=k-1;j>=0;j--){
    b[C[a[j]]-1] = a[j];
    C[a[j]]--;
    // for(int i=0;i<n;i++){
    //   if(i != n-1) cout << B[i] << " ";
    //   else cout << B[i] << endl;
    // }
  }
}

int main(){
  cin >> n;
  for(int i=0;i<n;i++) cin >> A[i];

  countingsort(A, B, n);
  for(int i=0;i<n;i++){
    if(i != n-1) cout << B[i] << " ";
    else cout << B[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 18740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();

		String line;
		while ((line = reader.readLine()) != null) {
			if(line.isEmpty()){
				break;
			}
			StringTokenizer tokenizer = new StringTokenizer(line,",");
			int[] num = new int[5];
			for (int i = 0; i < 5; i++) {
				num[i] = Integer.parseInt(tokenizer.nextToken());
			}

			Arrays.sort(num);
			int sum = 0;
			boolean straight = true;
			for (int i = 0; i < 4; i++) {
				int j = num[i + 1] - num[i];
				if (i == 0) {
					if (j != 1 && j != 9) {
						straight = false;
					}
				} else {
					if (j != 1) {
						straight = false;
					}
				}
				if (j == 0) {
					sum += (i + 1) * (i + 2) + 1;
				}

			}

			if (straight) {
				System.out.println("straight");
			} else {
				switch (sum) {
				case 23:
				case 41:
					System.out.println("four card");
					break;
				case 31:
				case 37:
					System.out.println("full house");
					break;
				case 10:
				case 20:
				case 34:
					System.out.println("three card");
					break;
				case 16:
				case 24:
				case 28:
					System.out.println("two pair");
					break;
				case 0:
					System.out.println("null");
					break;
				default:
					System.out.println("one pair");
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 15028
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

sorted_AB = sorted(AB, key=lambda x: x[0])

total_cost = 0
total_drink = 0
for i in range(N):
    total_cost += sorted_AB[i][0] * sorted_AB[i][1]
    total_drink += sorted_AB[i][1]

    if total_drink >= M:
        timing_count = i
        break

answer = total_cost - (total_drink - M) * sorted_AB[timing_count][0]

print(answer)

Measured memory_bytes: 29360
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
	  int x;
	    cin >> x;
			if(x>=30)	cout << "Yes" << endl;
			else 	    cout << "No" << endl;
      return 0;
}


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


int main()
{
	set<int> st;
	int n;

	cin >> n;
	for ( int i=0; i<n; i++ ) {
		int t;
		cin >> t;
		st.insert(t);
	}

	cout << st.size() << endl;

	return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = [int(i) for i in input().split()]

c = Counter(A)
b = sorted(c.keys())

ret = 0
for j in range(len(c) - 1, -1, -1) :
    i = 2
    while c[b[j]] > 0 and i - b[j] <= b[j] :
        if b[j] != i - b[j] :
            if c[b[j]] > 0 and c[i-b[j]] > 0 :
                M = min(c[b[j]], c[i-b[j]])
                ret += M
                c[b[j]] -= M
                c[i-b[j]] -= M
        else :
            if c[b[j]] > 1 :
                ret += c[b[j]] // 2
                c[b[j]] %= 2
        i *= 2
    
print(ret)


Measured memory_bytes: 111828
h,w=map(int,input().split())
li=[list(map(int,input().split())) for i in range(10)]
a=[list(map(int,input().split())) for i in range(h)]

#0と2～9について、（同じ数字を経由するのはありえないことを利用して）
#全探索で「1にするのに必要なエネルギー」の最小値を求める。

seq=(0,1,2,3,4,5,6,7,8,9)
mi=[float("inf")]*10 #各数字から1にするのにかかる最小値を記録する配列

import itertools
for ptn in itertools.permutations(seq):
  num=ptn[0] #今調べる始点数値がどれか。
  en=0 #1までにするのに必要なエネルギー量を記録。
  for i in range(9):
    if ptn[i]==1:
      break
    else:
      en+=li[ptn[i]][ptn[i+1]]
  mi[num]=min(mi[num], en)

ans=0

for i in a:
  for j in i:
    if j!=-1:
      ans+=mi[j]
print(ans)

Measured memory_bytes: 44124
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
//#define m 998244353 
int m[1001][1001]={0};
int main(){
	
	ios_base::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(NULL);
  //  cin>>t;

    int t;
    cin>>t;
	int temp=0;

	while(t!=0){
		temp=t%10;
		t=t/10;
		if(temp==7) {
			cout<<"Yes";
			break;
		}
		
	}if(temp!=7)cout<<"No";
	
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

ll N,K;

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

    ll ans=min(N%K,abs(N%K-K));

    cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class A
{
    static void Main()
    {
        uint N = uint.Parse(Console.ReadLine());
        string[] S = new string[N];
        for (int i = 0; i < N; i++)
        {
            S[i] = Console.ReadLine();
        }
        string[] O = S.Distinct().ToArray();
        Console.WriteLine(O.Length);
    }
}

Measured memory_bytes: 50036
#include <stdio.h>
int main(){
  int N_tw,V_tw,i,j,k;
  scanf("%d",&N_tw);
  int A_tw[N_tw];
  for(i=0;i<N_tw;i++){
    scanf("%d",&A_tw[i]);
    
  }
  for(i=0;i<N_tw;i++){
    V_tw=A_tw[i];
    j=i-1;
    while(j>=0&&A_tw[j]>V_tw){
      A_tw[j+1]=A_tw[j];
      j--;
    }
    A_tw[j+1]=V_tw;
    for(k=0;k<N_tw;k++){
      if(1<=k&&k<N_tw)printf(" ");
      printf("%d",A_tw[k]);
      
    }
    printf("\n");
  }
  return 0;
}
  
    



Measured memory_bytes: 2100
#include <cstdio>
#include <algorithm>

int main()
{
  long long n, c, k;
  scanf("%lld%lld%lld", &n, &c, &k);
  long long t[100000];
  for (long long i = 0; i < n; ++i)
  {
    scanf("%lld", t + i);
  }
  std::sort(t, t + n);
  long long ans = 1;
  long long lim = t[0] + k;
  long long cap = c;
  for (int i = 0; i < n; ++i)
  {
    if (cap == 0 || t[i] > lim)
    {
      ++ans;
      cap = c;
      lim = t[i] + k;
    }
    --cap;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
using namespace std;
int main(void){
  int N , K , A ;
  cin >> N >> K;
  int* d = new int[K];
  int* nsk = new int[N];
  for(int i = 0; i < K; i++)
  {
    cin >> d[i];
    for(int f = 0 ; f < d[i]; f++)
    {
      cin >> A;
      nsk[A-1]++;
    }
  }
  int itzr = 0;
  for(A = 0; A < N; A++)
  {
    if(nsk[A] == 0)
      itzr++;
  }
  cout << itzr << endl;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    int N;
    cin >> N;
    vector<string> vs(N);
    for (auto& s : vs) cin >> s;

    map<map<char, int>, int> mm;
    for (auto s : vs) {
        map<char, int> m;
        for (auto c : s) {
            m[c]++;
        }
        mm[m]++;
    }

    int ans = 0;
    for (auto m : mm) {
        int t = m.second;
        ans += t * (t - 1) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 69376
#include<stdio.h>

int main(void){
    int a,b,c,i,x;
    scanf("%d%d%d",&a,&b,&c);
    int n = 0;
    for(i=a;i<=b;i++){
        x = c % i;
        if(x == 0){
            n += 1;
        }
    }
    printf("%d\n",n);
    return 0;
}


Measured memory_bytes: 2148
x, y, a, b, c = map(int, input().split())

red = sorted(list(map(int, input().split())), reverse=True)
gre = sorted(list(map(int, input().split())), reverse=True)
non = sorted(list(map(int, input().split())), reverse=True)

red = red[0:x]
gre = gre[0:y]

eat = red + gre + non

eat.sort(reverse=True)

print(sum(eat[0:x+y]))


Measured memory_bytes: 23200
#include <iostream>

using namespace std;

int main(void)
{
    int points[5];
    int connect_range;

    for(int i = 0; i < 5; i++){
        cin >> points[i];
    }
    cin >> connect_range;

    if(points[4] - points[0] > connect_range){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }

    return 0;
}
    

Measured memory_bytes: 256
def main():

	n=input()
	a=list(map(int,input().split()))
	
	
	if 0 in a:
		print(0)
		return

	d=1
    
	

	for b in a:
		d=d*b
		if d>10**18:
			print("-1")
			return
	print(d)

main()

Measured memory_bytes: 21644
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> grid(h);
    for (int i = 0; i < h; ++i) {
        cin >> grid[i];
    }
    vector<vector<bool>> visited(h, vector<bool>(w));
    static const pair<int, int> d[] = {
        {1, 0},
        {-1, 0},
        {0, 1},
        {0, -1},
    };
    ll ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (grid[i][j] == '#' && !visited[i][j]) {
                int black = 0, white = 0;
                queue<pair<int, int>> que;
                que.push({i, j});
                while (!que.empty()) {
                    auto from = que.front();
                    que.pop();
                    if (visited[from.first][from.second])
                        continue;

                    visited[from.first][from.second] = true;
                    black += grid[from.first][from.second] == '#';
                    white += grid[from.first][from.second] == '.';

                    for (const auto &e : d) {
                        int toy = from.first + e.first;
                        int tox = from.second + e.second;

                        if (!(0 <= toy && toy < h && 0 <= tox && tox < w) || visited[toy][tox] || grid[toy][tox] == grid[from.first][from.second])
                            continue;

                        que.push({toy, tox});
                    }
                }

                ans += (ll)black * (ll)white;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <queue>
#include <tuple>
#include <cmath>
#include <map>
#include <cstring>

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

using namespace std;

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

using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par.resize( n ); siz.resize( n ); par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


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

	cout << (int)ceil( ( a + b ) / 2.0 ) << endl;

	return ( 0 );
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j[2000000],N,k,n;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&j[i]);
  }
  n=0;
  k=1;
  for(i=0;i<N;i++){
    if(j[i]!=k){
      n=n+1;
    }
    else{
      n=n;
      k=k+1;
    }
  }
  if(n==N){
    printf("-1");
  }
  else{
    printf("%d",n);
  }
  return 0;
}

Measured memory_bytes: 2944
n, a, b = map(int, input().split())
s = input()
q = [1] * n
for i,l in enumerate(s):
    q[i] *= ((l == "b" and b > 0) or l == "a") and a + b > 0
    b -= q[i]*(l == "b")
    a -= q[i]*(l == "a")
print("\n".join(["YNeos"[1-i::2] for i in q]))

Measured memory_bytes: 10740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N) cin >> A[i];

    vl cnt(N + 1);
    rep(i, N) cnt[A[i]]++;

    ll sum = 0;
    rep(i,N+1){
        sum += cnt[i] * (cnt[i] - 1) / 2;
    }
    rep(i,N){
        cout << sum - (cnt[A[i]] - 1) << "\n";
    }
}

Measured memory_bytes: 5760
#include<iostream>

using namespace std;
int main(){
string s;
cin>>s;
if(s=="SUN")cout<<7;
if(s=="MON")cout<<6;
if(s=="TUE")cout<<5;
if(s=="WED")cout<<4;
if(s=="THU")cout<<3;
if(s=="FRI")cout<<2;
if(s=="SAT")cout<<1;
return 0;}


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


int main(){

	int n;
	pair<int, int> p[100010];

	cin >> n;

	for(int i = 1; i <= n; i++){
		p[i].second = i;
		cin >> p[i].first;
	}

	sort(p+1, p+n+1);

	for(int i = 1; i <= n; i++){
		cout << p[i].second << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 1536
#include<iostream>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    int a[n][m];
    int b[m];
    int c[n] = {0};
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            c[i] += a[i][j]*b[j];
        }
        cout << c[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3096
def checkpoints(N: int, M: int, students: list, points: list)->list:
    ans = []
    for x, y in students:
        min_d, min_i = float('inf'), 0
        for i, (c, d) in enumerate(points):
            if abs(x-c) + abs(y-d) < min_d:
                min_d = abs(x-c) + abs(y-d)
                min_i = i
        ans.append(min_i)

    return ans


if __name__ == "__main__":
    N = 0
    M = 0
    N, M = map(int, input().split())
    students = [tuple(map(int, input().split())) for _ in range(N)]
    points = [tuple(map(int, input().split())) for _ in range(M)]
    ans = checkpoints(N, M, students, points)

    print('\n'.join(str(i+1) for i in ans))


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;


int maze[50][50];

int tag[20];

int main()
{
    int n;
    while(~scanf("%d",&n) && n){
        memset(tag,0,sizeof(tag));
        memset(maze,0x3f,sizeof(maze));
        for(int i = 0;i <= 9;++i) maze[i][i] = 0;
        int u,v,l;
        for(int i = 1;i <= n;++i){
            scanf("%d%d%d",&u,&v,&l);
            tag[u] = tag[v] = 1;
            maze[u][v] = maze[v][u] = min(maze[u][v],l);
        }
        
        for(int k = 0;k <= 9;++k){
            for(int i = 0;i <= 9;++i){
                for(int j = 0;j <= 9;++j){
                    maze[j][i] = maze[i][j] = min(maze[i][j],maze[i][k] + maze[k][j]);
                }
            }
        }
        int pos = 0;
        long long ans = 0x3f3f3f3f3f3f;
        for(int i = 0;i <= 9;++i){
            long long tmp = 0;
            for(int j = 0;j <= 9;++j){
                if(!tag[j]) continue;
                tmp += maze[i][j];
            }
            if(ans > tmp){
                ans = tmp;
                pos = i;
            }
            
        }
        cout << pos << ' ' << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3248
#include<bits/stdc++.h>
#define gc getchar()
#define ll long long
#define pb push_back
#define mk make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<"\n"
#define pa pair<int,int>
#define fir first
#define sec second
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return  w*s;}
struct node{int to,next;} e[290010];
int n,h[101010],tot,exist[101010][21],Ans;
inline void add(int from,int to){e[++tot].next=h[from];h[from]=tot;e[tot].to=to;}
inline void DFS(int now,int ffa){
	//debug(now);
	for(rint i=h[now];i;i=e[i].next){
		int to=e[i].to;if(to==ffa) continue;
		DFS(to,now);
		for(rint j=1;j<=20;++j) exist[now][j]+=exist[to][j];
	}
	int Min=0;
	for(rint i=1;i<=20;++i) if(exist[now][i]>=2) Min=i;
	//debug(Min);
	Min++;
	while(exist[now][Min]) Min++;
	Ans=max(Ans,Min);
	exist[now][Min]=1;
	for(rint i=1;i<=Min-1;++i) exist[now][i]=0;
}
int main()
{
	n=read();
	for(rint i=1;i<n;++i){
		int u=read(),v=read();
		add(u,v);add(v,u);
	}
	DFS(1,0);
	cout<<Ans-1<<"\n";
	return 0;
}


Measured memory_bytes: 13952
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	int a, b;
	cin >> a >> b;
	if(a>=13) cout << b << endl;
	else if(a>=6) cout << b/2 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256