akhauriyash/Code-Regression huggingface dataset:
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    int64_t X;
    std::cin >> X;

    int64_t ans = (X / 11) * 2;

    auto rem = X % 11;
    if (0 < rem) {
        ans++;
        if (7 <= rem) {
            ans++;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

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

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

int main()
{
    ll n;
    cin >> n;
    ll a[200005], sum[200005]={0};
    rep(i,n) cin >> a[i+1];
    ll ans=0;

    for (ll i = 1; i <= n; i++)
    {
        if (a[i] + i < 200005) {
            sum[a[i] + i] ++;
        }
    }

    for (ll i = 1; i <= n; i++)
    {
        if (i - a[i] > 0) {
            ans += sum[i-a[i]];
        }
    }

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

Measured memory_bytes: 6764
n, m, k = map(int, input().split())

mod = 998244353

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod

factorial = [1]
for i in range(1, n):
    factorial.append(factorial[i - 1] * i % mod)

inverseFactorial = [0] * n
inverseFactorial[n - 1] = power(factorial[n - 1], mod - 2)
for i in range(n - 2, -1, -1):
    inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod

def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod



tmp = [m]

for i in range(n):
    t = tmp[-1] * (m - 1) % mod
    tmp.append(t)


ans = 0

for kk in range(k + 1):
    c = comb(n - 1, kk)
    c *= tmp[n - kk - 1]
    ans += c
    ans %= mod

print(ans)


Measured memory_bytes: 106116
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        long k = scanner.nextLong();


        if (n % k == 0) {
            System.out.println(0);
        } else {
            long a = n % k;
            long b = a - k;


            if (b < 0) {
                b = -b;
            }

            if (a > b) {
                System.out.println(b);
            } else {
                System.out.println(a);
            }
        }
    }
}

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

int main(){
	int n,a,b,c,d;
	string s;
	bool ans_sub=false;
	cin >> n >> a >> b >> c >> d;
	cin >> s;
	if(d<c){//交差する必要あり
		//三連'.'検索
		for(int i=b-1;i<d;i++){
			if(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.'){
				ans_sub=true;
			}
		}
		if(ans_sub==false){
			cout << "No" <<endl;
			return 0;
		}

	}

	//二連で岩が置かれていないかチェック
	for(int i=b-1;i<d-1;i++){
		if(s[i]=='#' && s[i+1]=='#'){
			cout << "No" <<endl;
			return 0;
		}
	}
	for(int i=a-1;i<c-1;i++){
		if(s[i]=='#' && s[i+1]=='#'){
			cout << "No" <<endl;
			return 0;
		}
	}
	cout << "Yes" <<endl;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int H, W;
    cin >> H >> W;
    int dp[10][10];
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cin >> dp[i][j];
        }
    }
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            for (int k = 0; k < 10; k++)
            {
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k]);
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < W; i++)
    {
        for (int j = 0; j < H; j++)
        {
            int A;
            cin >> A;
            if (A == -1)
            {
                continue;
            }
            ans += dp[A][1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, M, V, P): (usize, i64, i64, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    fn bis<P: Fn(i64) -> bool>(ok: i64, ng: i64, p: P) -> i64 {
        let mid = (ok + ng) / 2;
        if (ok - ng).abs() == 1 {
            ok
        } else if p(mid) {
            bis(mid, ng, p)
        } else {
            bis(ok, mid, p)
        }
    }

    let B = {
        let mut B = A.clone();
        B.sort();
        B.reverse();
        B
    };
    let ans = bis(1, N as i64 + 1, |n| {
        let n = n as usize;
        let x = B[n - 1] + M;
        n <= P
            || (B[P - 1] <= x
                && B[(P - 1)..(n - 1)].iter().map(|&b| x - b).sum::<i64>()
                    >= M * (V - (P + N - n) as i64))
    });

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


Measured memory_bytes: 6396
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

aa = [0]*(n+1)
for i in range(n):
    aa[i+1] = aa[i] + a[i]

bb = [0]*(m+1)
for i in range(m):
    bb[i+1] = bb[i] + b[i]

j = m
ans = 0
for i in range(n+1):
    if aa[i] > k:
        break
    while bb[j] > k-aa[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)

Measured memory_bytes: 47628
L, R = [int(x) for x in input().split()]
if (R - L <= 2019):
    ans = 2019
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min(ans, i * j % 2019)
else:
    ans = 0
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
int main()
{
	int A1,A2,A3;
	int i;
	scanf("%d %d %d",&A1,&A2,&A3);
	i=A1+A2+A3;
	if(i>=22)
	{
		printf("bust");
	}
	else
	{
		printf("win");
	}
	return 0;
	
	
}

Measured memory_bytes: 3152
//
//  main.cpp
//  ALDS1_7_C
//
//  Created by ptyuan on 2018/11/6.
//  Copyright © 2018 YY. All rights reserved.
//

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

const int kNil = -1;
struct Node {
    int parent = -1;
    int left = -1;
    int right = -1;
};

int n = 0;


Node t[25];

void preorder(int r) {
    if (kNil == r) {
        return;
    }
    printf(" %d", r);
    preorder(t[r].left);
    preorder(t[r].right);
}

void inorder(int r) {
    if (kNil == r) {
        return;
    }
    inorder(t[r].left);
    printf(" %d", r);
    inorder(t[r].right);
}

void postorder(int r) {
    if (kNil == r) {
        return;
    }
    postorder(t[r].left);
    postorder(t[r].right);
    printf(" %d", r);
}

int main(int argc, const char * argv[]) {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) { t[i] = Node(); }
    for (int i = 0; i < n; ++i) {
        int id = kNil;
        int left = kNil;
        int right = kNil;
        scanf("%d %d %d", &id, &left, &right);
//        cin >> id >> left >> right;
        
        t[id].left = left;
        t[id].right = right;
        t[left].parent = id;
        t[right].parent = id;
    }
    
    int root = -1;
    for (int i = 0; i < n; i++) {
        if (kNil == t[i].parent) {
            root = i;
        }
    }
    printf("Preorder\n");
    preorder(root);
    printf("\n");
    printf("Inorder\n");
    inorder(root);
    printf("\n");
    printf("Postorder\n");
    postorder(root);
    printf("\n");
    return 0;
}



Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>k>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int d[n];
	long long flag =0;
	for(int i=0;i<n-1;i++)
	{
		d[i] = abs(a[i]-a[i+1]);
		flag += d[i];
	}
	d[n-1] = k-flag;
	sort(d,d+n);
	long long sum =0;
	for(int i=0;i<n-1;i++)
	sum += d[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
sum10 = 0
non10 = []
for _ in range(N):
  s = int(input())
  if s%10 == 0: sum10+=s
  else:non10.append(s)
non10.sort()
ans = sum10
if len(non10) > 0:
  sum_non10 = sum(non10)
  print(sum10 + sum_non10 if sum_non10%10!=0 else sum10+sum_non10-non10[0])
else:
  print(0)

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


int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  rep(i,n){
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static long mod = 1000_000_007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        long[][] dp = new long[n + 1][n + 1];
        dp[1][1] = 1;
        long[][] pref = new long[n + 1][n + 1];
        pref[1][1] = 1;
        for (int i = 2; i <= n; i++) {
            char cc = s.charAt(i - 2);
            for (int a = 1; a <= i; a++) {
                if (cc == '<') {
                    dp[i][a] = (dp[i][a] + pref[i - 1][a - 1]) % mod;
                    pref[i][a] = (pref[i][a - 1] + dp[i][a]) % mod;
                } else {
                    dp[i][a] = (dp[i][a] + pref[i - 1][i - 1]) % mod;
                    dp[i][a] = (dp[i][a] - pref[i - 1][a - 1]) % mod;
                    pref[i][a] = (pref[i][a - 1] + dp[i][a]) % mod;
                }
            }
        }

        long ans = 0;
        for (int i = 0; i <= n; i++) {
            ans = (ans + dp[n][i]) % mod;
            if (ans < 0) {
                ans += mod;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 231328
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

using namespace std;


int main() {
	#ifdef wws
		freopen ("in.txt", "r", stdin);
	#endif
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b) cout << "Zero", ioi
	b = min(b, -1);
	if (a > 0) cout << "Positive", ioi
	if ((b - a + 1) & 1) cout << "Negative";
	else cout << "Positive";
	ioi
}


Measured memory_bytes: 256
using System;
using System.Linq;

class E
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		int n = h[0];
		var rs = new int[h[1]].Select(_ => read()).ToArray();
		var qs = new int[int.Parse(Console.ReadLine())].Select(_ => read()).ToArray();

		var d = new long[n + 1, n + 1];
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				d[i, j] = long.MaxValue;
		foreach (var r in rs)
		{
			d[r[0], r[1]] = r[2];
			d[r[1], r[0]] = r[2];
		}

		for (int k = 1; k <= n; k++)
			for (int i = 1; i <= n; i++)
				for (int j = 1; j <= n; j++)
					if (d[i, k] < long.MaxValue && d[k, j] < long.MaxValue)
						d[i, j] = Math.Min(d[i, j], d[i, k] + d[k, j]);

		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				d[i, j] = d[i, j] <= h[2] ? 1 : long.MaxValue;

		for (int k = 1; k <= n; k++)
			for (int i = 1; i <= n; i++)
				for (int j = 1; j <= n; j++)
					if (d[i, k] < long.MaxValue && d[k, j] < long.MaxValue)
						d[i, j] = Math.Min(d[i, j], d[i, k] + d[k, j]);

		Console.WriteLine(string.Join("\n", qs.Select(x => d[x[0], x[1]]).Select(x => x < long.MaxValue ? x - 1 : -1)));
	}
}


Measured memory_bytes: 29228
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	long long x,y,z;
	cin >> x;
	y = x/11;
	z = x%11;
	if(z==0)cout << 2*y<<endl;
	else if (z<=6)cout << 2*y+1 <<endl;
	else cout << 2*y+2 << endl;
	return 0;
}

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

int main(){
	int x,y,w,h,r;
	cin >> w >> h >> x >> y >> r;
	
	if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r )) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>

#define MOD 1000000007
#define INF 2147483647

typedef long long lint;
using std::sort;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T abs(T num) { return num > 0 ? num : -num; }

int main()
{
	int n;
	scanf("%d", &n);
	
	int arr[10000] = { 1 }, p = 1;
	for (lint i = 6; i <= 100000; i *= 6) arr[p++] = i;
	for (lint i = 9; i <= 100000; i *= 9) arr[p++] = i;
	
	sort(arr, arr + p);

	int dp[100001] = { 0, 1 };
	for (int i = 2; i <= n; ++i)
	{
		lint min = INF, val;
		for (int j = 0; j < p && arr[j] <= i; ++j)
		{
			val = dp[i - arr[j]] + 1;
			min = min > val ? val : min;
		}

		dp[i] = min;
	}

	printf("%d", dp[n]);

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int F(int a,int b){
	return (max(a,b)+min(a,b))/(min(a,b)+1);
}
void bf(int a,int b,int l,int r){
	int c=(max(a,b)+min(a,b))/(min(a,b)+1),cnta=0;
	string ans;
	while(a+b){
		if(a&&F(a-1,b)<=c&&cnta<c)ans+="A",a--,cnta++;
		else ans+="B",b--,cnta=0;
	}
	cout<<"std\n";
	cout<<ans.substr(l-1,r-l+1)<<"\n";
}
int main(){
	int T;cin>>T;
	while(T--){
		int a,b,st,ed,cnta=0;cin>>a>>b>>st>>ed;
		//bf(a,b,st,ed);
		int c=(max(a,b)+min(a,b))/(min(a,b)+1);
		int l=1,r=a+b;
		while(l<=r){
			int mid=(l+r)/2,fail=false;
			int cnta=mid-mid/(c+1),cntb=mid/(c+1);
			if(cnta>a||cntb>b)fail=true;
			else if(F(a-cnta,b-cntb)>c)fail=true;
			else if(mid%(c+1)==0&&F(a-cnta,b-cntb+1)>c)fail=true;
			if(fail)r=mid-1;
			else l=mid+1;
		}
		//cout<<"r="<<r<<" c="<<c<<"\n";
		if(st<=r){
			for(int i=st;i<=min(r,ed);i++)
				if(i%(c+1)==0)cout<<"B";
				else cout<<"A";
			st=r+1;
		}
		for(int i=st;i<=ed;i++)
			if((a+b-i)%(c+1)==c)cout<<"A";
			else cout<<"B";
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 384
N = int(input())
H = list(map(int, input().split()))

ans = 0
cnt = [0] * N
for i in range(N-1):
    if H[i] >= H[i+1]:
        cnt[i] = 1

h_cnt = 0
for i in cnt:
    if i == 1:
        h_cnt += 1
    else:
        ans = max(ans, h_cnt)
        h_cnt = 0

print(ans)


Measured memory_bytes: 14224
//This is the Property of Rishabh Agarwal
#include <bits/stdc++.h>
#define F first
#define S second
#define MAX 10000003
using namespace std;

typedef long long int ll;
const ll mod = 1e9+7;
ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    ll temp=power(a,b/2)%mod;
    if(b%2==0){
        return (temp*temp)%mod;
    }
    else{
        return ((a*temp)%mod*temp)%mod;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    //cin>>t;
    t=1;
    while(t--){
        ll n;
        cin>>n;
        ll a[n][3];
        for(ll x=0; x<n; x++){
            cin>>a[x][0]>>a[x][1]>>a[x][2];
        }
        ll dp[n][3];
        dp[0][0]=a[0][0];
        dp[0][1]=a[0][1];
        dp[0][2]=a[0][2];
        for(ll x=1; x<n; x++){
            dp[x][0]=a[x][0]+max(dp[x-1][1],dp[x-1][2]);
            dp[x][1]=a[x][1]+max(dp[x-1][0],dp[x-1][2]);
            dp[x][2]=a[x][2]+max(dp[x-1][1],dp[x-1][0]);
        }
        cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<"\n";
    }
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main()
{  long long a,b,c,k;
  cin>>a>>b>>c>>k;
 long long  z=k;
 k=k-a;
 if(k<0)
     cout<<z;
 else
 {  k=k-b;
    if(k<0)
        cout<<a;
    else
        cout<<a-k;
 }
}

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

int main(){
  vector<int> x(4,0);
  for(int i=0;i<3;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    x.at(a)++;
    x.at(b)++;
  }
  
  bool flag=true;
  for(int i=0;i<4;i++){
    if(x.at(i)==3){
      flag=false;
    }
  }
  
  if(flag){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3556
N, W = map(int, input().split())
wv = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[0])

# 重さをi、dp[i]を価値の最大値とする
dp = [0]*(W+1)
dp[0] = 0

for i in range(N):
    w, v = wv[i]
    # 前から埋めていくとさっき更新したやつをもとに更新してしまう（同じものを使ってしまう）ので逆から更新する
    for j in range(W, w-1, -1):
        dp[j] = max(dp[j], dp[j-w] + v)

print(dp[W])

Measured memory_bytes: 41836
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    cin >> s;
    
    string w[3] = {"Sunny","Cloudy","Rainy"};
    for (int i = 0; i< 3;i++){
        if(s == w[i]){
            s=w[(i+1)%3];
            break;
        }
    }
    
    
    
    cout << s;
    
}


Measured memory_bytes: 256
from sys  import stdin,stdout

import bisect

import math

from collections import deque,Counter

mod=10**9 +7 

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")
    
def DFS(dictionary,vertex,visited):
    visited[vertex]=True
    stack=[vertex]
    print(vertex)
    while stack:
        a=stack.pop()
        for i in dictionary[a]:
            if not visited[i]:
                print(i)
                visited[i]=True
                stack.append(i)


def BFS(dictionary, vertex,visited):
    visited[vertex]=True
    q=deque()
    q.append(vertex)
    while q:
        a=q.popleft()
        for i in dictionary[a]:
            if not visited[i]:
                visited[i]=True
                q.append(i)
                print(i)

                


def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
  

def solve():
    d={'SUN':1,'MON':2,'TUE':3,'WED':4,'THU':5,'FRI':6,'SAT':7}
    s=input()
    pr(7-(d[s]-1))
    
    
for _ in range(1):
    solve()
    


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i=0; i<N; i++) {
    cin >> V[i];
  }
  sort(V.begin(),V.end());
  double a = V[0];
  for (int i=0; i<N; i++) {
    
    a = (a + V[i])/2.0;
    
  }
  cout << a;
  return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_vector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_vector(int n, Ts ... ts){
        return vector<decltype(make_vector(ts...))>(n, make_vector(ts...));
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;
    E_Set E;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}

    bool dfs(int v, int p = -1){
        int c = 0;
        for (auto &&u : E[v]) {
            if(u == p) continue;
            c += dfs(u, v);
        } // end
        if(c >= 2) throw 1;

        return c != 1;
    }

    bool solve(){
        try{
            return dfs(1);
        }
        catch(int k){
            return true;
        }
    }

    void run(){
        ll N;
        is >> N;
        if(!is) return;
        for (int i = 0; i < N - 1; ++i) {
            int A, B; is >> A >> B;
            E[A].insert(B);
            E[B].insert(A);
        } // end i
        cout << (solve() ? "First" : "Second") << endl;

    }
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_BlackAndWhiteTree.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  string str;
  unordered_map<string, int> result{
    {"AC",0},
    {"WA",0},
    {"TLE",0},
    {"RE",0},
  };
  for(int i = 0; i < n; i++) {
    cin >> str;
    result.at(str)++;
  }
  cout << "AC x " << result.at("AC") << endl;
  cout << "WA x " << result.at("WA") << endl;
  cout << "TLE x " << result.at("TLE") << endl;
  cout << "RE x " << result.at("RE") << endl;  
  
}

Measured memory_bytes: 3624
#include <stdio.h>
int main(){
  int a,b,c,out;
  scanf("%d %d %d",&a,&b,&c);
  out=a;
  a=b;
  b=out;
  out=a;
  a=c;
  c=out;
  printf("%d %d %d",a,b,c);
  return 0;
}

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

using namespace std;

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

const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;
const ll INF = 1ll << 60;

int n, m;

ll f[MAXN][2];

int a[MAXN];

void prework(){

}

int b[MAXN];

void read(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
		char s[10];
		if (i < n){
			scanf("%s", s);
			if (s[0] == '+')
				b[i + 1] = 1;
			else
				b[i + 1] = -1;
		}
	}
	b[0] = b[1] = 1;
	f[0][0] = 0;
	f[0][2] = f[0][1] = -INF;
	for(int i = 1; i <= n; i++){
		if (b[i] == 1){
			f[i][1] = max(f[i-1][1] - a[i], f[i-1][2] + a[i]);
			f[i][2] = f[i-1][2] + a[i];
			f[i][0] = max(f[i-1][0] + a[i], f[i][1]);
		}
		else{
			f[i][2] = max(f[i-1][1] + a[i], f[i-1][2] - a[i]);
			f[i][0] = max(f[i-1][0] - a[i], f[i][2]);
			f[i][1] = f[i][0];
		}
		//cout<<f[i][0]<<' '<<f[i][1]<<endl;
	}
	cout<<max(f[n][1],max(f[n][0], f[n][2]))<<endl;
}

void solve(int casi){

}

void printans(){

}


int main(){
	prework();
	int T = 1;
//	cin>>T;
	for(int i = 1; i <= T; i++){
		read();
		solve(i);
		printans();
	}
	return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

ll inv[1000000];
ll FactorialInv[1000000];
ll Factorial[1000000];
ll beki(ll a, ll b){
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}
void init_combination(){
    inv[1] = 1;
    FactorialInv[1] = 1;
    Factorial[1] = 1;
    for(int i = 2; i < 1000000; i++){
        inv[i] = beki(i, mod - 2);
        Factorial[i] = Factorial[i - 1] * i % mod;
        FactorialInv[i] = FactorialInv[i - 1] * inv[i] % mod;
    }
}
ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}


int main() {
    init_combination();
    //cout.precision(10);
    ll dp[1005][1005];
    ll a, b, c, d, n;
    cin >> n >> a >> b >> c >> d;
    for(ll i = 0; i <= n; i++){
        for(ll j = 0; j <= n; j++){
            dp[i][j] = 0;
        }
    }
    dp[n][a - 1] = 1;
    //for(ll people = 1; people <= n; people++){
    for(ll checked = a; checked <= b; checked++){
        for(ll people = 0; people <= n; people++){
        //for(ll checked = a; checked <= b; checked++){
            dp[people][checked] += dp[people][checked - 1];
            dp[people][checked] = dp[people][checked] % mod;
            ll patterns = 1;
            for(ll groups = 1; groups <= d; groups++){
                if(people - groups * checked < 0){
                    break;
                }
                patterns = patterns * combination(people - checked * (groups - 1), checked) % mod;
                patterns = patterns * inv[groups] % mod;
                if(groups < c) continue;
                ll delta = dp[people][checked - 1] * patterns % mod;
                //dp[people - groups * checked][checked] = (dp[people - groups * checked][checked] + dp[people][checked - 1]) % mod;
                //dp[people - groups * checked][checked] = (dp[people - groups * checked][checked]) * patterns % mod;
                dp[people - groups * checked][checked] = (dp[people - groups * checked][checked] + delta) % mod;
            }
        }
    }
    /*for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            //cout << j << " " << i << " " << dp[j][i] << endl;
        }
    }*/
    cout << dp[0][b] << endl;
    return 0;
}


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

ll ans = 0;

void dfs(string s, int count, ll total, ll now){
    if(count==s.size()){
        ans += total + now;
        return;
    }
    ll tmp = s[count] - '0';
    dfs(s, count+1, total+now, tmp);
    dfs(s, count+1, total, now*10+tmp);
}

int main() {
    string S;
    cin >> S;
    dfs(S, 1, 0, S[0]-'0');

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int p[N];
    REP(i, N){
        cin >> p[i];
    }

    int res = 0;
    bool flag = true;
    REP(i, N){
        if (p[i] != i+1){
            res++;
        }
        if(res > 2){
            flag = false;
            break;
        }
    }
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector<tuple<string, int, int>> v;
    for(int i = 0; i < n; i++){
        string s;
        int t;
        cin >> s >> t;
        v.emplace_back(s, -t, i+1);
    }
    sort(v.begin(), v.end());
    for(auto x : v) cout << get<2>(x) << endl;
}


Measured memory_bytes: 256
//#define DEB1 //output check function
//#define DEB2 //same output, input from input.txt

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VVI = vector<VI>;


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


#ifdef DEB1
#define DPRINT(x) cout<< #x << "=" << (x) << endl; // print at debug mode
#else
#define DPRINT(x) ;
#endif
#ifdef DEB1
#define DCHECK(x) cout<< "debug check" << #x << endl;
#else
#define DCHECK(x) ;
#endif
 


/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9
int md = 1000000007;
inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

// Main program
void solve(){
    string S;
    cin >> S;

    int dp_next[13];
    int dp[13];
    int s_size = S.size();
    int mul = 1;
    REP(i,13) dp[i]=0;
    dp[0] = 1;

    for(int d= s_size-1;d>=0;--d){
        REP(i,13) dp_next[i] = 0;
        DPRINT(S[d])
        REP(i,13){
            if(S[d]=='?'){
                REP(j,10){
                    add(dp_next[(j*mul+i)%13], dp[i]);
                }
            }
            else{
                int s = S[d] - '0';
                add(dp_next[(s*mul + i)%13], dp[i]);
            }
        }
        REP(i,13) {
            dp[i] = dp_next[i];
            DPRINT(i)
            DPRINT(dp_next[i])
        }
        mul = mul*10 %13;
        DPRINT(mul)
    }
    cout << dp_next[5] << endl;
}



// ----------------------------------------------
int main() {

#ifdef DEB2
    cout << "DEBUG MODE"  << endl;
	ifstream in("input.txt"); //for debug
	cin.rdbuf(in.rdbuf()); //for debug
#endif

	int T=1; 

	for (int i = 0; i < T; ++i) {
		solve();
	}
}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }

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

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

void solve(long long S) {

}

int main() {
  string s;
  string cmp0,cmp1;
  cin>>s;
  REP(i, s.length()){
    if(i%2==0){
      cmp0+='0';
      cmp1+='1';
    }
    else{
      cmp0+='1';
      cmp1+='0';
    }
  }
  int a=0;
  int b=0;
  REP(i,s.length()){
    if(s[i]!=cmp0[i])a++;
    if(s[i]!=cmp1[i])b++;
  }
  cout<<min(a,b)<<endl;
  return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		// N

		int n = sc.nextInt();

		// A
		int a = sc.nextInt();

		// B
		int b = sc.nextInt();

		if (n * a > b) {

			System.out.println(b);
		} else {

			System.out.println(n * a);
		}

	}
}


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

int main() {
	int n;
	cin>>n;
	int ans=1;
	int record = 0;
	for(int i=1;i<=n;i++){
		int count = 0;
		int j=i;
		while(j%2==0) {
			count++;
			j/=2;
		}
		if(count>record){
			record = count;
			ans = i;
		}
	}
	cout<<ans<<endl;
}


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

int main(){
    int H, W;
    cin >> H >> W;
    for(int i = 0; i < W + 2; i++){
        cout << "#";
    }
    cout << endl;
    for(int i = 0; i < H; i++){
        string text;
        cin >> text;
        cout << "#" << text << "#" << endl;
    }
    for(int i = 0; i < W + 2; i++){
        cout << "#";
    }
    cout << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  int xs, ys, hs;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i] >> h[i];
    if (h[i] > 0) {
      xs = x[i]; 
      ys = y[i];
      hs = h[i];
    }
  }
  for (int cx = 0; cx <= 100; ++cx) 
    for (int cy = 0; cy <= 100; ++cy) {
      bool ok = true;
      int H = hs + abs(xs-cx) + abs(ys-cy);
      for (int i = 0; i < n; ++i) {
        if (h[i] != max(H-abs(x[i]-cx)-abs(y[i]-cy), 0)) {
          ok = false;
          break;
        }
      }
      if (ok) {
        cout << cx << " " << cy << " " << H << endl;
        return 0;
      }
    }

  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#define RG register
#define IL inline
#define inf 2147483640
#define LL long long
#define pi acos(-1.0)
#define db double
using namespace std;
IL int gi()
{
	RG int res=0,w=1;
	RG char ch;
	for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
	if(ch=='-') w=-1,ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) res=10*res+ch-48;
	return res*w;
}
LL n;
int main()
{
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	scanf("%lld",&n);
	for(RG LL i=1;i<=3500;++i) {
		for(RG LL j=1;j<=3500;++j) {
			RG LL x=4*i*j-n*i-n*j;
			RG LL y=n*i*j;
			if(!x) continue;
			if(y%x) continue;
			RG LL k=y/x;
			if(k<=0) continue;
			printf("%lld %lld %lld\n",i,j,k);
			return 0;
		}
	}
	//fclose(stdin);fclose(stdout);
	return 0;
}


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

int main(){
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  if(n-k==0)cout<<1<<endl;
  else{
    int ans;
    if((n-k)%(k-1)!=0) ans=(n-k)/(k-1)+2;
    else ans=(n-k)/(k-1)+1;
    cout<<ans<<endl;
  }
}


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

const int INF = 10000;

// TODO: implement
int main() {
  // input
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  int ans = INF;
  rep(div, 1 << (h - 1)) {
    // format data
    vector<int> id(h);
    int g = 0;
    int count[h][w];
    rep(i, h) rep(j, w) count[i][j] = 0;
    rep(i, h) {
      rep(j, w) count[g][j] += s[i][j] - '0';
      if (div >> i & 1) g++;
    }
    g++;

    // devid vertically
    int now = g - 1;
    int sum[g];
    rep(i, g) sum[i] = 0;
    rep(j, w) {
      rep(i, g) {
        if (count[i][j] > k) {
          now = INF;
          break;
        }
      }
      rep(i, g) sum[i] += count[i][j];
      rep(i, g) {
        if (sum[i] > k) {
          now++;
          rep(i, g) sum[i] = count[i][j];
        }
      }
    }
    ans = min(ans, now);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int64_t N, ans=1;
  cin >> N;
  vector<int64_t> T(N);
  for (int i=0; i<N; i++) {
    cin >> T[i];
    ans=lcm(ans,T[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3616
/**
 *    author:  tourist
 *    created: 27.11.2019 10:00:08       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int ans = 0;
  for (char c : s) {
    ans += (int) (c - '0');
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int a, b;
  cin >> a >> b;
  int ans = -1;
  rep (i, 10000) {
    if ((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	string s="ABC",t;
	cin>>t;
	s=s+t;
	cout<<s<<endl;
}

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

fn main() {
    let x: usize = read();
    println!(
        "{}",
        if x == 7 || x == 5 || x == 3 {
            "YES"
        } else {
            "NO"
        }
    );
}

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


Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  int n,l; cin >> n>>l;
  string a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<n;i++) cout<<a[i];
  cout<<endl;
  return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

int main(){
	int n;cin>>n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	int ans = 0;
	for(int i = 0; i < n; i++) {
		if((i + 1 )% 2 == 1&& a[i] % 2 == 1){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
            using namespace std;
            #define int long long
            #define fi first
            #define se second
            #define pi pair<int,int>  
            #define pb push_back

            // dont forget to initialize global variables inside main() ;
            

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

            int tt=1;       
            
            
            while( tt-- ){
                string s;cin>>s;
                int c=0;
                if( s[0]=='R' && s[1]=='R' && s[2]=='R' )
                    c = 3;
                else if( s[0]=='R' && s[1]=='R' )
                    c=2;
                else if( s[2]=='R' && s[1]=='R' )
                    c=2;
                else if( s[0]=='R' || s[1]=='R' || s[2]=='R' )
                    c=1;
                else
                    c=0;
                cout<<c<<endl;

            }

            return 0;
        }

                    
     

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int K = sc.nextInt();
		double radDiff = Math.PI * 2 / N;
		Point p1f = new Point(1, 0);
		Point p1t = new Point(Math.cos(radDiff * K), Math.sin(radDiff * K));
		Point p2f = new Point(Math.cos(radDiff), Math.sin(radDiff));
		Point p2t = new Point(Math.cos(-radDiff * (K - 1)), Math.sin(-radDiff * (K - 1)));
		Point cross = getIntersectPoint(p1f, p1t, p2f, p2t);
		double dx1 = p1f.x - cross.x;
		double dy1 = p1f.y - cross.y;
		double dx2 = p2f.x - cross.x;
		double dy2 = p2f.y - cross.y;
		double area = (dx1 * dy2 - dx2 * dy1) / 2;
		double all = (p1f.x * p2f.y - p2f.x * p1f.y) / 2;
		System.out.printf("%.9f\n", (all - area) * N);
	}

	static Point getIntersectPoint(Point p1, Point p2, Point p3, Point p4) {
		double x1 = p1.x;
		double y1 = p1.y;
		double x2 = p2.x;
		double y2 = p2.y;
		double x3 = p3.x;
		double y3 = p3.y;
		double x4 = p4.x;
		double y4 = p4.y;
		double dx2 = x4 - x3;
		double dy2 = y4 - y3;
		double s1 = dx2 * (y1 - y3) - (dy2 * (x1 - x3));
		double s2 = dx2 * (y3 - y2) - (dy2 * (x3 - x2));
		double ss = s1 + s2;
		if (ss == 0) return null;
		double sr = s1 / ss;
		double cx1 = x1 + ((x2 - x1) * sr);
		double cy1 = y1 + ((y2 - y1) * sr);
		if (Double.compare(cx1, x1) * Double.compare(cx1, x2) > 0) {
			return null;
		}
		if (Double.compare(cy1, y1) * Double.compare(cy1, y2) > 0) {
			return null;
		}
		if (Double.compare(cx1, x3) * Double.compare(cx1, x4) > 0) {
			return null;
		}
		if (Double.compare(cy1, y3) * Double.compare(cy1, y4) > 0) {
			return null;
		}
		return new Point(cx1, cy1);
	}

	static class Point {
		double x, y;

		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}
	}

}

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

int main()
{
	int n = 0, m = 0;
	cin >> n >> m;
	vector<int> v(n);
	for (int i = 0; i < n; ++i) {
		v[i] = -1;
	}

	for (int i = 0; i < m; ++i)
	{
		int s = 0, c = 0;
		cin >> s >> c;
		s--;
		if (v[s] != -1 && v[s] != c)
		{
			cout << -1;
			return 0;
		}
		//if (v[s] != -1)
		//{
		//	if (c < v[s])
		//		v[s] = c;
		//}
		//else
		{
			v[s] = c;
		}
	}

	if (n == 1 && v[0] <= 0) {
		cout << 0;
		return 0;
	}

	if (v[0] == 0)
	{
		cout << -1;
		return 0;
	}

	if (v[0] == -1)
	{
		v[0] = 1;
	}

	int ret = 0;
	int n10 = 1;
	for (int i = n - 1; i >= 0; i--)
	{
		if (v[i] > 0)
		{
			ret += v[i] * n10;
		}

		n10 *= 10;
	}
	cout << ret;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
	double x,h;
	while(scanf("%lf %lf",&x,&h), x||h)
	{
		printf("%.6lf\n",x*x + 2*(x*sqrt(h*h+x*x/4.0)));
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    int a[n],b[n];
    rep(i,n){
        cin>>a[i]>>b[i];
        a[i]=b[i]-a[i];
    }
    vector<int> ord(n);
    iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](int x,int y){
        return b[x]<b[y];
    });
    int cur = 0;
    for(auto i:ord){
        if(cur>a[i]){
            cout<<"No"<<endl;
            return 0;
        }
        cur += b[i]-a[i];
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 2560
H,W = map(int,input().split())
a = [''] * H
for i in range(H):
	a[i] = input()
	
row = [False] * H
col = [False] * W 

for i in range(H):
	for j in range(W):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True

for i in range(H):
	if row[i]:
		for j in range(W):
			if col[j]:
				print(a[i][j], end = '')
		print()



	

	

Measured memory_bytes: 4468