akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int x, y, z;
  scanf("%d%d%d", &x, &y, &z);
  x -= z;
  int r = 0;
  while(x >= y+z) {
    x -= y+z;
    r++;
  }
  printf("%d\n", r);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int A, B, K;
    scanf("%d%d%d", &A, &B, &K);
    int i;
    if(A + K - 1 >= B - K + 1) {
        for(i=A; i<=B; i++) {
            printf("%d\n", i);
        }
        return 0;
    }
    for(i=A; i<=A+K-1; i++) {
        printf("%d\n", i);
    }
    for(i=B-K+1; i<=B; i++) {
        printf("%d\n", i);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,f[100009];
vector<int>son[100009];
void dfs(int x) {
	if(son[x].empty()) return;
	for(int i=0;i<son[x].size();i++) dfs(son[x][i]);
	vector<int>tmp;
	for(int i=0;i<son[x].size();i++) tmp.push_back(f[son[x][i]]);
	sort(tmp.begin(),tmp.end());
	int mx=0;
	for(int i=0;i<tmp.size();i++) mx=max(mx,tmp[i]+(int)tmp.size()-i);
	f[x]=mx;
}
int main() {
	scanf("%d",&n);
	for(int i=2;i<=n;i++) {
		int x;
		scanf("%d",&x);
		son[x].push_back(i);
	}
	dfs(1);
	printf("%d\n",f[1]);
	return 0;
}

Measured memory_bytes: 13952
import java.util.*;
import java.math.*;

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

     Scanner sc = new Scanner(System.in);  
      
     int color[] = {0,0,0,0,0,0,0,0};
     
   int N = sc.nextInt();
   int overcolor = 0;     
     
   for(int i = 0;i < N;i++){       
     int x = sc.nextInt();
     for(int j = 0;j <= 7;j++){
         if(400*j<= x && x < 400*(j+1)){
             color[j]++;
         }        
     }
     if(x >= 3200){
         overcolor++;
     }
   }
     
     int sum = 0;
     for(int i = 0;i < 8;i++){
         if(color[i] > 0){
             sum++;
         }
     }     
     
     if(sum == 0){
         int min = 1;
         int max = overcolor;
         System.out.println(min + " " + max);
         return;
     }
     
     if(sum > 0){
         int min = sum;
         int max = sum + overcolor;
         System.out.println(min + " " + max);
         return;
     }
     
          
      
   }
}
        
        

Measured memory_bytes: 21076
n = int(input())
L = list(map(int, input().split()))
p = 0
for _ in L:
    for j in range(n-1, 0, -1):
        if L[j] < L[j-1]:
            L[j], L[j-1] = L[j-1], L[j]
            p += 1
print(*L)
print(p)

Measured memory_bytes: 7692
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

Tuple!(string,int,int) def(int p,int q){
    Tuple!(int,int)[] list;
    string s1,s2;
    string ret = "";
    s1 = to!string(p);
    s2 = to!string(q);
    int ind,n;
    n = p;
    ind++;
    n *= 10;

    while(n){
	s1 ~= '0';
	ind++;
	int a = n % q;
	int b = to!int(n / q);
	for(int i=0;i<list.length;i++){
	    if(a == list[i][0] && b == list[i][1]){
		return tuple(ret,i,ind-1);
	    }
	}
	ret ~= to!string(b);
	list ~= tuple(a,b);
	n = a;
	n *= 10;
    }
    return tuple(ret,-1,-1);
}

void main(){

    while(true){
	string s1 = readln();
	if(stdin.eof()) break;
	auto s = s1.split().to!(int[]);
	int p = s[0];
	int q = s[1];
	auto ans = def(p,q);
	writeln(ans[0]);
	if(ans[1] != -1){
	    string ret="";
	    for(int i=0;i<ans[0].length;i++){
		if(ans[1] <= i &&  i <= ans[2]) {
		    ret ~= "^";
		}else ret ~= " ";
	    }
	    writeln(ret);
	}
    }

}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define Rep(i,n) for(ll i = 0; i <= n; i++)
#define REp(i,n) for(ll i = 1; i < n; i++)
#define REP(i,n) for(ll i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



int main(){
  int n, m;
  cin >> n >> m;
  V<int> a(n);
  rep(i,n) cin >> a[i];
  int sum = 0;
  rep(i,n) sum += a[i];
  int ans = 0;
  rep(i,n) {
    if(sum <= a[i] * 4*m) ans++;
  }
  YesorNo(ans >= m);
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << '\n'

using ll = long long;
using namespace std;

const int MOD = 1e9 + 7;
const int N = 1010;
char grid[N][N];
int dp[N][N], n, m;

int solve(int i, int j)
{
	if (i == 0 && j == 0)
		return 1;
	int &dp = ::dp[i][j];
	if (grid[i][j] == '#')
		return dp = 0;

	if (dp != -1)
		return dp;
	
	dp = 0;
	if (i > 0)
		dp += solve(i - 1, j);
	if (j > 0)
		dp += solve(i, j - 1);
	dp %= MOD;
	return dp;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

#ifdef LOCAL_DEFINE
	freopen("in.txt", "r", stdin);
#endif

	cin >> n >> m;

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			cin >> grid[i][j];

	memset(dp, -1, sizeof(dp));

	cout << solve(n - 1, m - 1) << '\n';

	return 0;
}

Measured memory_bytes: 5376
import java.util.*

fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val n = Integer.parseInt(reader.readLine())
    val input = reader.readLine()
    val stringTokenizer = StringTokenizer(input)
    val array = IntArray(n) { Integer.parseInt(stringTokenizer.nextToken()) }
    val strBuilder = StringBuilder(array.size * 2)
    array.cSort().forEach {
        strBuilder.append(it).append(" ")
    }
    println(strBuilder.deleteCharAt(strBuilder.lastIndex))
}

fun IntArray.cSort(): IntArray {
    val countArray = IntArray((this.max() ?: 0) + 1)
    countArray.fill(0)
    for (i in this) {
        countArray[i]++
    }
    for (i in 1 until countArray.size) {
        countArray[i] += countArray[i - 1]
    }
    val ansArray = IntArray(this.size)
    for (i in ansArray.size-1 downTo 0) {
        ansArray[countArray[this[i]] - 1] = this[i]
        countArray[this[i]]--
    }
    return ansArray
}


Measured memory_bytes: 163620
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n, T;
  string s;
  cin >> n >> s >> T;
  vi s1(n + 1);
  for (int i = 0; i < n; ++i) {
    s1[i + 1] = s1[i] + (int)(s[i] == 'M');
  }
  for (int test = 1; test <= T; ++test) {
    int k;
    cin >> k;
    ll res = 0, cur = 0, cnt = 0;
    for (int i = 0; i < n; ++i) {
      if (i >= k) {
        if (s[i - k] == 'D') {
          --cnt;
          cur -= s1[i] - s1[i-k];
        }
      }
      if (s[i] == 'D') ++cnt;
      else if (s[i] == 'M') cur += cnt;
      else if (s[i] == 'C') {
        res += cur;
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size()/2;i++){
		ans+=(s[i]!=s[s.size()-1-i]);
    }
    cout<<ans<<"\n";
}

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

int main() {
	int d, g;
	cin >> d >> g;
	vector<int> p(d), c(d);
	rep(i, d) cin >> p[i] >> c[i];
	int ans = 1001001001;
	rep(bit, (1 << d)) {
		int tmp = 0;
		int cnt = 0;
		rep(i, d) {
			if (bit & (1 << i)) {
				tmp += (i + 1) * 100 * p[i] + c[i];
				cnt += p[i];
			}
		}
		int now = -1;
		int deg = 0;
		rep(i, d) if (!(bit & (1 << i))) now = 100 * (i + 1), deg = p[i];
		while (tmp < g && deg > 0) {
			tmp += now;
			deg--;
			cnt++;
		}
		if (tmp >= g) ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
w = list(map(int, input().split()))
total = sum(w)
sum1 = 0
for j in range(n):
    sum1 += w[j]
    if sum1 >= total / 2:
        if abs(total/2 - sum1) <= w[j] / 2:
            idx = j
        else:
            idx = j - 1
        break
ans = abs(sum(w[:idx + 1]) - sum(w[idx+ 1:]))
print(ans)


Measured memory_bytes: 3060
/*
 ============================================================================
 Name        : ABC160-C.c
 Author      : shigu-shigu_rain
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
int K, N, slong, mlong;
int main(void) {
	scanf("%d %d", &K, &N);
	int A[N+2];
	int B[N+2];
	for(int i = 0; i < N+2; i++){
		A[i]=0;
		B[i]=0;
	}
	scanf("%d", &A[0]);
	for(int j = 1; j < N; j++){
		scanf("%d", &A[j]);
		B[j] = A[j] - A[j-1];
	}

	B[0] = K - A[N-1] + A[0];
	B[N] = K - A[N-1] + A[0];

	int x = 1;
	while(x <= N){
		if(B[x] > (K - A[x-1]) / 2){
			if(B[x] > mlong){
				mlong = B[x];
				break;
			}else break;
		}else if(B[x] > mlong){
			mlong = B[x];
		}

		x++;
	}

	printf("%d", (K - mlong));

	return 0;
}

Measured memory_bytes: 3288
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int R;
    cin >> R;
    cout << 2 * R * M_PI << endl;
}

Measured memory_bytes: 3788
fun main(args: Array<String>) {
    apc001b()
}

fun apc001b() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toLong() }.toLongArray()
    val bList = readLine()!!.split(" ").map { it.toLong() }.toLongArray()

    val remain = (0 until n).map {
        when {
            aList[it] > bList[it] -> -(aList[it] - bList[it])
            aList[it] < bList[it] -> (bList[it] - aList[it]) / 2
            else -> 0
        }
    }.sum()

    val answer = if (remain >= 0) "Yes" else "No"

    println(answer)
}


Measured memory_bytes: 42008
#include<iostream>
#include<algorithm>
using namespace std;
long long a[2017],m[2017],x;
int main(){
	int n;cin>>n>>x;
	for(int i=0;i<n;i++){
		cin>>a[i];
		m[i]=1145141919;
	}
	long long ans=114514114514810;
	for(int k=0;k<n;k++){
		long long cnt=k*x;
		for(int i=0;i<n;i++){
			m[i]=min(m[i],a[(i+k)%n]);
			cnt+=m[i];
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int arr[n];
	int arr1[n];
	int arr2[n];
	int ansMin = INT_MAX;
	for(int i = 0 ; i < n ; i++){
		cin>>arr[i];
	}
	arr1[0] = arr[0];
	for(int i = 1 ; i < n ; i ++){
		arr1[i] = arr[i] + arr1[i - 1];
	}
	arr2[n - 1] = arr[n - 1];
	for(int i = n - 2 ; i >= 0 ; i--){
		arr2[i] = arr2[i + 1] + arr[i];
	}
	for(int i = 0 ; i < n - 1; i++){
		if(abs(arr1[i] - arr2[i + 1]) < ansMin)
			ansMin = abs(arr1[i] - arr2[i + 1]);
	}
	cout<<ansMin;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,x,a[100000],ans;
int32_t main(){
CODE_START;
cin >> n;
cin >> x;
for(ll i=0;i<n;i++)
    cin >> a[i];
for(ll i=1;i<n;i++)
if(a[i]+a[i-1]>x){
        ans=ans+a[i]+a[i-1]-x;
        a[i]=max(0LL,a[i]-a[i]-a[i-1]+x);
 
}
cout <<ans;
return 0;}

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

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

string s;
int a, b;

bool MMYY(string s) {
	return a > 0 && a <= 12;
}

bool YYMM(string s) {
	return b > 0 && b <= 12;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> s;
	a = stoi(s.substr(0, 2));
	b = stoi(s.substr(2));
	if(MMYY(s) && YYMM(s))
		cout << "AMBIGUOUS";
	else if(MMYY(s))
		cout << "MMYY";
	else if(YYMM(s))
		cout << "YYMM";
	else
		cout << "NA";
	return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && a != c) cout << "Yes" << endl;
  else if(b == c && b != a) cout << "Yes" << endl;
  else if(c == a && c != b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

use std::collections::HashMap;

fn main() {
    input!{
        n: usize,
        k: usize,
        mut td: [[usize; 2]; n]
    }
    td.sort_by(|x, y| y[1].cmp(&x[1]));
    let mut tab: Vec<Vec<usize>> = Vec::new();
    let mut map: HashMap<usize, usize> = HashMap::new();
    for i in 0..n {
        if let Some(&idx) = map.get(&td[i][0]) {
            tab[idx].push(td[i][1]);
        } else {
            map.insert(td[i][0], tab.len());
            tab.push(vec![td[i][1]]);
        }
    }
    let mut ans: usize = 0;
    let mut max: usize = 0;
    let mut s: Vec<usize> = Vec::new();
    for i in 0..tab.len() {
        let mut ds = tab[i].clone();
        ans += ds[0] + 2 * i + 1;
        ds.remove(0);
        s.append(&mut ds);
        if s.len() + i + 1 >= k {
            s.sort_by(|x, y| y.cmp(&x));
            s.truncate(k - i - 1);
            max = std::cmp::max(max, ans + s.iter().clone().sum::<usize>());
        }
        if i == k - 1 {
            break;
        }
    }
    println!("{}", max);
}


Measured memory_bytes: 19960
#include <bits/stdc++.h> 
     
    using namespace std; 
    // using namespace arma;
     
    #define ll long long
    #define ld long double
    // int ans(vector < vector<int > > xx)
    // {
    //  return 0;
    // }
    int main()
    {
        ll n;
        cin >> n;
        ll arr[n];
        for(ll i=0;i<n;i++)
            cin >> arr[i];
        sort(arr,arr+n);
        ll ans=arr[n-1];
        ll ct=1;
        for(ll i=n-2;i>=0;i--)
        {
            ans+=arr[i]*2;
            ct+=2;
            if(ct==n-1)
                break;
            if(ct>n-1)
            {
                ct--;
                ans-=arr[i];
                break;
            }
        }
        if(n==2)
            ans=arr[n-1];
        cout << ans << "\n";
    }

Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>

using namespace std;

int n, k, q;
vector<int> a;

signed main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k >> q;
	a.resize(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

    int ans = 1.5e9;
    for (int ri = 0; ri < n; ++ri) {
        int l = 0, r = -1;
		while (l < n && a[l] < a[ri]) ++l;

        vector<int> vals;

        while (l < n) {
			r = l;
            while (r+1 < n && a[r+1] >= a[ri]) ++r;

            if (r-l+1 >= k) {
				vector<int> tmp(r-l+1);
				for (int i = 0; i <= r-l; ++i) tmp[i] = a[l+i];
				sort(tmp.begin(), tmp.end());
				for (int i = 0; i + k <= tmp.size(); ++i) vals.push_back(tmp[i]);
            }

            l = r+2;
            while (l < n && a[l] < a[ri]) ++l;
        }

        sort(vals.begin(), vals.end());
        if (vals.size() < q) continue;
        ans = min(ans, vals[q-1] - vals[0]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
////=====BIsmillahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comilla University

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define fi 2*acos(0.0)
#define ee 2.71828
#define ll  long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define edl printf("\n")
#define infinity 1e16
#define mod 1000000007
#define cn continue
#define csprint1 printf("Case %lld: ", cs++)
#define csprint2 printf("Case %lld:\n", cs++)
#define sf(a) scanf("%lld", &a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define all(v) v.begin(),v.end()
#define pfn(a) printf("%lld\n",a)
#define pfs(a) printf("%lld ",a)

using namespace __gnu_pbds;
using namespace std;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<pl> vpi;
typedef vector<pl> vpl;
typedef tree<pair<ll, int> , null_type, less<pair<ll, int> >, rb_tree_tag, tree_order_statistics_node_update> ost;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<","<< spc;
    err(++it, args...);
    cout<<edl;
}
///Bit manipulation

bool checkbit(int mask,int bit){return mask & (1<<bit);}
int setbit(int mask,int bit){ return mask | (1<<bit) ; }
int clearbit(int mask,int bit){return mask & ~(1<<bit);}
int togglebit(int mask,int bit){return mask ^ (1<<bit);}
int bitno(int mask) {return (int)__builtin_popcount(mask);}

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

///=====================================///

const int maX = 1e5+10;
ll dp[3005][3005];
int main(){
  ll n;sf(n);
  if(n)pfn(0);
  else pfn(1);
return 0;
}
//4 3
//7 -1 3
//8 2 5
//3 -1 9
//1 7 4


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }



void solve(long long r){
	ll res = 0;
	res = 3 * r * r;
	cout << res << "\n";
}

int main(){
    long long r;
    scanf("%lld",&r);
    solve(r);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
const int MaxN=100010,inf=1<<25;
int N;
struct edge{int to;edge*next;}E[MaxN*2],*ne=E,*fir[MaxN];
void link(int u,int v){*ne=(edge){v,fir[u]};fir[u]=ne++;}
bool limed[MaxN];
int fa[MaxN],lim[MaxN],l[MaxN],r[MaxN];
bool dfs1(int i){
	bool lm=0;
	int st=0;
	l[i]=-inf;r[i]=inf;
	for(edge*e=fir[i];e;e=e->next)if(e->to!=fa[i]){
		fa[e->to]=i;
		if(!dfs1(e->to))return 0;
		if(limed[e->to]){
			st|=1<<(l[e->to]&1);
			if(st==3)return 0;
			if(l[e->to]-1>l[i])l[i]=l[e->to]-1;
			if(r[e->to]+1<r[i])r[i]=r[e->to]+1;
			if(l[i]>r[i])return 0;
			lm=1;
		}
	}
	if(lm){
		if(limed[i]){
			if(lim[i]<l[i]||lim[i]>r[i]||(lim[i]&1)!=(l[i]&1))return 0;
			l[i]=r[i]=lim[i];
		}
		limed[i]=1;
	}
	else if(limed[i])l[i]=r[i]=lim[i];
	return 1;
}
int ans[MaxN];
void dfs2(int i,int v){
	ans[i]=v;
	for(edge*e=fir[i];e;e=e->next)if(e->to!=fa[i]){
		bool fl=1;
		for(int w=v-1;w<=v+1&&fl;w+=2)if(!limed[e->to]||w>=l[e->to]&&w<=r[e->to]){
			dfs2(e->to,w);
			fl=0;
		}
	}
}
int main(){
	scanf("%d",&N);
	for(int i=1,u,v;i<N;i++)scanf("%d%d",&u,&v),link(u,v),link(v,u);
	int K;scanf("%d",&K);
	while(K--){
		int v;scanf("%d",&v);
		limed[v]=1;
		scanf("%d",lim+v);
	}
	if(!dfs1(1))puts("No");
	else{
		dfs2(1,l[1]);
		puts("Yes");
		for(int i=1;i<=N;i++)printf("%d\n",ans[i]);
	}
}

Measured memory_bytes: 13056
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;

int main(void){
    int n,k;cin>>n>>k;
    int ans=0;
    int l[n];for(int i=0;i<n;i++)cin>>l[i];
    sort(l,l+n,greater<int>());
    for(int i=0;i<k;i++)ans+=l[i];
    cout<<ans<<endl;
}

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

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

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);
  for(auto &a: A)
    std::cin >> a;
  std::vector<int> f(N);
  std::vector<int> b(N);
  f[0] = A[0];
  for(int i=1;i<N;i++)
    f[i] = gcd(f[i-1],A[i]);
  b[N-1] = A[N-1];
  for(int i=N-2;i>=0;i--)
    b[i] = gcd(b[i+1],A[i]);
  int max_ans = b[1];
  for(int i=1;i<N-1;i++){
    int ans = gcd(f[i-1],b[i+1]);
    if (ans > max_ans) max_ans = ans;
  }
  if(f[N-2] > max_ans) max_ans = f[N-2];
  std::cout << max_ans << std::endl;
  return 0;
}


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

int main() {
  int64_t H;
  int64_t W;
  int64_t answer;
  cin >> H >> W;
  
  if (H == 1 || W == 1) {
    answer = 1;
  }
  else if (H != 1 && W != 1) {
    if (H * W % 2 == 0) {
      answer = H * W / 2;
    }
    
    else if (H * W % 2 != 0) {
      answer = H * W / 2 + 1;
    }
    }
  
  cout << answer << endl;
  
}  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a, b, c;
int main(){
//	freopen("input.in","r",stdin);
//	freopen("output.out","w",stdout);
	scanf("%d%d%d", &a, &b, &c);
	printf("%d\n", max(b-(a-c), 0));
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  #穴をあける
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  
#bingoチェック
  
#たて
if True in [ not False in [A[j][i]==A[j+1][i] for j in range(len(A)-1)] for i in range(len(A[0]))]:
  print("Yes")
#よこ
elif True in [len(Counter(tmpA))==1 for tmpA in A]:
  print("Yes")
#ななめ
elif A[1][1]==-1 and (A[0][0] == A[2][2] or A[0][2]==A[2][0]):
  print("Yes")
#ダメ
else:
  print("No")


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    ll a, v; std::cin >> a >> v;
    ll b, w; std::cin >> b >> w;
    ll t; std::cin >> t;
    ll diff = abs(a-b), add = (v-w);
    if (v > w && (diff+add-1)/add <= t) {
        std::cout << "YES" << "\n";
    } else {
        std::cout << "NO" << "\n";
    }
}


Measured memory_bytes: 3652
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

const Mod = 1000000007

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	r := NewReader(os.Stdin, 1024*4)

	grid := make([][]byte, h)
	for i := 0; i < h; i++ {
		grid[i] = r.Line()
	}

	var dp [1001][1001]int
	dp[0][0] = 1

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if grid[i][j] != '.' {
				continue
			}
			if i == 0 && j == 0 {
				dp[i][j] = 1
				continue
			}
			if i == 0 {
				dp[i][j] = dp[i][j-1]
				continue
			}
			if j == 0 {
				dp[i][j] = dp[i-1][j]
				continue
			}

			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % Mod
		}
	}

	fmt.Println(dp[h-1][w-1])
}

// generated by https://github.com/murosan/gollect

type Reader struct{ *bufio.Reader }

func NewReader(r io.Reader, size int) *Reader {
	return &Reader{Reader: bufio.NewReaderSize(r, size)}
}

func (r *Reader) Line() []byte { b, _ := r.ReadBytes('\n'); return b }


Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
   // freopen("vidu.inp","r",stdin);
   // freopen("vidu.out","w",stdout);
    int n, m;
    cin >> n >> m;

    int f[n+1];
    f[0] = 0;
    int nf = 1;

    int s = 0;
    for (int i = 0; i < n; i++) 
    {
        int a;
        cin >> a;
        s = (s + a) % m;
        f[nf++] = s;
    }
    sort(f, f + nf);

    long long int r = 0;
    int c = 0;
    for (int i = 1; i < nf; i++)
    {
        if (f[i] == f[i - 1])
        {
            c++;
        } 
        else
        {
            c = 0;
        }
        r += c;
    }

    cout << r;

    return 0;
}

Measured memory_bytes: 640
#135_C
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

cnt=0
for i in range(n):
    if b[i]>a[i]:
        if a[i+1]>(b[i]-a[i]):
            cnt+=b[i]
            a[i+1]-=(b[i]-a[i])
        else:
            cnt+=a[i]+a[i+1]
            a[i+1]=0
    else:
        cnt+=b[i]
print(cnt)
    

Measured memory_bytes: 18476
n = int(input())
list = [[int(j) for j in input().split()] for _ in range(n)]
ans = 0
for i in range(n):
    for j in range(n):
        ans += ((list[i][0] - list[j][0]) ** 2 + (list[i][1] - list[j][1]) ** 2) ** 0.5
print(ans / n)

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;

public class Program{
  public static void Main(){
    var s = string.Join("", Console.ReadLine().Reverse());
    var t = string.Join("", Console.ReadLine().Reverse());
    var a = "";
    var can = false;
    for(var i=0; i<s.Length-t.Length+1; i++){
      for(var j=0; j<t.Length; j++){
        if(t[j]==s[j+i]||s[j+i]=='?'){
          can = true;
        }else{
          //Console.WriteLine("FALSE i={0} j={1}", i, j);
          can = false;
          break;
        }
      }
      if(can){
        //Console.WriteLine("i={0} t.len={1} s.len={2}", i, t.Length, s.Length);
        a = s.Substring(0,i)+t+s.Substring(i+t.Length, s.Length-t.Length-i);
        break;
      }
    }
    Console.WriteLine(can?string.Join("", a.Replace('?', 'a').Reverse()):"UNRESTORABLE");
  }
}


Measured memory_bytes: 13268
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
max = min(n, 2 * 10 ** 5)

fac1 = [n] * (max + 1)
fac2 = [1] * (max + 1)
for i in range(2, max + 1):
    fac1[i] = fac1[i - 1] * (n - i + 1) % mod
    fac2[i] = fac2[i - 1] * i % mod
c = fac1[a] * pow(fac2[a], mod - 2, mod) % mod
d = fac1[b] * pow(fac2[b], mod - 2, mod) % mod

print((pow(2, n, mod) - c - d - 1) % mod)


Measured memory_bytes: 18804
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    string words[4] = {"maerd", "remaerd", "resare", "esare"};
    string s; cin >> s;
    reverse(s.begin(), s.end());
    for (int i = 0; i < s.size(); ) {
        for (int j = 0; j < 4; ++j) {
            if (s.substr(i, words[j].size()) == words[j]) {
                //substr : sのi番目からwords[j].size()個を取り出す
                i += words[j].size();
                break;
            }
            if (j == 3) {
                cout << "NO" << endl;
                return 0;
            }
        }
        
    }
    cout << "YES" << endl;
    return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

ll A, B;

bool check(ll a, ll i) {
    ll M = 1ll<<(i+1);
    ll b = a&(M-1);
    return b*2 >= M && b%2 == 0;
}
 
ll g(ll a) {
    ll ans = 0;
    if (a%4 == 1 || a%4 == 2) ans++;
    FOR (i, 1, 45) {
        if (check(a, i)) ans += (1ll<<i);
    }
    return ans;
}


ll solve() {
    if (A == 0) return g(B);
    else return g(B) ^ g(A-1);
}

int main() {
    cin >> A >> B;
    cout << solve() << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Stack;
class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br
		= new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> s=new Stack<Integer>();
		while(true){
String buf;
			if((buf=br.readLine())==null)break;
			if(buf.length()==0)break;
			int dat=Integer.parseInt(buf);
			if(dat!=0)
				s.push(new Integer(dat));
			else
				System.out.println(s.pop());
		}
	}
}

Measured memory_bytes: 9364
<?php
  
$N = trim(fgets(STDIN));

for ($i = 0; $i < $N; ++$i) {
    $e = trim(fgets(STDIN));
    if (!isset($input[$e])) {
        $input[$e] = 1;
    } else {
        $input[$e]++;
    }
}

$nmc = 0;
$rs = [];

ksort($input);

foreach ($input as $k => $v) {
    if ($v >= $nmc) {

        if ($nmc !== $v) {
            $rs = [];
        }
        $rs[] = $k;
        $nmc = $v;
    }
}

foreach ($rs as $k) {
    echo $k .PHP_EOL;
}


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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N,0);
    int ans = 0;
    int flag =0;
    for(int i = 0;i < N;i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    for(int i=0; i < N; i++){
        flag = 1;
        while(A[i] == A[i+1]){
            flag++;
            i++;
        }
        if(flag % 2 == 1){
            ans++;
        }

    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String t = s.substring(s.length() - 1, s.length());
    int i = Integer.parseInt(t);
    String ans = null;
    if (i == 3) {
      ans = "bon";
    } else if (i == 0 || i == 1 || i == 6 || i == 8) {
      ans = "pon";
    } else {
      ans = "hon";
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 35680
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (H, W, K) = Read3Longs();
            var C = new int[H, W];
            for (var i = 0; i < H; i++)
            {
                var j = 0;
                foreach (var c in ReadText())
                {
                    C[i, j] = c == '#' ? 1 : 0;
                    j++;
                }
            }
            var maxH = Math.Pow(2, H);
            var maxW = Math.Pow(2, W);
            var count = 0;
            for (var h = 0; h < maxH; h++)
            {
                var bitH = Convert.ToString(h, 2).PadLeft((int)H,'0');
                for (var w = 0; w < maxW; w++)
                {
                    var bitW = Convert.ToString(w, 2).PadLeft((int)W,'0');
                    if (IsValid(H, W, K, C, bitH, bitW))
                    {
                        count++;
                    }
                }
            }
            return count;
        }
        private static bool IsValid(long H, long W, long K, int[,] c, string bitH, string bitW)
        {
            var sum = 0;
            for(var i = 0; i < H; i++)
            {
                for(var j = 0; j < W; j++)
                {
                    sum += c[i, j] * int.Parse(bitH[i].ToString()) * int.Parse(bitW[j].ToString());
                }
            }
            return sum == K;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 35664
import math
import sys
a=int(input())
List=list(map(int,input().split()))
s=sum(List)
r=1
count=0
for i in range(a+1):
  count+=r
  r-=List[i]
  s-=List[i]
  if r<0:
    print(-1)
    sys.exit()
  r=min(s,2*r)
print(count)



Measured memory_bytes: 20008
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    int a[3][3];
    rep(i,3){
        rep(j,3){
            cin>>a[i][j];
        }
    }
    int n;
    cin>>n;
    rep(k,n){
        int b;
        cin>>b;
        rep(i,3){
            rep(j,3){
                if(a[i][j]==b){
                    a[i][j]=-1;
                }
            }
        }
    }
    bool flag=false;
    rep(i,3){
        if(a[i][0]+a[i][1]+a[i][2]==-3)flag=true;
        if(a[0][i]+a[1][i]+a[2][i]==-3)flag=true;
    }
    if(a[0][0]+a[1][1]+a[2][2]==-3)flag=true;
    if(a[2][0]+a[1][1]+a[0][2]==-3)flag=true;
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	int ans = 0;
	ans += m * 1900;
	ans += (n - m) * 100;
	rep(i, m)ans *= 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
lol=[int(n) for n in input().split()]
ans = 0
m = lol[0]
for i in lol:
    if(i < m):
        ans += (m-i)
        m=max(i,m)
    else:
        m = max(i,m)
        continue
print(ans)    

Measured memory_bytes: 32136
package main
 
import(
  "fmt"
  "bufio"
  "os"
  "strings"
  "strconv"
  "log"
)
 

func main(){
    a := 0
    fmt.Scan(&a)
    h,m := 0,0
    h = int(a/3600)
    a = a - h*3600
    m = int(a/60)
    a = a - m*60
    fmt.Printf("%d:%d:%d\n",h,m,a)
}


var sc = bufio.NewScanner(os.Stdin)

func Rr() []string {
  sc.Scan()
  slice := strings.Split(sc.Text(), " ")
  return slice
}



//入力関係ライブラリ(Atcoder:yamanobori_oldさんのもの)
func make_liner(maxByte int) *bufio.Scanner {
  liner := bufio.NewScanner(os.Stdin)
  liner.Buffer(make([]uint8, 0, 8192), maxByte)
  return liner
}
func word_spliter() *bufio.Scanner {
  words := make_liner(8192) 
  words.Split(bufio.ScanWords)
  return words
}

func eGetLine(r *bufio.Scanner) string {
  if r.Scan() {
    return r.Text()
  }
  err := r.Err()
  if err != nil {
    log.Fatal(err)
  }
  // EOF
  return ""
}

func eGetInt(r *bufio.Scanner) int {
  line := eGetLine(r)
  return eAtoi(line)
}

func eAtoi(s string) int {
  n, err := strconv.Atoi(s)
  if err != nil {
    log.Fatal(err)
  }
  return n
}


Measured memory_bytes: 1128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	int s = 3*c;
	cout<<a<<' '<<b<<' '<<s-a-b<<'\n';
	cout<<s-c-(b+c+2*a-s)<<' '<<c<<' '<<(b+c+2*a-s)<<'\n';
	cout<<s-(s-a-b)-c<<' '<<s-b-c<<' '<<s-a-c<<'\n';
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void)
{
	int a, b;
	
	std::cin >> a >> b;
	
	if( a < b )
		std::cout << "a < b" << std::endl;
	
	else if( a > b )
		std::cout << "a > b" << std::endl;

	else 
		std::cout << "a == b" << std::endl;
	
	return 0;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

int N;
vector<pair<int, int>> say[20];

int check(int a) {
  int tmp = a;
  int ret = 0;

  for (int i = 0; i < N; i++) {
    int uso = tmp & 1;
    tmp = tmp >> 1;
    if (uso == 0) {
      continue;
    }
    ret++;

    for (auto &p : say[i]) {
      int x = p.first;
      int y = p.second;
      if (y != ((a >> x) & 1)) {
        return 0;
      }
    }
  }
  return ret;
}

void solve() {
  cin >> N;

  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    while (A--) {
      int x, y;
      cin >> x >> y;
      say[i].emplace_back(x - 1, y);
    }
  }

  int ans = 0;
  for (int a = 0; a < (1 << N); a++) {
    ans = max(ans, check(a));
  }
  cout << ans << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long H, N, A[1 << 18];

int main() {
	cin >> H >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i]; H -= A[i];
	}
	if (H <= 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1024
n, m = gets.split.map(&:to_i)
points = gets.split.map(&:to_i).sort

if n >= m
  p 0
  exit 0
end

gaps = []
(points.count - 1).times do |index| #100000
  gaps.push(points[index + 1] - points[index])
end
gaps.sort!.reverse!

p gaps.drop(n - 1).inject(:+)

Measured memory_bytes: 10736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NK = ReadLine().Split(' ');
        var (N, K) = (int.Parse(NK[0]), long.Parse(NK[1]));
        var A = new List<int>() { 0 };
        A.AddRange(ReadLine().Split(' ').Select(s => int.Parse(s)));

        var route = new List<int>();
        var visited = Enumerable.Repeat(-1, N + 1).ToArray();
        var step = 0;
        var town = 1;

        while(true)
        {
            // 訪問済み
            if(-1 < visited[town])
            {
                break;
            }

            route.Add(town);

            visited[town] = step;
            
            town = A[town];

            step++;
        }

        var acyclic = route.GetRange(0, visited[town]);
        var cyclic = route.GetRange(visited[town], step - visited[town]);

        if(K < acyclic.Count)
        {
            WriteLine(acyclic[(int)K]);
        }
        else
        {
            var k = (K - acyclic.Count + cyclic.Count) % cyclic.Count;
            WriteLine(cyclic[(int)k]);
        }
    }
}


Measured memory_bytes: 46980
import java.util.*;
import java.util.Map.Entry;
public class Main {
	HashMap<String, Integer> wordtmp;
	Scanner sc;
	void run() {
		sc = new Scanner (System.in);
		wordtmp = new HashMap<String, Integer>();
		while (sc.hasNext()) {
			String str = sc.next();
			String[] words = str.split(" ");
			for (int i=0;i<words.length;i++) {
				if (!wordtmp.containsKey(words[i]))
					wordtmp.put(words[i], 1);
				else {
					wordtmp.put(words[i], wordtmp.get(words[i])+1);
				}
			}
		}
		int c = 0;
		int len = 0;
		String str="";
		String strl="";
		
		for (Iterator it = wordtmp.entrySet().iterator();it.hasNext();) {
			Entry entry = (Entry)it.next();
			if ( c < (Integer)entry.getValue() ) {
				c = (Integer)entry.getValue();
				str = (String)entry.getKey();
			}
			if (len < entry.getKey().toString().length() ) {
				len = entry.getKey().toString().length();
				strl = entry.getKey().toString();
			}
		}
		System.out.println( str + " " + strl);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
	
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define cins(s,n) rep(i,n)cin>>s.at[i];
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}

int main()
{
    int x;cin>>x;
    int divi,ans=0;
    ans+=(x/500)*1000;divi=x%500;
    ans+=(divi/5)*5;
    cout<<ans;

}

Measured memory_bytes: 256