akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define mod (1000*1000*1000+7)
#define modd (1000*1000*1000+9)
#define flush fflush(stdout)
#define pi 3.14159265358979323846264338327950
#define read_in_arr(a, n) for(int i=0;i<n;i++){ cin>>a[i];}
#define print_arr(a, n) for(int i=0;i<n;i++){ cout<<a[i]<<" ";} cout<<endl;
// cout<<fixed<<setprecision(12)<<ans<<endl;
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n, d;
	cin>>n>>d;
	ull count = 0;
	while(n--){
		ll x, y;
		cin>>x>>y;
		
		ull temp = (x*x) + (y*y);
		long double ans = sqrt(temp);
		
		if(ans<=d){
			count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 3696
#include <iostream>
using namespace std;
int main(){
  string s[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
  string ss;
  cin >> ss;
  for(int i=0;i<7;i++){
    if(ss==s[i]){
      cout << 7 - i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n;
char ch[100005];
char ret(char a,char b){
	if(a == 'T' && b == 'F') return 'F';
	else return 'T';
}
int main(){
	cin>>n;
	repn(i,n) scanf(" %c",&ch[i]);
	char cur = ret(ch[1],ch[2]);
	for(int i=3;i<=n;i++){
		cur = ret(cur,ch[i]);
	}
	printf("%c\n",cur);
}


Measured memory_bytes: 3300
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size

/*
author: Basel
*/

using namespace std;

ll n,ans;

string s;

map<vector<ll>,ll>mp;

ll f(ll x)
{
    return (x*(x+1))/2;
}

int main()
{
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> s;
        vector<ll>v(26);
        for (auto X:v)X=0;
        for (int j=0;j<10;j++)
        {
            v[s[j]-'a']++;
        }
        mp[v]++;
    }
    for (auto X:mp)
    {
        ans+=f(X.S-1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 29952
import java.util.*;

public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		int K = scanner.nextInt();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		
		long biscuit = 1;
		boolean money= false;
		if (A+1<B) {
		
		for (long index=0; index<K;) {
			
				for (int index2=0; biscuit<A; index2++) {
					if (index<K) {
						index++;
					} else {
						break;
					}
					biscuit++;
				}
			if (index<K-1) {
				biscuit=biscuit-A;
				index++;
				money = true;
			}
				
			if (index<K && money==true) {
				biscuit=biscuit+B;
				index++;
				money=false;
			}
			if (index==K-1&&money==false){
				biscuit++;
				index++;
			}
		}
		} else {
			biscuit=1+K;
		}
			System.out.println(biscuit);
	}
}

Measured memory_bytes: 23636
var
	N,t,ans:Longint;
begin
	read(N);
	if N>=9 then begin
		inc(ans,9);
		if N>=999 then begin
			inc(ans,900);
			if N>=99999 then begin
				inc(ans,90000);
			end else begin
				if N>=10000 then begin
					inc(ans,N-9999);
				end
			end
		end else begin
			if N>=100 then begin
				inc(ans,N-99);
			end
		end
	end else ans:=N;
	writeln(ans);
end.


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1);
const ll mod=1e9+7;
struct node
{
	string a;
}p[205000];
bool camp(node x,node y)
{
	return x.a>y.a;
}
int main()
{
	
	int n;
	cin>>n;
	string s;
	for(int i=0;i<n;i++)
	{
	
		cin>>s;
		p[i].a=s;
	}
	sort(p,p+n,camp);
	ll sum=1;
	for(int i=1;i<n;i++)
	{
		if(p[i].a!=p[i-1].a)
		{
			sum++;
		}
	}
	cout<<sum<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 10036
a, b = map(int, input().split())

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

g = gcd(a, b)

i = 2
count = 1
m = gcd(a, b)
while i * i <= g:
    if m % i == 0:
        count += 1
    while m % i == 0:
        m = m // i
    i += 1

if m > 1:
    count += 1

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL maxn = 1e5 + 5;

priority_queue<LL> L;
priority_queue<LL, vector<LL>, greater<LL> > R;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    LL Q;
    cin >> Q;
    LL opt, x, y;
    LL sumL = 0, sumR = 0, sum = 0;

    while(Q--)
    {
        cin >> opt;
        if(opt== 1)
        {
            cin >> x >> y;
            sum += y;
            if(L.empty() || x < L.top())
            {
                L.push(x);
                sumL += x;
            }
            else
            {
                R.push(x);
                sumR += x;
            }
            if(L.size() > R.size()+1){
                LL tp = L.top();
                L.pop();
                R.push(tp);
                sumR += tp;
                sumL -= tp;
            }
            if(R.size() > L.size()){
                LL tp = R.top();
                R.pop();
                L.push(tp);
                sumR -= tp;
                sumL += tp;
            }
        }
        else
        {
            x = L.top();
            LL ans = sum + (x * L.size() - sumL) + (sumR - x * R.size());
            cout << x << " "<<ans<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define inf 2248012
#define mp make_pair
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 1e5+2; //AREGLAAAAAAAAR!!!!
pair<int,int> a[MAXN];
pair<int,int>a2[MAXN];
int main(){
	int n;
	ll h;
	ri(n);
	lri(h);
	FOR(i,0,n){
		int t,c;
		rii(t,c);
		a[i]={-c,-t};
		a2[i]={-t,c};
	}
	sort(a2,a2+n);
	FOR(i,0,n) if(abs(a[i].F)<abs(a2[0].F)) a[i].F=a2[0].F;
	sort(a,a+n);
	ll suma=h;
	FOR(i,0,n){
		suma+=(a[i].F);
		if(suma<=0){
			printf("%d\n",i+1);
			return 0;			
		}
	}
	suma=h;
	FOR(i,0,n) suma+=(a[i].F);
	ll ans=n;
	ll te=-a2[0].F;
	ans+=suma/(te);
	if(suma%te) ans++;
	printf("%lld\n",ans);

}

	

Measured memory_bytes: 1792
#include <bits/stdc++.h> 
using namespace std; 
int solve(string t ,string s){ 
	int n = s.size(), m = t.size(); 
	int ans = INT_MAX; 
	for (int i = 0; i < m - n + 1; i++) { 
		int minremove = 0; 
		for (int j = 0; j < n; j++){ 
			if (s[j] != t[i + j])
				minremove++; 
		} 
		ans = min(minremove, ans); 
	} 
	return ans; 
} 

// Driver Code 
int main() { 
    string s,t;
    cin >> s;
    cin.ignore();
    cin >> t;
	cout << solve(s,t); 

	return 0; 
} 


Measured memory_bytes: 3640
loop.with_index {|_, k|
    n = gets.to_i
    break if n == 0
    points = (1..n).map{ gets.split.map &:to_f }
    points << points[0]
    area = points.each_cons(2).map{|u, v|
        u[1] * v[0] - u[0] * v[1]
    }.inject(:+) / 2
    puts "#{k+1} %.1f" % area
    gets
}

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

int main() {
  int64_t k, s, a = 0;
  cin >> k >> s;
  vector<vector<int64_t>> v;
  rep(i, k+1){
    rep(j, k-i+1){
      if(i*2+j+k >= s && i*3+j*2 <= s) v.push_back({i, i+j, s-2*i-j});
    }
  }
  rep(i, v.size()){
    unordered_set<int> u;
    u.insert(v[i][0]); u.insert(v[i][1]); u.insert(v[i][2]);
    if(u.size() == 3) a += 6;
    else if(u.size() == 2) a += 3;
    else if(u.size() == 1) a += 1;
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 44068
num_r, num_g, num_b = gets.split(" ").map(&:to_i)
 
def cul(r, g, b)
    if (100*r + 10*g + b) % 4 == 0
        puts "YES"
    else
        puts "NO"
    end
end
 
cul(num_r, num_g, num_b)

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	map<int, ll>mp;
	int n;cin>>n;
	int arr[n];
	for(int i = 0; i < n; ++i) {
		cin>>arr[i];
		mp[arr[i]]++;
	}
	ll sum = 0;
	for(auto &x : mp){
		sum += x.second*(x.second-1)/2;
	}
	for(int i = 0; i < n; ++i){
		cout<<sum - mp[arr[i]] + 1<<endl;
	}
	return 0;
}



Measured memory_bytes: 10368
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var k = sc.nextInt();
		var sb = new StringBuilder();
		for (var i = 0; i < k; i++) {
			sb.append("ACL");
		}
		sc.close();
		System.out.printf(sb.toString());
	}
}


Measured memory_bytes: 35816
N = int(input())
h = list(map(int,input().split()))

ans = 0
while True:
  if max(h) == 0:
    break
    
  i = 0
  while i < N:
    if h[i] == 0:
      i += 1
    else:
      ans += 1
      while i<N and h[i]>0:
        h[i] -= 1
        i += 1

print(ans)

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(4*(10**6))

N,Q=map(int,input().split())
edge=[[] for _ in range(N+1)]
score=[0]*(N+1)
for _ in range(N-1):
    a,b=map(int,input().split())
    edge[a].append(b)
    edge[b].append(a)

for _ in range(Q):
    p,x=map(int,input().split())
    score[p]+=x

visited=set()

def dfs(v):
    global score
    visited.add(v)
    for i in edge[v]:
        if i in visited:
            continue
        score[i]+=score[v]
        dfs(i)

dfs(1)
print(*score[1:])

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


int main()
{
	int N;
	cin>>N;
	vector<int> ans(N);
	rep(i,N)
	{
		int a;
		cin>>a;
		ans[a-1]=i+1;
	}
	rep(i,N)
	{
		cout<<ans[i];
		if(i!=N-1) cout<<" ";
	}
	cout<<endl;
	return 0;
}


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

int main(){
	string a, b, c;
	int n;
	int count = 0;

	cin >> n >> a >> b >> c;

	for(int i = 0; i < n; i++){
		if(a.at(i) == b.at(i) && b.at(i) != c.at(i)) count++;
		else if(b.at(i) == c.at(i) && c.at(i) != a.at(i)) count++;
		else if(c.at(i) == a.at(i) && a.at(i) != b.at(i)) count++;
		else if(a.at(i) != b.at(i) && b.at(i) != c.at(i)) count += 2;
	}

	cout << count << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int m,f,b,x;
	scanf("%d %d %d",&m,&f,&b);
	if(m>=b){
		printf("0\n");
	}
	else if(m+f>=b){
		printf("%d\n",b-m);
	}
	else{
		printf("NA\n");
	}
}


Measured memory_bytes: 2112
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define LL long long
#define MOD 1000000007

int n, a[200002], ans[200002] = {}, sum = 0;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = n; i > 0; i--) {
		int cnt = 0;
		for (int j = 1; i * j <= n; j++) 
			cnt += ans[i*j];
		ans[i] = abs(cnt % 2 - a[i]);
		if (ans[i] == 1)sum++;
	}
	cout << sum << endl;
	for (int i = 1; i <= n; i++) {
		if(ans[i] == 1) cout << i << endl;
	}
	return 0;
}

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

namespace AGC029A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            string S = Input.String();

            long ans = 0;
            int white = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == 'W')
                {
                    ans += i - white;
                    white++;
                }
            }

            Console.WriteLine(ans);
        }
    }

    internal static class Input
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 11616
function Main(input){
  
  var str = input;
  var tmp = str.split("\n");
   // console.log(tmp);
  var n = tmp[0];
  var tmps = tmp[1];
  //console.log(tmps);
  var s = tmps.split("");
  var red = 0;
  var blue = 0;
  
  for(i=0;i<=n-1;i++){
   if(s[i]=="R"){
     red++;}
    else{
      blue++}//else
    
  }//for
  
 if(red-blue>0){
   console.log("Yes");}
  else {
       console.log("No");}
  


    
}//function
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

const ll INF = 1LL << 60;

ll N, M, Q;
ll c[510][510];
ll sum[510][510];
int main() {
    cin >> N >> M >> Q;
    rep(i, M) {
        ll l, r;
        cin >> l >> r;
        // l--; r--;
        sum[l][r]++;
    }

    rep(i, N)rep(j, N) {
        sum[i + 1][j + 1] += sum[i][j + 1] + sum[i + 1][j] - sum[i][j];  
        // cout << sum[i][j + 1] << " " << sum[i + 1][j] << " " << sum[i][j] << " " << c[i][j] << endl;
    }
    // rep(i, N + 1) {
    //     rep(j, N + 1) {
    //         cout << sum[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    rep(i, Q) {
        ll p, q;
        cin >> p >> q;

        cout << sum[q][q] - sum[q][p - 1] - sum[p - 1][q] + sum[p - 1][p - 1] << endl;
    }
}

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

int main() {
    int n;
    cin >> n;
    int flag = 0;
    if (n > 81 || n==0){
        cout << "No";
        return 0;
    }
    else {
        for (int i = 1; i <= 9;i++)
            for (int j = 1; j <= 9;j++){
                if(n == i*j){
                    flag++;
                    break;
                }
            }
    }
    puts(flag != 0 ? "Yes" : "No");
}

Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
map<P, ll> mem;
V ans;

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

  cin >> n >> k >> c >> s;
  rep(i, n) {
    if (s[i] == 'x') continue;
    cnt++;
    mem[{i, cnt}] = 1;
    i += c;
    if (cnt == k) break;
  }

  cnt = 0;
  rrrep(i, n - 1, 0) {
    if (s[i] == 'x') continue;
    if (mem[{i, k - cnt}] == 1) ans.p_b(i);
    cnt++;
    i -= c;
    if (cnt == k) break;
  }
  sort(all(ans));
  rep(i, Size(ans)) Cout(ans[i] + 1);
  return 0;
}

Measured memory_bytes: 15880
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        List<Integer> A = new ArrayList<>(N);
        for(int i=0; i<N; i++){
            A.add(sc.nextInt());
        }

        int ans = 999999999;
        List<Integer> B;
        int sub;

        Collections.sort(A);

        for(int i=0; i<=(N-K); i++){
            B = A.subList(i,i+K);
            sub = B.get(K-1) - B.get(0);
            if(sub < ans){
                ans = sub;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 61268
PROGRAM ATCODER

implicit none
integer :: s,c1=0,c2=0

read*, s

if ( mod(s,100) >= 1 .and. mod(s,100) <= 12  ) then
  c1 = 1
end if

if ( s/100 >= 1 .and. s/100 <= 12 ) then
  c2 = 1
end if

if ( c1 == 1 .and. c2 == 1 ) then
  print'(a)', 'AMBIGUOUS'
end if

if ( c1 == 1 .and. c2 == 0 ) then
  print'(a)', 'YYMM'
end if

if ( c1 == 0 .and. c2 == 1 ) then
  print'(a)', 'MMYY'
end if

if ( c1 == 0 .and. c2 == 0 ) then
  print'(a)', 'NA'
end if

END PROGRAM ATCODER

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll ans=a*x+b*y;
    ans=min(ans,2*c*max(x,y));
    ans=min(ans,2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y)));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC113_D___Number_of_Amidakuji
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver());
        }
        static long solver()
        {
            var HWK = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var H = HWK[0];
            var W = HWK[1];
            var K = HWK[2];
            if (W == 1) return 1;
            long MOD = 1000000007;

            var amida1 = new long[W + 1];
            for (int i = 1; i < W; i++)
            {
                var DP = new long[W, 2];
                DP[0, 0] = 1;
                for (int j = 1; j < W; j++)
                {
                    DP[j, 1] = DP[j - 1, 0];
                    DP[j, 0] = j == i ? 0 : (DP[j - 1, 0] + DP[j - 1, 1]) % MOD;
                }
                amida1[i] = (DP[W - 1, 0] + DP[W - 1, 1]) % MOD;
            }

            var amida2 = new long[W + 1];
            for (int i = 1; i < W + 1; i++)
            {
                var DP = new long[W + 1, 2];
                DP[0, 0] = 1;
                for (int j = 1; j < W + 1; j++)
                {
                    DP[j, 1] = j == i || j == i - 1 ? 0 : DP[j - 1, 0];
                    DP[j, 0] = (DP[j - 1, 0] + DP[j - 1, 1]) % MOD;
                }
                amida2[i] = (DP[W - 1, 0] + DP[W - 1, 1]) % MOD;
            }

            var mainDP = new long[H + 1, W + 2];
            mainDP[0, 1] = 1;
            for (int h = 1; h < H + 1; h++)
            {
                for (int w = 1; w < W + 1; w++)
                {
                    mainDP[h, w] += (mainDP[h - 1, w] * amida2[w]) % MOD;
                    mainDP[h, w] += (mainDP[h - 1, w - 1] * amida1[w - 1]) % MOD;
                    mainDP[h, w] += (mainDP[h - 1, w + 1] * amida1[w]) % MOD;
                    mainDP[h, w] %= MOD;
                }
            }
            return mainDP[H, K];
        }
    }
}


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

void solve()
{
	double k = 100;
	double r = 1.01;
	ll x;
	cin>>x;
	ll i = 0;
	while(k<x)
	{
		k=(ll)(k*r);
		i++;
	}
	cout<<i<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3620
import sys
read = sys.stdin.read
def main():
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    n = int(input())
    if n == 1:
        print(0)
        sys.exit()
    nfac = factorization(n)
    r = 0
    for nfe in nfac:
        c = 1
        while True:
            if c <= nfe[1]:
                nfe[1] -= c
                r += 1
                c += 1
            else:
                break
    print(r)

if __name__ == '__main__':
    main()


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

bool a(char c){
  if(c == 'A' || c == 'T' || c == 'G' || c == 'C') return true;
  return false;
}

int main(){
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  vector<vector<int>> A(N, vector<int>(M, 0));
  for(int i = 0; i < M; i++){
    cin >> B.at(i);
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      cin >> A.at(i).at(j);
    }
  }
  int result = 0;
  for(int i = 0; i < N; i++){
    int sum = 0;
    for(int j = 0; j < M; j++){
      sum += A.at(i).at(j) * B.at(j);
    }
    sum += C;
    if(sum > 0) result++;
  }
  cout << result << endl;
  
}

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

using namespace std;

main(){
	int a=100000;
	int b;
	cin >> b;
	int c=0;
	while (c<b){
		a=a+a*0.05;
		c=c+1;
		a=((a+999)/1000)*1000;
	}
	printf("%d\n",a);
}


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

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
ll n,k,h;
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n;
	k=n%11;
	h=n/11;
	if(k==0){
		cout<<h*2;
	}
	else if(k<=6){
		cout<<h*2+1;
	}
	else{
		cout<<h*2+2;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F(i) for(int i=0;i<n;i++)
using namespace std;
long m[2000][2000]={},n,x,ans=1e18,sum=0;
main(){cin>>n>>x;F(i)cin>>m[0][i];F(i){sum=0;F(j){if(i)m[i][j]=min(m[i-1][j],m[0][(i+j)%n]);sum+=m[i][j];}ans=min(ans,sum+i*x);}cout<<ans<<endl;}

Measured memory_bytes: 31488
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    h, w, k = list(map(int, readline().split()))
    a = [list(str(readline().rstrip().decode('utf-8'))) for _ in range(h)]
    no = 0
    is_f = True
    for i in range(h):
        if a[i].count("#") != 0:
            row_f = True
            no += 1
            for j in range(w):
                if a[i][j] == "#":
                    if not row_f:
                        no += 1
                    else:
                        row_f = False
                a[i][j] = no
            if is_f:
                is_f = False
                if i != 0:
                    for j in range(i - 1, -1, -1):
                        for k in range(w):
                            a[j][k] = a[i][k]
        else:
            for j in range(w):
                a[i][j] = a[i-1][j]
    for i in range(h):
        print(*a[i])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 49628
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;

int N;
string s;
vector<int> v[3]; //RGB

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'R') v[0].push_back(i);
		else if (s[i] == 'G') v[1].push_back(i);
		else v[2].push_back(i);
	}

	ll ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'R') {
			ll n1 = lower_bound(v[1].begin(), v[1].end(), i) - v[1].begin();
			ll n2 = lower_bound(v[2].begin(), v[2].end(), i) - v[2].begin();
			ans += n1 * n2;
			for (int j = 1; i + 2 * j < s.size(); j++) {
				if (s[i + j] == 'G' && s[i + 2 * j] == 'B') ans--;
				else if (s[i + j] == 'B' && s[i + 2 * j] == 'G') ans--;
			}
		}
		else if (s[i] == 'G') {
			ll n1 = lower_bound(v[0].begin(), v[0].end(), i) - v[0].begin();
			ll n2 = lower_bound(v[2].begin(), v[2].end(), i) - v[2].begin();
			ans += n1 * n2;
			for (int j = 1; i + 2 * j < s.size(); j++) {
				if (s[i + j] == 'R' && s[i + 2 * j] == 'B') ans--;
				else if (s[i + j] == 'B' && s[i + 2 * j] == 'R') ans--;
			}
		}
		else {
			ll n1 = lower_bound(v[0].begin(), v[0].end(), i) - v[0].begin();
			ll n2 = lower_bound(v[1].begin(), v[1].end(), i) - v[1].begin();
			ans += n1 * n2;
			for (int j = 1; i + 2 * j < s.size(); j++) {
				if (s[i + j] == 'R' && s[i + 2 * j] == 'G') ans--;
				else if (s[i + j] == 'G' && s[i + 2 * j] == 'R') ans--;
			}
		}
	}
	cout << ans << '\n';
	return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

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

	int n;
	cin >> n;

	vector<pair<string, pair<int, int>>> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i].fi >> v[i].se.fi;
		v[i].se.fi *= -1;
		v[i].se.se = i + 1;
	}

	sort(all(v));

	for (auto i: v) {
		cout << i.se.se << "\n";
	}

    return 0;
}


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


fac = [1]


def pow(n, p):
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod


for i in range(1, n + 2):
    fac.append((fac[i - 1] * i) % mod)

d = 0
f = 1
res = 0
for i in range(n - 1):
    d = x[n - 1] - x[i]
    res += (d * fac[n - 1] * pow(i + 1, mod - 2)) % mod

print(res % mod)


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

#define  ll    long long int

int cnt[111];
set<int> prime;
set<int>::iterator it;

void go(int n)
{
    int i, j, rt = sqrt(n);
    for (i = 2; i <= rt; i++) {
        if (n % i == 0) {
            while (n % i == 0) {
                n /= i;
                cnt[i]++;
            }
            prime.insert(i);
        }
    }
    if (n != 1) {
        prime.insert(n);
        cnt[n]++;
    }
}

int main( )
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        go(i);
    }
    int i, j, k;
    vector<int> v;
    for (it = prime.begin(); it != prime.end(); it++) {
        //cout << (*it) << ' ' << cnt[(*it)] << '\n';
        v.push_back(*it);
    }
    int c = 0;
    set< pair<int, pair<int, int> > > st1;
    for (i = 0; i < (int) v.size(); i++) {
        if (cnt[v[i]] >= 74) c++;
        for (j = 0; j < (int) v.size(); j++) {
            if (i == j) continue;
            if (cnt[v[i]] >= 2 && cnt[v[j]] >= 24) c++;
            if (cnt[v[i]] >= 4 && cnt[v[j]] >= 14) c++;
            for (k = 0; k < (int) v.size(); k++) {
                if (i == k || j == k)  continue;
                if (cnt[v[i]] >= 2 && cnt[v[j]] >= 4 && cnt[v[k]] >= 4) {
                    int a = v[j];
                    int b = v[k];
                    if (a < b) swap(a, b);
                    st1.insert(make_pair(v[i], make_pair(a, b)));
                }
            }
        }
    }
    cout << c + (int) st1.size() << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.util.Arrays;

import java.util.Collections;

import java.util.Comparator;

import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int N = Reader.nextInt();
        int[] arr = new int[N];
        int count = 0;
        for(int i=0;i<N;i++){
                arr[i] = Reader.nextInt();
        }
        for(int i=0;i<N;i++){
            int maxind = -1;
            int max = 0;
            for(int j=0;j<N;j++){
                if(arr[j]>max){max = arr[j]; maxind=j;}
            }
            if((i&1)==0){count+= max; arr[maxind]=0;}
            else{count-=max;arr[maxind]=0;}
        }
        System.out.println(count);
    }
}

class Reader {

    static BufferedReader reader;

    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {

        reader = new BufferedReader(

                new InputStreamReader(input) );



        tokenizer = new StringTokenizer("");

    }



    static String nextToken() {

        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {

                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    /** get next word */

    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }



    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }



    static long nextLong() {

        return Long.parseLong(nextToken());

    }


}


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

int main(){
  int N;
  cin>>N;
  vector<int> L;
  for(int i=0; i<2*N; ++i){
    int a;
    cin>>a;
    L.push_back(a);
  }
  sort(L.begin(),L.end());
  int ans=0;
  for(int i=0; i<N; ++i) ans += L[2*i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main()
{
    int n, t;
    t = 0;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        if ((i + 1) % 2 == 1 && a[i] % 2 == 1)
        {
            t++;
        }
    }
    cout << t;
    return 0;
}

Measured memory_bytes: 3592
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define M 1000000007
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}

int main() 
{ 
  ll n,m;
  cin>>n>>m;
  ll mid1=ncr(n,2);
  ll mid2=ncr(m,2);
  cout<<mid1+mid2<<endl;
  
} 


Measured memory_bytes: 256
package main

import (
  "fmt"
)

func Foo(x int) int {

  ans := 0
  for i := 1; i <= x; i++ {
    max := int(x / i)
    rec := i * max * (max + 1) / 2
    ans = ans + rec
  }
  return ans
}

func main() {
  var n int
  fmt.Scanf("%d", &n)

  fmt.Println(Foo(n))
}

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

int main(){
  ll n,min,ans,a;
  cin >> n ;
  min =0;
  ans = 0;
  for(int i =0;i<n;i++){
    cin >> a;
    if(a<min){
      ans+=min-a;
    }
    else{
      min =a;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
int main(){
		int weight[6] = {200,300,500,1000,1200,1500},price[6] = {380,550,850,1520,1870,2244};
		int n;
		while(std::cin >> n,n){
		
			const int INF = 50000;
			int dp[5001] = {0};
			for(int i=1;i<5001;i++){
				dp[i] = INF;
			}
			
			for(int i=0;i<6;i++){
				for(int j=0;j<=n;j++){
					if(j+weight[i] <= n)
						dp[j+weight[i]] = std::min(dp[j+weight[i]],dp[j]+price[i]);
				}
			}
			
			std::cout << dp[n] << std::endl;
		}
}

Measured memory_bytes: 0
gets.chomp.to_i
l = gets.chomp.split().map {|v| v.to_i }
total = 0
l.each {|v| total += v }
left = 0
result = total
l.length.times do |i|
  left += l[i]
  right = total - left
  v1 = (left - right).abs
  if v1 < result
    result = v1
  end
end

puts(result)


Measured memory_bytes: 1788
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long long int gcd(long long int a,long long int b){
    if(!b)return a;
    return gcd(b,a%b);
}
int main(){
    long long int A,B,C,D;
    cin>>A>>B>>C>>D;
    long long int ans=0;
    ans=B-A+1;
    ans-=(B/C)-((A-1)/C);
    ans-=(B/D)-((A-1)/D);
    long long int sai=(C*D)/gcd(C,D);
    ans+=(B/sai)-((A-1)/sai);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3156
# Code for B - Trick or Treat
# Use input() to fetch data from STDIN
[n, k] = map(int, input().split())
d = [0 for x in range(k)]
a = [[] for x in range(k)]

for i in range(k):
    d[i] = int(input())
    a[i] = set([int(x) for x in input().split()])

org = set([x + 1 for x in range(n)])
uniq = set()
for s in a:
    uniq = uniq | s

print(len(org - uniq))


Measured memory_bytes: 9772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int a[2], b[2], p[2], s[2];
    FOR(i, 0, 2)cin >> a[i];
    FOR(i, 0, 2)cin >> b[i];
    FOR(i, 0, 2)cin >> p[i];
    FOR(i, 0, 2)cin >> s[i];
    int h = 0, k = 0;
    FOR(i, 0, 2)h += a[i] * p[i] + a[i] / (10 * (i + 1)) * s[i];
    FOR(i, 0, 2)k += b[i] * p[i] + b[i] / (10 * (i + 1)) * s[i];
    if (h > k)cout << "hiroshi\n";
    else if (h < k)cout << "kenjiro\n";
    else cout << "even\n";
}


Measured memory_bytes: 3200
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;

int main(void){
        int i,j;

        int n;
        int m;
        int s[10];
        int c[10];
        int a[5];

        scanf("%d%d", &n, &m);
        for(i=0;i<m;i++){
                scanf("%d%d", &s[i], &c[i]);
        }
        for(i=0;i<m;i++){
                s[i]--;
        }
        for(i=0;i<n;i++){
                a[i]=-1;
        }
       

        for(i=0;i<m;i++){
                if(a[s[i]]==-1){
                        a[s[i]] = c[i];
                } else if(a[s[i]] != c[i]){
                        printf("-1\n");
                        return 0;
                }
        }
        for(i=0;i<n;i++){
                if(a[i]==-1){
                        if(n==1){
                                a[i]=0;
                        } else if(i==0){
                                a[i]=1;
                        } else {
                                a[i] = 0;
                        }
                }
        }
        if(a[0]==0 && n!=1){
                printf("-1\n");
                return 0;
        }
        
        for(i=0;i<n;i++){
                printf("%d", a[i]);
        }
        printf("\n");
        return 0;
}



Measured memory_bytes: 128
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6+3
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

h,w,a,b=map(int,input().split())
ans=0
for j in range(h-a):
  ans=ans+cmb(b+j-1,j,mod)*cmb(w+h-b-j-2,w-b-1,mod)
print(ans%mod)

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void printVec(vector<int>& vec) {
    for (auto& e : vec) {
        cout << e << " ";
    }
    cout << endl;
}

int main() {
    long long n;
    cin >> n;
    pair<int, int> a[n + 1];

    rep(i, n) {
        int student;
        cin >> student;
        a[i] = make_pair(student, i);
    }

    sort(a, a + n);
    rep(i, n) { cout << a[i].second + 1 << " "; }
    cout << endl;

    return 0;
}



Measured memory_bytes: 1536
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
pre = a[0]
up = false
down = false
cnt = 1
(n-1).times do |i|
  if !up && !down
    if pre <= a[i+1]
      up = true
    end
    if pre >= a[i+1]
      down = true
    end
  elsif up && down
    if pre > a[i+1]
      up = false
    elsif pre < a[i+1]
      down = false
    end
  elsif up
    if pre > a[i+1]
      up = false
      cnt += 1
    end
  elsif down
    if pre < a[i+1]
      down = false
      cnt += 1
    end
  end
  pre = a[i+1]
end
puts cnt

Measured memory_bytes: 21620
#include<iostream>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main(){
    string w,t;
    cin >> w;
    long cnt=0;
    while(cin >> t && !(t=="END_OF_TEXT")){
        F(i,0,t.size()) if(t[i]>='A' && t[i]<='Z') t[i]=t[i]-'A'+'a';
        if(t==w) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
	int k, s, counter=0;
	cin >> k >> s;
	rep(i, k+1) {
		rep(j, k + 1) {
			if (s - i - j >= 0 && s - i - j <= k) {
				counter++;
			}
		}
	}
	cout << counter << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll a,b,c,red,blue;
vector<ll> s;

int main()
{
	cin>>a>>b>>c;
	red=a/2,blue=a-a/2;
	s.push_back(abs(red*b*c-blue*b*c));
	red=b/2,blue=b-b/2;
	s.push_back(abs(red*a*c-blue*a*c));
	red=c/2,blue=c-c/2;
	s.push_back(abs(red*a*b-blue*a*b));
	sort(s.begin(),s.end());
	cout<<s[0]<<endl;
	return 0;
}

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

using LL = long long;

#define ALL(a) begin((a)), end((a))
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); (i)--)
#define debug(x) cout << #x << " : " << x << '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const LL LINF = 1e16;

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

  LL ans = 0;
  int N, D;
  cin >> N >> D;
  vector<vector<double>> coordinate(N, vector<double>(D));
  FOR(i, 0, N) {
    FOR(k, 0, D) { cin >> coordinate[i][k]; }
  }

  FOR(i, 0, N) {
    FOR(j, i + 1, N) {
      double sum = 0.0;
      double temp = 0.0;

      FOR(k, 0, D) {
        temp = abs(coordinate[i][k] - coordinate[j][k]);
        sum += temp * temp;
      }

      double root = sqrt(sum);
      if (ceil(root) == floor(root)) {
        ans++;
      }
    }
  }

  cout << ans << '\n';

  return 0;
}

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

using namespace std;

#define LL long long
const LL MOD = 1e9 + 7;

LL factorial(LL n) {
    if (n == 0) {
        return 1;
    } else {
        return (n * factorial(n - 1)) % MOD;
    }
}

int main() {
    LL n, m;
    cin >> n >> m;

    LL ans = 0;
    if (abs(m - n) == 0) {
        ans = (factorial(m) * factorial(n) * 2) % MOD;
    } else if (abs(m - n) == 1) {
        ans = (factorial(m) * factorial(n)) % MOD;
    }

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

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;




int main()
{
	int N;
	int num = 0;
	int cnt = 0;
	cin >> N;
	vector<int> data(N,0);

	for (int i = 0; i < N; i++) {
		cin >> data[i];
	}

	for (int i = 0; i < N-1; i++) {
		if (data[i] == i+1) {
			swap(data[i + 1], data[i]);
			cnt++;
		}
	}
	if (data[N - 1] == N)cnt++;




	cout << cnt << endl;


	


	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    long long N,i,num;
    int ans = 0;
    cin >> N;
    int s = (int)sqrt(N) + 1;
    for(i=s;i>=1;i--){
        if(N%i == 0){
            num = N/i;
            break;
        }
    }
    while(num > 0){
        ans++;
        num /= 10;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

using namespace std ;

const int N=1e6+10 ;
const int P=1e9+7 ;

int f[N] , ban[N] ;
int n , m ;
int main ()
{
    int i , x ;
    scanf("%d%d",&n,&m);
    for ( i=1 ; i<=m ; i++ ) scanf("%d",&x),ban[x]=1;
    f[0]=1;
    if ( !ban[1] ) f[1]=1;
    for ( i=2 ; i<=n ; i++ ) 
        if ( !ban[i] ) f[i]=(f[i-1]+f[i-2])%P;
    printf("%d\n",f[n]);
    return 0 ;
}

Measured memory_bytes: 4608
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 100000;
ll const MOD = 1000000007;

int main() {
    ll N;
    cin >> N;
    vector<double> a(N);

    rep(i, N) cin >> a[i];
    double avg = 0;
    rep(i, N) { avg += a[i]; }
    avg /= (double)N;

    vector<pair<double, ll>> diff;
    rep(i, N) {
        pair<double, ll> p = make_pair(abs(avg - a[i]), i);
        diff.push_back(p);
    }

    // cout << avg << endl;
    sort(diff.begin(), diff.end());
    // repv(diff) { cout << (*it).first << "," << (*it).second << endl; }
    cout << diff[0].second << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define alla(a,n) a, a + n
#define endstring std::string::npos
#define prtarr(n,len) {for(int i=0;i<len;i++) cout<<n[i]<<" "; cout<<"\n";}
#define prtpair(n) {cout<<n.fr<<" "<<n.sc<<"\n";}
#define Ataru main
using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
using namespace std;
int judge(int x,int y){
    cout<<"? "<<x+1<<" "<<y+1<<endl;
    int a; cin>>a;
    return a;
}
const ll INF= 0x3f3f3f3f;
const ll bignum=1e18;

int cnt(ll n){
    int ans=0;
    for(int i=1;i<=n;i++){
        if(n%i==0) ans++;
    }
    return ans;
}
ll n;
int Ataru(){
    /// #jojofan
    /// #csgofan
    /// Author: Ataru
    //freopen("input.txt", "r", stdin) ;
    //freopen("output.txt", "w", stdout) ;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=(n-1)/i;
    }
    cout<<ans;



    return 0;
}


Measured memory_bytes: 3572