akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void DFS(int V,int P,int C,int PC,vector<vector<int> > & GRAPH,vector<int> &color,map<pair<int,int> ,int> & mp)
{
  if(PC != -1)//initial
  color[mp[make_pair(P,V)]] = C;
  int nC = 1;
  for (auto &&i : GRAPH[V])
  {
    if(i == P)continue;
    while(nC == C)nC++;

    DFS(i,V,nC,C,GRAPH,color,mp);
    nC++;
  }
  return;
}
void solve(void)
{
  int N;cin>>N;
  vector<vector<int> > GRAPH(N);
  map<pair<int,int> ,int>mp;
  for (int i = 0; i < N-1; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    GRAPH[A].push_back(B);
    GRAPH[B].push_back(A);
    mp[make_pair(A,B)] = i;
    mp[make_pair(B,A)] = i;
  }
  vector<int> color(N,-1);
  DFS(0,-1,0,-1,GRAPH,color,mp);
  set<int> SET;
  for (int i = 0; i < N-1; i++)
  {
    SET.insert(color[i]);
  }
  cout<<SET.size()<<endl;
  
  for (int i = 0; i < N-1; i++)
  {
    cout<<color[i]<<endl;
  }
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


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

int main() {
    long double a, b, x, h1, h2, rad, deg;
    cin >> a>>b>>x;

    if(a*a*b/2<=x){
        h1 = x / (a * a);
        h2 = b - h1;

        //cout<<h1<<" "<<h2<<endl;
        
        rad = atan(h2/(a/2));
        
        deg = rad * 360 / (2 * M_PI);
        
        cout<<setprecision(12)<<deg<<endl;
    }
    else{
        h1 = 2 * x /(a*b);
        
        rad = atan(h1/b);
        
        deg = rad * 360 / (2 * M_PI);
        
        cout<<setprecision(12)<<90-deg<<endl;
    }
    
    
    //cout<<setprecision(12)<<deg<<endl;
    
    return 0;
}


Measured memory_bytes: 512
package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var H, W, N, P int
	fmt.Scan(&H, &W, &N)
	P = max(H, W)
	fmt.Println((N + P - 1) / P)
}


Measured memory_bytes: 512
n = int(input())
s = input()
b = ""
ab = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(int(len(s))):
    for j in range(int(len(ab))):
        if (s[i] == ab[j]):
            if (int(j+n) > 25):
                b += ab[j+n-26]
                break
            else:
                b += ab[j+n]
                break

print(b)


Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int h1, m1, h2, m2, K;
    cin >> h1 >> m1 >> h2 >> m2 >> K;
    int start = 60 * h1 + m1;
    int end = 60 * h2 + m2;
    cout << end - start - K << endl;
    return 0;
}

Measured memory_bytes: 3636
N, M = gets.chomp.split.map(&:to_i)
$aa = []
N.times do
  $aa << gets.chomp
end
$bb = []
M.times do
  $bb << gets.chomp
end

ans = "No"

def match(x, y)
  ret = true
  for i in 0..(M - 1) do
    for j in 0..(M - 1) do
      unless $aa[y + j][x + i] == $bb[j][i]
        ret = false
        break
      end
    end
    break if ret == false
  end
  ret
end

for i in 0..(N - M) do
  for j in 0..(N - M) do
    ret = match(j, i)
    if ret
      ans = 'Yes'
      break
    end 
  end
  break if ans == 'Yes'
end

puts ans

Measured memory_bytes: 1788
#include<algorithm>
#include<cstdio>
#include<string>
#include<iostream>
using namespace std;
string s, p[4];
int sz[4];
int main() {
	cin >> s;
	reverse(s.begin(), s.end());
	p[0] = "maerd";
	sz[0] = 5;
	p[1] = "remaerd";
	sz[1] = 7;
	p[2] = "esare";
	sz[2] = 5;
	p[3] = "resare";
	sz[3] = 6;
	search:
	for (int i = 0; i < 4; ++i)
		if (s.substr(0, sz[i]) == p[i]) {
			s.erase(0, sz[i]); goto search;
		}
	puts(s.empty() ? "YES" : "NO");
	return 0;	
}


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

int main() {
  int n;
  cin >> n;
  vector<int> l(2*n);
  rep(i,0,2*n) cin >> l[i];
  sort(l.begin(), l.end());
  int ans = 0;
  rep(i,0,n) {
    ans += l[i*2];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
use std::io;
use std::io::BufRead;
use std::cmp;

fn main() {
    let stdin = io::stdin();
    let stdin_lock = stdin.lock();

    let mut splitted = stdin_lock.split(b'\n');
    let (n, k) = parse_two_nums(splitted.next().unwrap().unwrap().as_ref());

    let mut sushi_params = splitted.map(|line_res| {
            let line = line_res.unwrap();
            parse_two_nums(line.as_ref())
        })
        .collect::<Vec<(usize, usize)>>();
    sushi_params.sort_by(|a, b| b.1.cmp(&a.1));

    let mut not_duplicated = Vec::with_capacity(n);
    let mut duplicated = Vec::with_capacity(n);
    let mut dup_check = vec![false; n+1];
    for &(type_num, d_point) in sushi_params.iter() {
        if !dup_check[type_num] {
            not_duplicated.push(d_point);
            dup_check[type_num] = true;
        } else {
            duplicated.push(d_point);
        }
    }

    let mut sums_at_nth = Vec::with_capacity(not_duplicated.len() + 1);
    sums_at_nth.push(0);
    let mut total = 0;
    for d_point in not_duplicated.iter() {
        total += *d_point;
        sums_at_nth.push(total);
    }

    let mut sums_at_nth2 = Vec::with_capacity(duplicated.len() + 1);
    sums_at_nth2.push(0);
    total = 0;
    for d_point in duplicated.iter() {
        total += *d_point;
        sums_at_nth2.push(total);
    }

    let mut ans = 0;
    for i in 0..k+1 {
        let not_dup_num = i;
        let dup_num = k - not_dup_num;

        if sums_at_nth.len() > not_dup_num && sums_at_nth2.len() > dup_num {
            let temp = sums_at_nth[not_dup_num] + sums_at_nth2[dup_num] + i * i;
            ans = cmp::max(ans, temp);
        }
    }

    println!("{}", ans);
}

fn parse(num_bytes: &[u8]) -> usize {
    let mut digit = num_bytes.iter()
        .take_while(|byte| is_num_byte(**byte))
        .count() as u32 - 1;
    num_bytes.iter()
        .take_while(|b| **b != b' ')
        .fold(0, |mut total, byte| {
            let num = 10_u32.pow(digit) * (*byte - b'0') as u32;
            total += num as usize;

            if let Some(checked) = digit.checked_sub(1) {
                digit = checked;
            }
            total
        })
}

fn parse_two_nums(multi_num_bytes: &[u8]) -> (usize, usize) {
    let mut not_num_idx: usize = 0;
    for (idx, byte) in multi_num_bytes.iter().enumerate() {
        if !is_num_byte(*byte) {
            not_num_idx = idx;
            break;
        }
    }
    not_num_idx += 1;
    (parse(&multi_num_bytes[0..not_num_idx]), parse(&multi_num_bytes[not_num_idx..]))
}

fn is_num_byte(byte: u8) -> bool {
    for b in b'0' .. b'9'+1 {
        if b == byte { return true }
    }
    false
}

Measured memory_bytes: 8444
n,qq = map(int,input().split())

g = [[] for _ in range(n)]

for i in range(n-1):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)


l = [0]*n
count = [0]*n

for _ in range(qq):
    p,x = map(int,input().split())
    l[p-1] += x

p = [True]*n
p[0] = False


q = [0]

while q:
    v = q.pop()
    for w in g[v]:
        if p[w]:
            p[w] = False
            l[w] += l[v]
            q.append(w)

print(*l)

Measured memory_bytes: 107136
import java.util.*;
import java.io.*;
import java.math.*;

public class Main{



  public static OutputStream out=new BufferedOutputStream(System.out);
  static Scanner sc=new Scanner(System.in);
  static long mod=1000000007l;
  static int INF=10000000;
  static int[] rr=new int[]{1, 0, -1, 0};                                 //rook row move
  static int[] rc=new int[]{0, 1, 0, -1};                                 //rook col move

  //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
  public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes()); }
  public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
  public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes()); out.write(("\n").getBytes());}
  public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
  public static void scanl(long[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextLong();}
  public static void scani(int[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextInt();}
  public static void scan2D(int[][] a,int n,int m) {for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=sc.nextInt();}
  //static variables

  //


  public static void main(String[] args) throws IOException{
    long sttm=System.currentTimeMillis();
    long mod=100000l;

    int t=sc.nextInt();
    nl(1-t);

    out.flush();
  }

}

class Pair{
  int x; int y;
  Pair(int x,int y){
    this.x=x;
    this.y=y;
  }
}


Measured memory_bytes: 38504
#include<bits/stdc++.h>
using namespace std;
string s;
string st,ed;
int q,t,f;
char c;
int main()
{
    cin>>s;
    scanf("%d",&q);
    bool cnt=0;
    while(q--)
    {
        scanf("%d",&t);
        if(t==1) cnt^=1;
        else
        {
            scanf("%d %c",&f,&c);
            if(f==1)
            {
                if(cnt) ed+=c;
                else st+=c;
            }
            else
            {
                if(cnt) st+=c;
                else ed+=c;
            }
        }
    }
    if(cnt)
    {
        reverse(s.begin(),s.end());
        reverse(ed.begin(),ed.end());
        s=ed+s+st;
    }
    else
    {
        reverse(st.begin(),st.end());
        s=st+s+ed;
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 1348
#pragma GCC optimize("O3")
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(ll i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b)
{
    return (a.first.second<b.first.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
bool cmp(const array<int,3> &a, const array<int,3> &b)
{
    return a[0]<b[0];
}
bool cmp2(const array<int,3> &a, const array<int,3> &b)
{
    return (double(a[2])/double(a[0]))>(double(b[2])/double(b[0]));
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}
int main()
{
    vok();
    ll n,m,k;
    IN n>>m>>k;
    vll fact, ifact;
    fact.pb(1);
    loop(i,1,n+1)
    {
        fact.pb((fact[i-1]*i)%M);
    }
    loop(i,0,n+1)
    {
        ifact.pb(P(fact[i],M-2,M)%M);
    }
    ll ans=0;
    loop(i,0,k+1)
    {
    	ll m1=m;
        m1%=M;
        ll m2=P(m-1,n-1-i,M);
        m2%=M;
      //m1=1;
      	//m1=1;
        ll add=(m1*m2)%M;
        ll mul=fact[n-1]%M;
        mul*=ifact[i];
        mul%=M;
        mul*=ifact[n-1-i];
        mul%=M;
        add*=mul;
        add%=M;
        ans+=add;
        ans%=M;
    }
    OUT (ans%M)<<endl
    return 0;
}

Measured memory_bytes: 7920
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main()
{
    ll n,d,ans=0;
    cin >> n >> d;
    ll x[n][d];
    rep(i,n){
        rep(j,d) cin >> x[i][j];
    }
    rep(i,n-1){
        REP(j,i+1,n){
            double tmp=0.0;
            rep(k,d) tmp+=pow(x[i][k]-x[j][k],2);
            tmp=sqrt(tmp);
            if((ll)tmp==tmp) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> a(3*N);
  for (int i = 0; i < 3*N; i++) cin >> a.at(i);
  sort(a.begin(), a.end(), greater<int>());
  long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += a.at(2*i + 1);
  }
  cout << ans << endl;
}



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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        int[] u = new int[n];
        int[] v = new int[n];
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            u[i] = x + y;
            v[i] = x - y;
            if (i != 0 && Math.abs(u[i - 1] % 2) != Math.abs(u[i] % 2)) {
                System.out.println(-1);
                return;
            }
        }
        int r = 1 ^ Math.abs(u[0] % 2);
        System.out.println(31 + r);
        if (r == 1) {
            System.out.println(1);
        }
        for (long i = 1; i >> 31 != 1; i <<= 1) {
            System.out.println(i);
        }

        long b = (1L << 31) - 1 - r;
        char[] d = {'L', 'D', 'U', 'R'};
        for (int i = 0; i < n; i++) {
            if (r > 0) {
                System.out.print("R");
            }
            long u1 = (u[i] + b) / 2;
            long v1 = (v[i] + b) / 2;
            for (int j = 0; j < 31; j++, u1 /= 2, v1 /= 2) {
                System.out.print(d[(int)(Math.abs(u1 % 2) * 2 + Math.abs(v1 % 2))]);
            }
            System.out.println();
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int n; cin >> n;
    map<int, int> m;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(a <= 399) m[1]++;
        else if(a <= 799) m[2]++;
        else if(a <= 1199) m[3]++;
        else if(a <= 1599) m[4]++;
        else if(a <= 1999) m[5]++;
        else if(a <= 2399) m[6]++;
        else if(a <= 2799) m[7]++;
        else if(a <= 3199) m[8]++;
        else m[9]++;
    }
    int min = m.size();
    int max = m.size();
    if(m[9]){
        if(min != 1) min -= 1;
        max += m[9] - 1;
    }
    cout << min << " " << max << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	int N;
	cin >> N;
	multiset<LL> A;
	vector<LL> koho;
	for(int i=0; i<N; i++){
		LL tmp;
		cin >> tmp;
		A.insert(tmp);
		if(A.count(tmp) == 2){
			koho.push_back(tmp);
			A.erase(tmp);
			A.erase(tmp);
		}
	}
	sort(koho.begin(), koho.end());
	if(koho.size() < 2) cout << 0 << endl;
	else{
		cout << koho[koho.size()-1]*koho[koho.size()-2] << endl;
	}
	

	return 0;
}


Measured memory_bytes: 4992
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;

int main()
{
    ll n;
    cin>> n;
    vector<ll> a(n);
    ll ans=1;
    rep(i,n){
        cin >> a[i];
        if(a[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,n){
        ans*=a[i];
        if(i<n-1 && ans>(INF/a[i+1])){
            cout << -1 << endl;
            return 0;
        }
        if(ans>INF){
            cout << -1 << endl;
            return 0;
        }
    }
    //cout << setprecision(30);
    cout << ans << endl;
    return 0;
} 

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

using namespace std;

#define ll long long
const int N = 1e5;

int main() {
//#ifndef ONLINE_JUGDE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll n;
    cin>>n;
    string ans="";
    while(n){
    	ll ch=n/26;
    	ll z=n%26;
    	if(z==0){
    		ch--;
    		ans=(char)('z')+ans;
		}
		else
			ans=(char)('a'+z-1)+ans;
		n=ch;
	}
	cout<<ans;
    return 0;
}

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

using namespace std;

using ll = long long;

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

    int n;
    cin >> n;

    vector<ll> a(n);
    for (auto &ai : a) cin >> ai;
    sort(a.begin(), a.end());

    deque<ll> order;
    int l = 0, r = n - 1;
    order.push_front(a[l++]);
    while (l <= r) {
        if (l <= r) order.push_front(a[r--]);
        if (l <= r) order.push_back(a[r--]);
        if (l <= r) order.push_front(a[l++]);
        if (l <= r) order.push_back(a[l++]);
    }

    ll sum1 = 0;
    for (auto it = order.begin(); it != order.end(); ++it) {
        if (next(it) != order.end()) {
            sum1 += abs(*next(it) - *it);
        }
    }

    l = 0, r = n - 1;
    order.clear();
    order.push_front(a[r--]);
    while (l <= r) {
        if (l <= r) order.push_front(a[l++]);
        if (l <= r) order.push_back(a[l++]);
        if (l <= r) order.push_front(a[r--]);
        if (l <= r) order.push_back(a[r--]);
    }
    ll sum2 = 0;
    for (auto it = order.begin(); it != order.end(); ++it) {
        if (next(it) != order.end()) {
            sum2 += abs(*next(it) - *it);
        }
    }

    cout << max(sum1, sum2) << endl;

    return 0;
}


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

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int n,k;
//vector<int> dm(100);

int func0(vector<int> &v2,int l,int r,int n,int k){
  int sabun=r-l;
  int a=0;
  vector<int> dm(sabun);
  for(int i=0;i<sabun;i++){
    dm[i]=v2[l+n+i];
  }
  sort(dm.begin(), dm.end());
  int skipk=k-sabun;
  for(int i=0;i<sabun;i++){
    if (dm[i]>0){
      a+=dm[i];
    }else{
      skipk--;
      if (skipk<0)a+=dm[i];
    }
  }

  return a;
}



int main(){
  int ans=0;
  cin>>n>>k;
  vector<int> v(n);
  vector<int> v2(n*2);
  REP(i,n){
    cin>>v[i];
    v2[i]=v[i];
    v2[i+n]=v[i];
  }


  int kk=min(k,n);
  int tmp;
  REP(rght,kk+1){
    for(int left=rght-kk;left<=0;left++){
      if (left!=rght){
        //cout<<left<<" "<<rght<<endl;
        tmp=func0(v2,left,rght,n,k);
        ans=max(ans,tmp);
      }
    }
  }


  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef double db;
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define SZ(x) (int)(x.size())
#define sci(x) scanf("%d",&(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define syn ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
ll modpow(ll x,ll n,ll mod){ll res=1;for(;n;n>>=1,x=x*x%mod)if(n&1)res=res*x%mod;return res;}
const db eps=1e-8,PI=acos(-1.0);
const int N=2e5+10,M=1e6+10,INF=0x3f3f3f3f,mod=1e9+7;//998244353
int n,k,c,len;
int dp[N],pos;
char s[N];
int main(){
	sci(n),sci(k),sci(c);
	scanf("%s",s+1);
	rep(i,1,n){
		if(s[i]=='o'){
			if(!pos || i-pos>c){
				pos=i;
				len++;
				dp[i]++;
			}
		}
	}
	if(len>k)return 0*puts("");
	pos=n+1;
	len=0;
	per(i,n,1){
		if(s[i]=='o'){
			if(pos==n+1 || pos-i>c){
				pos=i;
				len++;
				dp[i]++;
			}
		}
	}
	if(len>k)return 0*puts("");
	rep(i,1,n){
		if(dp[i]==2){
			printf("%d\n",i);
		}
	}
    return 0;
}

Measured memory_bytes: 2432
n,p = map(int,input().split())
a = list(map(int,input().split()))
even = 0
odd = 0
for i in range(len(a)):
         if a[i] % 2 == 0:
                  even += 1
         else:
                  odd += 1
if p == 1 and odd == 0:
         print(0)
else:
         print((2**(max(0,odd-1)))*(2**even))


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if(A + B > C + D)
    cout << "Left" << endl;
  else if(A + B < C + D)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <memory.h>

using namespace std;

const int MAX_N = 100000;
int N;
int Q;
bool marked[MAX_N + 4];
int par[MAX_N + 4];

int find(int x) {
//    if (marked[par[x]]) {
    if (par[x] == x) {
        return par[x];
    }
    return find(par[x]);
}

int main() {
    while (scanf("%d %d", &N, &Q) != EOF && N > 0 && Q > 0) {
        memset(marked, 0, sizeof(marked));
        marked[1] = 1;
        long long res = 0;
        for (int i = 2; i <= N; i++) {
            scanf("%d", &par[i]);
        }
        par[1] = 1;
        cin.ignore();
        char operation;
        int node;
        for (int i = 0; i < Q; i++) {
            scanf("%c %d", &operation, &node);
            if (operation == 'Q') {
                res += find(node);
            }
            else if (operation == 'M') {
//                marked[node] = 1;
                par[node] = node;
            }
            cin.ignore();
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MAX_N = 1e5 + 10;
LL N,A,B;
LL h[MAX_N];

bool isOK(int key)
{
    LL add = 0;
    REP(i,N)
    {
        if(h[i] - key * B <= 0) continue;
        else
        {
            add += (h[i] - key * B + (A-B-1)) / (A - B);
        }
    }
    if(add > key) return false;
    else return true;
}


int binary_search() {
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = 1e9 + 10; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (abs(ng - ok) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid)) ok = mid;
        else ng = mid;
    }


    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return ok;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    cin >> N >> A >> B;
    REP(i,N) cin >> h[i];

    cout << binary_search() << endl;
    REP(i,N)
    {
        dump(i)
        dump(isOK(i))
    }

}


Measured memory_bytes: 1024
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        int M = sc.nextInt();
        int D = sc.nextInt();
      
      int count = 0; 
      for(int k = 4 ; k <= M ; k++){
        for(int i = 22; i <= D; i++){
            int d1 = i % 10;
            int d10 = i / 10;
            if((d1 * d10  == k) && (d1 != 1)&&(d10 != 1)){
              count++;
           } 
        }
      }
      
         System.out.println(count);
      
    }
}

Measured memory_bytes: 35732
import sys
sys.setrecursionlimit(10**9)
from functools import lru_cache
mod=1000000007

@lru_cache()
def calc(l,r):
    if l>r:
        return 0
    if r==0:
        return 1
    b_l,b_r=l.bit_length(),r.bit_length()
    if b_l==b_r:
        return calc(l-(1<<(b_l-1)),r-(1<<(b_r-1)))
    if r==(1<<(b_r-1))-1 and l==0:
        return pow(3,b_r,mod)
    return (calc(l,r-(1<<(b_r-1)))+calc(l,(1<<(b_r-1))-1)+calc(0,r-(1<<b_r-1)))%mod

@lru_cache()
def solve(l,r):
    if l>r:
        return 0
    b_l,b_r=l.bit_length(),r.bit_length()
    if b_r>b_l:
        return (solve(l,(1<<b_r-1)-1)+calc(0,r-(1<<(b_r-1))))%mod
    a=1<<(b_l-1) if l else 0
    return calc(l-a,r-a)

l,r=map(int,input().split())
print(solve(l,r))

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
#include <map>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

int main()
{
    // 整数の入力
    ll N;
    map<string,ll> data;
    vector<ll> lengthes;
    cin >> N;
    for(int i = 0;i< N;i++){
        string music;
        ll length;
        cin >> music >> length;
        lengthes.push_back(length);
        data[music] = i;
    }
    string X;
    cin >> X;
    ll total = 0;
    for(int i = data[X] + 1;i< N;i++){
        total += lengthes[i];
    }
    cout << total << endl;

    return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  string s;
    cin >> s;
  int ans = 0;
    rep(i,4){
      if(s[i]=='+')ans++;
      else ans--;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define MOD 10007
string tmp = "JOI", s;//sは当番
int dp[1001][1 << 3], n;
int rec(int now,int bit){
  if(now == n) return 1;
  if(dp[now][bit]) return dp[now][bit];
  int ret = 0;
  for(int i = 1 ; i < 8 ; i++ ){
    if((bit & i )/*昨日の当番がいるかどうか*/&& ((i >> tmp.find(s[now])/*２進数にしたとき当番のところが１になっているか*/) & 1)){
      ret += rec( now + 1, i);
    }
  }
  return dp[now][bit] = ret % MOD;
}
int main(){
  cin >> n >> s;
  cout << rec(0,1) << endl;
}

Measured memory_bytes: 1304
c,n=map(int,input().split())
arr=list(map(int,input().split()))
if c>=n:
  print(0)
else:
  arr=sorted(arr)
  diff=[]
  for i in range(n-1):
    diff.append(abs(arr[i]-arr[i+1]))
  diff=sorted(diff)
  for i in range(c-1):
    diff.pop()
  print(sum(diff))

Measured memory_bytes: 13968
from sys import stdin,stdout
from collections import defaultdict
n,e=list(map(int,stdin.readline().split()))
h=list(map(int,stdin.readline().split()))
g=defaultdict(list)
for _ in range(e):
    a,b=map(int,stdin.readline().split())
    g[a]+=[b]
    g[b]+=[a]
ans=0
for cur in range(1,n+1):
    f=1
    for neigh in g[cur]:
        if h[neigh-1]>=h[cur-1]:
            f=0
            break
    if f:ans+=1
print(ans)

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> A(N),F(N);
  for(int i(0);i<N;i++) cin>>A[i];
  for(int i(0);i<N;i++) cin>>F[i];
  sort(A.begin(),A.end());
  sort(F.rbegin(),F.rend());
  ll l = -1,r = 1e12;
  while(l+1<r){
    ll x = (l+r)/2;
    bool ok = [&]{
      ll sum(0);
      vector<ll> Ai(N);
      for(int i(0);i<N;i++){
        Ai[i] = x/F[i];
      }
      for(int i(0);i<N;i++){
        sum += max(0ll,A[i] - Ai[i]);
      }
      //cout << x << " " << sum <<" " << K<< endl;
      if(sum <= K) return true;
      else return false;
    }();
    if (ok) r = x;
    else l = x;
  }
  cout << r << endl;

  return 0;
}



Measured memory_bytes: 4992
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define PI 3.14159265358979
#define MOD 1000000007
#define ERR 0.00000000000001
#define NUM 200010

int main(){
    int n, m, i;
    scanf("%d %d",&n,&m);
    int h[100002], p,q,c[n+1] = {}, count = 0;
    for(i=1;i<=n;i++){
        scanf("%d",&h[i]);
    }
    for(i=1;i<=m;i++){
        scanf("%d %d",&p, &q);
        if(h[p]==h[q]){ c[p] = 1; c[q] = 1; }
        else if(h[p]>h[q]){ c[q] = 1; }
        else{ c[p] = 1; }
    }
    for(i=1;i<=n;i++){
        if(c[i]==0){ count++; }
    }
    printf("%d",count);
}

Measured memory_bytes: 2508
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, K;
  cin >> N >> K;

  if (N % K == 0) {
    cout << 0 << endl;
  } else {
    cout << min(N % K, K - N % K) << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 100100;
const int MOD = (int) 1e9 + 7;

int n, c[100];
char s[N];

int main() {

	scanf("%d %s", &n, s);

	memset(c, 0, sizeof c);

	for (int i = 0; i < n; i++) {
		c[s[i] - 'a']++;
	}

	long long res = 1;

	for (int i = 0; i < 26; i++) {
		res = res * (c[i] + 1) % MOD;
	}

	printf("%lld\n", (res + MOD - 1) % MOD);

	return 0;

}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    ll N, K;
    cin >> N >> K;

    ll d = (N + (K - 1)) / K;
    cout << min(abs(N - max(0LL, d - 1) * K), abs(N - d * K)) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef int64_t intl;


int main(){
  int H,A;
  cin >> H>>A;
  if ( H%A != 0) {
    cout << H/A +1;
  }
  else {
    cout << H/A;
  }
}

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

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

int main(){

    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    for(int i = 0; i < h; i++){
        cin >> c[i];
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < w; k++){
                cout << c[i][k];
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3652
// 2010/12/21 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int L;
		cin >> L;
		if(L==0)
			break;
		int M[12], N[12];
		for(int i=0; i<12; i++)
			cin >> M[i] >> N[i];

		int chochiku = 0;
		int getsusuu = 0;
		for(int i=0; i<12; i++){
			chochiku += (M[i]-N[i]);
			if(chochiku>=L){
				getsusuu = i+1;
				break;
			}
		}

		if(getsusuu!=0)
			cout << getsusuu << endl;
		else
			cout << "NA" << endl;
	}

    return 0;
}

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

saidai_kyori = 0
sou_kyori = 0
for i, position in enumerate(house_list):
    kyori = 0
    if i == 0:
        kyori = K + house_list[0] - house_list[-1]
    else:
        kyori = house_list[i] - house_list[i-1]

    if kyori > saidai_kyori:
        saidai_kyori = kyori
    
    sou_kyori += kyori

print(sou_kyori - saidai_kyori)

Measured memory_bytes: 26436
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        x: u64,
        y: u64,
    }
    let mut x = x;
    for i in 1.. {
        x *= 2;
        if x > y {
            println!("{}", i);
            break;
        }
    }
}



Measured memory_bytes: 4352
#include <cstdio>

using namespace std;

const int C = 26;
const int D = 365;
int c[C];
int s[D][C];
int down[C];

int main() {
    int i, j;
    
    scanf("%*d");
    
    for (i = 0; i < C; i++) scanf("%d", &c[i]);
    
    for (i = 0; i < D; i++) {
        for (j = 0; j < C; j++) {
            scanf("%d", &s[i][j]);
        }
    }
    
    for (i = 0; i < D; i++) {
        int best = -1e9, index = -1;
        
        for (j = 0; j < C; j++) down[j] += c[j];
        
        for (j = 0; j < C; j++) {
            int sum = s[i][j] + down[j];
            
            if (sum > best) {
                best = sum;
                index = j;
            }
        }
        
        printf("%d\n", index + 1);
        
        down[index] = 0;
    }
    
    return 0;
}


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

#define pb push_back

using namespace std;

void dfs(vector<vector<int> > &adj, int v, vector<bool> &isVisited, pair<int, int> edge){
	isVisited[v] = true;
	for(int i = 0; i < adj[v].size(); i++){
		int u = adj[v][i];
		if(!isVisited[u]){
			if((u == edge.first && v == edge.second) || (u == edge.second && v == edge.first)) continue;
			dfs(adj, u, isVisited, edge);
		}
	}
}

int main(void){
	int n, m; cin >> n >> m;
	vector<vector<int> > adj(n);
	vector<pair<int, int> > edges(m);
	int u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		--u; --v;
		edges[i].first = u;
		edges[i].second = v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	int ans = 0;
	for(int i = 0; i < m; i++){
		vector<bool> isVisited(n, false);
		bool flag = true;
		u = edges[i].first; v = edges[i].second;
		dfs(adj, u, isVisited, edges[i]);
		/*cout << u << " " << v << endl;
		for(int j = 0; j < n; j++) cout << isVisited[j] << " ";
		cout << endl;*/
		for(int j  = 0; j < n; j++){
			flag = flag & isVisited[j];
		}
		if(!flag){
			ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    S = input().strip()
    ans = 0
    x = 0
    for c in S:
        if c == "#":
            x += 1
        else:
            if x > 0:
                ans += 1
                x = max(x-1, 0)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3500
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int n;
    std::cin >> n;
    if (n == 1) { std::cout << "Hello World" << std::endl; }
    else
    {
        int a, b;
        std::cin >> a >> b;
        std::cout << a + b << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll a,b;cin>>a>>b;
    ll ans = 0;
    if(a < 0){
        if(b < 0){
            if(a < b){
                ans = -a+b;
            }else if(a > b){
                ans = -b+a+2;
            }else {
                ans = 0;
            }
        }else if(b > 0){
            ans = min(b-a,abs(b+a)+1);
        }else {
            ans = -a;
        }
    }else if(a > 0){
        if(b < 0){
            if(-b < a){
                ans = a+b+1;
            }else if(-b > a){
                ans = -b-a+1;
            }else{
                ans = 1;
            }
        }else if(b > 0){
            if(b > a){
                ans = b-a;
            }else if(b < a){
                ans = a-b+2;
            }else{
                ans = 0;
            }
        }else {
            ans = a+1;
        }
    }else{
        if(b < 0){
            ans = -b+1;
        }else if(b > 0){
            ans = b;
        }else {
            ans = 0;
        }
    }
    cout << ans << endl;
}



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

int main()
{
    string arr,frr;
    cin>>arr>>frr;
    int a,b;
    cin>>a>>b;
    string krr;
    cin>>krr;
    if(arr==krr)a--;
    if(frr==krr)b--;
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cassert>
#include <algorithm>
#include <functional>
using namespace std;
int main(void){
    // Your code here!
    int a;
    int b;
    int c;
    scanf("%d", &a);
    scanf("%d",&b);
    scanf("%d",&c);
    int ans = std::min({a+b,b+c,c+a});
    printf("%d",ans);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>

using namespace std;

int
main() {

  string s;
  cin>>s;

  int i = 0, j = s.length()-1;
  int ans = 0;
  while (1) {
    if (i>=j) break;

    if (s[i] != s[j]) ans++;
    i++;
    j--;
  }
 
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	double dec;
	int itg;
	int ans1[16], ans2[8];
	
	while(scanf("%lf",&dec))
	{

		memset(ans1, 0, sizeof(ans1));
		memset(ans2, 0, sizeof(ans2));

		if(dec < 0)
		{
			break;
		}
		
		itg = (int)dec;
		dec -= itg;

		for(int i = 7; i >= 0; i--)
		{
			ans1[i] = itg%2;
			itg /= 2;
		}
		for(int i = 0; i < 4; i++)
		{
			dec *= 2;
			if(dec >= 1)
			{
				ans2[i] = 1;
				dec -= 1;
			}
		}

		if(!itg && !dec)
		{
			for(int i = 0; i < 8; i ++)
			{
				printf("%d", ans1[i]);
			}
			printf(".");
			for(int i = 0; i < 4; i++)
			{
				printf("%d", ans2[i]);
			}
			puts("");
		}
		else
		{
			printf("NA\n");
		}
	}
}

Measured memory_bytes: 1232
import java.util.*;

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

        int N = sc.nextInt();
        String S = sc.next();

        int count = 0;

        for(int i=0; i<N-2; i++) {
            if(S.charAt(i) == 'A'){
                if(S.charAt(i+1) == 'B') {
                    if(S.charAt(i+2) == 'C') {
                        count++;
                        i += 2;
                    }
                }
            }
        }
        System.out.println(count);
        
    }
}

Measured memory_bytes: 21844