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

using namespace std;

using ll = long long int; 

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}

ll gcd(ll a, ll b) {    //最小公倍数
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {    //最大公約数
  return a * b / gcd(a, b);
}
 

int main(void){

    int n,k;
    cin>>n>>k;
    int sum = 0;

    //vector<int> h(n);
    for(int i=0;i<n;i++){
        int x;
        cin>>x;

        if(x>=k)sum++;

    }

    cout<<sum<<endl;
    return 0;


}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  int a;
  cin >> a;
  cout << "ABC" << a << endl;
  ret 0;
}

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;
constexpr LL MOD = 1e9 + 7;

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	
	LL n, k;
	cin >> n >> k;

	LL res = 0;

	for (LL i = k; i <= n + 1; i++) {
		LL L = i * (i - 1) / 2;
		LL R = n * i - L;

		res += R - L + 1;
	}

	cout << res % MOD << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
typedef long long ll;


using namespace std;


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14 100兆
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll n, m, d;
  cin >> n >> m >> d;
  long double x = 0;
  if(2 * d >= n){
    x += n - d;
    x += n - d;
    x /= n * n;
  }
  else if(d == 0){
    x += n;
    x /= n * n;
  }
  else{
    x += d;
    x += 2 * (n - 2 * d);
    x += d;
    x /= n * n;
  }
  cout << fixed << setprecision(10);
  cout << x * (m - 1) << endl;
}

Measured memory_bytes: 256
A, B, K = list(map(int, input().split()))

L = []

for i in range(A, min(A + K, B + 1)):
  L.append(i)

for i in range(max(B - K + 1, A + K), B + 1):
  L.append(i)

for i in L:
  print(i)



Measured memory_bytes: 3060
#include<iostream>
#include<bits/stdc++.h>
#define ll long long int

using namespace std;
int main()
{
  ll n;
  cin >> n;
  ll i,a[n+1];
  ll cnt =0;
  for(i=1;i<=n;i++)
  {
    cin >> a[i];
    if(i%2==1&&a[i]%2==1)
    {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3604
str = input()
str_len = len(str)
h_flag = 0
for cat_i in range(str_len):
  if str_len % 2 == 1:
    print('No')
    break
  
  if h_flag == 0 and str[cat_i] == 'h':
    h_flag = 1
  elif h_flag == 1 and str[cat_i] == 'i':
    h_flag = 0
  else:
    print('No')
    break
    
  if cat_i == (str_len - 1):
    print('Yes')

Measured memory_bytes: 3064
n = int(input())
F = [list(map(int, input().split())) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]
ans = - float('inf')
for flag in range(1, 2 ** 10):  # 開店スケジュールでループを回す。ただし開店しないことはない。
    tmp = 0
    for shop in range(n):  # 他店の開店数に対応
        op = 0  # 初期値は0でしまっている
        for i in range(10):  # 曜日と時間に対応
            if flag & (1 << i):  # 論理積をとって1が立っている時
                c = 1  # 開店
            else:
                c = 0  # 閉店
            if F[shop][i] * c == 1:  # そもそも新規店舗が空いていない時はc=0で、対象の店が空いていない時はF[][]=0になる
                op += 1  # 両方開店している時
        tmp += P[shop][op]  # 利益を足す
    ans = max(ans, tmp)  # 最大値を更新
print(ans)


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

const lli MOD = 1e9 + 7;
lli dp[100005][15];

int main()
{
	string s;
	
	cin >> s;
	
	int l = s.size();
	
	lli k, val;
	
	dp[0][0] = 1;
	for(int j = 1; j <= 12; j++) dp[0][j] = 0;
	
	for(int i = 0; i < l; i++){
		if(s[i] == '?'){
			for(int j = 0; j <= 12; j++){
				if(dp[i][j] == 0) continue;
				for(k = 0; k <= 9; k++){
					val = 10 * j + k;
					dp[i+1][val%13] += dp[i][j];
					dp[i+1][val%13] %= MOD;
				}
			}
		}
		else{
			k = s[i] - '0';
			for(int j = 0; j <= 12; j++){
				if(dp[i][j] == 0) continue;
				val = 10 * j + k;
				dp[i+1][val%13] += dp[i][j];
				dp[i+1][val%13] %= MOD;
			}
		}
	}
	
	cout << dp[l][5]%MOD << "\n";
	
	return 0;
}


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

int main() {
	string a,b,c;
	cin>>a>>b>>c;
	if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007ll
#define rep(i,L,R) for(ll i=L;i<R;i++)
#define f(n) rep(i,0,n)
#define pll pair<ll,ll>
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
#define sq(X) ((X)*(X))
#define PI 3.141592653589
const ll INF = 1e18l+10,N = 1e5+1,MAX = 2e5+10;
// A B C D H F E I G K L M N P S O Q R J U Z Y X T V W

int main()
{
    int n,k,i,j;
    cin>>n>>k;
    bitset <100001> dp;
    int a[n];
    f(n) cin>>a[i];

    for(i=0;i<=k;i++)
    {
        for(j=0;j<n;j++)
        {
            if(i+a[j]>k || dp[i]) break;
            dp[i+a[j]]=1;
        }
    }
    if(dp[k]) cout<<"First\n";
    else cout<<"Second\n";
}

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

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


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

using namespace std;

typedef long long int lli;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    lli n, i, j, size, l, r, rv, lv;
    
    cin >> n;
    
    lli a[n];
    lli maximize[n][n];
    
    for(i = 0; i < n; ++i)
    {
        cin >> a[i];
        maximize[i][i] = a[i];
    }
    
    lli INF = 1e18;

    //cout << INF << '\n';
    
    
    
    /*
    for(i = 0; i < n; ++i)
    {
        for(j = 0; j < n; ++j)
        {
            maximize[i][j] = -INF;
        }
    }
    */
    
    
    
    for(size = 2; size <= n; ++size)
    {
        for(l = 0; l < n - size + 1; ++l)
        {
            r = l + size - 1;
            lv = a[l] - maximize[l + 1][r];
            rv = a[r] - maximize[l][r - 1];
            maximize[l][r] = max(lv, rv);
        }
    }
    /*
    for(i = 0; i < n; ++i)
    {
        for(j = 0; j < n; ++j)
        {
            cout << maximize[i][j] << " ";
        }
        cout << '\n';
    }
    
    
    for(i = 0; i < n; ++i)
    {
        for(j = 0; j < n; ++j)
        {
            cout << minimize[i][j] << " ";
        }
        cout << '\n';
    }
    */
    
    cout << maximize[0][n - 1];
    
    return 0;
}

Measured memory_bytes: 70400
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int ans = INF;
    rep(i, max(X, Y) + 1) {
        int cost = C * i * 2;
        cost += max(0, (X - i) * A);
        cost += max(0, (Y - i) * B);
        ans = min(ans, cost);
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int A ,B,C,K;
    cin>>A>>B>>C>>K;
while(K!=0){
    if(B<=A){
        B*=2;
        K--;
    }
    else{
        break;
    }
}
while(K!=0){
    if(C<=A||C<=B){
        C*=2;
        K--;
    }
    else{
        break;
    }
}
if(C>B&&C>A&&B>A){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}
return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int l[55];
int main(){
    int n,k;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    sort(l,l+n,greater<int>());
    int sum = 0;
    for(int i=0;i<k;i++){
        sum += l[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  cout << (k == 1 ? 0 : n - k) << endl;
  return 0;
}


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

double r[500];
double pos[500];

bool check(double r1, double p1, double r2, double p2){
	double dx = p1 - p2, dy = r1 - r2;
	double d = sqrt(dx * dx + dy * dy);
	return d <= r1 + r2;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

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

	for(int i = 1; i < N; i++){
		double ng = pos[i - 1], ok = 1e9;
		for(int loop = 0; loop < 200; loop++){
			double mid = (ok + ng) / 2;
			bool flag = true;
			for(int j = 0; j < i; j++){
				if(check(r[j], pos[j], r[i], mid)){
					flag = false;
					break;
				}
			}
			if(flag) ok = mid;
			else ng = mid;
		}
		pos[i] = ok;
	}

	double minx = 1e9, maxx = -1e9;
	for(int i = 0; i < N; i++){
		minx = min(minx, pos[i] - r[i]);
		maxx = max(maxx, pos[i] + r[i]);
	}
	cout << fixed << setprecision(15) << maxx - minx << endl;
}

Measured memory_bytes: 3276
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
    	var sc = new Scanner();
    	int n = sc.NextInt();
    	var l = new LinkedList<int>();
    	
    	for (int i = 0; i < n; i++)
    	{
    		int a = sc.NextInt();
    		if (i % 2 != 0) l.AddFirst(a);
    		else l.AddLast(a);
    	}
    	Console.WriteLine(string.Join(" ", (n % 2 == 0 ? l : l.Reverse())));
    }
    
    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }
        
    public long NextLong()
    {
    	CheckNext();
    	return long.Parse(buf[index++]);
    }
    
    public double NextDouble()
    {
    	CheckNext();
    	return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}

Measured memory_bytes: 50816
read a b
if [ $((b-a+1)) -lt -1000000 ]; then
  seq -1000000..$((b+a-1))
elif [ 1000000 -lt $((b+a-1)) ]; then
  seq $((b-a+1))..1000000
else
  seq $((b-a+1)) $((b+a-1))
fi

Measured memory_bytes: 556
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    k = I()
    ans = -1
    s = 7%k
    if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
    print(ans)

main()            


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

using namespace std;

const int N = 100000 + 5;

int a[N], c[N], x[N];

int main()
{
    int n;
    scanf("%d", &n);

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

    sort(a, a + n);

    int count = 0;

    for (int i = 0, j; i < n; i = j)
    {
        for (j = i; j < n && a[i] == a[j]; j++);
        c[count] = j - i;
        x[count] = a[i];
        count++;
    }

    if (count > 3 || count < 1)
    {
        puts("No");
        return 0;
    }

    if (count == 3)
    {
        if (c[0] == c[1] && c[1] == c[2] && (x[0] ^ x[1]) == x[2])
        {
            puts("Yes");
        }
        else
        {
            puts("No");
        }
    }
    else if (count == 2)
    {
        if (x[0] == 0 && c[1] == c[0] * 2)
        {
            puts("Yes");
        }
        else
        {
            puts("No");
        }
    }
    else
    {
        if (x[0] == 0)
        {
            puts("Yes");
        }
        else
        {
            puts("No");
        }
    }

    return 0;
}

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

def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j -= g
            cnt += 1
        A[j+g] = v


def shellSort(A, n):
    
    def func(m):
        if m == 0:
            return 1
        else:
            return func(m-1)*3 + 1
    
    G = []
    i = 0
    
    while True:
        gi = func(i)
        if gi <= n:
            G.append(gi)
            i += 1
        else:
            break
    
    G = G[::-1]
    for g in G:
        insertionSort(A, n , g)
    
    return A, G


if __name__ == '__main__':

    n = int(input())
    A = [int(input()) for i in range(n)]

    cnt = 0
    A, G = shellSort(A, n)
    
    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for i in range(n):
        print(A[i])




Measured memory_bytes: 45528
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;
typedef long long llong;
const int MOD=1000000007;

int main(int argc, char**argv){
    string s;
    cin >> s;

    int zero_start = 0;
    int one_start = 0;

    // cout << s.size() << endl;

    for (int i = 0; i < s.size(); i++){
        if (i % 2 == 0){
            // cout << s[i] << endl;
            if (s[i] == '0') one_start += 1;
            else zero_start += 1;
        }
        if (i % 2 == 1){
            if (s[i] == '1') one_start += 1;
            else zero_start += 1;
        }
    }

    // cout << "zero_start, one_start" << endl;
    // cout << zero_start << one_start << endl;
    cout << min(zero_start, one_start) << endl;

    return 0;
}

Measured memory_bytes: 512
N = int(input())
S = input()
x = 0
l = [0]
for i in range(N):
    if S[i] == 'I':
        x += 1
        l.append(x)
    elif S[i] == 'D':
        x -= 1
        l.append(x)
ans = max(l)
print(ans)

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

int main()
{
  int N, T;
  int c[1001], t[1001];
  int res=INF;
  cin >> N >> T;

  rep(i,N) {
    cin >> c[i] >> t[i];
  }

  rep(i,N){
    if(t[i]<=T) res = min(res, c[i]);
  }
  if(res==INF) cout << "TLE" << endl;
  else cout << res << endl;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a == b) && (a != c)){
        cout << "Yes" << endl;
    }
    else if((b == c) && ( a != b)){
        cout << "Yes" << endl;
    }
    else if((a == c) && (a != b)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

using namespace std;

const int MAXN = 302;

int n;
double dp[MAXN][MAXN][MAXN];
bool vis[MAXN][MAXN][MAXN];

double solve(int x, int y, int z) {
  if(vis[x][y][z])
    return dp[x][y][z];
  vis[x][y][z] = 1;

  if(!x && !y && !z)
    return dp[x][y][z] = 0;

  int total = x + y + z;
  double convertido = (double)total;
  double tot = (n - total)/convertido;

  if(x != 0) tot += x*((solve(x-1,y,z) + 1)/convertido);
  if(y != 0) tot += y*((solve(x+1,y-1,z) + 1)/convertido);
  if(z != 0) tot += z*((solve(x,y+1,z-1) + 1)/convertido);
  return dp[x][y][z] = tot;
}

int main() {
  int a[4] = {0,0,0,0};
  cin >> n;
  for(int i=1; i<=n; ++i) {
    int x;
    cin >> x;
    ++a[x];
  }
  cout.precision(10);
  cout << solve(a[1],a[2],a[3]);
  return 0;
}


Measured memory_bytes: 241920
import java.util.*;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	private void run() {
		Scanner scan = new Scanner(System.in);
		while (scan.hasNext()) {
			long a = scan.nextInt();
			long b = scan.nextInt();
			
			long gcd = gcd(a, b);
			long lcm = a * b / gcd;
			System.out.println(gcd + " " + lcm);
		}
	}
	
	private long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}else {
			return gcd(b, a%b);
		}
	}

}

Measured memory_bytes: 17224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
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(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template <typename First> void Exit(First first){cout << first << endl;exit(0); };

int main(){
    iosetup;
    int N; cin >> N;
    cout << (N - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);
 
int main () {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll n;
  cin >> n;
  ll ans = (1000 - (n % 1000)) % 1000;
  cout << ans << endl;
  
}


Measured memory_bytes: 3644
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int K, S;
    cin >> K >> S;

    long long res = 0;
    for (int sum = max(0, S - K); sum <= 2 * K && sum <= S; ++sum) {
        int l = max(0, sum - K);
        int r = min(sum, K);
        int cnt = r - l + 1;
        res += max(0, cnt);
    }

    cout << res << '\n';

    return 0;
}

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

int main() {
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    int x = (c-a)*60 + (d-b) - e;
    cout << x << endl;
    return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const ll INF = 1e18;
const int MOD = 1000000007;

long long modpow(long long a, long long b,long long mod){
        bitset<30> bit(b);
        string s = bit.to_string();
        long long ret = 1;
        for (int i = 0;i< s.length(); ++i){
                ret = (ret * ret) % mod;
                if(s[i]-'0') ret = (ret * a) % mod;
        }
        return ret;
}

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> cnt(k+1);
    for(ll i=2;i<=k;i++){
        cnt[i] = modpow(k/i,n,MOD);
    }
    ll s = 0;
    for(ll i=k;i>=2;i--){
        ll p = 2;
        while(i * p <= k){
            cnt[i] = (cnt[i] - cnt[i*p] + MOD)%MOD;
            ++p;
        }
        s = (s + cnt[i])%MOD;
    }
    cnt[1] = (modpow(k,n,MOD) - s + MOD)%MOD;
    ll ans = 0;
    for(ll i=1;i<=k;i++){
        ans = (ans + (cnt[i] * i)%MOD)%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3972
from scipy.sparse.csgraph import floyd_warshall
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(H)]

wf = floyd_warshall(c)
ans = 0
for i in range(H):
    for j in range(W):
        if a[i][j] == -1 or a[i][j] == 1:
            continue
        else:
            ans += wf[a[i][j]][1]

print(int(ans))

Measured memory_bytes: 14100
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
using namespace std;

int main(){
    int N;cin>>N;
    int X[200010],Y[200010];
    for(int i=0;i<N;i++){
        cin>>X[i];
        Y[i]=X[i];
    }
    sort(Y,Y+N);
    int M,m;
    M=Y[N/2];
    m=Y[N/2-1];

    for(int i=0;i<N;i++){
        if(X[i]>=M)cout<<m<<endl;
        else cout<<M<<endl;
    }
    return 0;
}

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

const int N = 2003;
int n;
long long dp[N][N], fp;
pair<int, int> b[N];

long long a(int i) {
	return b[i].first;
}

int o(int i) {
	return b[i].second;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> b[i].first;
		b[i].second = i;
	}
	sort(b + 1, b + n + 1);
	reverse(b + 1, b + n + 1);
	for(int i = 1; i <= n; ++i) {
		for(int j = 0; j <= i; ++j) {
			if(j && i - j) dp[j][i - j] = max(dp[j - 1][i - j] + a(i) * (o(i) - j), dp[j][i - j - 1] + a(i) * (n - (i - j - 1) - o(i)));
			else if(j) dp[j][i - j] = dp[j - 1][i - j] + a(i) * (o(i) - j);
			else /*if(i - j)*/ dp[j][i - j] = dp[j][i - j - 1] + a(i) * (n - (i - j - 1) - o(i));
		}
	}
	fp = dp[0][n];
	for(int i = 1; i <= n; ++i)
		fp = max(fp, dp[i][n - i]);
	cout << fp << endl;
	return 0;
}


Measured memory_bytes: 26344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll sum = 0;
    int n, m;
    cin >> n >> m;
    ll res = 0;
    map<ll, int> freq;
    for (int i = 0; i < n; i++) {
        ll in;
        cin >> in;
        in %= m;
        sum += in;
        sum %= m;
        res += freq[sum];
        freq[sum]++;
    }
    res += freq[0];
    cout << res;
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int L = 50;

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

int main() {
    int n;
    ll k;
    cin >> n >> k;

    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vector<vector<ll>> dp(L+1, vector<ll>(2, -1));  // dp[上からi桁まで][smaller]

    dp[0][0] = 0;
    rep(d, L) {

        ll mask = 1LL << (L - d - 1);

        int num = 0;  // aで元々d桁目にビットが立っているものの個数
        rep(i, n) {
            if(a[i] & mask) {
                num++;
            }
        }

        // Xのd桁目を0,1にしたときのコスト
        ll cost0 = mask * num;
        ll cost1 = mask * (n - num);

        if(dp[d][1] != -1) {
            chmax(dp[d+1][1], dp[d][1] + max(cost0, cost1));  // 0でも1でも自在に大きい方
        }

        if(dp[d][0] != -1) {

            if(k & mask) {  // kのd桁目が1だったらXのd桁目は0にする
                chmax(dp[d+1][1], dp[d][0] + cost0);
            }
        }

        if(dp[d][0] != -1) {

            if(k & mask) {
                chmax(dp[d+1][0], dp[d][0] + cost1);
            }
            else {
                chmax(dp[d+1][0], dp[d][0] + cost0);
            }
        }

    }

    cout << max(dp[L][0], dp[L][1]) << endl;
    return 0;
}

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

int dist[200000];
int main(void)
{
	cin.tie(0);	ios_base::sync_with_stdio(0);
	int k, n;	cin >> k >> n;
	int maxdiff = -1;
	for(int i=0; i<n; i++)
		cin >> dist[i];
	sort(dist, dist+n);
	for(int i=1; i<n; i++)
		maxdiff = max(maxdiff, dist[i]-dist[i-1]);
	maxdiff = max(maxdiff, k-dist[n-1]+dist[0]);
	cout << k-maxdiff;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
a = [int(x) for x in input().split()]
ite = 0
for i in range(N):
    if a[i] != 0:
        break
    else:
        ite += 1
if ite == N :
    print("Yes")
    exit()

if N % 3 != 0:
    print("No")
    exit()
else:
    n = N//3

a = sorted(a)
for j in range(n-1):
    if a[j] != a[j + 1]:
        print("No")
        exit()


for k in range(n, 2*n-1):
    if a[k] != a[k + 1]:
        print("No")
        exit()

for p in range(2*n, 3*n-1):
    if a[p] != a[p + 1]:
        print("No")
        exit()


if a[n] ^ a[0] != a[2*n]:
    print("No")
    exit()

print("Yes")


Measured memory_bytes: 14212
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
				Scanner sc = new Scanner(System.in);
				
				int X = sc.nextInt();
				int Y = sc.nextInt();
				
				int ans = X + Y/2;
				System.out.println(ans);

	}

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n,h;
  cin>>n>>h;
  vector<int> b(n);
  int max_a=0;
  REP(i,n){
    int a;
    cin>>a>>b[i];
    max_a=max(max_a,a);
  }

  sort(ALL(b),greater<int>());
  int ans=0;
  REP(i,n){
    if(b[i]<=max_a) break;
    if(h<=0) break;
    h-=b[i];
    ans++;
  }
  while(h>0){
    h-=max_a;
    ans++;
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 640
h,w,n = [int(_) for _ in input().split(" ")]
d = {}
for _ in range(n):
  a, b = [int(_) for _ in input().split(" ")]
  for i in [-1, 0, 1]:
    for j in [-1, 0, 1]:
      k = (a+i,b+j)
      if k in d:
        d[k] += 1
      else:
        d[k] = 1

ans = {i:0 for i in range(1,10)}
s = 0
for k, v in d.items():
  if 1 < k[0] < h and 1 < k[1] < w:
    ans[v] += 1
    s += 1
ans[0] = (w-2) * (h-2) - s

for _ in range(10):
  print(ans[_])

Measured memory_bytes: 166484
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> d(13, 0);
    d[0]++;
    for(int i = 0; i < n; i++) {
        int c;
        cin >> c;
        d[c]++;
        if(d[c] > 2) {
            cout << 0 << endl;
            return 0;
        }
    }
    int ans = 0;
    for(int i = 0; i < (1 << 13); i++) {
        bitset<13> bit(i);
        vector<int> v;
        for(int j = 0; j < 13; j++) {
            if(d[j] == 1) {
                if(bit[j]) {
                    v.push_back(j);
                } else {
                    v.push_back(24 - j);
                }
            }
            if(d[j] == 2) {
                v.push_back(j);
                v.push_back(24 - j);
            }
        }
        int ta = INT_MAX;
        for(int x = 0; x < v.size(); x++) {
            for(int y = x + 1; y < v.size(); y++) {
                int tmp = max(v[x], v[y]) - min(v[x], v[y]);
                ta = min(ta, min(tmp, 24 - tmp));
            }
        }
        ans = max(ans, ta);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] a = Console.ReadLine().Split(' ');

        int[] ans = new int[N];
        for (int i = 0; i < a.Length; i++)
            ans[int.Parse(a[i]) - 1]++;

        Console.WriteLine(string.Join(" ", ans));
    }
}


Measured memory_bytes: 43732
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int red = 0, white = 0;
    vi count(n);
    rep (i, n) {
        if (s.at(i) == 'R') red++;
        else white++;
        count.at(i) = white;
    }
    if (red == 0) cout << 0 << endl;
    else cout << count.at(red - 1) << endl;
    return 0;
}

Measured memory_bytes: 4448
#include <stdio.h>

int main(void)
{
	int W, H, x, y, r;

	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

	if (x - r < 0 || x + r > W || y - r < 0 || y + r > H)
		puts("No");
	else
		puts("Yes");

	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int R,G,B,N;
	cin >> R >> G >> B >> N;

	lint ans=0;
	for(int r=0;r<=3000;r++)
	{
		for(int g=0;g<=3000;g++)
		{
			int cnt=R*r+G*g;
			if(N-cnt>=0 && (N-cnt)%B==0)
				ans++;
		}
	}

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



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	_, _ = fmt.Scanf("%d", &n)
	m := map[string]int{"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

	for i := 0; i < n; i++ {
		var ans string
		_, _ = fmt.Scanf("%s", &ans)
		m[ans]++
	}
	//
	//mSorted := map[int]string{}
	//mKeys := []int{}
	//for k, v := range m {
	//	mSorted[v] = k
	//	mKeys = append(mKeys, v)
	//}
	//sort.Slice(mKeys, func(i, j int) bool {
	//	return mKeys[i] > mKeys[j]
	//})
	//for _, v := range mKeys {
	//	fmt.Printf("%s x %d\n", mSorted[v], v)
	//}
	//for k, v := range m {
	//	fmt.Printf("%s x %d\n", k, v)
	//}
	fmt.Printf("AC x %d\n", m["AC"])
	fmt.Printf("WA x %d\n", m["WA"])
	fmt.Printf("TLE x %d\n", m["TLE"])
	fmt.Printf("RE x %d\n", m["RE"])
}


Measured memory_bytes: 6348
#include<stdio.h>
int gcd(int x, int y)
{
	int t,r;
	if(x==0)
		return x;
	if(y==0)
		return y;
	if(x<y)
	{
		t = x;
		x = y;
		y = t;
	}
	do{
		r = x%y;
		if(r){
			x = y;
			y = r;
		}
	}while(r);
	return y;
}
int main()
{
	int K,i=1,j=1,k=1;
	long long sum=0;
	scanf("%d",&K);
	for(i=1;i<=K;i++)
		for(j=1;j<=K;j++)
			for(k=1;k<=K;k++)
				sum+=gcd(gcd(i,j),k);
	printf("%lld",sum);
}

Measured memory_bytes: 1720
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
   int n,m;
   cin >> n >> m;

   vector<int> broken(n+1);

   for(int i=0;i<m;i++){
     int a;
     cin >> a;
     broken[a] = 1;
   }
   vector<int> dp(n+2);
   const int mod = 1000000007;
   dp[n] = 1;
     for(int i=n-1;i>=0;i--) {
       if (broken[i]) {
       dp[i]=0;
       continue;
       }
      dp[i] = (dp[i+1] + dp[i+2]) % mod;
     }
  cout << dp[0] << endl;
  return 0;
}


Measured memory_bytes: 1024
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
 
int main()
{
	fast;
	ll t;
	cin>>t;
  string s;
  cin>>s;
  ll mid=s.size();
  if(t>=mid)
    cout<<s<<endl;
  else
  {
    for(int i=0;i<t;i++)
    {cout<<s[i];}
    cout<<"..."<<endl;
  }
}

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


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

bool isBitOne(ll x, int bit){
  return 1 == ((x >> (bit-1)) & 1);
}

ll doCalc(ll x){
    if(x%4 == 0) return x;
    if(x%4 == 1) return 1;
    if(x%4 == 2) return x+1;
    return 0;
}


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

    ll a,b;
    cin >> a >> b;
    ll ans =doCalc(a-1)^doCalc(b);
    cout << ans << endl;


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,a;
  cin >> n >> a;
  cout << n*n-a << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
typedef long long ll;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int n,x; cin >> n>>x;
    vector<int> m(n);
    int mn = INF;
    int sm = 0;
    for (int i = 0; i < n; i++) {
        cin >> m[i];
        mn = min(mn, m[i]);
        sm += m[i];
    }

    int res = n;
    res += (x - sm)/mn;

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;


int main(){
  int d;
  cin >> d;
  if(d==25){cout << "Christmas" << endl;}
  if(d==24){cout << "Christmas Eve" << endl;}
  if(d==23){cout << "Christmas Eve Eve" << endl;}
  if(d==22){cout << "Christmas Eve Eve Eve" << endl;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define MOD 1000000007
#define vec(a) vector<int>a
using namespace std;

bool isPrime(ll n)
{
	if(n==1||n==2||n==3||n==5||n==7)
		return 1;
	else
	{
		ll i,j,k,l,m;
		for(i=2;i<=sqrt(n);i++)
		{
			if(n%i==0)
				return 0;
		}
		return 1;
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	ll n;
	cin>>n;
	while(1)
	{
		if(isPrime(n))
		{
			cout<<n<<"\n";
			break;
		}
		else
			n++;
	}
	return 0;
}
	

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, a) for (ll i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n+1);

  int color = 101;
  int count = 0;

  rep(i,n) cin >> a[i];
  rep(i,n){
    if(a[i] == a[i+1]){
      a[i+1] = 101;
      color++;
      count++;
    } 
  }
  cout << count << endl;
}

Measured memory_bytes: 256
s=input()

a=[1,0,0,0]

for i in range(len(s)):
    c=s[i]
    if c=="A":
        a[1]+=a[0]
    elif c=="B":
        a[2]+=a[1]
    elif c=="C":
        a[3]+=a[2]
    elif c=="?":
        tmp=[a[i] for i in range(4)]
        a[0]=tmp[0]*3
        for j in range(3):
            a[j+1]=tmp[j+1]*3+tmp[j]

    a=[a[i]%1000000007 for i in range(4)]

print(a[3])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const long long MOD = 1000000007;

const long long max_cache=1000000;
long long cache_fact[max_cache],cache_inv_fact[max_cache];
long long combination_cached(long long n,long long r){
  ll m=MOD;
  if(r<0||r>n)return 0;
  if(r==0||r==n)return 1;
  if(n>m){
    std::cerr<<"Combination Error: n is greater than m"<<std::endl;
    exit(1);
  }
  static bool cached=false;
  if(cached==false){
    cached=true;
    cache_inv_fact[1]=1;
    for (long long i = 2; i < max_cache; i++) {
      cache_inv_fact[i]=(m-m/i)*cache_inv_fact[m%i]%m;
    }
    for (long long i = 2; i < max_cache; i++){
      cache_inv_fact[i]=cache_inv_fact[i]*cache_inv_fact[i-1]%m;
    }
    cache_fact[0]=1;
    for (long long i = 1; i < max_cache; i++) {
      cache_fact[i]=cache_fact[i-1]*i%m;
    }
  }
  r=min(r,n-r);
  return cache_fact[n]*cache_inv_fact[r]%m*cache_inv_fact[n-r]%m;
}
void solve(long long N, long long M, long long K){
  ll ans=0;
  For(i,N){
    For(j,M){
      ans=(ans+(i+j)*combination_cached(N*M-2,K-2)%MOD*(N-i)%MOD*(M-j)%MOD)%MOD;
      if(i>0&&j>0){
        ans=(ans+(i+j)*combination_cached(N*M-2,K-2)%MOD*(N-i)%MOD*(M-j)%MOD)%MOD;
      }
    }
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    solve(N, M, K);
    return 0;
}


Measured memory_bytes: 15872
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toDouble() }.toMutableList()
    var sum = 0.0
    for (i in a) {
        sum += 1 / i
    }
    println(1 / sum)
}

Measured memory_bytes: 37904
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;
string s,q;
string::iterator i;
int a=0;
int main(){
	cin>>s;
	i=s.begin();
	for(int j=0;j<s.size();j++){
		*i=tolower(*i);
	i++;}

	while(cin>>q&&q!="END_OF_TEXT"){
		i=q.begin();
	for(int j=0;j<q.size();j++){
		*i=tolower(*i);
	i++;}
		if(q==s){a++;}
	}
	cout<<a<<endl;
return 0;}
	


Measured memory_bytes: 1192
/**
 *   created: 03 June 2019  00:25:23
**/
#include<bits/stdc++.h>
using namespace std;

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

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
ll modexpo(ll n, ll p){
	if(p==0)
		return 1;
	if(p%2==0)
		return modexpo((n%MOD * n%MOD)%MOD, p/2);
	return (n%MOD*modexpo(n,p-1)%MOD)%MOD;
}
int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n;
		cin>>n;
		int sum=0,maxi=-1;
		while(n--){
			int x;
			cin>>x;
			sum += x;
			maxi = max(x,maxi);
		}
		cout<<sum-maxi/2;
	}
	return 0;
}


Measured memory_bytes: 256