akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main() {
	int t[6];
	for(int i = 0; i < 3; i++) {
		int n[3] = {0, 0, 0};
		for(int i = 0; i < 6; i++) {
			cin >> t[i];
		}
		for(int i = 2; i >= 0; i--) {
			n[i] += t[i + 3] - t[i];
			if(n[i] < 0) {
				n[i - 1]--;
				n[i] += 60;
			}
		}
		cout << n[0] << " " << n[1] << " " << n[2] << endl;
	}
}

Measured memory_bytes: 0
N = int(input())
A_list = list(map(int, input().split()))

B_sum = 0
B = 10 ** 9
cnt = 0

for i in range(N):
  A = A_list[i]
  if A < 0:
    cnt += 1
    A = -A
  B_sum += A
  B = min(B, A)
  
if cnt % 2 == 0:
  print(B_sum)
else:
  print(B_sum - 2 * B)

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

int main(){

int n, k, soma=0,maior=0;
cin >> n;
int vetor[n];

for (int i=0;i<n;i++){
    cin >> k;
    vetor[i]=k;
    if (vetor[i] >=maior){soma++;maior=vetor[i];}
    }

cout << soma << endl;



return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(", ")[scanner.nextInt()-1]);
    }
}

Measured memory_bytes: 21716
N, M = map(int, input().split())
ab = sorted([list(map(int, input().split())) for _ in range(N)]) #入力する時から気をつける

count = 0
ans = 0
for _ab in ab:
    diff = M - count
    if _ab[1] < diff:
        count += _ab[1]  
        ans += _ab[0] * _ab[1]
    else:
        ans += _ab[0] * diff
        break

print(ans)


Measured memory_bytes: 28652
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(10) if c == '?' else (int(c),)
    a = [sum(a[(i - p * j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])


Measured memory_bytes: 46316
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
void HEX() {
	char x, y;
	cin >> x >> y;
	char t[6] = {'A','B','C','D','E','F'};
	map<char,int> m;
	for (size_t i = 10; i < 16; i++)
	{
		m[t[i - 10]] = i;
	}
	int a, b;
	a = m[x];
	b = m[y];

	cout << (a < b ? '<' : a == b ? '=' : '>') << endl;
}
int main() {

	HEX();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    int main(){
      int a,b;
      cin>>a>>b;
      int sum=a*(2*b+a-1)/2;
      if(a+b>0 && b<=0) cout<<sum<<endl;
      else if(b<0) cout<<sum-(b+a-1)<<endl;
      else cout<<sum-b<<endl;
      return 0;
    }

Measured memory_bytes: 256
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <cstdio>
#define ll long long
#define abs(a) ((a)>0?(a):(-a))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
ll n,a[210000],tot,ans=922372036854775805;
int main()
{
	scanf("%lld",&n);
	for(register ll i=1; i<=n; ++i) scanf("%lld",&a[i]),tot+=a[i];	 
	for(register ll i=1; i<=n-1; ++i)
		tot-=2*a[i],ans=min(ans,(ll)abs(tot));
	printf("%lld\n",ans);	
	return 0;
}

Measured memory_bytes: 1664
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
aa = 0
b = 0
for i in range(n):
    aa += a[i] ** 2  
    b += a[i]
    #aa %= mod
    #b %= mod
print((b ** 2 - aa)//2%mod)

Measured memory_bytes: 31312
#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    x = input()
    lev = 0
    for c in x:
        if c == "S":
            lev += 1
        else:
            lev -= 1
            lev = max(0, lev)
    print(lev * 2)

main()


Measured memory_bytes: 4008
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Sun Jan 20 21:00:00 2019
//
package main

import "fmt"

func main() {
	var A, B, C int
	fmt.Scan(&A, &B, C)

	fmt.Println(A * B / 2)
}


Measured memory_bytes: 512
#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>;
 
int main(){
	ll n;
	cin >> n;
	string ans = "";
	while(n != 0){
		char b = 'a' + n%26 - 1;
		if(b == '`') b = 'z';
		ans += b;
		n = (n-1)/26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int A,B;
    cin >> A>>B;

    cout << A+B/2 << endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<functional>
typedef long long ll;
using namespace std;
typedef pair<int,int> p;

int main(){
  vector<int> m;
  string s;
  for(int i=0;i<3;i++){
    int t;
    cin >> t;
    m.push_back(t);
  }
  sort(m.begin(),m.end());
  cout << m[0]+m[1] << endl;

  return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll a;
  string s;
  cin >> a;
  cin >> s;
  if (a >= 3200)
    cout << s << endl;
  else
    cout << "red" << endl;

  return 0;
}


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

int main()
{
    string str1, str2;
    int m, h, l;
    cin >> str1;
    while(str1[0] != '-')
    {
        cin >> m;
        for(int i=0; i<m; i++)
        {
            cin >> h;
            l = str1.size();
            str2 = str1;
            for(int j=0; j<l; j++)
            {
                str1[j] = str2[(j+h)%l];
            }
        }
        cout << str1 << endl;
        cin >> str1;
    }

    return 0;
}


Measured memory_bytes: 3204
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
typedef long long ll;
using namespace std;


void solve(long long N, long long X, long long T){
    long long res = N / X;
    if  (N % X == 0) { 
        cout << res * T << endl;
    } else  { 
        cout << (res + 1) * T << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long T;
    scanf("%lld",&T);
    solve(N, X, T);
    return 0;
}


Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int a, b;
    cin >> a >> b;
    //(a+b)2

    int ans;
    if ((a+b) % 2 == 0) cout << (a+b)/2 << '\n';
    else cout << "IMPOSSIBLE\n";
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}


Measured memory_bytes: 3584
#include<stdio.h>
#include<string.h>
#define N 1000
#define M 2000
char s1[M];
char s2[M];

int LGS(int,int);

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

  for(i = 0;i<n ; i++){
    scanf("%s",s1);
    scanf("%s",s2);
    printf("%d\n",LCS(strlen(s1),strlen(s2)));
  }
  return 0;
}


int LCS(int length1,int length2){
  int i,j,x;
  int result[N+1][N+1];
  x = 0;
  for(i = 0; i<length1; i++){
    result[i][0] = 0;
  }

  for(i = 0; i<length2; i++){
    result[0][i] = 0;
  }
  for(i = 0; i<length1; i++ ){
    for(j = 0;j<length2; j++){
      if(s1[i] == s2[j]&& s1[i]!=' ' &&s2[i] != ' '){
	if(i == 0||j==0){
	  result[i][j] = 1;
	}
	else{
	  result[i][j] = result[i-1][j-1]+1;
	}
      }
      else{
	if(i == 0 && j!= 0){
	  result[i][j] = result[0][j-1];
	}
	else if(i != 0 && j== 0){
	  result[i][j] = result[i-1][0];
	}

	else if(i == 0 && j == 0){
	    result[0][0] = 0;
	  }
	else if(i != 0 && result[i-1][j] > result[i][j-1]){
	  result[i][j] = result[i-1][j];
	}
	else if(result[i - 1][j] <= result[i][j-1]){
	  result[i][j] = result[i][j-1];
	}
      }
    }
  }
  return result[length1-1][length2-1];
}



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

int main() {
 int x, y, z;
  double a, b, c, d, e;
   cin  >> a;
   b = a  / 100;
  x = b;
 c = (b - x) * 10;
 y = c;
d = (c - y) * 10;
z = d;     
  cout <<x + y + z << endl;
}

Measured memory_bytes: 256
//	-*- mode: C++ -*-
//	Sum of Numbers
//
//		Write a program which reads an integer and prints sum of its digits.
//
//	Input
//		The input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 1000.
//
//		The input ends with a line including single zero. Your program should not process for this terminal symbol.
//
//	Output
//		For each dataset, print the sum of digits in x.
//
//	Sample Input
//		123
//		55
//		1000
//		0
//	Sample Output
//		6
//		10
//		1

#include <iostream>
#include <string>
#include <vector>

int	main(int	argc,
		 char*	argv[])
{
	std::vector<unsigned int>	digits	{}; 

	while(true){
		std::string	x	{};

		std::cin >> x;

		if(x == "0"){
			break;
		}

		unsigned int	sum	{0};

		for(unsigned int i = 0; i < x.length(); i++){
			sum	+=	(x[i] - '0');
		}

		digits.push_back(sum);
	}

	for(auto x : digits){
		std::cout << x << '\n';
	}

    return 0;
}



Measured memory_bytes: 3176
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

ans1=a[0]

b=ans1//2
ans2=0
for i in range(n):
    if abs(a[i]-b)<abs(ans2-b):
        ans2=a[i]

print(ans1,ans2)


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

int main() {
  int an[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int n;cin>>n;
  cout<<an[n-1];
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char xc[1000]={'0'};
  int x=0,i;
  while(1){
    scanf("%s",xc);
    for(i=0;i<1000;i++)if(xc[i]!=NULL)x+=xc[i]-48;
    if(x==0) break;
    else{
      printf("%d\n",x);
      x-=x;
      for(i=0;i<1000;i++) xc[i]=NULL;
    }
  }
  return 0;
}

Measured memory_bytes: 536
A, B, C = map(int, input().split())
K = int(input())
yes = False
for i in range(0, 8):
    for j in range(0, 8):
        for k in range(0, 8):
            if i + j + k == K:
                new_A = A * (2 ** i)
                new_B = B * (2 ** j)
                new_C = C * (2 ** k)
                if new_C > new_B and new_B > new_A:
                    yes = True
                    break
        if yes:
            break
    if yes:
        break
                
if yes:
    print("Yes")
else:
    print("No")

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

int main(){
    int n;
    
    cin >> n;
    int a[n];
    for(int i = 1;i<=n;i++){
        cin >> a[i-1];
    }
    for(int i = n;i>1;i--){
        cout << a[i-1] << " ";
    }
    cout << a[0] <<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
namespace my_std {
using namespace std;
#define reg register
#define Rint register int
#define FOR(i, a, b) for (register int i = (a), ed_##i = (b); i <= ed_##i; ++i)
#define ROF(i, a, b) for (register int i = (a), ed_##i = (b); i >= ed_##i; --i)
typedef long long i64;
#define Templ(T) template <typename T>
inline int read() {
    reg int ans = 0, f = 1;
    reg char c = getchar();
    while (!isdigit(c)) f ^= (c == '-'), c = getchar();
    for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
    return f ? ans : -ans;
}
Templ(_Tp) inline int chkmin(_Tp &x, _Tp y) { return x > y ? x = y, 1 : 0; }
Templ(_Tp) inline int chkmax(_Tp &x, _Tp y) { return x < y ? x = y, 1 : 0; }
#define mod 998244353
inline void inc(int &x, const int &y) { x += y; if (x >= mod) x -= mod; }
inline void dec(int &x, const int &y) { x -= y; if (x < 0) x += mod; }
inline void qmo(int &x){ x += (x >> 31) & mod; }
inline int ksm(int x, i64 y) {
    int res = 1;
    for (; y; y >>= 1, x = (i64)x * x % mod)
        if (y & 1) res = (i64)res * x % mod;
    return res;
}
} // namespace my_std
using namespace my_std;

#define N 410
int fac[N], ifac[N];
int n;
inline void init(int lim){
    *fac = *ifac = 1;
    FOR(i, 1, lim) fac[i] = (i64)i * fac[i - 1] % mod;
    ifac[lim] = ksm(fac[lim], mod - 2);
    ROF(i, lim - 1, 1) ifac[i] = (i64)(i + 1) * ifac[i + 1] % mod;
}

int a[N], b[N], Sa, Sb;
int f[N][N];

int main() {
    n = read();
    FOR(i, 1, n) a[i] = read(), Sb += (b[i] = read()) - 1;
    init(Sb), Sb = 0;
    f[0][0] = mod - 1;
    FOR(i, 1, n){
        Sa += a[i], Sb += b[i] - 1;
        ROF(j, Sa, a[i]) ROF(k, Sb, 0){
            reg i64 t(1);
            FOR(x, 0, min(b[i] - 1, k)){
                qmo(f[j][k] -= t * ifac[x] % mod * f[j - a[i]][k - x] % mod);
                (t *= a[i]) %= mod;
            }
        }
    }
    Rint ans(0);
    FOR(j, 1, Sa){
        reg const int inv(ksm(j, mod - 2));
        reg i64 t(Sa * (i64)inv % mod);
        FOR(k, 0, Sb){
            qmo(ans += (t * fac[k] % mod * f[j][k] % mod) - mod);
            (t *= inv) %= mod;
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

int main(void)
{
    ll d, t, s;

    cin >> d >> t >> s;

    if(s*t>=d) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, h = map(int, input().split())

a = [0]* n
b = [0]* n
for i in range(n):
    a[i], b[i] = map(int, input().split())

amax = max(a)
ans = 0

b.sort(reverse=True)

for attack in b:

    if attack < amax: break
    h -= attack
    ans += 1
    if h <= 0:
        print(ans)
        exit()

ans += -(-h//amax)

print(ans)


Measured memory_bytes: 11312
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Thu Jan 10 22:29:57 2019
//
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scan(&A, &B)

	if A%3 == 0 || B%3 == 0 || (A+B)%3 == 0 {
		fmt.Println("Possible")
	} else {
		fmt.Println("Impossible")
	}
}


Measured memory_bytes: 512
// WARNING: Add compile option "-std=c++11" for C++11 compile.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

// Macro
#define REP(i, N) for(int i=0; i<(int)N; i++)
#define REPR(i, N) for(int i=(int)N-1; i>=0; i--)
#define mp make_pair
#define pb push_back

// Type
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;

// Constants
const ll MOD = 1000000007;

/**
  型に合わせたINFを返す
  int: 214,748,364 (2.14 * 1e8)
  ll : 922,337,203,685,477,580 (9.22 * 1e17)
*/
template <typename T>
T getINF() {
  // NOTE: INF同士を足してもオーバーフロー起こさないように、10で割っている
  return numeric_limits<T>::max() / 10;
}

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

double calc_win_p(int n, int k) {
  int count = 0;
  while(n < k) {
    count++;
    n *= 2;
  }
  return 1 / (float)pow(2, count);
}

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

  double p = 0;
  REP(i, n) {
    p += (calc_win_p(i+1, k) * (1 / (double)n));
  }
  printf("%.12f\n", p);
  return 0;
}

Measured memory_bytes: 512
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        long ans = 1;
        long A[] = new long[N];
        long max = 1000000000000000000l;

        for(int i = 0; i < N; i++) {
            A[i] = scan.nextLong();
            if(A[i] == 0) {
                os.println(0);
                return;
            }
        }

        for(int i = 0; i < N; i++) {
            long digits = digits(A[i]);
            digits += digits(ans);

            if(digits > 18) {
                os.println(-1);
                return;
            }
            if(digits == 18) {
                int AFirst = fitstDigit(A[i]);
                int ansFirst = fitstDigit(ans);
                if(ansFirst != 1 || AFirst != 1){
                    os.println(-1);
                    return;
                }
            }
            ans *= A[i];
            if(ans > max) {
                os.println(-1);
                return;
            }
        }
        os.println(ans);

    }

    static int digits(long value) {
        int digits = 0;
        while(value/10 > 1){
            value /= 10;
            digits++;
        }
        return digits;
    }

    static int fitstDigit(long value) {
        while(value/10 > 1){
            value /= 10;
        }
        return (int)value;
    }
}

Measured memory_bytes: 50852
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define btinpct(x) __builtin_popcountll((x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?b:gcd(b%a,a); }

#define ll long long int 
#define ld long double
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
typedef pair <ll, ll> pi; typedef pair <ll, pi> spi; typedef pair <pi, pi> dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (300006)
ll n;
string S;
const ll MOD=1e9+7;
void add(ll &x,ll y) {
	x%=MOD, y%=MOD;
	x+=y;
	if(x<0) x+=MOD; else x%=MOD;
}
ll mult(ll x,ll y) {
	return ((x%MOD)*(y%MOD))%MOD;
}
int main()
{
	FAST
	cin>>n>>S;S="##"+S;
	vector<ll> dp;
	vector<ll> psum(2,1); psum[0]=0;
	FOR(i,2,n) {
		dp.clear();
		dp.resize(i+1, 0);
		FOR(j,1,i) {
			if(S[i]=='<') add(dp[j],psum[j-1]);
			else add(dp[j],psum.back()-psum[j-1]+MOD);
		}
		psum.clear();
		psum.resize(i+1, 0);
		FOR(j,1,i) add(psum[j],psum[j-1]+dp[j]);
	}
	cout<<psum.back()<<'\n';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
#define int long long

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef cc_hash_table<int, int, hash<int > > ht;
#define TIMES_PER_SEC (CLOCKS_PER_SEC)



double get_absolute_time()
{
	return (double)clock()/TIMES_PER_SEC;
}
double starttime_acrush;
void starttime()
{
	starttime_acrush=get_absolute_time();
}
double gettime()
{
	return get_absolute_time()-starttime_acrush;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define MOD   1000000007
#define maxn 100002
#define inf 1e18
int fun(int n){
  int i = 0 ;
  int c = 0 ;
  int  k = 1 ;
  while(n>i){
    i= i + (k);
    k*=2;
    c++;
  }
  return k ;
}

int32_t main(){

  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int n ;
  cin >> n ;
  int c=fun(n);
  cout << (c)-1;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	
	int n, q;
	int *S, *T;
	int count = 0;
	
	cin >> n;
	S = new int [n];
	
	for(int i=0;i<n;i++)
		cin >> S[i];
		
	cin >> q;
	T = new int [q];
	
	for(int i=0;i<q;i++)
		cin >> T[i];
		
	for(int i=0;i<q;i++)
		for(int j=0;j<n;j++)
			if(T[i] == S[j]) {
			count++;
			break;
		}
	cout << count << "\n";
	
	delete [] S;
	delete [] T;
	
	return 0;
}


Measured memory_bytes: 3136
import java.util.Scanner;

class Main{	
	
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		
		while (sc.hasNext()){
		int a = sc.nextInt();
		int b = sc.nextInt();
		int n = 1;
		for(int i=2; i<=a&&i<=b ;i+=0){
			if(a%i==0 &&b%i==0){
				n *= i;
				a /= i;
				b /= i;
			}else{
				i++;
			}
		}
		System.out.println(n+" "+n*a*b);
		n=1;
		}
	
	}
} 

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
int N,D;
int da[100][100];
int ans = 0;
float dis(int x,int y){
	float ret = 0;
	for(int i = 1;i<=D;i++){
		ret += pow(abs(da[x][i]-da[y][i]),2);
	}
	ret = sqrt(ret);
	
	return ret;
}
int main(){
	ios::sync_with_stdio(false);
	cin >> N >> D;
	for(int i = 1;i<=N;i++){
		for(int j = 1;j<=D;j++){
			cin >> da[i][j];
		}
	}
	for(int i = 2;i<=N;i++){
		for(int j = 1;j<i;j++){
			float t = dis(i,j);
			if(floor(t) == t){
				ans ++;
			}
		}
	}
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        var rCount = (long)s.Count(x => x == 'R');
        var gCount = (long)s.Count(x => x == 'G');
        var bCount = (long)s.Count(x => x == 'B');
        var res = rCount * gCount * bCount;
        for (int i = 1; i < s.Length - 1; i++)
        {
            for (int j = i - 1, k = i + 1; 0 <= j && k < s.Length; j--, k++)
            {
                if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) res--;
            }
        }
        Console.WriteLine(res);
    }


    static long GCD(long a, long b)
    {
        while (true)
        {
            if (b == 0) return a;
            a %= b;
            if (a == 0) return b;
            b %= a;
        }
    }
}

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

public class Main {


	public static void main(String[] args) {
		Main sol = new Main();
		long answer = sol.solve();
		System.out.println(answer);
	}

	private long solve() {

		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();
		long [] answer = new long[3];		 
		for(int i=0;i<N;i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();

			long temp_a, temp_b, temp_c;
			if (i==0) {
				temp_a = a;
				temp_b = b;
				temp_c = c;
			} else {
				 temp_a = a + Math.max(answer[1], answer[2]);
				 temp_b = b + Math.max(answer[0], answer[2]);
				 temp_c = c + Math.max(answer[0], answer[1]);				 
			}
			answer[0] = temp_a;
			answer[1] = temp_b;
			answer[2] = temp_c;
			//System.out.println(Arrays.toString(answer));
		}

		return Math.max(answer[0], Math.max(answer[1], answer[2]));
 
	}

}

Measured memory_bytes: 58064
package main

import "fmt"

func main() {
	var a int
	fmt.Scan(&a)
	var s string
	fmt.Scan(&s)
	ans := 0
	cnt := "A"
	for i :=0; i<a; i++ {
		if cnt != string(s[i]) {
			ans++
			cnt = string(s[i])
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1664
import sys

l={}
n = int(sys.stdin.readline())

for i in range(n):
    a = sys.stdin.readline().strip()
    if a in l.keys():
        l[a] += 1
    else:
        l[a] = 1

m = int(sys.stdin.readline())

for i in range(m):
    b = sys.stdin.readline().strip()
    if b in l.keys():
        l[b] -= 1

print(max(l.values()) if max(l.values()) > 0 else 0)


Measured memory_bytes: 3060
#include <stdio.h>

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

int gcd3(int a, int b, int c)
{
    int gcd_ab = gcd(a, b);
    return gcd(gcd_ab, c);
}

int main(void)
{
    int	k;
    int	ans = 0;

    if (fscanf(stdin, "%d", &k) != 1)
	return 0;

    for (int ia = 1; ia <= k; ia++) {
	for (int ib = 1; ib <= k; ib++) {
	    for (int ic = 1; ic <= k; ic++) {
		ans += gcd3(ia, ib, ic);
	    }
	}
    }

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

/*
 * vim:smartindent:sw=4:sts=4:co=84:nu:wm=78:
 */


Measured memory_bytes: 1736
<?php
	fscanf(STDIN, "%d %d", $burger, $levels);

    $total_layers = [];  
	$total_p = [];  
	$total_layers[0] = 1;
    $total_p[0] = 1; //'P'

    for($i=1;$i< min($levels,55);$i++){
     $total_layers[$i] = 2*$total_layers[$i-1] + 2 + 1;
      $total_p[$i] = 2*$total_p[$i-1]+1;
    }

	echo findP($levels,$burger);
	function findP($targetPos, $burgerLevel){
		global $total_layers,$total_p;
       if($burgerLevel == 0){
       	return 1;
       }
      if($targetPos <=1)return 0;
      if($targetPos == $total_layers[$burgerLevel]) return $total_p[$burgerLevel];
      if($targetPos == 1+$total_layers[$burgerLevel-1])return $total_p[$burgerLevel-1];
      if($targetPos == 2+$total_layers[$burgerLevel-1])return ($total_p[$burgerLevel-1]+1);
	  if($targetPos < 1+$total_layers[$burgerLevel-1]) return findP($targetPos-1,$burgerLevel-1);
      return $total_p[$burgerLevel-1] + 1+ findP($targetPos- $total_layers[$burgerLevel-1]-2  , $burgerLevel-1);
    }
?>

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

int main() {
  string S1,S2,S3; // 前半・中盤・後半：中盤は最初の文字列
  cin >> S2; // 中盤文字列
  int Q; cin >> Q;  // 操作回数
  bool Normal=true; // 文字列の状態：falseは反転状態

  char T,F,C;
  rep(i,Q){
    cin >> T;
    if(T=='1'){
      Normal = ! Normal;  // 状態を反転
    } else {
      cin >> F >> C;
      if ( F=='1' &&  Normal ){S1+=C;}  // ノーマルで前に付ける
      if ( F=='1' && !Normal ){S3+=C;}  // リバースで前に付ける
      if ( F=='2' &&  Normal ){S3+=C;}  // ノーマルで後ろに付ける
      if ( F=='2' && !Normal ){S1+=C;}  // リバースで後ろに付ける
    }
  }

  // 最終出力
  if(Normal){
    reverse(S1.begin(),S1.end());
    cout << S1 << S2 << S3 << endl;
  } else {
    reverse(S2.begin(),S2.end());
    reverse(S3.begin(),S3.end());
    cout << S3 << S2 << S1 << endl;
  }

}

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

long long n, m, x[100005], y[100005], sumx[100005], sumy[100005], start, ax, ay;
const int MOD = 1e9+7;

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

    cin >> start;
    for(int i=1; i<n; i++) {
        cin >> x[i];
        x[i] -= start;
        sumx[i] = sumx[i-1]+x[i];
    }
    cin >> start;
    for(int i=1; i<m; i++) {
        cin >> y[i];
        y[i] -= start;
        sumy[i] = sumy[i-1]+y[i];
    }

    for(int i=0; i<n; i++) {
        long long sob = sumx[n-1]-sumx[i], tob=n-i-1;
        ax = (ax+sob-tob*x[i])%MOD;
    }
    for(int i=0; i<m; i++) {
        long long sob = sumy[m-1]-sumy[i], tob=m-i-1;
        ay = (ay+sob-tob*y[i])%MOD;
    }
    cout << (ax*ay)%MOD << endl;

    return 0;
}

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

int main(){
    set<int> st;
    int N, di, i;

    cin >> N;

    for (i=0; i<N; i++) {
        cin >> di;
        st.insert(di);
    }

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

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
int H,W; 
char data[20][20];

int dp[2][2][2][1<<19];
/*
int dfs(int pos , int j , int f , int bit){ 
	//cout << pos << " " << j << " " << f << " " << bit << endl;
	if(pos == H*W) return f;
	if(memo[pos][j][f].find(bit) != memo[pos][j][f].end() ) return memo[pos][j][f][bit];
	int ans = 0;
	int x = pos % W;
	int y = pos / W;
	if(f){
		if(data[y][x] == '?') ans += 3 * dfs( pos+1 , 0 , 1 , 0);
		else ans += dfs(pos+1,0,1,0);
	}else{
		if(data[y][x] == '?'){
			if(j) ans += dfs( pos+1 , 0 , 0 , (bit>>1)|(1<<(W-2)) );
			else ans += dfs(pos+1,0,0,bit>>1);

			if(x != W-1) ans += dfs(pos+1,1,0,bit>>1);
			else 	     ans += dfs(pos+1,0,0,bit>>1);

			if(bit&1) ans += dfs(pos+1,0,1,0);
			else	  ans += dfs(pos+1,0,0,bit>>1);
			
		}else{
			if(j && data[y][x] == 'O') ans += dfs( pos+1 , 0 , 0 , (bit>>1)|(1<<(W-2)) );
			else if(data[y][x] == 'J' && x != W-1) ans += dfs(pos+1,1,0,bit>>1);
			else if(data[y][x] == 'I' && (bit&1) ) ans += dfs(pos+1,0,1,0);
			else ans += dfs(pos+1,0,0,bit>>1);
		} 
	}
	return memo[pos][j][f][bit] = ans % 100000;
}
*/
int main(){
	while(cin >> H >> W && H){
		vector<int> c;
		rep(i,H)rep(j,W) cin >> data[i][j];
		rep(i,1<<(W-1)){
			bool f = true;
			rep(j,W){
				if( (i>>(j+1) & 1) && ( (i>>j) & 1) ){ f = false; break;}
			}
			
			if(f) c.push_back(i);
		}
		
		int N = H*W , BIT = c.size();
		dp[0][0][0][0] = 1;
		for(int pos = 0 ; pos < N ; pos++){
			int x = pos % W;
			int y = pos / W;
			//cout << data[y][x] << endl;
			for(int b = 0 ; b < c.size() ; b++){
				int bit = c[b];
				for(int j = 0 ; j < 2 ; j++){
					for(int f = 0 ; f < 2 ; f++){
						dp[(pos+1)&1][j][f][bit] = 0;
					}
				}
			}
			for(int b = 0 ; b < c.size() ; b++){
				int bit = c[b];
				for(int j = 0 ; j < 2 ; j++){
					for(int f = 0 ; f < 2 ; f++){
						dp[pos&1][j][f][bit] %= 100000;
						//if(x == 1 && y) cout << dp[pos&1][j][f][bit] << endl;
						if(f){
							if(data[y][x] == '?') 	dp[(pos+1)&1][0][1][0] += 3 * dp[pos&1][j][f][bit];
							else 			dp[(pos+1)&1][0][1][0] +=     dp[pos&1][j][f][bit];
						}else{
							if(data[y][x] == '?'){
								if(j) dp[(pos+1)&1][0][0][(bit>>1)|(1<<(W-2))] += dp[pos&1][j][f][bit];
								else  dp[(pos+1)&1][0][0][bit>>1] += dp[pos&1][j][f][bit];

								if(x != W-1) dp[(pos+1)&1][1][0][bit>>1] += dp[pos&1][j][f][bit];
								else 	     dp[(pos+1)&1][0][0][bit>>1] += dp[pos&1][j][f][bit];

								if(bit&1) dp[(pos+1)&1][0][1][0] 	  += dp[pos&1][j][f][bit];
								else	  dp[(pos+1)&1][0][0][bit>>1] += dp[pos&1][j][f][bit];
			
							}else{
								if(j && data[y][x] == 'O') dp[(pos+1)&1][0][0][(bit>>1)|(1<<(W-2))] += dp[pos&1][j][f][bit];
								else if(data[y][x] == 'J' && x != W-1) dp[(pos+1)&1][1][0][bit>>1] += dp[pos&1][j][f][bit];
								else if(data[y][x] == 'I' && (bit&1) ) dp[(pos+1)&1][0][1][0] += dp[pos&1][j][f][bit];
								else dp[(pos+1)&1][0][0][bit>>1] += dp[pos&1][j][f][bit];
							} 
						}	
					}
				}
			}
		}
		cout << dp[N&1][0][1][0]%100000 << endl;
	}
}

Measured memory_bytes: 4704
# -*- coding: utf-8 -*-
# モジュールのインポート
import collections


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    # 標準入力の取得
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    B, C = [], []
    for q in range(Q):
        B_q, C_q = list(map(int, input().split()))
        B.append(B_q)
        C.append(C_q)

    return N, A, Q, B, C


def main(A: list, B: list, C: list) -> None:
    """
    求解処理.

    Args:\n
        A (list): N個の正整数からなる数列
        B (list): 操作における変換前の値
        C (list): 操作における変換後の値
    """
    # 求解処理
    sum_A = sum(A)
    counter_A = collections.Counter(A)
    for b, c in zip(B, C):
        sum_A += (c - b) * counter_A[b]
        # 結果出力
        print(sum_A)
        # カウンターの更新
        counter_A[c] += counter_A[b]
        counter_A[b] = 0


if __name__ == "__main__":
    # 標準入力を取得
    N, A, Q, B, C = get_input()

    # 求解処理
    main(A, B, C)


Measured memory_bytes: 30072
(defun solver ()
  (let* ((n (read)) (x (make-array n :fill-pointer 0)) y
         (mid 0)
         (m (1- (/ n 2))) (l (/ n 2)))
    (loop repeat n do
          (vector-push (read) x))
    (setf y (sort (copy-seq x) #'<))
    (setf mid (aref y l))
    (loop for i from 0 below n do
          (if (< (aref x i) mid)
              (format t "~a~%" (aref y l))
              (format t "~a~%" (aref y m))))))

(solver)


Measured memory_bytes: 61668
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
ans = [0] * len(S)
r = 0
l = 0
for i in range(len(S)):
	if i == len(S)-1:
		break
	if S[i] == 'R' and S[i+1] == 'R':
		ans[i] = 0
		r += 1
	elif S[i] == 'L' and S[i+1] == 'L':
		ans[i+1] = 0
		l += 1
	elif S[i] == 'R' and S[i+1] == 'L': # i と i+1 にたまる
		r += 1
		l += 1
		tmp = i
	else:
		if abs(r - l) % 2 == 0:
			ans[tmp] = (r + l) // 2
			ans[tmp+1] = (r + l) // 2
		elif r % 2 == 1 and l % 2 == 0:  # rが奇数
			ans[tmp] = (r + l)//2+1
			ans[tmp+1] = (r+ l)//2
		else:  # l が奇数
			ans[tmp] = (r + l)//2
			ans[tmp+1] = (r+ l)//2+1
		r = 0
		l = 0
if abs(r - l) % 2 == 0:
	ans[tmp] = (r + l) // 2
	ans[tmp+1] = (r + l) // 2
elif r % 2 == 1 and l % 2 == 0:  # rが奇数
	ans[tmp] = (r + l)//2+1
	ans[tmp+1] = (r+ l)//2
else:  # l が奇数
	ans[tmp] = (r + l)//2
	ans[tmp+1] = (r+ l)//2+1
print(*ans, sep=" ")


Measured memory_bytes: 8660
class Levenshtein:
    def initArray(self,str1,str2):
        distance = []
        for i in range(len(str1)+1):
            distance.append([0]*(len(str2)+1))
            distance[i][0] = i
        for j in range(len(str2)+1):
            distance[0][j] = j
        return distance
    def editDist(self,str1,str2,distance):
        dist = [0]*3
        for i in range(1,len(str1)+1):
            for j in range(1,len(str2)+1):
                dist[0] = distance[i-1][j-1] if str1[i-1]==str2[j-1] else distance[i-1][j-1]+1
                dist[1] = distance[i][j-1]+1
                dist[2] = distance[i-1][j]+1
                distance[i][j]=min(dist)
        return distance[i][j]

    def __init__(self,str1,str2):
        self.str1 = str1
        self.str2 = str2
        Levenshtein.distance = self.initArray(str1,str2)
        Levenshtein.dist = self.editDist(str1,str2,Levenshtein.distance)

    
str1 = input()
str2 = input()
leven = Levenshtein(str1,str2)
print(leven.dist)



Measured memory_bytes: 41976
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const long mod=998244353;
/*ll comb(int n,int r)
{
	ll p=1,q=1,m;
	if(n-r<r)
		r=n-r;
	while(r)
	{
		p*=n;
		q*=r;
		m=__gcd(p,q);
		p/=m;
		q/=m;
		n--;r--;
	}
	return p;
}
*/
/*int checkpermute(string s1,string s2)
{
	int n=s1.length(),i;
	vector <int> a1(26,0),a2(26,0);
	for(i=0;i<n;i++)
	{
		a1[s1[i]-'a']++;
		a2[s2[i]-'a']++;
	}
	for(i=0;i<26;i++)
		if(a1[i]!=a2[i])
			return 0;
	return 1;
}*/
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
	t=1;
    while(t--)
	{
		string s1,s2;
		cin>>s1>>s2;
		reverse(s1.begin(),s1.end());
		if(s1==s2)
			cout<<"YES";
		else
			cout<<"NO";
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        if(i%3==0||i%5==0)continue;
        sum+=i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3676
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define debug(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<i<<" "; cout<< "]" << endl
#define debugp(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<"("<<i.x<<","<<i.y<<")"<<" "; cout<< "]" << endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << "[" << *it << ": " << a << "]\t";
    err(++it, args...);
}
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
	tezz
 

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({b*d, a*d, b*c, a*c}) << endl;
 
	return 0;
}  

Measured memory_bytes: 3616
N,A,B,C,D=map(int, open(0).read().split())
T=abs(A-B)
E=D-C
n=(N-1)//2
if N&1:
    b=any(-(n-i)*E+2*i*C<=T<=(n-i)*E+2*i*D for i in range(n+1))
else:
    b=any(-(n-i)*E+2*i*C+C<=T<=(n-i)*E+2*i*D+D for i in range(n+1))
print("YNEOS"[not b::2])

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

int main()
{
ll int a,b,c;
cin>>a>>b>>c;
if(a+b+c>=22)
{
    cout<<"bust"<<endl;
}
else
{
    cout<<"win"<<endl;
}

return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
par = [-1] * n  # 親だった場合は-(その集合のサイズ)


# xがどのグループに属しているか調べる
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return find(par[x])


# 自分のいるグループの数
def size(x):
    return -par[find(x)]


# xとyの属する集合を併合
def unite(x, y):
    # 根を探す
    x, y = find(x), find(y)

    # 根が一緒
    if x == y:
        return

    # 大きい方に小さい方をくっつける
    if size(x) < size(y):
        x, y = y, x

    # xのサイズを更新
    par[x] += par[y]
    # yの親をxにする
    par[y] = x


# 同じ集合に属するか判定
def same(x, y):
    return find(x) == find(y)


bridges = [list(map(int, input().split())) for _ in range(m)]
bridges.reverse()
huben = n * (n - 1) // 2
ans = []
for i in range(m):
    ans.append(huben)
    a, b = bridges[i]
    a, b = a - 1, b - 1
    if same(a, b):
        continue
    else:
        huben -= size(a) * size(b)
        unite(a, b)
ans.reverse()
for i in range(m):
    print(ans[i])


Measured memory_bytes: 34652
#include <stdio.h>

int main( void ) {

	int n;
	double x[4], y[4];

	scanf( "%d", &n );

	while ( n-- ) {

		scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3] );

		x[0] -= x[1]; y[0] -= y[1]; x[2] -= x[3]; y[2] -= y[3];

		if ( y[0] *  x[2] -  y[2] * x[0] <= 0.0000000001 && y[0] *  x[2] -  y[2] * x[0] >= -0.0000000001 ) {

			printf( "YES\n" );

		} else {

			printf( "NO\n" );

		}

	}

	return 0;

}

Measured memory_bytes: 620
import sys
from operator import itemgetter

read = sys.stdin.read

N, *ab = map(int, read().split())
mod = 10 ** 9 + 7
ab = list(zip(ab[:N], [0] * N)) + list(zip(ab[N:], [1] * N))
ab.sort(key=itemgetter(0))

remain_pc = 0
remain_power = 0
answer = 1

for x, p in ab:
    if p == 0:
        if remain_power == 0:
            remain_pc += 1
            continue
        answer *= remain_power
        remain_power -= 1
    else:
        if remain_pc == 0:
            remain_power += 1
            continue
        answer *= remain_pc
        remain_pc -= 1
    answer %= mod

print(answer)


Measured memory_bytes: 27740
import bisect
#int bit[n+1],n

def sum(i):#[1,i]のsumを求める
    s = 0
    while(i > 0):
        s += bit[i]
        i = i&(i-1)
    return s

def add(i,x):#i番目にxを加算 i & (-i):iの最後の1のbit
    while(i <= n):
        bit[i] += x
        i += i & (-i)

n = int(input())
a = list(map(int,input().split()))
aa = sorted(a)

bit = [0]

for i in range(n):
    a[i] = bisect.bisect_left(aa,a[i])+1
    bit.append(0)

ans = 0

for i in range(n):
    ans += (i - sum(a[i]))
    add(a[i],1)

print(ans)


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll N;
ll C[200005];
ll next_idx[200005];
ll dp[200005];
ll mod = 1e9+7;

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

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

	map<ll,ll> mp;

	for (int i = N-1;i >= 0;i--){
		next_idx[i] = -1;
		if(mp[C[i]] != 0){ 
			next_idx[i] = mp[C[i]];
			mp[C[i]] = i;
		}
		mp[C[i]] = i;
	}

	dp[0] = 1;

	for (int i = 0;i < N;i++){
		dp[i] %= mod;
		if(next_idx[i] != -1){
			dp[next_idx[i]] += dp[i];
			dp[next_idx[i]] %= mod;
		}
		if(next_idx[i] != i+1){ 
			dp[i+1] += dp[i];
			dp[i+1] %= mod;
		}
	}

	dp[N] %= mod;

	cout << dp[N] << endl;

	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef map<int, int> mii;

#define fastIO \
ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

int main(){
	int n, m, l;
	cin >> n >> m >> l;
	ll dis[n][n];
	for(int i=0;i<n;i++)	{
		for(int j=0;j<n;j++)	dis[i][j] = 1e12;
		dis[i][i] = 0;
	}
	for(int i=0;i<m;i++){
		int a, b, c;
		cin >> a >> b >> c;
		--a, --b;
		dis[a][b] = dis[b][a] = c;
	}
	ll sd[n][n];
	for(int i=0;i<n;i++)	for(int j=0;j<n;j++)	sd[i][j] = dis[i][j];
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				sd[i][j] = min(sd[i][j], sd[i][k] + sd[k][j]);
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(sd[i][j] <= l)	dis[i][j] = 1;
			else	dis[i][j] = 1e12;
		}
		dis[i][i] = 0;
	}
	for(int i=0;i<n;i++)	for(int j=0;j<n;j++)	sd[i][j] = dis[i][j];
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				sd[i][j] = min(sd[i][j], sd[i][k] + sd[k][j]);
			}
		}
	}
	int q;
	cin >> q;
	while(q--){
		int s, t;
		cin >> s >> t;
		--s, --t;
		cout << ((sd[s][t]<=n)?(sd[s][t]-1):(-1)) << endl;
	}
	return 0;
}

Measured memory_bytes: 1920