akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	static int[] bits=new int[8];
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int N=sc.nextInt();
		int[] ngs=new int[3];
		int[] take=new int[N];
		for(int i=0; i<3; i++) {
			ngs[i]=sc.nextInt();
		}
		for(int i=0; i<N; i++) {
			take[i]=sc.nextInt();
		}
		int baai=1;
		for(int i=0; i<N; i++) {
			baai*=4;
		}
		int min=114514810;
		for(int i=0; i<baai; i++) {
			int tmp=0;
			int[] kazu=new int[3];
			tori(i);
			if(sanbon()) {
				for(int j=0; j<N; j++) {
					if(bits[j]==1) {
						kazu[0]++;
					}
					else if(bits[j]==2) {
						kazu[1]++;
					}
					else if(bits[j]==3) {
						kazu[2]++;
					}
				}
				int naga=0;
				for(int k=0; k<N; k++) {
					if(bits[k]==1) {
						naga+=take[k];
					}
				}
				tmp+=((kazu[0]-1)*10)+Math.abs(naga-ngs[0]);
				naga=0;
				for(int k=0; k<N; k++) {
					if(bits[k]==2) {
						naga+=take[k];
					}
				}
				tmp+=((kazu[1]-1)*10)+Math.abs(naga-ngs[1]);
				naga=0;
				for(int k=0; k<N; k++) {
					if(bits[k]==3) {
						naga+=take[k];
					}
				}
				tmp+=((kazu[2]-1)*10)+Math.abs(naga-ngs[2]);
				min=Math.min(min, tmp);
			}
		}
		pl(min);
	}
	static void tori(int i) {
		for(int k=0; k<8; k++) {
			bits[k]=i%4;
			i/=4;
		}
	}
	static boolean sanbon() {
		int a=0;
		int b=0;
		int c=0;
		for(int i=0; i<8; i++) {
			if(bits[i]==1) {
				a=1;
			}
			else if(bits[i]==2) {
				b=1;
			}
			else if(bits[i]==3) {
				c=1;
			}
		}
		if(a+b+c==3) {
			return true;
		}
		else {
			return false;
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}

Measured memory_bytes: 27204
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int N,pos=0,ofs=0;
string s1,s2;
bool TY[60];//縦:true 横:false

ll MOD=1000000007;

int main()
{
	cin>>N>>s1>>s2;
	for(pos=0;pos<N;)
	{
		if(s1[pos]==s2[pos])
		{
			TY[ofs++]=true;
			pos+=1;
		}
		else
		{
			TY[ofs++]=false;
			pos+=2;
		}
	}
	ll res=1;
	for(int i=0;i<ofs;i++)
	{
		if(i==0)
		{
			if(TY[0]==true)res=3;
			else res=6;
		}
		else
		{
			if(TY[i-1]==true&&TY[i]==true)res=(res*2)%MOD;
			else if(TY[i-1]==true&&TY[i]==false)res=(res*2)%MOD;
			else if(TY[i-1]==false&&TY[i]==true)res=(res*1)%MOD;
			else if(TY[i-1]==false&&TY[i]==false)res=(res*3)%MOD;
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

int main(void)
{
    ll n, a;
    cin >> n;
    set<ll> s;
    rep(i, 0, n)
    {
        cin >> a;
        s.insert(a);
    }
    cout << (s.size() % 2 == 1 ? s.size() : s.size() - 1) << endl;
}

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

using namespace std;
typedef long long ll;

int main(){
	int n;
	ll y;
	cin >> n >> y;

	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= n-i; j++){
			int temp = n - i - j;
			if(y == (10000 * i + 5000 * j + 1000 * temp)){
				printf("%d %d %d\n",i, j,temp);
				return 0;
			}
		}
	}

	cout << "-1" << " " << "-1" << " "<< "-1" << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

a = INT()
print(a+a**2+a**3)


Measured memory_bytes: 10552
n = int(input())
n_ = n-1
a = [n]
if n_ == 1:
    a_ = []
else:
    a_ = [n_]
    
for i in range(2,int(n**0.5//1+1)):
    if n%i == 0:
        a.append(i)
        if n/i != i:
            a.append(n/i)
    if n_%i == 0:
        a_.append(i)
        if n_/i != i:
            a_.append(n_/i)

ans = len(a_)
for i in a:
    num = n
    while num%i == 0:
        num /= i
    if num % i == 1:
        ans += 1
    
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>
int main(void){
    double r;
    double are,circ;

    scanf("%lf", &r);
    
    are=r*r*3.141592653589;
    circ=2*r*3.141592653589;
    
    printf("%f %f\n", are, circ);
    
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int n;
    int sell[20];
    int c;
    cin>>n;
    while(n!=0){
        for(int i=0;i<10;i++){
            sell[i]=0;
        }
        for(int i=0;i<n;i++){
            cin>>c;
            sell[c]++;
        }
        for(int i=0;i<10;i++){
            if(sell[i]==0){
                cout<<'-';
            }else{
                for(int j=0;j<sell[i];j++){
                    cout<<'*';
                }
            }
            cout<<"\n";
        }
        cin>>n;
    }
    return 0;
}




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

int main()
{
	char s[16];
	while(cin >> s)
	{
		for(int i=0; i<10; i++) s[i]-='0';
		for(int i=0; i<9; i++)
		for(int j=0; j<9-i; j++)
		{
			s[j]=(s[j]+s[j+1])%10;
		}
		cout << (int)s[0] << endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define int long
signed main(){
  int n,p;
  string s;
  cin>>n>>p>>s;
  vector<int> v(n+1,0);
  for(int i=n-1,j=1;i>=0;--i,j=j*10%p) v[i]=((s[i]-'0')*j+v[i+1])%p;
  int r=0;
  if(p==2||p==5){
    for(int i=0;i<n;++i)if((s[i]-'0')%p==0)r+=i+1;
  }
  else{
    map<int,int> m;
    m[0]=1;
    for(int i=n-1;i>=0;--i){
      r+=m[v[i]];
      ++m[v[i]];
    }
  }
  cout<<r;
}


Measured memory_bytes: 2564
#include<iostream>

using namespace std;

void swap(int &a , int &b)
{
	int temp = a;
	a = b;
	b = temp;
}

int main(void)
{
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	
	for(int i = 0 ; i < 3 ; i++)
	{
		for(int j = 0 ; j < 3 - i - 1 ; j++)
		{
			if(a[j] > a[j+1])
			{
				swap(a[j] ,a[j+1]);
			}
		}
	}
	for(int i = 0 ; i < 3 ; i++ )
	{
		
		cout << a[i] << ( (i != 2) ? " " : "" );
	}
	cout << endl;
	return 0;
} 



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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    ll z;
    cin >> x >> y >> z;
    ll sum = z;
    ans = 0;
    while (sum < x) {
        sum += y + z;
        ans++;
    }
    if (sum > x) ans--;
    MSG(ans)
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define pi pair<ll,ll>
#define endl "\n"
#define MAXN 100005
using namespace std;

ll n,h,sum,x;

void solve()
{
    cin>>h>>n;
    for(ll i=0;i<n;i++)
    {
    	cin>>x;sum+=x;
    }
    if(sum>h) cout<<-1<<endl;
    else cout<<h-sum<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
}


Measured memory_bytes: 3640
package main

import (
	"fmt"
)

func min(n []int) {
	min := 9999999999999
	for _, v := range n {
		if min > v {
			min = v
		}
	}
	if min == 9999999999999 {
		fmt.Println("TLE")
		return
	}

	fmt.Println(min)
}
func main() {
	var N, T int
	fmt.Scan(&N, &T)

	var c = make([]int, N)
	var t = make([]int, N)
	var c_t []int
	for i := 0; i < N; i++ {
		fmt.Scan(&c[i], &t[i])
		if t[i] <= T {
			c_t = append(c_t, c[i])
		}
	}
	min(c_t)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
#define PI (acos(-1))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}
LL exp(int a, int b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum) % MOD;
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

double r, gx, gy;
vector<double> p;
int N;

double dot(complex<double> a, complex<double> b){
    return a.real() * b.real() + a.imag() * b.imag();
}
int main(){
    cin >> r >> gx >> gy >> N;
    p.resize(N);
    double sum = 0;
    REP(i, N){
        cin >> p[i];
        sum += p[i];
    }
    REP(i, N){
        p[i] = p[i] / sum * PI * 2;
    }
    double nsum = 0;
    REP(i, N){
        double dn = r * r * p[i] / 2 ;
        double cn = dn;
        complex<double> v(sin(nsum + p[i]) - sin(nsum), cos(nsum + p[i]) - cos(nsum));
        v *= r;
        complex<double> nv = v / abs(v);
        nv *= complex<double>(0, -1);
        complex<double> p1(sin(nsum), cos(nsum));
        p1 = -p1;
        p1 *= r;
        cn -= dot(p1, nv) * abs(v) / 2;
        double vb = dot(p1, nv) * abs(v) / 2;
        double va = cn;
        double h1 = dot(p1, nv);
        p1 = complex<double>(gx, gy) + p1;
        double h2 = dot(p1, nv);
        cn += dot(p1, nv) * abs(v) / 2;
        if(i>0)cout << " ";
        printf("%d", (int)(100*cn/dn));
        nsum += p[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; ++i)
#define int long long
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
using namespace std;
typedef pair<int, int> P;
struct edge {
	int to, cost;
};
// other libs
int gcd(int a, int b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

class dijkstra {
  private:
	int V;
	int d[100002];
	priority_queue<P, vector<P>, greater<>> que;

  public:
	dijkstra(int v, int s, vector<edge> G[]) {
		V = v;
		update(s, G);
	}

	void update(int s, vector<edge> G[]) {
		fill(d, d + V + 1, 100000000000ll);
		d[s] = 0;
		que.push(make_pair(0, s));
		while (!que.empty()) {
			P p = que.top();
			que.pop();
			int v = p.second;
			if (d[v] < p.first)
				continue;
			rep(i, G[v].size()) {
				edge e = G[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					que.push(make_pair(d[e.to], e.to));
				}
			}
		}
	}

	int find(int e) {
		return d[e];
	}
};
template<typename T>
class Union_Find {
  private:
	vector<T> t, s;

  public:
	Union_Find(T max_length) {
		rep(i, max_length + 1) {
			t.push_back(i);
			s.push_back(1);
		}
	}

	void Union(T x, T y) {
		if (same(x, y))
			return;
		T tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}
	T Find(T n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}

	bool same(T x, T y) {
		return Find(x) == Find(y);
	}

	T get_Size(size_t a) {
		return s[a];
	}
};
bool ifPrime(int n) {
	if (n == 1)
		return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)
			return false;
	}
	return true;
}
vector<int> primeFactorization(int n) {
	vector<int> re;
	int cnt = 2;
	while (n != 1) {
		if (n % cnt != 0) {
			cnt++;
			continue;
		}
		n /= cnt;
		re.push_back(cnt);
	}
	return re;
}
signed main(signed argc, char* argv[]) {
    int n;
    cin>>n;
    int a=n-n/2;
    printf("%.10f",(double)a/n);
}

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

int main() {
	int N,c;
	c=0;
	cin >>N;
	string S;
	cin >>S;
	for(int i=2;i<N;i++){
		if(S.at(i-2)=='A'&&S.at(i-1)=='B'&&S.at(i)=='C'){
			c++;
		}
	}
	cout <<c<<endl;
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


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

Measured memory_bytes: 3644
n = int(input())
A = list(map(int, input().split()))

ans = 'APPROVED'
for i in range(n):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            ans = 'DENIED'

print(ans)

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

int main()
{
    string S;
    unsigned long long int a, b, c, temp = 0, temp2 = 0, count = 0;
    // S = "BBW";
      cin >> S;

       for(unsigned long int i = 0; i < S.size(); i++){
        if(S[i] == 'W'){
            count += i - temp;
            temp++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    Edge = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        Edge[a-1].append(b-1)
        Edge[b-1].append(a-1)
    counter = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        counter[p-1] += x
    a = deque()
    a.append((-1, 0)) #"pre, now"
    while a:
        pre, now = a.popleft()
        for e in Edge[now]:
            if e != pre:
                counter[e] += counter[now]
                a.append((now, e))
    print(" ".join(map(str, counter)))

    return 0

if __name__ == "__main__":
    solve()

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

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

  vector<int> x(N); // N個の数学の点数データ
  vector<int> y(N); // N個の英語の点数データ

  // 数学の点数データを受け取る
  for (int i = 0; i < N; i++) {
    cin >> x.at(i);
  }

  // 英語の点数データを受け取る
  for (int i = 0; i < N; i++) {
    cin >> y.at(i);
  }

  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (x.at(i) > y.at(i)){
   sum += x.at(i);   
   sum -= y.at(i);
    }
    
  }
    cout << sum << endl;
}


Measured memory_bytes: 256
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

x = int(input())

print(pow(x, 3))





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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

bool check(int i, vector<int>& A){
    FOR(j, i+1, A.size()) if(A[i] < A[j]) return true;
    return false;
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    long long money = 1000, stock = 0, price = 1e+9;
    REP(i, N){
        if(check(i, A) and price > A[i]){
            while(i+1 < N and A[i] >= A[i+1]) ++i;
            stock = money/A[i];
            money -= stock*A[i];
            price = A[i];
        }else if(A[i] > price){
            while(i+1 < N and A[i] <= A[i+1]) ++i;
            money += A[i]*stock;
            stock = 0;
            price = A[i];
        }
    }
    cout << money << endl;

    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdint>
using namespace std;

int main(){
    int K;

    cin >> K;
    if(K % 2 == 0) {
        cout << (K / 2) * (K / 2) << endl;
    }
    else {
        cout << (K / 2) * ((K / 2) + 1) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n, m; scanf("%d %d", &n, &m);
  int res = 0;
  res += (n - m) * 100 + 1900 * m;
  for(int i = 0; i < m; i++) res *= 2;
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>

#define rep(i,m,n) for(int i=(m);i<(n);++i)
#define rem(i,m,n) for(int i=(m);i>(n);--i)
#define MOD 1000000007

using namespace std;

using ll = long long ;
using std::swap;

//vector<long long int> v;
vector<long long int> w;

int main() {
	ll N, K, MA, MI;
	ll ANS = 0;
	cin >> N >> K;
	rep(i, K, N + 2) {
		MA = 0;
		MI = 0;
		MI = (0 + (i - 1))*ll(i) / 2;
		MA = (N + (N - i + 1))*ll(i) / 2;
		ANS += (MA - MI + 1) % MOD;
		ANS %= MOD;
	}
	ANS %= MOD;
	cout << ANS << '\n';

	return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>

#define FIRST_BLOCK '#'
#define SECOND_BLOCK '.'
#define ARR_LIMIT 10000

typedef struct {
    int width;
    int height;
} Size;

void InputNumber(int* number, int limitLow, int limitHigh);
void Drawing(Size* sizes, int length);

int main(void) {
    int length;
    Size sizes[ARR_LIMIT];
    
    for (length = 0; length < ARR_LIMIT; length++) {
        int width;
        int height;
        
        InputNumber(&height, 0, 300);
        InputNumber(&width, 0, 300);
        
        if (height == 0 && width == 0) {
            break;
        }
        
        Size size = sizes[length];
        size.width = width;
        size.height = height;
        sizes[length] = size;
    }
    
    Drawing(sizes, length);
    
    return 0;
}

void InputNumber(int* number, int limitLow, int limitHigh) {
    int x;
    do {
        scanf("%d", &x);
    } while (x < limitLow || x > limitHigh);
    *number = x;
}

void Drawing(Size* sizes, int length) {
    int idx;
    int idW;
    int idH;
    
    for (idx = 0; idx < length; idx++) {
        Size size = sizes[idx];
        
        for (idH = 0; idH < size.height; idH++) {
            for (idW = 0; idW < size.width; idW++) {
                char block = '.';
                
                if ((idH % 2 == 0 && idW % 2 == 0) ||
                    (idH % 2 == 1 && idW % 2 == 1)) {
                    block = '#';
                }
                
                printf("%c", block);
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>    
#include <unordered_map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cerr<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define endl "\n"
#define fo(i,n) for(int i=0;i<n;i++)
#define foo(i,x,n) for(int i=x;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define w(x) int x;cin>>x;while(x--)
#define display(a,n) {fo(i,n) {cout<<a[i]<<" ";}cout<<endl;}
#define fil(a,n,val) {fo(i,n) a[i]=val; }
#define sp(x,y) cout<<fixed<<setprecision(y)<<x<<endl;
#define int ll
const ll MOD   = 1000*1000*1000+7;
const ll MOD2  = 998244353;
const ll N = 1000*1000+5;
const double PI  = 3.14159265;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
ll search(vl arr, ll l, ll r, ll x){if (r >= l) {ll mid = l + (r - l) / 2;if (arr[mid] == x)return mid;if (arr[mid] > x)return search(arr, l, mid - 1, x);return search(arr, mid + 1, r, x);} return -1;}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll lcm(ll a , ll b){return (a*b)/ gcd(a,b);}
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p; } return res; }
ll modInverse(ll n, ll p){return power(n, p-2, p);}
const int maxn=3e5+5;

string k;
int n;
int dp[10005][105][2];

int solve(int pos, int d, int tight){
	int ub=(tight)?(k[pos]-'0'):9;
	if(pos==k.length()-1){
		int ans=0;
		fo(x,ub+1){
			if(x%n==d)
				ans++;
		}
		return ans;
	}
	if(dp[pos][d][tight]!=-1)
		return dp[pos][d][tight];
	int ans=0;
	for(int x=0;x<=ub;x++){
		ans=(ans+solve(pos+1,((n+d-x%n)%n), (tight&&(x==ub))))%MOD;
	}
	return dp[pos][d][tight]=ans;
}

signed main(){
	cin>>k>>n;
	fill(dp,-1);
	cout<<(MOD+solve(0,0,1)-1)%MOD<<endl;
}

Measured memory_bytes: 20924
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int t[100001], x[100001], y[100001];
    for(int i=0;i<n;i++)
        cin >> t[i+1] >> x[i+1] >> y[i+1];
    int flag = 1;

    //1からNまで実行可能かどうかをそれぞれ判定
    for(int i=1;i<=n;i++){
        //x座標,y座標の和で判定
        int sum;
        sum = x[i] + y[i];
        if((sum > t[i] ) || (sum%2 != t[i]%2))
            flag = 0; //到達不能
    }
    if(flag == 0)
        cout << "No" << '\n';
    else
        cout << "Yes" << '\n';
    return 0;
}

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


long long int L , R , DP[65][2] , A[65][2];
void pre(){
    DP[0][0] = DP[0][1] = 1 ;
    for(int i=1;i<=64;i++){
        DP[i][0] = (DP[i-1][0]+DP[i-1][1]) ;
        DP[i][1] = (DP[i-1][0]+DP[i-1][1]) ;
    }
}

void solve(){
    long long sum = 0 ;
    for(int i=63;i>=0;i--){
        A[i][0] += sum ;
        if(L & (1LL << i)){
            A[i][0] += (L - DP[i][0]) ;
            sum += (DP[i][0]/2) ;
            L -= DP[i][0] ;
        }
    }
    R ++ ;
    sum = 0 ;
    for(int i=63;i>=0;i--){
        A[i][1] += sum ;
        if(R & (1LL << i)){
            A[i][1] += (R - DP[i][1]) ;
            sum += (DP[i][1]/2) ;
            R -= DP[i][1] ;
        }
    }
    sum = 0 ;
    for(int i=63;i>=0;i--){
        A[i][1] -= A[i][0] ;
        A[i][1] %= 2 ;
        if(A[i][1])
            sum += (1LL << i) ;
    }
    cout << sum << endl ;
}
int main(){
    pre() ;
   
        cin >> L >>  R ;
        solve() ;
   
    return 0 ;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;


int main(void){
    string s;
    cin >> s;
    if(s[0] == 'S'){
        cout << "Cloudy" << endl;
    }
    else if(s[0] == 'C'){
        cout << "Rainy" << endl;
    }
    else
    {
        cout << "Sunny" << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    string s;
    cin>>n>>k;
    cin>>s;
    vector<ll> v;
    if(s[0]=='0') v.push_back(0);
    int l=0;
    while(l<n){
        char t=s[l];
        int c=0;
        while(s[l]==t){
            l++;
            c++;
        }
        v.push_back(c);
    }
    if(s[n-1]=='0') v.push_back(0);
    int m=v.size();
    ll sum[m+1]={};
    for(int i=0;i<m;i++){
        sum[i+1]=sum[i]+v[i];
    }
    if((m-1)/2<k){
        cout<<sum[m]<<endl;
        return 0;
    }

    ll ans=0;
    for(int i=2*k+1;i<=m;i+=2){
        ans=max(ans,sum[i]-sum[i-2*k-1]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2116
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int flowerNum = scan.nextInt();						// 花の総本数
		int[] flowerHeightList = new int[flowerNum]; 			// 花の高さを入れる配列
		int count = 0; 											// 水やり回数

		/* データ入力 */
		for (int i = 0; i < flowerNum; i++) {
			flowerHeightList[i] = scan.nextInt();
		}

		int tmp = 0;
		int head = 0;

		while(head < flowerNum) {
			// 現在の先頭要素が0だった場合、先頭を変更
			if(flowerHeightList[head] == 0) {
				tmp = ++head;
				continue;
			}
			// 水やりの範囲を決定する
			for(int tail = head; tail < flowerNum; tail++) {
				if(flowerHeightList[tail] == 0) {
					head = tmp;
					break;
				}
				flowerHeightList[tail]--;
			}
			count++;
		}

		System.out.println(count);
		scan.close();
	}

}


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

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

int main(void){
	int N,M,sum = 0;
	cin >> N >> M;
	REP(i,M){
		int x;
		cin >> x;
		sum += x;
	}
	if(sum < N) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


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

struct UnionFind {
    vector<int> data;
    int sz;
    UnionFind(int sz) : data(sz, -1), sz(sz) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) == (y = root(y))) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y]; data[y] = x; sz--;
        return true;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return sz; }
};

int main() {
    const int MAX = 101010;
    UnionFind uf(MAX * 2);
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        uf.unionSet(x, y + MAX);
    }
    map<int, long long> mx, my;
    for (int i = 0; i < MAX; i++) mx[uf.root(i)]++, my[uf.root(i + MAX)]++;
    long long res = 0;
    for (int i = 0; i < MAX * 2; i++) res += mx[i] * my[i];
    cout << res - n << endl;
    return 0;
}

Measured memory_bytes: 26240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll l, r, d;
    cin >> l >> r >> d;
    ll ans = 0;
    for(ll x  = l; x <= r; ++x){
        if(x % d == 0){ ans++; }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
        string s;
        cin >> s;
        int indexofC=1000;
        for(int i=0;i<s.length();i++){
                if(s[i]=='C'){
                        indexofC=i;
                        break;
                }
        }
        for(int j=indexofC;j<s.length();j++){
                if(s[j]=='F'){
                        cout << "Yes" << endl;
                        return 0;
                }
        }
        cout << "No" << endl;
        return 0;
}


Measured memory_bytes: 384
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double[] v = new double[N];
        for(int n=0; n<N; n++) v[n]=sc.nextDouble();
        Arrays.sort(v);

        double ans = v[0];
        for(int n=1; n<N; n++){
            ans = (ans+v[n])/2;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,x;
  cin >> n >> x;
  int l[n];
  for(int i=0; i<n; i++) {
    cin >> l[i];
  }
  int ans=1, d=0;
  for(int i=0; i<n; i++) {
    d += l[i];
    if(d > x) {
      break;
    }
    ans++;
  }
  cout << ans << endl;
}

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

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

    long power = 1;

    for (int i = 1; i < n+1; i++) {
        power *= i;
        power %= 1000000007;
    }

    cout << power << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
    int a,b;
    string Operator;
    
    while(cin >> a >> Operator >> b){
        
        if(Operator == "?"){
            return 0;
        }
        if(Operator == "+"){
            cout << a + b << endl;
        }else if(Operator == "-"){
            cout << a - b << endl;
        }else if(Operator == "*"){
            cout << a * b << endl;
        }else if(Operator == "/"){
            cout << a / b << endl;
        }  
    }
}

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

A = [list(map(int,input().split())) for i in range(N)]
B = [list(map(int,input().split())) for i in range(M)]
ANS = [[0]*L for i in range(N)]

for x in range(N):
    for y in range(L):
        for z in range(M):
            ANS[x][y] += A[x][z]*B[z][y]

for row in range(N):
    print("%d"%ANS[row][0],end="")
    for col in range(1,L):
        print(" %d"%ANS[row][col],end="")
    print()



Measured memory_bytes: 7052
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n=5;
	vector<int> vec;
	for(int i=0;i<n;i++)
	{
		int x;
		cin >> x;
		vec.push_back(x);
	}
	for(int i=0;i<n;i++)
	{
		if(vec[i]==0)
		{
			cout << i+1<<endl;
			break;
		}
	}
	
	
	
}

Measured memory_bytes: 3620
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  getl solve >>= putStrLn

solve :: String -> String
solve xs = reverse $ foldl f "" xs
  where
    f ss c
      | c == '0' = '0' : ss
      | c == '1' = '1' : ss
      | otherwise = if null ss then "" else tail ss

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 380
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
 



int main()
{
    fastio
    ll i,j;
    
    ll n;
    cin>>n;
    
    ll a[n];
    
    for(i=0;i<n;i++)
    cin>>a[i];
    
    vector<pair<ll,ll>>v;
    ll q;
    cin>>q;
    map<ll,ll>m;
    ll sum=0;
    for(i=0;i<n;i++)
    {
        m[a[i]]++;
        sum+=a[i];
    }
    
    for(i=0;i<q;i++)
    {
        ll x,y;
        cin>>x>>y;
        //v.pb({x,y});
        
        sum=sum+m[x]*(y-x);
        m[y]+=m[x];
        m[x]=0;
        cout<<sum<<'\n';
    }
    
    
    
    
    
}


Measured memory_bytes: 10300
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		Integer W = sc.nextInt();
		Integer H = sc.nextInt();
		Integer x = sc.nextInt();
		Integer y = sc.nextInt();
		Integer r = sc.nextInt();

		if (x - r < 0 || y - r < 0 || x + r > W || y + r > H) {
			System.out.println("No");
			return;
		}

		System.out.println("Yes");

	}

}



Measured memory_bytes: 26340
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int,int> P;

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

int main(){
	int a,b,x;
	cin>>a>>b>>x;
	if(a+b>=x&&a<=x){
		cout<<"YES";
	}
	else cout<<"NO";
}


Measured memory_bytes: 256
/*=======================================================================*\
    > File: 	.cpp
    > Author: 	SpongeBob_QDD
    > Mail: 	10132130251@ecnu.cn
    > Time: 	wdu  now
    > Comment:
\*=======================================================================*/

#include<bits/stdc++.h>
#define PB push_back
#define se second
#define fi first
#define iOS std::ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef double DB;
typedef long long LL;
typedef pair<int, int> P;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int MOD = int(1e9) + 9;
const int INF = 0x3f3f3f3f;
const DB PI = acos(-1.0);
const DB EPS = 1e-9;
const DB OO = 1e20;
const int MAXN = 10000;

bitset <MAXN> s[10];
int cnt[MAXN];
int main()
{
    iOS;
    int n, m, x;
    while (cin >> n >> m, n||m)
    {
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j)
            {
                cin >> x;
                s[i][j] = x;
            }
        int N = 1 << n, ans = 0;
        for (int i = 0; i < N; ++i)
        {
            int sum = 0;
            memset(cnt, 0, sizeof(cnt));
            for (int j = 0; j < n; ++j)
                if (i & (1 << j))
                    s[j].flip();
            for (int j = 0; j < n; ++j)
                for (int k = 0; k < m; ++k)
                    cnt[k] += s[j][k];
            for (int j = 0; j < m; ++j)
                sum += max(cnt[j], n-cnt[j]);
            ans = max(ans, sum);
            for (int j = 0; j < n; ++j)
                if (i & (1 << j))
                    s[j].flip();
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1252
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <regex>
#include <bitset>
#include <string>
#include <vector>
#include <iomanip>
#include <sstream>
#include <utility>
#include <iterator>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define pq priority_queue<int,vector<int>,greater<int>>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define INF 9999999999
#define F first
#define S second
//#define int long long

using namespace std;

typedef pair<int, int> pi;
typedef pair<int, pi> pp;

int dx[] = { 1, -1, 0, 0 };
int dy[] = { 0, 0, 1, -1 };
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int main() {
	int a, b, c, t, ans = 10000;
	cin >> a >> b;
	rep(i, a) {
		cin >> c >> t;
		if (t <= b) {
			ans = min(c, ans);
		}
	}
	ans != 10000 ? cout << ans << endl : cout << "TLE" << endl;
	return 0;
}

Measured memory_bytes: 256
// scan tuple
let scan1 f = stdin.ReadLine() |> f
let scan2 f = stdin.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1]))
let scan3 f = stdin.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2]))
let scan4 f = stdin.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2], a.[3]))

// scan vec and matrix (using Array)
let scanVecH f = stdin.ReadLine().Split() |> Array.map f
let scanVecV f n = [| for i in 1..n -> stdin.ReadLine() |> f |]
let scanMatrix f n = [| for i in 1..n -> stdin.ReadLine().Split() |> Array.map f |]
let scanCharMatrix n = [| for i in 1..n -> stdin.ReadLine().ToCharArray() |]

(*
初期位置を含めて 全てが mod D で等しいことが必要十分条件。

そういうように入力が作成されているのだろう（さもなくば 1）。

全てが同値類の元なので、x - y は kで割り切れる

なので X - x1 と X - x2 でGCD Y を求め、それとGCDを求め、というように

GCDをfoldしていけば答えになる。ゼロになるときはスキップが必要か。

途中で 1 になったら打ち切りでよい。

*)

let rec gcd a b =
  if b > a 
  then gcd b a
  else match a % b with
       | 0 -> b
       | c -> gcd b c

let N, X = scan2 int
let xs = 
  scanVecH int
  |> Array.map (fun n -> abs (n - X))
  |> Array.filter ((<>) 0)

Array.fold gcd xs.[0] xs
|> printfn "%d"



Measured memory_bytes: 21340
#include<stdio.h>
int main(void){
  int X,Y,W,H,N;
  int num;
  int cat=0;
  int i,j;
  int x[101],y[101];
  scanf("%d",&num);
  for(i=0;i<num;i++){
    cat=0;
    scanf("%d %d %d %d",&X,&Y,&W,&H);
    scanf("%d",&N);
    for(j=0;j<N;j++){
      scanf("%d %d",&x[j],&y[j]);
      if((x[j]>=X && x[j]<=X+W) && (y[j]>=Y && y[j]<=Y+H))
	cat++;
    }
    printf("%d\n",cat);
  }
  return 0;
}

Measured memory_bytes: 596
package main

import "fmt"

func main() {
	var A, B, C int
	fmt.Scan(&A, &B, &C)

	if A%2 == 0 && B%2 == 0 && C%2 == 0 {
		if A == B && B == C && C == A {
			fmt.Println("-1")
		} else {
			ans := 0
			for A%2 == 0 && B%2 == 0 && C%2 == 0 {
				tA := A
				tB := B
				tC := C
				A = tB/2 + tC/2
				B = tA/2 + tC/2
				C = tA/2 + tB/2
				ans++
			}
			fmt.Println(ans)
		}
	} else {
		fmt.Println("0")
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
# define MOD 1000000000+7
# define INF 1000000000
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a * 3 + b) / 2 << endl;


}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  char a[11] ;
  int i ;
  int k=0 ;
  int j=0 ;

  scanf("%s", a) ;

  for(i=0;i<11;i++)
    {
      if(a[i]=='A'||a[i]=='C'||a[i]=='G'||a[i]=='T')
	j++ ;
      else
	{
	  if(k<j)
	    k=j ;
	  j=0 ;
	}
    }

  printf("%d", k) ;
  return 0 ;
}


Measured memory_bytes: 128
import heapq

n, m = (int(x) for x in input().split())
A = [int(x) * (-1) for x in input().split()]
heapq.heapify(A)

for ticket in range(m):
    maxval = heapq.heappop(A) * (-1)
    heapq.heappush(A, (maxval//2)*(-1))

print(sum(A) * (-1))


Measured memory_bytes: 72216
#include<stdio.h>
#include<math.h>

int main (void)
{
	double x1,x2,y1,y2;
	double dis;
	
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	dis = sqrt(pow(x2 - x1,2) + pow(y2 - y1,2));
	printf("%lf\n",dis);
	
	return 0;
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,d;
  cin>>n>>d;
  vector<vector<int>> xs(n, vector<int>(d));
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin>>xs.at(i).at(j);
    }
  }
  int int_sum=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      int sum=0;
      for(int k=0;k<d;k++){
        sum+=pow(xs.at(i).at(k)-xs.at(j).at(k), 2);
      }
      double xd=sqrt(sum);
      int int_xd=floor(xd);
      if(xd==int_xd){int_sum++;}
    }
  }
  cout<<int_sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll a;
  cin >> a;
  print(a + a * a + a * a * a);
}

Measured memory_bytes: 3632
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

string s;
ll t;

ll dp[100005][105] = {};
ll n;

ll const MOD = 1e9 + 7;
ll mod_p(ll x, ll y) {
	return (x + y + MOD) % MOD;
}

void fill_dp() {
	dp[0][0] = 1;
	REP(i, 1, n) {
		REP(j, 0, t - 1) {
			REP(k, 0, 9) {
				dp[i][j] = mod_p(dp[i][j], dp[i - 1][(j + 100 * t - k) % t]);
			}
		}
	}
}

ll f(string s, ll x, ll y) {
	if (x == n) {
		if (y == 0) {
			return 1;
		}
		else {
			return 0;
		}
	}
	else {
		ll c = s[x] - '0';
		//cout << x + 1 << (y - c + 100 * t) % t << endl;
		ll cnt = f(s, x + 1, (y - c + 100 * t) % t);
		REP(i, 0, c - 1) {
			cnt = mod_p(cnt, dp[n - x - 1][(y - i + 100 * t) % t]);
		}
		return cnt;
	}
}

int main() {
	cin >> s >> t;
	n = s.size();
	fill_dp();
	cout << mod_p(MOD - 1, f(s, 0, 0)) << endl;
	/*
	REP(i, 0, n) {
	REP(j, 0, t) {
	cout << dp[i][j] << " ";
	}
	cout << endl;
	}
	*/
}


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


#define long long long int

using namespace std;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef pair<int, int> pi;


int main() {
    std::ios_base::sync_with_stdio(false);

    int a, b, c;
    cin >> a >> b >> c;

    cout << (a == b && b == c ? "No" : a != b && a != c && b != c ? "No" : "Yes");

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
  int h,w,d;scanf("%d %d %d",&h,&w,&d);
  int mp[h][w];
  vector<pair<int,pair<int,int> > > a[d];
  for(int i = 0; h > i; i++){
    for(int j = 0; w > j; j++){
      scanf("%d",&mp[i][j]);
      a[mp[i][j]%d].push_back(make_pair(mp[i][j],make_pair(i,j)));
    }
  }
  vector<long long> b[d];
  for(int i = 0; d > i; i++){
    sort(a[i].begin(),a[i].end());
    b[i].push_back(0);
    b[i].push_back(a[i][1].second.first+a[i][1].second.second);
    //cerr << b[i][1] << endl;
    for(int j = 1; a[i].size() >= j; j++){
      //cerr << a[i][j].second.first << " " << a[i][j-1].second.first << " " << a[i][j].second.second<< " " << a[i][j-1].second.second << endl;
      b[i].push_back(b[i][j]+abs(a[i][j].second.first-a[i][j-1].second.first)+abs(a[i][j].second.second-a[i][j-1].second.second));
      //cerr << b[i][j+1] << endl;
    }
  }
  int q;scanf("%d",&q);
  for(int _ = 0; q > _; _++){
    int x,y;scanf("%d %d",&x,&y);
    //cerr << b[x%d].size() << " " << x << " "  << y << endl;
    //cerr << b[x%d][(y-1)/d+1] << " " <<  b[x%d][(x-1)/d+1] << endl;
    int ans = b[x%d][(y-1)/d+1]-b[x%d][(x-1)/d+1];
    printf("%d\n",ans);
  }
}    

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

using namespace std;

int main() {
    bitset<64> bst;

    int n;
    cin >> n;

    bitset<64> mask[n];
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        while (k--) {
            unsigned int b;
            cin >> b;
            mask[i].set(b);
        }
    }

    int q;
    cin >> q;
    while (q--) {
        unsigned int op, idx;
        cin >> op >> idx;

        switch (op) {
            case 0:
                cout << bst.test(idx) << endl;
                break;
            case 1:
                bst |= mask[idx];
                break;
            case 2:
                bst &= ~mask[idx];
                break;
            case 3:
                bst ^= mask[idx];
                break;
            case 4:
                cout << ((bst & mask[idx]) == mask[idx]) << endl;
                break;
            case 5:
                cout << (bst & mask[idx]).any() << endl;
                break;
            case 6:
                cout << (bst & mask[idx]).none() << endl;
                break;
            case 7:
                cout << (bst & mask[idx]).count() << endl;
                break;
            case 8:
                cout << (bst & mask[idx]).to_ullong() << endl;
                break;
            default:
                break;
        }
    }

    return 0;
}


Measured memory_bytes: 3092
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] parsedLine = line.split(" ");
        Integer a = Integer.parseInt(parsedLine[0]);
        String op = parsedLine[1];
        Integer b = Integer.parseInt(parsedLine[2]);

        if ("+".equals(op)) {
            System.out.println(a + b);
        } else {
            System.out.println(a - b);
        }
    }
}

Measured memory_bytes: 23252