akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 56
using namespace std;
int  n,m,f;
char a[N][N],b[N][N];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%s",a[i]+1);
	for(int i=1;i<=m;i++)scanf("%s",b[i]+1);
	if(m>n)return puts("No"),0;
	for(int i=1;i<=n-m+1;i++)
	 for(int j=1;j<=n-m+1;j++){
	 	bool flag=1;
	    for(int k=1;k<=m;k++)
	    	for(int h=1;h<=m;h++)if(a[i+k-1][j+h-1]!=b[k][h])flag=0;
	    if(flag)f=1;
	 }
	if(f)puts("Yes");else puts("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)
int main(){
    int N;
    cin >> N;
    vector<long> A(N);
    rep(i,N) cin >> A[i];
    long MIN = 1e9;
    long sum = 0;
    int cnt = 0;
    bool zero = false;

    for(auto a : A){
        sum += abs(a);
        MIN = min(MIN,abs(a));
        if(a < 0) cnt++;
        if(a == 0) zero = true;
    }

    if(!zero && cnt%2) sum -= 2*MIN;
    cout << sum << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[][][] data = new int[4][3][10];
        StringBuilder sb = new StringBuilder();

        for(int i=0;i<n;i++){
            String[] s = sc.nextLine().split(" ");
            int b = Integer.parseInt(s[0]);
            int f = Integer.parseInt(s[1]);
            int r = Integer.parseInt(s[2]);
            int c = Integer.parseInt(s[3]);
            data[b-1][f-1][r-1]+=c;
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<3;j++){
                for(int m=0;m<10;m++){
                    sb.append(" "+data[i][j][m]);
                }
                sb.append("\n");
            }
            if(i!=3) sb.append("####################\n");
        }
        System.out.print(sb);
    }
}	


Measured memory_bytes: 27176
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//数値
		int n = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
      	//配列
        int m[] = new int[n];
        for(int i = 0; i < n; i++){
        	m[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(m);
        for(int i = 0; i < n; i++){
        	x -= m[i];
        }
        int wari  = x/m[0];
        System.out.println(m.length+wari);
     }
}	

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

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

    int i = stoi(a + b);

    int j = (int) sqrt((double) i);

    cout << ((i == (j * j)) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3588
(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let x1, x2, x3, x4, x5 = Scanf.sscanf (read_line ()) "%d %d %d %d %d" ( fun x1 x2 x3 x4 x5 -> x1, x2, x3, x4, x5)

let () =
        (
                if x1 = 0 then
                        1
                else
                if x2 = 0 then
                        2
                else
                if x3 = 0 then
                        3
                else
                if x4 = 0 then
                        4
                else
                        5
        ) |> Printf.printf "%d\n"


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

void trace(vector<int> A, int N) {
  int i;
  for (int i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << A.at(i);
  }
  cout << endl;
}

void insertion (vector<int> A, int N) {
  int i, j, v;
  for (i = 1; i < N; i++) {
    v = A.at(i);
    j = i - 1;
    while (j >= 0 && A.at(j) > v) {
      A.at(j + 1) = A.at(j);
      j--;
    }
    A.at(j + 1) = v;
    trace(A, N);
   }
}
  
int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }  
  trace(A, N);
  insertion(A, N);
}



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

int main(){
  int x;
  cin>>x;
  double ans=0;
  for(int i=1;i*i<=x;i++){
    for(int j=2;j<=10;j++){
      if(pow(i,j)<=x){
        ans=max(ans,pow(i,j));
      }
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

void trace(int arr[], int num)
{
    cout << arr[0];
    for(int l=1; l<num; l++)
    {
        cout << " " << arr[l];
    }
    cout << endl;
}

void inSort(int arr[], int num)
{
    for(int i=1; i < num; i++)
    {
        int tmp = arr[i];
        int j = i - 1;
        while (j>=0 && tmp < arr[j])
        {
            arr[j+1] = arr[j]; 
            j--;
        }
        arr[j+1] = tmp;
        trace(arr, num);
    }
    return;    
}

int main()
{ 
    int num, arr[100];
    cin >> num;
    for(int i=0; i < num; i++)
    {
        cin >> arr[i];
    }

    trace(arr, num);
    inSort(arr, num);    

    return 0;
}



Measured memory_bytes: 3080
#include <algorithm>
#include <iostream>
#include <string>

int main()
{
    std::string s;
    int q;
    std::cin >> s >> q;

    std::string head;
    std::string tail;

    bool flip = false;

    for (int i = 0; i < q; ++i)
    {
        int t;
        std::cin >> t;

        switch (t)
        {
        case 1:
            flip = (!flip);
            break;
        case 2:
        {
            int f;
            char c;
            std::cin >> f >> c;

            if (flip)
            {
                switch (f)
                {
                case 1:
                    tail.push_back(c);
                    break;
                case 2:
                    head.push_back(c);
                    break;
                }
            }
            else
            {
                switch (f)
                {
                case 1:
                    head.push_back(c);
                    break;
                case 2:
                    tail.push_back(c);
                    break;
                }
            }
        }
        break;
        }
    }

    if (!flip)
    {
        std::reverse(head.begin(), head.end());
        std::cout << head << s << tail << std::endl;
    }
    else
    {
        std::reverse(tail.begin(), tail.end());
        std::reverse(s.begin(), s.end());
        std::cout << tail << s << head << std::endl;
    }

    return 0;
}


Measured memory_bytes: 1088
use std::cmp;

fn main() {
    let nc: Vec<i64> = read_vec();
    let n = nc[0] as usize;
    let c = nc[1];
    let xvs: Vec<Vec<i64>> = read_vec2(n as u32);
    let mut xvs_r = xvs.clone();
    xvs_r.reverse();
    let xvs_r = xvs_r;


    let mut r1: i64 = 0;
    let mut tab: i64 = 0;
    let mut cals1: Vec<i64> = Vec::new();
    cals1.push(0);
    for i in &xvs {
        let x = i[0];
        let v = i[1];

        tab += v;
        let cal = tab - x;
        if cal > r1 {
            r1 = cal;
        }
        cals1.push(r1);
    }

    tab = 0;
    let mut r2: i64 = 0;
    let mut cals2: Vec<i64> = Vec::new();
    cals2.push(0);
    for i in &xvs_r {
        let x = c - i[0];
        let v = i[1];

        tab += v;
        let cal = tab - x;
        if cal > r2 {
            r2 = cal;
        }
        cals2.push(r2);
    }

    let mut r: i64 = cmp::max(*cals1.last().unwrap(), *cals2.last().unwrap());
    tab = 0;

    for (ni, i) in xvs.iter().enumerate() {
        let x = i[0];
        let v = i[1];

        tab += v;
        let cal = tab - x * 2 + cals2[n - ni - 1];
        if cal > r {
            r = cal;
        }
    }

    tab = 0;

    for (ni, i) in xvs_r.iter().enumerate() {
        let x = c - i[0];
        let v = i[1];

        tab += v;
        let cal = tab - x * 2 + cals1[n - ni - 1];
        if cal > r {
            r = cal;
        }
    }

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

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_lines<T: std::str::FromStr>(n: u32) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

Measured memory_bytes: 18684
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) (1e9)
#define mod (ll) (1e9 + 7)
#define endl "\n"
#define tt ll testcase; cin>>testcase; while(testcase--)
 
int main(){
	fast;
	ll n;
	cin>>n;
	double p[n];
	for(int i=0; i<n; i++){
		cin>>p[i];
	}
	vector<vector<double>>dp(n+1, vector<double>(n+1, 0));
// dp[i][j] --> j heads after throwing first i coins
	// j <= i
	dp[0][0] = 1.0;
	for(int i=1; i<=n; i++){
		for(int j=0; j<=i; j++){
			dp[i][j] = ((j <= i-1) ? dp[i-1][j] : 0 )*(1 - p[i-1]) + dp[i-1][j-1]*(p[i-1]);
			//cout<<dp[i][j]<<" ";
		}
		//cout<<endl;
	}
	double ans = 0;
	for(int i= n/2 + 1; i<=n; i++){
		ans += dp[n][i];
	}
	printf("%.10f\n", ans);
	// cout<<ans;
}

Measured memory_bytes: 70784
import math

a = list(map(int, input().split()))
a.sort()

if a[0] == a[1] == a[2]:
    print(0)
else:
    count = a[2] - a[1]
    a[1] += count
    a[0] += count
    if a[0] == a[1]:
        print(count)
    else:
        tmp_count = math.ceil((a[1] - a[0]) / 2)
        count += int(tmp_count)
        a[0] += tmp_count * 2
        if a[0] == a[1]:
            print(count)
        else:
            print(count + 1)


Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
#define INF 999999999
#define lint long long
#define rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define rep0(i, n) for(int i = 0; i < (int)(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){
    lint N, A, B;
    cin >> N >> A >> B;
    cout << min(N*A, B);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  ll mn = (N - 1) * A + B;
  ll mx = (N - 1) * B + A;
  if (N == 0) mn = INF;

  cout << max((ll)0, mx - mn + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    string S;
    ll K;
    cin>>S>>K;
    bool judge=true;
    rep(i,sz(S)-1){
        if(S.at(i)!=S.at(i+1))judge=false;
    }
    if(judge){
        ll x=K;
        x*=sz(S);
        cout<<x/2<<endl;
        return 0;
    }
    string S2=S+S;
    if(sz(S)==1){cout<<max(K-2,0ll)<<endl;return 0;}
    int count1=0,count2=0;
    rep(i,sz(S)-1){
        if(S.at(i)==S.at(i+1)){
            S.at(i+1)='!';
            count1++;
        }
    }
    
    rep(i,sz(S2)-1){
        if(S2.at(i)==S2.at(i+1)){
            S2.at(i+1)='!';
            count2++;
        }
    }
    ll ans=count2-count1;
    ans*=K-1;
    ans+=count1;
    cout<<ans<<endl;
}

Measured memory_bytes: 3648
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#define ll long long

using namespace std;
int main(void){
  ll x;
  ll buf[11] = {0,0,1,1,1,1,1,1,1,1,1};

  cin >> x;
  cout << ((x*2)/11+buf[(2*x)%11]) << "\r\n";
}


Measured memory_bytes: 256
MOD=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))

a.sort(reverse=True)


fact = [1]
fact_inv = [1]
mod=10**9+7
for i in range(10**5+1):
    new_fact = fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))


def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod

  
c=[]
for i in range(1,n-k+1+1):
  c.append(mod_comb_k(n-i,k-1,MOD))
lc=len(c)
#print(c,a)
sum=0
for i in range(lc):
  sum+=c[i]*(a[i]-a[-i-1])%MOD
  
print(sum%MOD)


Measured memory_bytes: 70312
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x: usize = read();
    let n: usize = read();
    let mut a: Vec<bool> = vec![false; 102];

    for _ in 0..n {
        a[read::<usize>()] = true;
    }

    let mut r = x;
    let mut l = x;

    while a[r] == true {
        r += 1;
    }
    while a[l] == true {
        l -= 1;
    }

    if x - l <= r - x {
        println!("{}", l);
    } else {
        println!("{}", r);
    }
}


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

int n, m;
vector<long long> a[8];
long long ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(int i=0; i<n; ++i){
		long long x, y, z;
		cin >> x >> y >> z;
		a[0].push_back(x+y+z);
		a[1].push_back(x+y-z);
		a[2].push_back(x-y+z);
		a[3].push_back(x-y-z);
		a[4].push_back(-x+y+z);
		a[5].push_back(-x+y-z);
		a[6].push_back(-x-y+z);
		a[7].push_back(-x-y-z);
	}
	for(int i=0; i<8; ++i)
		sort(a[i].begin(), a[i].end());
	for(int i=0; i<8; ++i){
		long long tmp = 0;
		for(int j=0; j<m; ++j)
			tmp += a[i][a[i].size()-1-j];
		ans = max(ans, tmp);
	}
	cout << ans << "\n";
}

Measured memory_bytes: 384
def main():
    a = [int(input()) for i in range(5)]
    k = int(input())
    ans = False
    for aa in a:
        for b in a:
            if abs(aa-b) > k:
                ans = True
                break
        if ans:
            break
    print(':(' if ans else 'Yay!')

if __name__ == '__main__':
    main()
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------
 
signed main() {
    int n;
    cin >> n;
    vector<int> h(n);
    cin >> h;
    int max=0, cnt=0;
		for (auto temp: h) {
      if (max <= temp) {
        max = temp;
        cnt++;
      }
    }
		cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
/***********************************************
#
#      Filename: a.cpp
#
#        Author: Comsyl - ylsong15@fudan.edu.cn
#   Description: ---
#        Create: 2017-05-06 20:16:34
***********************************************/
#include <bits/stdc++.h>
using namespace std;

int count_round(int a, int b, int c) {
    int ta, tb, tc, count = 0;
    while (true) {
        ta = (b + c) / 2;
        tb = (a + c) / 2;
        tc = (a + b) / 2;
        ++ count;
        if (ta % 2 || tb % 2 || tc % 2) return count;
        if (ta == tb && tb == tc) return -1;
        a = ta; b = tb; c = tc;
    }
}

int main()
{
    int a, b, c;
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> a >> b >> c; 
    if (a % 2 || b % 2 || c % 2) {
        cout << 0 << endl;
    } else if (a == b && b == c) {
        cout << -1 << endl;
    } else {
        int ans = count_round(a, b, c);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#define rep(i,n) for(int (i)=1;(i)<(n);(i)++)
using namespace std;

int main() {
	long long a = 0;
	long long b = 0;
	long long x = 0;
	cin >> a >> b >> x;
	long long count = 0;
	if (a % x == 0) {
		count++;
	}
	a = (a / x) * x;
	count = count + (b - a) / x ;
	cout << count << endl;
	return 0;
}

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

struct Node {
  int id;
  int left;
  int right;
  Node(int id) {
    this->id = id;
    this->left = -1;
    this->right = -1;
  }
};
void crawl_postorder(vector<Node*> &node_list, vector<int> &order_list, Node* node) {
  if(node->left != -1) {
    crawl_postorder(node_list,order_list,node_list[node->left]);
  }
  if(node->right != -1) {
    crawl_postorder(node_list,order_list,node_list[node->right]);
  }
  order_list.push_back(node->id);
  return;
}

int main() {
  /* input */
  int n; cin >> n;
  vector<int> pre_list(n);
  vector<int> in_list(n);
  for(int i=0;i<n;i++)
    cin >> pre_list[i];
  for(int i=0;i<n;i++)
    cin >> in_list[i];

  /* construct tree */
  vector<Node*> node_list(n+1,NULL);
  int root_id = pre_list[0];
  node_list[root_id] = new Node(root_id);
  for(int i=1;i<n;i++) {
    int pre_id = pre_list[i];
    node_list[pre_id] = new Node(pre_id);

    int pre2in_index;
    for(int j=0;j<n;j++) {
      if(pre_list[i] == in_list[j]) {
        pre2in_index = j;
        break;
      }
    }

    int in_left_index = -1;
    for(int j=pre2in_index-1;j>=0;j--) {
      if(node_list[in_list[j]] != NULL) {
        in_left_index = j;
        break;
      }
    }
    int in_right_index = -1;
    for(int j=pre2in_index+1;j<n;j++) {
      if(node_list[in_list[j]] != NULL) {
        in_right_index = j;
        break;
      }
    }

    int pre_left_index = -1;
    if(in_left_index != -1) {
      for(int j=0;j<n;j++) {
        if(pre_list[j] == in_list[in_left_index]) {
          pre_left_index = j;
          break;
        }
      }
    }
    int pre_right_index = -1;
    if(in_right_index != -1) {
      for(int j=0;j<n;j++) {
        if(pre_list[j] == in_list[in_right_index]) {
          pre_right_index = j;
          break;
        }
      }
    }

    int parent_id;
    if(pre_right_index > pre_left_index)
      parent_id = pre_list[pre_right_index];
    else
      parent_id = pre_list[pre_left_index];

    if(in_list[in_right_index] == parent_id)
      node_list[parent_id]->left = pre_id;
    else
      node_list[parent_id]->right = pre_id;

  }
  vector<int> order_list;
  crawl_postorder(node_list,order_list,node_list[root_id]);
  for(int i=0;i<n-1;i++) {
    cout << order_list[i] << " ";
  }
  cout << order_list[n-1] << endl;
}

Measured memory_bytes: 1220
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define S_MAX 1000
#define N_MAX 50
#define M_MAX 50
#define INF 2000000000
#define MOD 1000000007
#define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b))))

typedef unsigned long long ull;
typedef   signed long long dll;

typedef struct {
	int a;
	int b;
	int c;
} moneydata;

ull n, m;
int h, w;
int i, j;
int k;

ull max(ull a, ull b){
	return (a > b) ? a : b;
}

ull min(ull a, ull b){
	return (a < b) ? a : b;
}

ull abs(dll a) {
	if (a >= 0) return (ull)a;
	else return (ull)(-a);
}

void solve(){
	ull i = 1;
	ull x;
	while (i * i <= n) {
		if ((n % i) == 0) x = i;
		i++;
	}
	i = n / x;
	x = 0;
	while (i) {
		x++;
		i /= 10;
	}
	printf("%llu\n", x);
	return;
}

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

	solve();
	
	return 0;
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b;
    cin >> a >> b;
    if(a<=8 && b <= 8) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#ABC138 E

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
m = len(t)
f = [False]*26
f2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    f[alpha.index(s[i])] = True
for i in range(m):
    f2[alpha.index(t[i])] = True
for i in range(26):
    if not f[i] and f2[i]:
        print(-1)
        quit()
ans = 0
pre = s.index(t[0])
ans += pre+1
for i in range(1,m):
    s = s[pre+1:] + s[:pre+1]
    inde = s.index(t[i])
    ans += inde+1
    pre = inde
print(ans)


Measured memory_bytes: 3976
#include<stdio.h>
int main()
{
	int h, w, i, j;
	while (1)
	{
		scanf("%d %d", &h, &w);
		if (h == 0 && w == 0)break;
		for (i = 1; i <= h; i++){
			for (j = 1; j <= w; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
constexpr long long MOD(long long in) {
	return in % mod;
}

ll n, x;
int main()
{
	std::cin >> n >> x;

	ll ans = n;
	ll a = std::max(x, n - x), b = std::min(x, n - x);
	while (b != 0) {
		ans += a / b * b * 2;
		auto aa = b, bb = a % b;
		a = aa, b = bb;
	}

	std::cout << ans - a << std::endl;
	return 0;
}


Measured memory_bytes: 256
import bisect
n = int(input())
s = input()
count = 0
num_ind_list = []
for i in range(10):
    num_ind_list.append([0])
for i in range(n):
    num_ind_list[int(s[i])].append(i)
for i in range(10):
    num_ind_list[i].append(30000)
for i in range(10):
    if len(num_ind_list[i]) != 2:
        for j in range(10):
            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1])
            if num_ind_list[j][b] != 30000:
                for k in range(10):
                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b])
                    if num_ind_list[k][c] != 30000: count += 1
print(count)


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

#define int long long int
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define lb lower_bound
#define ub upper_bound
#define srt(a) sort(a.begin(),a.end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
#define mxe(a) *max_element(a.begin(),a.end())
#define mne(a) *min_element(a.begin(),a.end())
#define endl '\n'
#define mod 1000000007
#define INF64 1e18

void solve(){
  int n ;cin>>n;
  vi a(n+1);
  vvi dp(n+1,vi(n+1,INF64));
  for(int i=1;i<=n;i++){
    cin>>a[i];
    a[i]+=a[i-1];
    dp[i][i]=0;
  }
  for(int d=2;d<=n;d++){
    for(int i=1;i+d-1<=n;i++){
      int j=i+d-1;
      for(int k=i;k<j;k++)
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]);
      dp[i][j]+=a[j]-a[i-1];
    }
  }
  cout<<dp[1][n];
}

int32_t main(){
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
  #endif
  
  ios_base::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);

  int T=1;
  //cin>>T;
  for(int TT=1;TT<=T;TT++){
    solve();
  }
}

Measured memory_bytes: 4504
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//文字列を宣言して読み込む
		String S = sc.next();
		String ans="Good";
		if(S.charAt(0)==S.charAt(1)){ans="Bad";}
		if(S.charAt(1)==S.charAt(2)){ans="Bad";}
		if(S.charAt(2)==S.charAt(3)){ans="Bad";}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, r, g, b;
    cin >> r >> g >> b >> n;
    int odp = 0;
    for (int x = 0; x <= n; ++x)
    {
        for (int y = 0; y <= n; ++y)
        {
            int mam = x * r + y * g;
            int potrz = n - mam;
            if (potrz < 0)
                continue;
            if (potrz % b != 0)
                continue;
            ++odp;
        }
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
 
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };
 
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end());
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, n, m);
    vector<int> c;
    Rep(m){
        Cin(int, a, b);
        if(a == 1) c.push_back(b);
        if(b == n) c.push_back(a);
    }
    Sort(c);
    Cout((unique(Range(c)) != c.end()) ? "POSSIBLE" : "IMPOSSIBLE");
}


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

////// Union Find https://atcoder.jp/contests/atc001/tasks/unionfind_a
// 引用資料：https://mickey24.hatenablog.com/entry/20090602/1243950241
// 経路圧縮のみ実装？ 深さ１の部分木を生成

class DisjointSet {
private:
    vector<int> p;              // 頂点 i の所属している集合の root を記録する or 集合の root には自分を含む要素数が負の数で記録してある
    int count;                  // 集合の数を記録(１となったときすべての要素が一つにまとまったことを示す)

    // 所属している集合の root を調べる
    int root(int x) {         
        return p[x] < 0 ? x : p[x] = root(p[x]);
    }

public:
    // コンストラクタ 要素数の提示が必要
    DisjointSet(int size) {
        p.resize(size, -1); 
        count = size;
    }
    // 集合同士の結合
    bool unite_set(int x, int y) {          
        int rootX = root(x);
        int rootY = root(y);

        if (rootX != rootY) {                       // 同集合内でのループが起こらないように
            if (p[rootX] > p[rootY]) {              // 自分を含む要素数が多い方を rootX とする  
                swap(rootX, rootY); 
            }
            p[rootX] += p[rootY];                   // 自分を含む要素数を p[rootX] に渡す
            p[rootY] = rootX;                       // root を変更
            count--;                                // 集合同士がつながったので、集合の数を一つ減らす
            return true;
        }
        return false;
    }
    // 集合の要素数を算出
    int number_of_elements(int x){
        int rootX = root(x);
        return abs(p[rootX]);
    }
    // 同じ集合に属しているか調べる
    bool is_same_set(int x, int y) {          
        if (root(x) == root(y)) {
            return true;
        }
        return false;
    }
    // 集合の数を出力
    int number_of_sets() {
        return count;
    }
};
int main(void)
{
    // 入力
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> friendGraph(n); 
    vector<vector<int>> blockGraph(n);
    DisjointSet friendJoint(n);        // コンストラクト、インスタンス化
    // 友達関係の入力 友達chainの構築
    for (int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--;  b--;
        friendGraph.at(a).push_back(b);
        friendGraph.at(b).push_back(a);
        friendJoint.unite_set(a, b);
    }
    // ブロック関係の入力
    for (int i = 0; i < k; i++){
        int c, d;
        cin >> c >> d;
        c--;  d--;
        blockGraph.at(c).push_back(d);
        blockGraph.at(d).push_back(c);
    }
    
    // 友達chain より、ブロック関係と友達関係を除いた数を cnt として出力
    for (int i = 0; i < n; i++){
        int elements = friendJoint.number_of_elements(i);
        int nFriends = friendGraph.at(i).size(); 
        int cnt = elements - nFriends -1;
        for (int blockPerson : blockGraph.at(i) ){
            if (friendJoint.is_same_set(i, blockPerson)){
                cnt--;
            } 
        }
        if (i==n-1){
            cout << cnt;
        }
        else{
            cout << cnt << ' ';
        }
        
    }
    cout << endl;

    return 0;
}


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

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

  if (N[0] == N[1] && N[1] == N[2]) cout << "Yes" << endl;
  else if (N[1] == N[2] && N[2] == N[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>
 
const int MAXN = 105;
using namespace std;
bool visited[MAXN];
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
struct edge{
  edge(int from,int to):from(from),to(to){}
  int from,to;
};
bool operator<(edge a,edge b){
  if(a.from != b.from)return a.from < b.from;
  else return a.to < b.to;
}
typedef pair<int,edge> P;

int main(){
  int n,m;
  while(cin >> n >> m && (n | m) != 0){
    priority_queue<P,vector<P>,greater<P> > que;
    for (int i = 0; i < m; ++i){
      int a,b,c;
      cin >> a >> b >> c;
      que.push(make_pair(c,edge(a,b)));
    }
    UnionFind u(MAXN);
    int ans = 0;
    while(!que.empty()){
      edge e = que.top().second;
      int  cost= que.top().first;
      que.pop();
      if(!u.findSet(e.from,e.to)){
	ans += cost;
	u.unionSet(e.from, e.to);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll k,a[200009],b[200009];
int cmp(ll a,ll b)
{
    return a>b;
}
int check(ll x)
{
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]<=x)
            continue;
        sum+=(a[i]-x)%b[i]?(a[i]-x)/b[i]+1:(a[i]-x)/b[i];
    }
    return sum<=k;
}
int main()
{
    scanf("%d%lld",&n,&k);
    for(int i=1; i<=n; i++)
        scanf("%lld",&a[i]);
    for(int i=1; i<=n; i++)
        scanf("%lld",&b[i]);
    sort(a+1,a+n+1,cmp);
    sort(b+1,b+n+1);
    for(int i=1; i<=n; i++)
        a[i]=a[i]*b[i];
    ll left=0,right=1e12,mid;
    while(right-left>1)
    {
        mid=(left+right)/2;
        if(check(mid))
            right=mid;
        else
            left=mid+1;
    }
    if(check(left))
        printf("%lld",left);
    else
        printf("%lld",right);
    return 0;
}

Measured memory_bytes: 3328
n = int(input())
h = list(map(int,input().split()))
cmax = 0
c = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    c += 1
  else:
    if c > cmax:
      cmax = c
    c = 0
if c > cmax:
  cmax = c
print(cmax)

Measured memory_bytes: 14252
import math
X,Y = map(int,input().split())
a,b = (2*Y-X)/3,(2*X-Y)/3
n = 10**9+7
def cmb(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
def count():
  if not (a//1 == a and b//1==b):
    return 0
  else:
    ahat = int(a%n)
    bhat = int(b%n)
    return cmb(ahat+bhat,ahat)


print(int(count())%(10**9+7))

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int x, y, s;

int main(int argc, char const *argv[]) {
    while(cin>>x>>y>>s, x||y||s) {
        double tax_before = x / 100.0;
        double tax_after = y / 100.0;
        int ans = 0;
        for (int i = 1; i < s; ++i) {
            for (int j = i; j < s; ++j) {
                int before_i = i + i * tax_before;
                int before_j = j + j * tax_before;
                int sum_before = before_i + before_j;
                if ( sum_before == s ) {
                    int after_i = i + i * tax_after;
                    int after_j = j + j * tax_after;
                    int sum_after = after_i + after_j;
                    ans = max (ans, sum_after);
                }
            }
        }

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

Measured memory_bytes: 3100
M,N=(int(i) for i in input().split())
AB=[]
for i in range(M):
  AB.append([int(i) for i in input().split()])
sortedAB=sorted(AB,key=lambda x:x[0])
t=0
i=0
money=0
while t<N:
  if N-t<sortedAB[i][1]:
    money=money+(N-t)*sortedAB[i][0]
    t=N
  else:
    t=t+sortedAB[i][1]
    money=money+sortedAB[i][0]*sortedAB[i][1]
  i+=1
print(money)

Measured memory_bytes: 23524
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int h,w;
    cin>>h>>w;
    char s[h][w];
    rep(i,h){
        rep(j,w) cin>>s[i][j];
    }
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#'){
                if(s[i][j-1]=='.'&&s[i][j+1]=='.'&&s[i-1][j]=='.'&&s[i+1][j]=='.'){
                    cout<<"No";
                    return 0;
                }
            }
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while('0' <= c && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int main() {
    int t = read();
    if(t >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>

using namespace std;

int main() {
	string str, p;
	cin >> str >> p;
	int lstr = str.length(), lp = p.length();
	bool flag = 0;
	for(int i = 0; i < lstr; i++) {
		string substr = "";
		for(int j = 0; j < lp; j++) substr += str[(i + j) % lstr];
		if(substr == p) { flag = 1; break; }
	}
	if(flag) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    int res = 0;
    for (int i = 1;i<=n;i++){
        if(i<=k)
            continue;
        int t=(i - k) * (n / i);
        res += t;
        int x = n - (n/i)*i;
        if (x >= k)
            res += x - k+1*(k!=0);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

class Dis{
  public:
  vector<ll> rank,p;
  
  Dis(int s){
    rank.resize(s,0);
    p.resize(s,0);
    rep(i,s) makeSet(i);
  }
  
  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
  }
  
  bool same(int x,int y){
    return findSet(x)==findSet(y);
  }
  
  void unite(int x,int y){
    link(findSet(x),findSet(y));
  }
  
  void link(int x,int y){
    if(rank[x]>rank[y]) p[y]=x;
    else{
      p[x]=y;
      if(rank[x]==rank[y]) rank[y]++;
    }
  }
  
  int findSet(int x){
    if(x != p[x]) p[x]=findSet(p[x]);
    return p[x];
  }
};
  
class Edge{
  public: int source,target,cost;
  Edge(int source=0, int target=0, int cost=0):
  source(source),target(target),cost(cost){}
  bool operator < (const Edge &e) const{
    return cost<e.cost;
  }
};
  
int kruskal(int N,vector<Edge> edges){
  int totalCost=0;
  sort(ALL(edges));
  
  Dis dset=Dis(N+1);
  
  int source,target;
  rep(i,edges.size()){
    Edge e=edges[i];
    if(!dset.same(e.source,e.target)){
      totalCost+=e.cost;
      dset.unite(e.source,e.target);
    }
  }
  return totalCost;
} 

int main() {
  int n;
  cin>>n;
  
  vector<pair<int,int>> A(n),B(n);
  int x,y;
  rep(i,n){
    cin>>x>>y;
    A[i]={x,i};
    B[i]={y,i};
  }
  sort(ALL(A));
  sort(ALL(B));
  
  vector<Edge> edges;
  rep(i,n-1){
    edges.push_back(Edge(A[i].second,A[i+1].second,A[i+1].first-A[i].first));
    edges.push_back(Edge(B[i].second,B[i+1].second,B[i+1].first-B[i].first));
  }
  
  cout<<kruskal(n,edges)<<endl;
  
  return 0;
}

Measured memory_bytes: 11112
import java.util.Scanner;

public class Main {

	public static int findLCS(String string1, String string2) {
		int strings[][] = new int[1 + string1.length()][1 + string2.length()];
		
		for(int i = 1; i <= string1.length(); i++) {
			for(int j = 1; j <= string2.length(); j++) {
				if(string1.charAt(i-1) == (string2.charAt(j-1))){
					strings[i][j] = strings[i-1][j-1] + 1;
				}else {
					strings[i][j] = max(strings[i-1][j], strings[i][j-1]);
				}
			}
		}
		
		return strings[string1.length()][string2.length()];
	}
	
	public static int max(int x, int y) {
		int maximum = 0;
		if(x > y) {
			maximum = x;
		}else {
			maximum = y;
		}
		return maximum;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int timesToRun = sc.nextInt();
		
		for(int i = 0; i < timesToRun; i++) {
			String firstString = sc.next();
			String secondString = sc.next();
			System.out.println(findLCS(firstString, secondString));
		}
		
	}
}



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

int main(void) {
    int N;
    cin >> N;
    for(int i=N;i<1000;i++) {
        if((i/100) == ((i/10)%10) && (i/100) == (i%10)) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_109
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            string result = a % 2 == 1 && b % 2 == 1 ? "Yes" : "No";
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 11092
import numpy as np
from decimal import *
 
n = int(input())
a = list(map(Decimal, input().split()))
b = np.array(a)
temp = 1
 
if a.count(0) >0:
  print(0)
  exit()
 
for i in range(n):
  temp = b[i] * temp
  if temp > 10**18 or temp < 0:
    print('-1')
    exit()
 
print(temp)

Measured memory_bytes: 47552
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL INF=100000000000;
string u="abcdefghijklmnopqrstuvwxyz";


int main(){
    int N;
    cin >> N;
    string s1,s2;
    cin >> s1 >> s2;
    LL ans=0;
    bool c;
    for(int i=0;i<N;){
        if(s1[i]==s2[i]){
            if(i==0) ans+=3;
            else if(c==true) ans*=2;
            c=true;
            i++;
            ans%=mod;
        }
        else{
            if(i==0) ans+=6;
            else if(c==false) ans*=3;
            else ans*=2;
            c=false;
            i+=2;
            ans%=mod;
        }
    }
    cout << ans%mod << endl;
    return 0;
}

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

int main()
{
int n;
  cin>>n;
  int arr[n];
  map<int,int>m;
  for(int i=1;i<=n-1;i++)
  {
     cin>>arr[i];
    m[arr[i]]++;
  }
  sort(arr,arr+n);
  for(int i=1;i<=n;i++)
  {
    if(m[i])
    {
      cout<<m.find(i)->second<<endl;
    }
    else
      cout<<0<<endl;
     
    
  }
 
}

Measured memory_bytes: 13764
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	string s;
	cin >> s;

	if (s == "ABC")
	{
		cout << "ARC" << endl;
	}
	else
	{
		cout << "ABC" << endl;
	}
	
	return 0;
}


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


int main() {
    int n;
    cin >> n;
    vector<int> bi;
    rep(i, n - 1) {
        int b;
        cin >> b;
        bi.push_back(b);
    }
    int total = 0;
    rep(i, n) {
        if (i == 0) {
            total += bi[0];
        } else if (i == n - 1) {
            total += bi[n - 2];
        } else {
            total += min(bi[i - 1], bi[i]);
        }
    }
    cout << total << "\n";
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // L+i -1;
    int n, l; cin>>n>>l;
    vector <int> ringo(n);
    int ans = 1e9;
    int sum=0;
    bool mi = false;
    for(int i=0;i<n;i++){
        ringo[i] = l+i;
        //cout<<ringo[i]<<endl;
        sum+= ringo[i];
        if(ans > abs(ringo[i])){
        ans = abs(ringo[i]); if(ringo[i]<0) mi = true; else mi = false;}
    }
    //cout<<ans<<'*'<<endl;
    if(mi == true) cout<<sum + ans<<endl;
    else cout<<sum - ans<<endl;
}


Measured memory_bytes: 256
while 1:
    n=int(input())
    if n==0:break
    y=int(input())
    bank_list=[]
    max_m=0
    num_keep=0
    mo=0
    for i in range(n):
        bank_list.append(list(map(int,input().split())))
    for i in bank_list:
        if i[2]==1:
            mo=1+y*i[1]/100
        if i[2]==2:
            mo=(1+(i[1]/100))**y
        if mo>max_m:
            max_m=mo
            num_keep=i[0]
    print(num_keep)


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

using namespace std;
// a - b
// a inc b dec
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define pb(a) push_back(a)
#define ALL(a) a.begin(),a.end()
#define sqr(x) (x) * (x)
#define fori(i, n) for(int i = 0; i < (int)(n); ++i)
#define cint const int &
#define SZ(a) ((int)(a.size()))
#define f(cnt) (((cnt) + 1) * (cnt) / 2)
#define watch(x) cout << (#x) << " = " << x << endl;
//#define log log10

const double PI = 2 * acos(0.0);

template<typename T>
struct edge {
    int from, to;
    T w;
    edge(int from, int to, T w): from(from), to(to), w(w) { }
    edge() { }
};


template<class T>
void show(T a) {
    for (auto x : a)
        cout << x << " ";
    cout << endl;
}



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

    int n;
    ll x;
    cin >> n >> x;
    vl a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(ALL(a));
    int cnt = 0;
    for (int i = 0; i < n && x; ++i) {
        if (x >= a[i]) {
            x -= a[i];
            if (i == n - 1) {
                if (!x) cnt++;
            } else cnt++;
        }
    }
    cout << cnt;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#define loop(i,b,n) for(int i = b; i<n; i++)
#define rep(i,n)  loop(i,0,n)
using namespace std;
int main(){
    
    
    vector<char>v(10);
    char s[100];
    cin >> s;
    int i = 0;
    int array[100];
    while(*(s+i)!= '\0')
    {
        if(*(s+i) == '1')
            array[i] = 2;
        else if(*(s+i) == '0')
            array[i] = 1;
        else if(*(s+i) == 'B')
            array[i] = 0;
        i++;
    }
    int size = i;
    rep(i, size)
    {
        if(array[i] == 0 && i-1 >= 0 )
            for(int k = i-1; k>=0;k--)
                if(array[k] != 0)
                { array[k] = 0; break;}
    }

    rep(i,size){
        if(array[i] == 1)
            cout << 0;
        if (array[i] == 2)
            cout  <<1;
    }
    //rep(i,size)
    //cout << " " << array[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256