akhauriyash/Code-Regression huggingface dataset:
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll pair<ll,ll>
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  998244353
const int N = 200005;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

ll n,a[N],t[4*N],dp[N];
void build(ll v,ll tl,ll tr)
{
     if (tl == tr)      t[v] = a[tl];
     else 
     {
          ll tm = (tl + tr) / 2;
          build(v*2, tl, tm);
          build(v*2+1, tm+1, tr);
          t[v] = max(t[v*2] , t[v*2+1]);
     }
}
ll sum(ll v,ll tl,ll tr,ll l,ll r) 
{
     if (l > r)     return 0;
     if (l == tl && r == tr) 
     {
          return t[v];
     }
     ll tm = (tl + tr) / 2;
     return max(sum(v*2, tl, tm, l, min(r, tm))
           , sum(v*2+1, tm+1, tr, max(l, tm+1), r));
}
void update(ll v, ll tl, ll tr, ll pos, ll new_val) {
     if (tl == tr)  t[v] = new_val;
     else 
     {
          ll tm = (tl + tr) / 2;
          if (pos <= tm)      update(v*2, tl, tm, pos, new_val);
          else                update(v*2+1, tm+1, tr, pos, new_val);
          t[v] = max(t[v*2] , t[v*2+1]);
     }
}
ll solve1(ll id)
{
    if(id==n)    return 1;
    ll ans1 = dp[id];
    if(ans1!=-1)   return ans1;
    ans1 = 0;
    ans1 = solve1(id+1);
    ans1 = (ans1 + solve1(a[id]+1))%MOD;
    return dp[id] = ans1;
}
void solve()
{
    cin >> n;
    pll p[n];
    for(ll i=0;i<n;i++)
    {
        cin >> p[i].ff >> p[i].ss;
    }
    build(1,0,n-1);
    sort(p,p+n);
    a[n-1] = n-1;
    update(1,0,n-1,n-1,n-1);
    for(ll i=n-2;i>=0;i--)
    {
        a[i] = i;
        pll range = {p[i].ff + p[i].ss,-1};
        ll temp = lower_bound(p,p+n,range) - p;
        ll maxi = sum(1,0,n-1,i+1,temp-1);
        a[i] = max(a[i],maxi);
        update(1,0,n-1,i,a[i]);
    }
    memset(dp,-1,sizeof(dp));
    ll ans1 = solve1(0);
    cout<<ans1;
}

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

Measured memory_bytes: 19072
//
//  main.swift
//  Atcoder
//
//  Created by Louis Joe Shen on 2020/9/26.
//  Copyright © 2020 Louise Joe Shen. All rights reserved.
//

import Foundation

var input = readLine()!.split(separator: " ")

var N = Int(input[0])!

var sum = 0

for i in 1 ... N{
    sum += i
}

print(sum)


Measured memory_bytes: 13580
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n;
string s;
ll a[300005];
int main()
{
	SPEED;
	cin>>n;
	cin>>s;
	for(int i=1;i<=n;i++)
	{
		if(s[i-1]=='E')
			a[i]++;
		a[i]+=a[i-1];
	}
	ll ans=n+1;
	for(int i=1;i<=n;i++)
	{
		ll x=i-1-a[i-1];
		ll y=a[n]-a[i];
		ans=min(ans,x+y);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2964
#include <stdio.h>

int main(void)
{
	int n;
	int id;
	
	while (scanf("%d", &n) != EOF){
		if (n % 39 == 0){
			id = 39;
		}
		else {
			id = n % 39;
		}
		
		printf("3C%02d\n", id);
	}
	
	return (0);
}

Measured memory_bytes: 608
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll mod  = 1000000007;
ll modinv(ll a){
  ll b = mod,u = 1,v = 0,t;
  while(b){
    t = a/b;
    a -= t*b;swap(a,b);
    u -= t*v;swap(u,v);
  }
  u %= mod;
  if(u < 0) u += mod;
  return u;
}
int main(){
  ll n,k,i,ans = 0;scanf("%lld%lld",&n,&k);
  ll P[n+1];P[0] = P[1] = 1;
  for(i=2;i<=n;i++) P[i] = P[i-1]*i%mod;
  for(i=0;i<min(n,k+1);i++){
    ans = (ans+P[n]*modinv(P[i])%mod*modinv(P[n-i])%mod*P[n-1]%mod*modinv(P[n-i-1])%mod*modinv(P[i])%mod)%mod;
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 5296
#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector <string>
#define vvs vector <vector<string>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr ll inf = INT32_MAX / 2;
constexpr ll INF = LLONG_MAX / 2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }

    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int X;
    cin >> X;
    cout << X / 500 * 1000 + X % 500 / 5 * 5 << endl;
}


    


Measured memory_bytes: 3560
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  int tmp;
  bool flag = false;
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int k=0;k<N-1;k++){
        if(a[k]>a[k+1]){
          flag = false; 
          break;
        }
        flag = true;
  }
  if(flag == true){
    cout << "YES" << endl;
        return 0;
  }
    
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      
      tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
      for(int k=0;k<N-1;k++){
        if(a[k]>a[k+1]){
          flag = false; 
          break;
        }
        flag = true;
      }
      if(flag == true){
        cout << "YES" << endl;
        return 0;
      }
      
      a[j] = a[i];
      a[i] = tmp;
    }
  }
   cout << "NO" << endl;
  return 0;
}

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

using namespace std;

int main() {
	string s,t;
  	cin>>s>>t;
  	int M = s.length(), N = t.length();
  
  	vector<vector<int> > dp(M+1, vector<int> (N+1, 0));
    	
  	for(int i=1;i<=M;i++) {
    	for(int j=1;j<=N;j++) {
        	if(s[i-1]==t[j-1])
              	dp[i][j] = 1+dp[i-1][j-1];
          	else
              	dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
  	
  	/*
  	for(auto row:dp) {
    	for(auto i:row)
          cout<<i<<" ";
      	cout<< endl;
    }
    */
  
  	int n = dp[M][N];
  	string res(n, 'x');
  
  	int i = M, j = N;
  	while(i > 0 and j > 0) {	// till we reach first row or column
    	if(s[i-1] == t[j-1]) {
        	res[n-1] = s[i-1];
          	n-=1;
          	i -= 1;
          	j -= 1;
        }
      	else {
      		if(dp[i-1][j] > dp[i][j-1]){
            	i-=1;
            }
          	else
              	j-=1;
      	}
    }
  
  	cout<<res;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
static const int mod=1000000007;
int main(){
int N;
  cin>>N;
  vector<int>C(N);
  for(int i=0;i<N;i++)
    cin>>C.at(i);
  vector<int64_t>Count(N);
  Count.at(N-1)=1;
  map<int,int>M; M[C.at(N-1)]=N-1;
  for(int i=N-2;0<=i;i--){
  if(!M.count(C.at(i))){
  M[C.at(i)]=i; Count.at(i)=Count.at(i+1);
  }else{
  int j=M.at(C.at(i)); M.at(C.at(i))=i;
    if(j==i+1)
      Count.at(i)=Count.at(j);
    else
      Count.at(i)=(Count.at(i+1)+Count.at(j))%mod;
  }
  }cout<<Count.at(0)<<endl;
    return 0;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    public static Edge[] e;
    public static int[] sum;
    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), q = in.ni();
        e = new Edge[n];
        sum = new int[n];
        for (int i = 0; i < n; i++) e[i] = new Edge();
        for (int i = 0; i < n - 1; i++) {
            int a = in.ni()-1, b = in.ni()-1;
            e[a].add(b);
            e[b].add(a);
        }
        for (int i = 0; i < q; i++) sum[in.ni()-1] += in.ni();
        dfs(-1, 0, 0);
        StringBuilder sb = new StringBuilder();
        for(int s: sum){
            sb.append(s);
            sb.append(' ');
        }
        out.println(sb);
    }
    public static void dfs(int p, int c, int x){
        sum[c] += x;
        for(Integer edge: e[c]){
            if(edge != p){
                dfs(c, edge, sum[c]);
            }
        }
    }
    public static class Edge extends ArrayList<Integer>{}
    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 118308
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

ll dfs(int n, ll x) {
  if (n == 0) return 1; 
  ll len = (1LL<<(n+1)) - 3;//n-1レベルのバーガーの高さ
  ll num = (1LL<<n)-1;//n-1レベルのバーガーのパテ数
  if(x == 1)return 0;
  else if(x <= len+1)return dfs(n-1,x-1);
  else if(x == len+2)return num+1;
  else if(x <= (len+1)*2)return num+1+dfs(n-1,x-len-2);
  else return num*2+1;
}

int main(){
  int n;
  ll x;
  cin >> n >> x;
  cout << dfs(n, x) << endl;
  return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

int main(){
	int t,n;
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		int prev;
		int mah=0,mih=0;
		rep(i,n){
			int h; scanf("%d",&h);
			if( i>0 ){
				if( prev<h )mah = max(mah, h-prev);
				else        mih = max(mih, prev-h);
			}
			prev = h;
		}
		printf("%d %d\n",mah,mih);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(void){
    int x,y,a=0;
    cin >> x;
    if(x==1){
        printf("1");
    }else{
        for(int i=1;i<=x;i++){
            for(int j=2;j<=x;j++){
                y=pow(i,j);
                if(y<=x&&y>a){
                    a=y;
                }
            }
        }
        printf("%d",a);
    }
    
    return 0;
}


Measured memory_bytes: 384
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        sc.nextLine();
        Set<String> hasOkashi = new HashSet<>();
        for(int i = 0 ; i<k; i++){
            int d = Integer.parseInt(sc.nextLine());
            String[] arr = sc.nextLine().split(" ");
            for(int j = 0; j<d;j++){
                hasOkashi.add(arr[j]);
            }
        }
        int sum = n - hasOkashi.size();
        System.out.println(sum);

    }
}

Measured memory_bytes: 37964
#include <stdio.h>

int main(){
    int a,b,i,j,sum=0;
    scanf("%d %d",&a,&b);

    int r[100][100]={0};
    
    for (i=0; i<a; i++)
    {
        for (j=0; j<b; j++)
        {
            scanf("%d",&r[i][j]);
        }
    }
    
    for (i=0; i<a; i++)
    {
        for (j=0; j<b; j++)
        {
            printf("%d ",r[i][j]);
            sum=sum+r[i][j];
        }
        printf("%d\n",sum);
        sum=0;
    }
    for (j=0; j<b; j++)
    {
        for (i=0; i<a; i++)
        {
            sum=sum+r[i][j];
        }
        printf("%d ",sum);
        sum=0;
    }
    for (i=0; i<a; i++)
    {
        for (j=0; j<b; j++)
        {
            sum=sum+r[i][j];
        }
    }
    printf("%d\n",sum);
    return 0;

}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long N;cin>>N;
    vector<long long>vec(5);
    for(int i=0;i<5;i++)cin>>vec[i];
    sort(vec.begin(),vec.end());
    long long m=vec[0];
    long long x=(N+m-1)/m;
    cout<<x+4<<endl;
}

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

#define si(n) scanf("%d",&n)
#define f first
#define s second
#define mp(a,b) make_pair(a,b)
#define MAX 100005
#define ll long long

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j;
    int n,a,b;
    cin>>n>>a>>b;
    if(abs(a-b)==1)cout<<"Borys"<<endl;
    else if((abs(a-b)-1)%2)cout<<"Alice"<<endl;
    else cout<<"Borys"<<endl;
}


Measured memory_bytes: 256
import sys
from bisect import bisect_left
sys.setrecursionlimit(10**7)
input=sys.stdin.buffer.readline
N=int(input())
*a,=map(int,input().split())
w=[[]for _ in range(N)]
INF=10**18
for _ in range(N-1):
  u,v=map(int,input().split())
  w[u-1].append(v-1)
  w[v-1].append(u-1)
dp=[INF]*N
ans=[0]*N

def dfs(now,pre):
  idx=bisect_left(dp,a[now])
  before=dp[idx]
  dp[idx]=min(before,a[now])
  ans[now]=bisect_left(dp,INF)
  for nxt in w[now]:
    if pre!=nxt:
      dfs(nxt,now)
  dp[idx]=before
dfs(0,-1)
print(*ans,sep='\n')

Measured memory_bytes: 225476
get;
lines.map({
	my ($a,$b)=(+<<.words).sort;
	my$f=0+|sqrt $a*$b-1;
	$f--if $f**2>=$a*$b;
	say $a|$a+1==$b??2*$a-2!!$a*$b>$f*($f+1)??2*$f-1!!2*$f-2
})

Measured memory_bytes: 79448
// https://atcoder.jp/contests/abc078/tasks/arc085_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, Z, W;
  cin >> N >> Z >> W;

  VL as(N);
  rep(i, N) cin >> as[i];

  VVL dp(N + 1, VL(2));  // dp[i][j] i 枚カードがひかれていて j = 0: 先手, j =
                         // 1: 後手が操作する時の答え

  repr(i, N) {
    // 先手
    {
      ll op = i == 0 ? W : as[i - 1];

      // 全部を取る場合
      chmax(dp[i][0], abs(op - as[N - 1]));

      repf(j, i + 1, N) chmax(dp[i][0], dp[j][1]);
    }

    // 後手
    {
      dp[i][1] = INF;
      ll op = i == 0 ? Z : as[i - 1];

      // 全部を取る場合
      chmin(dp[i][1], abs(op - as[N - 1]));
      repf(j, i + 1, N) chmin(dp[i][1], dp[j][0]);
    }
  }

  ll res = dp[0][0];
  cout << res << endl;
}

void solve2() {
  ll N, Z, W;
  cin >> N >> Z >> W;

  VL as(N);
  rep(i, N) cin >> as[i];

  if (N == 1) drop(abs(as[0] - W));

  ll res = max(abs(as[N - 1] - W), abs(as[N - 1] - as[N - 2]));

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve2();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
import math
cnt=0
fir=10
for i in range(5):
	a=int(input())
	b=(math.ceil(a/10))*10
	cnt += b
	if int(str(a)[-1]) != 0 and fir > int(str(a)[-1]):
		fir = int(str(a)[-1])
print(cnt+(fir-10) if fir != 0 else cnt)

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	N := nextInt(sc)
	K := nextInt(sc)
	p := make([]int, N)
	for i := 0; i < N; i++ {
		p[i] = nextInt(sc)
	}
	// fmt.Println("N", N, "K", K, "p", p)
	e := make([]float64, N)
	for i := 0; i < N; i++ {
		e[i] = float64((1+p[i])*p[i]/2) / float64(p[i])
	}
	sume := make([]float64, N+1)
	for i := 0; i < N; i++ {
		sume[i+1] = sume[i] + e[i]
	}
	// fmt.Println("e", e, "sume", sume)
	ans := 0.0
	for i := 0; i+K < N+1; i++ {
		ans = max(ans, sume[i+K]-sume[i])
	}
	fmt.Println(ans)
}
func max(a, b float64) float64 {
	if a > b {
		return a
	}
	return b
}


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

int main(){
    int N,M,X;
    cin>>N>>M>>X;
    vector<ll>C(N);
    ll sum=0;
    Graph A(N,vector<int>(M));
    rep(i,N){
        cin>>C.at(i);
        sum=sum+C.at(i);
        rep(j,M){
            cin>>A[i][j];
        }
    }
    ll money=sum;
    bool flag=false;
    for(int tmp=0;tmp<(1<<12);tmp++){
        bitset<12>s(tmp);
        ll mon=0;
        vector<int>B(M,0);
        rep(i,N){
            if(s.test(i)){
                mon=mon+C.at(i);
                rep(j,M){
                    B[j]+=A[i][j];
                }
            }
        }
        bool flag2=true;
        rep(j,M){
            if(B[j]<X){
                flag2=false;
                break;
            }
        }
        if(flag2){
            flag=true;
            money=min(money,mon);
        }
    }
    if(flag){
        cout<<money<<endl;
    }
    else{
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main()
{
	double x[4], y[4];
	int n;
	cin >> n;
	while (n--) {
		for (int i = 0; i < 4; ++i) cin >> x[i] >> y[i];
		double A1 = y[1] - y[0];
		double B1 = x[0] - x[1];
		double C1 = A1 * x[0] + B1 * y[0];
		double A2 = y[3] - y[2];
		double B2 = x[2] - x[3];
		double C2 = A1 * x[2] + B1 * y[2];
		if (A1 * B2 - A2 * B1 == 0)
			cout << "YES";
		else
			cout << "NO";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
// https://atcoder.jp/contests/abc162/tasks/abc162_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int c, int d) { return c / gcd(c, d) * d; }

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int K;
    cin >> K;
    int sum = 0;
    FOR(i, 1, K + 1) {
        FOR(j, 1, K + 1) {
            FOR(k, 1, K + 1) { sum += gcd(gcd(i, j), k); }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

/**
 * Created by sonetsuyoshi on 2016/07/31.
 */
public class Main {

    static public void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        long x = scanner.nextLong();

        long[] arr = new long[N];
        for(int i = 0; i < N; i++) {
            arr[i] = scanner.nextLong();
        }


        long count = 0;
        for(int i = 0; i < N - 2; i++) {

            long s1 = arr[i] + arr[i + 1];

            if(s1 > x) {
                if(s1 - x <= arr[i + 1]) {
                    count += s1 - x;
                    arr[i + 1] -= s1 - x;
                } else {
                    arr[i + 1] = 0;
                    count += s1 - x -arr[i + 1];
                    arr[i] -= s1 - x - arr[i + 1];
                }
            }
        }

        if(arr[N - 2] + arr[N - 1] > x) {
            count += arr[N - 2] + arr[N - 1] - x;
        }
        System.out.println(count);
    }
}

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[2005];
ll B[2005];
ll C[2005];

int main()
{
    ll N, K;
    cin >> N >> K;
    REP(i, N)
    {
        cin >> A[i];
    }

    memset(B, 0, sizeof(B));
    memset(C, 0, sizeof(C));
    REP(i, N)
    {
        FOR(j, N, i + 1)
        {
            if (A[i] > A[j])
                B[i]++;
        }
        REP(j, N)
        {
            if (A[i] > A[j])
                C[i]++;
        }
    }

    ll ans = 0;
    ll mul = K * (K - 1) / 2;
    mul %= MOD;
    REP(i, N)
    {
        ans += (B[i] * K) % MOD + (mul * C[i]) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ i=0;i<(int__)(j);i++)
#define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++)
#define all(v) v.begin(),v.end()
const int INF = 1 << 30;
template<typename T>
ostream& operator << (ostream &os , const vector<T> &v){
    rep(i,v.size()) os << v[i] << (i!=v.size()-1 ? " " : ""); return os;
}

template<typename T>
istream& operator >> (istream &is , vector<T> &v){
    rep(i,v.size()) is >> v[i]; return is;
}

pair<int,ll> div2(ll n){
    int cnt = 0;
    while(n % 2 == 0) n /= 2, cnt++;
    return make_pair(cnt, n);
}

vector<pair<int,ll>> calc_good_number(ll upper){
    vector<pair<int,ll>> res;
    set<ll> memo;
    queue<ll> que;
    que.push(2);
    que.push(8);
    while(que.size()){
        ll n = que.front(); que.pop();
        auto p = div2(n);
        if(not memo.count(p.second)){
            res.push_back(div2(n));
            memo.insert(p.second);
        }
        
        if(n < upper){
            que.push(n * 10 + 2);
            que.push(n * 10 + 8);
        }
    }
    return res;
}

map<pair<int,ll>, int> dp;
int dfs(const vector<pair<int,ll>> &good_number, int now, int left2, ll left){
    if(left == 1) return left2;
    if(dp.count(make_pair(left2, left))) return dp[make_pair(left2, left)];
    int ans = -INF;
    while(now < (int)good_number.size()){
        if(left % good_number[now].second == 0 and left2 >= good_number[now].first){
            ans = max(ans, dfs(good_number, now, left2 - good_number[now].first, left / good_number[now].second));
        }
        now++;
    }
    return dp[make_pair(left2, left)] = ans + 1;
}


bool solve(){
    ll n; cin >> n;
    if(n == 1){
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int,ll>> good_number = calc_good_number(n);
    //rep(i, good_number.size()) cerr << good_number[i].second << endl;
    int left2 = 0;
    while(n % 2 == 0) n /= 2, left2++;
    int res = dfs(good_number, 0, left2, n);
    cout << (res < 0 ? -1 : res) << endl;
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}

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

namespace ABC045A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, h;

            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            h = int.Parse(Console.ReadLine());

            Console.WriteLine((a + b) * h / 2);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main()
{
  char a[100];
  int i=0,count=0,change=0;
  scanf("%s",&a[0]);
  for(count=0;a[count]!='\0';count++);
  for(i=0;i<count/2;i++)
    if(a[i]!=a[count-i-1])change++;
  printf("%d\n",change);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define abs(x) ((x) < 0 ? (-(x)) : (x))
#define rep(i,a,m) for((i) = (a) ; (i) < (m) ; ++(i))
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.end(),x.begin()
#define sz(x) ((int)x.size())
#define PI 3.14159265

using namespace std;
/*
#ifdef JUDGE
#include <fstream>
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#else
#include <iostream>
using std::cin;
using std::cout;
#endif
*/
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pi;
int a, b, c, i, j, k;
long long ans = 0LL;
long double eps = 1.0E-14;
long long MOD = 1000000007;
/*
bool comparator(const MyStruct& lhs, const MyStruct& rhs) {
   return lhs.key < rhs.key;
}
*/
int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	long double T;
    cin >> T;
    long double pi = 3.14159265;
    cout << (2.0)*pi*T << endl;	
	return 0;
}

Measured memory_bytes: 3800
import sys

A,B,C,D = map(int,input().split())

turn = 1
while True:
    if turn % 2 == 1:
        #takahashi turn
        C = C - B

        #判定
        if C <= 0:
            print("Yes")
            sys.exit()

    if turn % 2 == 0:
        # aoki turn
        A = A - D

        #判定
        if A <= 0:
            print("No")
            sys.exit()

    turn = turn + 1



Measured memory_bytes: 9180
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <vector>
using namespace std;

int main(int argc, char* argv[]){
        int N = 0;
        int tmp = 0;
        vector<int> v;

        cin >> N;
        cin >> tmp;

        v.clear();
        v.push_back(tmp);
        for(int i=1; i<N; i++){
                cin >> tmp;
                int s = 0;
                int e = v.size();
                for(; e-s>1 ;){
                        int m = (s+e)/2;
                        if(tmp<v[m]){
                                e = m;
                        }
                        else if(tmp>=v[m]){
                                s = m;
                        }
                }
                if(tmp<v[s]){
                        v.insert(v.begin()+s, tmp);
                }
                else{
                        v.insert(v.begin()+s+1, tmp);
                }
        }

        int ans = 1;
        for(int i=v.size()-1; i>0; i--){
                if(v[i-1]<v[i]){ans++;}
        }
        printf("%d\n", ans);
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  string s;
  cin >> s;

  int L, R;
  L = (s[0]-'0')*10 + (s[1]-'0');
  R = (s[2]-'0')*10 + (s[3]-'0');

  bool lm = false;
  bool rm = false;
  if(1 <= L && L <= 12) lm = true;
  if(1 <= R && R <= 12) rm = true;

  bool yymm = false, mmyy = false;
  if(rm) yymm = true;
  if(lm) mmyy = true;

  if(yymm && mmyy) cout << "AMBIGUOUS" << endl;
  else if(!yymm && mmyy) cout << "MMYY" << endl;
  else if(yymm && !mmyy) cout << "YYMM" << endl;
  else cout << "NA" << endl;
  
  return 0;
}


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

int main(){
    string S, T;
    cin >> S >> T;
    int diff = 0;
    for(int i = 0; i < S.size(); i++){
        if (S.at(i) != T.at(i)){
            diff++;
        }
    }
    cout << diff << endl;
}

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

int main() 
{
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int l[n+1],r[n+2];
    l[0]=0;
    r[n+1]=0;
    for(int i=1;i<=n;i++)
        l[i]=__gcd(a[i],l[i-1]);
    for(int i=n;i>=1;i--)
        r[i]=__gcd(a[i],r[i+1]);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,__gcd(l[i-1],r[i+1]));
    }
    cout<<ans;
	return 0;
}

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

# 行先記憶用
rooting = [[] for _ in range(N+1)]

for _ in range(M):
    A, B = map(int, input().split())
    rooting[A].append(B)
    rooting[B].append(A)

# グループの最大人数
max_group_num = 1

# 到達判定フラグ（到達していれば1）
visited = [0 for _ in range(N+1)]

# 幅優先探索
for i in range(1, N+1):
    if  visited[i] == 1:
        continue
    visited[i] = 1
    queue = [i]
    group_num = 1

    while not queue == []:
        h = queue.pop(0)
        for n in rooting[h]:
            if visited[n] != 1:
                queue.append(n)
                group_num += 1
                visited[n] = 1

    max_group_num = max(max_group_num, group_num)

print(max_group_num)

Measured memory_bytes: 44500
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define mod 1e9+7
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)

//int a[1001][1001] //aise global me hi

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}
//memset can initialize to 0 or -1 ONLY //memset(str, 't', sizeof(str)); // string
//memset(a, 0, sizeof(a));  //1D array    // memset(a,0,sizeof(a[0][0])*n*n); //2D array
// set.insert(),find()    // sort(v.begin(),v.end(),compare)

void solve()
{
ll n,k;cin>>n>>k;

cout<<1+long(log10(n)/log10(k));

}


int main()
{

ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
   // cin>>t;
    while(t--)
    {
    
    solve();
    
    }

}

Measured memory_bytes: 640
import sys
import numpy as np
from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = list((read_func().strip()))
    S = list(input_raw)
    left_count = 0
    for i in range(N):
        if input_raw[i] == '(':
            left_count += 1

        if input_raw[i] == ')':
            if left_count > 0:
                left_count -= 1
            else:
                S.insert(0, '(')

    for i in range(left_count):
        S.append(')')
    print "".join(S)



if __name__ == '__main__':
    main()

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#ifdef MPS
#define D(x...) printf(x)
#else
#define D(x...)
#endif
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

const int maxn = 200050;

int n, m, T = 2, las, a[maxn];
char str[maxn];
struct edge{int u, v;}ans[maxn];

int main()
{
	sf("%s",str+1);
	n = strlen(str+1);
	fo(i,1,n) a[i] = (str[i] - '0');
	if(a[1] == 0 || a[n] == 1 || a[n-1] == 0) {puts("-1"); return 0;}
	fo(i,1,n) if(a[i] != a[n-i]) {puts("-1"); return 0;}
	ans[++m] = (struct edge){1, 2}; las = 2;
	fo(i,2,n-1)
	{
		if(a[i] == 1) 
		{
			ans[++m] = (struct edge){las, T+1};
			++ T; las = T;
		}
		else
		{
			ans[++m] = (struct edge){las, T+1};
			++ T;
		}
	}
	if(m != n - 1) {puts("-1"); return 0;}
	fo(i,1,m) pf("%d %d\n",ans[i].u, ans[i].v);
	return 0;
}

Measured memory_bytes: 2688
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int c = sc.nextInt();
    int[] b = new int[m];
    for(int i = 0; i < m; i++) {
      b[i] = sc.nextInt();
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
      int p = c;
      for(int j = 0; j < m; j++) {
        int a = sc.nextInt();
        p += (a * b[j]);
      }
      if(p > 0) ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include <stdio.h>

int main() {
	long long int i, N, s;

	scanf("%lld", &N);

	s = N % 10;
	s = s + (N / 10 % 10);
	s = s + (N / 100 % 10);
	s = s + (N / 1000 % 10);
	s = s + (N / 10000 % 10);
	s = s + (N / 100000 % 10);
	s = s + (N / 1000000 % 10);
	s = s + (N / 10000000 % 10);
	s = s + (N / 100000000 % 10);
	s = s + (N / 1000000000 % 10);

	printf(N % s == 0 ? "Yes\n" : "No\n");

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main(void) {
  int N, swap, flag=0;
  scanf("%d", &N);
  int p[N+1];
  for (int i = 1; i < N+1; i++) {
    scanf("%d", p+i);
    if (p[i]!=i) {
      if (flag==0) {
        swap = i;
        flag = 1;
      } else {
        if (swap==p[i]) {
          /* do nothig*/
        } else {
          printf("NO\n");
          return 0;
        }
      }

    }
  }
  printf("YES\n");
  return 0;
}


Measured memory_bytes: 128
use proconio::input;

fn main() {
    input! {
        k: i32,
        s: i32,
    }

    let mut ans = 0;

    for x in 0..=k {
        for y in 0..=k {
            let z = s - x - y;
            if 0 <= z && z <= k {
                ans += 1;
            }
            // for z in 0..=k {
            //     if x + y + z == s {
            //         ans += 1;
            //     }
            // }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int l;
  cin>>l;
  long double res = 0;
  for(double i = l / 3; i <= l / 3 + 5; i+=0.001){
    for(double j = l / 3; j <= l / 3 + 5; j+=0.001){
      double x = l - (i + j);
      if(x > 0){
	if(i * j * x > res){
	  res = i * j * x;
	}
      }
    }
  }
  cout<<setprecision(10)<<res<<endl;
  return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			long[] nh = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
			long n = nh[0];
			long h = nh[1];

			List<Pair<long, long>> values = new List<Pair<long, long>>();
			for (int i = 0; i < n; i++) {
				long[] ab = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
				values.Add(new Pair<long, long>(ab[0], 2));
				values.Add(new Pair<long, long>(ab[1], 1));
			}

			var vv = values.OrderByDescending(x => x.F).ToArray();
			long ans = 0;
			foreach (var value in vv) {
				if (h <= 0) {
					break;
				}

				if (value.S == 1) {
					h -= value.F;
					ans++;
				} else {
					long num = (long)Math.Ceiling(h / (double)value.F);
					ans += num;
					h -= num * value.F;
				}
			}

			Console.WriteLine(ans);
		}
	}

	class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
	{
		public T F; public U S;
		public Pair(T f, U s) { this.F = f; this.S = s; }
		public int CompareTo(Pair<T, U> a) => F.CompareTo(a.F) != 0 ? F.CompareTo(a.F) : S.CompareTo(a.S);
		public override string ToString() => $"{F} {S}";
	}
}


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


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




void solve() {
	int n, m; cin >> n >> m;
	int a[1000], c[1000];
	rep(i, m) {
		cin >> a[i];
		int b; cin >> b;
		c[i] = 0;
		rep(j, b) {
			int p; cin >> p;
			c[i] |= (1 << (p - 1));
		}
	}
	int dest = (1 << n) - 1;
	unsigned int q[4096];
	rep(i, 4096) q[i] = 99999999;
	q[0] = 0;
	rep(i, m) {
		rep(j, dest) {
			q[j | c[i]] = min(q[j | c[i]], q[j] + a[i]);
		}
	}
	if (q[dest] == 99999999) cout << -1 << endl;
	else cout << q[dest] << endl;
}

int main() {


	solve();


	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  cout<<(24-n)+24<<endl;

}

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


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int h,w,i,j;
    scanf("%d%d\n",&h,&w);
    int a[114][514];
    for(i=0;i<h;i++){
        int check=0;
        for(j=0;j<w+1;j++){
            scanf("%c",&a[i][j]);
            check+=a[i][j];
        }
        if(check>=46*w){h--;i--;}
    }
    for(i=0;i<w;i++){
        int check=0;
        for(j=0;j<h;j++){
            check+=a[j][i];
        }
        if(check>=46*h){for(j=0;j<h;j++){a[j][i]=0;}}
    }
    for(i=0;i<h;i++){
        for(j=0;j<w+1;j++){
            if(a[i][j]!=0){printf("%c",a[i][j]);}
        }
    }
    return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    a=lispin()
    print(a.index(0)+1)
#%%submit!
resolve()


Measured memory_bytes: 61804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;


int main(){
    ll N;
    cin>>N;
    ll NN=N-1;
    ll RN=pow(N, 0.5);
    ll Cou=0;
  	
  	//cout<<"RN="<<RN<<endl;
    for(ll i=1; i<=RN; i++){
        if(N%i==0){
            ll ri=N/i;
            ll A=N;
            ll B=N;
            while(A%i==0&&i>1){
                A/=i;
            }
            A%=i;
            if(A==1&&i>1){
			Cou++;
            //cout<<i<<endl;
            }
            while(B%ri==0){
                B/=ri;
            }
            B%=ri;
            if(B==1&&i!=ri){
              Cou++;
              //cout<<ri<<endl;
            }
            
        }
        if(NN%i==0){
            //cout<<i<<endl;
          	//cout<<NN/i<<endl;
          	Cou+=2;
            if(i==1)Cou--;
          	if(i*i==NN)Cou--;
        }
    }
    cout<<Cou<<endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int res = 0;
    rep(i, 1, n)
        res += i;
    rep(i, 1, m)
        res += i;
    cout << res;
    return 0;
}

Measured memory_bytes: 256
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";var n=r(3),i=r(5);e.exports=function(e){var t=new n(e);i(t)}},function(e,t,r){"use strict";var n=r(4);e.exports=class{constructor(e){var t=e.trim().split(/\s+/g);this.inp=new n(t)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";e.exports=class{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=e.length,this.items=e,this.ind=0}enq(e){this.size+=1,this.items.push(e)}deq(){var e=this.items[this.ind];return this.size-=1,this.ind+=1,e}clear(){this.items=[],this.size=0,this.ind=0}}}])},function(e,t,r){"use strict";e.exports=function(e){var t=e.inr(),r=e.inr();console.log(r+t)}}]);


Measured memory_bytes: 7372
#include <iostream>
#include <fstream>

using namespace std;

int const NMAX = 1e6;
bool freq[1 + NMAX];

int main() {

  int n, m = 0, ans = 0;
  cin >> n;ans+= n;cin >> n;ans+= n;
  cin >> n;m+= n;cin >> n;m+= n;
  if(ans > m){
    cout << "Left";
  }else if(ans == m){
    cout << "Balanced";
  }else{
    cout << "Right";
  }
  return 0;
}


Measured memory_bytes: 3592