akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
    int n,p[100000],swap[100000],max_no=0,ans;
    
    scanf("%d",&n);
    for(int i = 0; i< n;i++){
        scanf("%d",&p[i]);
    }
    
    for(int i =0;i<n;i++){
        if((i + 1) == p[i])swap[max_no]=p[i],max_no++;
    }
    ans = max_no;
    
    for(int i =0;i<max_no;i++){
        if(swap[i+1] - swap[i] == 1)ans--,i++;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){
   
   int a,b;
   
   scanf("%d %d",&a,&b);
   
   char Moji[300];
   
   sprintf(Moji,"%d%d",a,b);
   
   int N = atoi(Moji);
   
   int root = (int)sqrt(N);
   
   if(root*root == N){
      printf("Yes\n");
   }
   else {
      printf("No\n");
   }
   
   return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(){
  int S[100000], count = 0, s, t, t0, i, j, left, right, mid;
  scanf("%d",&s);
  for(i = 0; i < s; i++) scanf("%d",&S[i]);
  scanf("%d",&t);

  for(i = 0; i < t; i++){
    left = 0;
    right = s;
    
    scanf("%d",&t0);
    while(left < right){
      mid = (right + left)/2;
      if(S[mid] == t0){
	count++;
	break;
      }
      else if(S[mid] > t0){
	right = mid;
      }
      else if(S[mid] < t0){
        left = mid + 1;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}

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

int main() {
  int n;cin >> n;
  int sum=0;
  vector<int> a(n);
  vector<int>b(n);
  rep(i,n){
    cin >> a[i];
  }
  rep(i,n)cin >> b[i];
  rep(i,n){
    if(a[i]>b[i])sum+=a[i]-b[i];
  }
    cout << sum << endl;
   // if()
}

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

# print(N, K)
S = input()
index_array = [0]
now_letter = "1"
for i, s in enumerate(S):
    if s != now_letter:
        now_letter = s
        index_array.append(i)
else:
    if now_letter == "1":
        index_array.append(N)
    else:
        index_array.append(N)
        index_array.append(N)        

# print(index_array)
ans = 0
array_len = len(index_array)
if (K + 1) * 2 > array_len:
    print(N)
    exit()
candidate = array_len // 2 - K
for i in range(candidate):
    # print(index_array[(i + K) * 2 + 1] - index_array[i * 2])
    ans = max(index_array[(i + K) * 2 + 1] - index_array[i * 2], ans)
print(int(ans))


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


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

    double ans;
    ans = pow(l/3.0,3);

    cout<<std::setprecision(18)<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

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

  for(int i=0; i<s.size(); i+=2) cout << s[i];
  cout << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

void Main(){
	int n; cin >> n;
	vector<mint> a(n);
	mint s = 0;
	rep(i,n){
		int t;
		cin >> t;
		s += t;
		a[i] = mint(t) * mint(t);
	}
	mint ans = s * s;
	rep(i,n){
		ans -= a[i];
	}
	cout << ans / 2 << endl;
}

Measured memory_bytes: 4784
n,q = map(int,input().split())
s = input()
lis = [0] * (n + 1)

for i in range(n):
    if s[i:i+2] == "AC":
        lis[i + 1] = lis[i] + 1
    else:
        lis[i + 1] = lis[i] + 0
for i in range(q):
    l,r = map(int,input().split())
    print(lis[r-1] - lis[l-1])

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  int N;
  cin >> N;
  vector<int> p(N);
  for(int i = 0; i < N; i++) cin >> p[i]; 
  sort(p.begin(), p.end());
  int ans = 0;
  for(int i = 0; i < N-1; i++){
    ans += p[i];
  }
  cout << ans + p[N-1] / 2 <<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll h,w;
  cin >> h >> w;
  char c[h][w];
  ll dist[h][w];
  ll ans=0;
  rep(i,h){
    rep(j,w){
      cin >> c[i][j];
      dist[i][j]=-1;
      if(c[i][j]=='.'){
        ans++;
      }
    }
  }
  queue<pair<ll,ll>> que;
  que.push(make_pair(0,0));
  int x[4]={1,0,-1,0};
  int y[4]={0,1,0,-1};
  dist[0][0]=0;
  while(!que.empty()){
    auto p=que.front();
    ll cpx=p.first;
    ll cpy=p.second;
    que.pop();
    for(int k=0;k<4;k++){
      int xx=cpx+x[k];
      int yy=cpy+y[k];
      if(xx<0 || xx>=h || yy>=w || yy<0 || c[xx][yy]=='#'){
        continue;
      }
      if(dist[xx][yy]!=-1){
        continue;
      }
      dist[xx][yy]=dist[cpx][cpy]+1;
      que.push(make_pair(xx,yy));
    }
  }
  if(dist[h-1][w-1]==-1){
    cout << -1;
    return 0;
  }
  cout << ans-1-dist[h-1][w-1];
}
  

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main(void){
    int x1, y1, x2, y2;
    cin>>x1>>y1>>x2>>y2;
    
    int dx = x2-x1, dy = y2-y1;
    
    int x3 = x2-dy, y3 = y2+dx;
    int x4 = x3-dx, y4 = y3-dy;
    
    cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
}


Measured memory_bytes: 256
n = int(input())

cnt = [[0] * 10 for i in range(10)]

for i in range(1,n+1):
    s = str(i)
    cnt[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += cnt[i][j] * cnt[j][i]
    
print(ans)

Measured memory_bytes: 3064
import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

# available on Google, not available on Codeforces
# import numpy as np
# import scipy


def solve(x,k,d):  # fix inputs here
    console("----- solving ------")
    console(x,k,d)

    x = abs(x)

    if k*d <= x:
        return x - k*d

    remainder = x%d
    moves = (x - remainder) // d

    leftover_moves = (k - moves) % 2

    console(remainder, moves, leftover_moves)

    return min(abs(remainder + leftover_moves*d), abs(remainder - leftover_moves*d))


def console(*args):  # the judge will not read these print statement
    print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return

# fast read all
# sys.stdin.readlines()

for case_num in [1]:
    # read line as a string
    # strr = input()

    # read line as an integer
    # k = int(input())
    
    # read one line and parse each word as a string
    # lst = input().split()

    # read one line and parse each word as an integer
    x,k,d = list(map(int,input().split()))

    # read matrix and parse as integers (after reading read nrows)
    # lst = list(map(int,input().split()))
    # nrows = lst[0]  # index containing information, please change
    # grid = []
    # for _ in range(nrows):
    #     grid.append(list(map(int,input().split())))

    res = solve(x,k,d)  # please change
    
    # Google - case number required
    # print("Case #{}: {}".format(case_num+1, res))

    # Codeforces - no case number required
    print(res)



Measured memory_bytes: 76732
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int n;
  std::cin >> n;
  vt<int> a(3*n);
  rep(i,3*n)
    std::cin >> a[i];

  sort(a.begin(),a.end());
  ll ans = 0;
  rep(i,n)
    ans += a[n+i*2];

  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(){

	int a, b, c;
	cin >> a >> b >> c;
	if (a > b) swap(a, b);
	if (a > c) swap(a, c);
	if (b > c) swap(b, c);
	cout << a << " " << b << " " << c << endl;
	return 0;
}


Measured memory_bytes: 3080
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] iArr = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int a = iArr[0];
            int b = iArr[1];
            int C = iArr[2];

            double theta = C * Math.PI / 180.0;
            double h = b * Math.Sin(theta);
            double S = a * h / 2.0;
            double L = a + b + Math.Sqrt(Math.Pow(a - b * Math.Cos(theta), 2) + h * h);

            Console.WriteLine("{0} {1} {2}", S, L, h);

            Console.ReadLine();
        }
    }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   ll N,T;cin >>N>>T;
   vector<P>p;
    for (int i = 0; i < N; ++i) {
        ll t,c;cin>>c>>t;
        if(t<=T)p.push_back({c,t});
    }
    if(p.empty())puts("TLE");
    else {
        sort(all(p));
        cout << p[0].first << endl;
    }
   return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  vs t = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
  rep(_, n) {
    string s;
    cin >> s;
    string r = "";
    int q, p = 0;
    rep(i, s.size()) {
      int x = s[i] - '0';
      if (x == 0) {
        if (p == 0) continue;
        r += t[p][(q - 1) % t[p].size()];
        p = 0;
        continue;
      }
      if (p == x) {
        q++;
      } else {
        q = 1;
      }
      p = x;
    }
    cout << r << endl;
  }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n;
string s[333];

int main(){
  cin>>n;
  rep(i,n)cin>>s[i];
  ll res=0;
  rep(a,n){
    bool ok=true;
    rep(i,n)rep(j,n){
      if(s[i][(j+a)%n]!=s[j][(i+a)%n])ok=false;

    }
    if(ok)res+=n;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

int main(void){
	ll n;
	cin>>n;
	ll a[n],b[n];
	vector<pair<ll,ll>>p(n);
	for(ll i=0;i<n;i++){
		cin>>a[i]>>b[i];
		p[i] = make_pair(b[i],a[i]);
	}
	sort(p.begin(),p.end());
	ll now = 0;
	bool flag=true;
	for(ll i=0;i<n;i++){
		now += p[i].second;
		if(now>p[i].first){
			flag=false;
			break;
		}
	}
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 6528
import sys
rr = lambda: sys.stdin.readline().strip()
rri = lambda: int(rr())
rrs = lambda: [int(_) for _ in rr().split()]

N, M = rrs()
data = [rrs() for _ in range(M)]

L = data[0][0]
R = data[0][1]

for d in data:
    if L < d[0]:
        L = d[0]
    if R > d[1]:
        R = d[1]

print(max(R - L + 1, 0))

Measured memory_bytes: 21156
#include<iostream>
#include<set>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int ans=1;
    long long m=0;
    while(ans<=n){
       m=(10*m+7)%n;
//        cout<<m<<endl;
        if(m%n==0) break;
        ans++;
    }
    if(ans<=n)
        cout<<ans;
    else cout<<-1;
    return 0;
}


Measured memory_bytes: 3188
def stack():
    S = list(input().split())
    N = len(S)

    A = [0]

    for i in range(N):
        if S[i] == '+':
            A[-2] += A[-1]
            A.pop()
        elif S[i] == '-':
            A[-2] -= A[-1]
            A.pop()
        elif S[i] == '*':
            A[-2] *= A[-1] #演算は常に「最新の２つの数字」について行われる事を利用
            A.pop()
        elif S[i] == '/':
            A[-2] /= A[-1]
            A.pop()
        else:
            A.append(int(S[i]))
    
    print(A[-1])

stack()



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
ll dp[55][55][2510];

void solve() {
	cin >> N >> K;
	if(K % 2) {
		cout << 0 << "\n"; return;
	}
	dp[0][0][0] = 1;
	rep(i, 0, N) {
		rep(j, 0, N) {
			rep(k, 0, K + 1) {
				if(!dp[i][j][k]) continue;
				ADD(dp[i + 1][j][k + j], dp[i][j][k]);
				// fill with i
				ADD(dp[i + 1][j][k + j], dp[i][j][k] * 2 * j % mod);
				// fill with ?
				ADD(dp[i + 1][j + 1][k + j + 1], dp[i][j][k]);
				// fill with number before it
				if(j > 0) ADD(dp[i + 1][j - 1][k + j - 1], dp[i][j][k] * j % mod * j % mod);
			}
		}
	}
	// rep(i, 0, N + 1) {
	// 	rep(j, 0, N + 1) {
	// 		rep(k, 0, 10) {
	// 			if(!dp[i][j][k]) continue;
	// 			debug(i, j, k, dp[i][j][k]);
	// 		}
	// 	}
	// }
	cout << dp[N][0][K / 2] << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 53504
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
    
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();

        int sum = 0;
        if(a < b) sum += a;
        else sum += b;
        if(c < d) sum += c;
        else sum += d;

        System.out.println(sum);

        scan.close();
    
    }

}

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define erep(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  i64 a, b, c;
  cin >> a >> b >> c;
  if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    cout << 0 << endl;
    return 0;
  }

  i64 ans = min({a * b, b * c, c * a});
  cout << ans << endl;
}


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

using namespace std;

typedef long long LL;

const int N = 100010;

int n;
int h[N], e[N], ne[N], idx;
int dist[N];
int q[N];
bool st[N];

void add(int a, int b)
{
    e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}

int spfa()
{
    memset(dist, 0x3f, sizeof dist);
    int hh = 0, tt = 0;
    dist[1] = 0;
    q[tt++] = 1;
    st[1] = true;

    while(hh != tt)
    {
        int t = q[hh++];
        if(hh == N) hh = 0;

        for(int i = h[t]; ~i; i = ne[i])
        {
            int j = e[i];
            if(dist[j] > dist[t] + 1)
            {
                dist[j] = dist[t] + 1;
                if(!st[j])
                {
                    q[tt++] = j;
                    if(tt == N) tt = 0;
                    st[j] = true;
                }
            }
        }
    }

    if(dist[2] == 0x3f3f3f3f) return -1;
    else return dist[2];
}

int main()
{
    memset(h, -1, sizeof h);

    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
    {
        int a;
        scanf("%d", &a);
        add(i, a);
    }

    printf("%d\n", spfa());
    return 0;
}


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

int main() {
    int K, A, B;
    cin >> K;
    cin >> A >> B;
    for(int i = A; i <= B; i++) {
        if(i % K == 0) {
            cout << "OK" << "\n";
            exit(0);
        }
    }
    cout << "NG" << "\n";
    return 0;
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()

#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<" "<<#x<<"="<<x

#define bit(k) (1LL<<(k))

typedef long long ll;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
/*------------------------------------*/
ll modpow(ll a, ll n, int mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n - i;
        y *= i+1;
    }
    return x / y;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,a,b;
    cin>>n>>a>>b;
    mint ans = modpow(2, n, MOD) - 1 - choose(n,a).x - choose(n,b).x;
    cout<<ans.x<<endl;
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int i;
    int ans = 0;
    for(i = 0; i < n-2; i++){
        if(s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C'){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int max = (int)Math.pow(10,9);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int s = sc.nextInt();
        ArrayList<Integer> li = new ArrayList<Integer>();
        for(int i = 0; i < k; i++){
            System.out.print(s+" ");
        }
        for(int i = k; i < n; i++){
            int prt = (s+1) % max;
            System.out.print(prt +" ");
        }
    }
}

Measured memory_bytes: 43076
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  int M = 0, m = 2000;
  for (int i = 0; i < N; i++)
  {
    int a;
    cin >> a;
    chmin(m, a);
    chmax(M, a);
  }
  
  int ans = M - m;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
const ll LINF = 1e18;
const int INF = 1e9;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<int> a(n);
    vector<int> ng(1001001,0);
    rep(i,n){
        cin >> a[i];
        ng[a[i]]++;
        
    }
    vector<bool> ok(n,1);
    rep(i,n){
        for(int j=1;j*j<=a[i];j++){
            if(j==1){
                if(a[i]==1){
                    if(ng[1]>1) ok[i]=0;
                }
                else{
                    if(ng[1]) ok[i]=0;
                    if(ng[a[i]]>1) ok[i]=0;
                }
            }
            else if(a[i]%j==0){
                if(ng[j]||ng[a[i]/j]){
                    ok[i]=0;
                }
            }
        }
    }
    int ans=0;
    rep(i,n) if(ok[i]) ans++;
    cout << ans << endl;
}


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

class Magatro
{
    static void Main()
    {
        new Magatro().Solve();
    }
    
    private int N;
    private int[]Cnt=new int[100002];
    
    public void Solve()
    {
        N=int.Parse(Console.ReadLine());
        var line = Console.ReadLine().Split(' ');
        foreach(var s in line)
        {
            var i=int.Parse(s);
            Cnt[i]++;
            if(i!=0)
                Cnt[i-1]++;
            Cnt[i+1]++;
        }
        Console.WriteLine(Cnt.Max());
    }
}

Measured memory_bytes: 16992
#include <cstdio>

int main(void) {
    int N, x, a, b;
    long long int ans=0, sum, tmp;
    scanf("%d %d", &N, &x);
    scanf("%d", &a);
    for(int i=1 ; i<N ; i++) {
        scanf("%d", &b);
        sum=a+b;
        if(sum>x) {
            tmp=sum-x;
            ans+=tmp;
            (tmp>b) ? b=0 : b-=tmp;
        }
        a=b;
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 128
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		int c = sc.nextInt();
		byte[] aa = sc.next().getBytes();
		int[] pp = new int[k];
		int[] qq = new int[k];
		for (int h = 0, i = 0, o = i - c - 1; i < n; i++)
			if (aa[i] == 'o' && i - o > c) {
				pp[h] = o = i;
				if (++h == k)
					break;
			}
		for (int h = 0, i = n - 1, o = i + c + 1; i >= 0; i--)
			if (aa[i] == 'o' && o - i > c) {
				qq[k - 1 - h] = o = i;
				if (++h == k)
					break;
			}
		for (int h = 0; h < k; h++)
			if (pp[h] == qq[h])
				println(pp[h] + 1);
	}
}


Measured memory_bytes: 52260
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back()
#define INF 1000000000

using namespace std;

const int mod = 1e9+7;

int main(){
	
	int x, y;
	
	cin>>x>>y;
	if(y == 0){
		cout<<x<<endl;
		return 0;
	}
	set<int> vec;
	for(int i= 0; i< y; i++){
		int v;
		cin>>v;
		vec.insert(v);
	}
	pair<int,int> mn = {INF,-1};
	for(int i = y; i <=101; i++){
		int k = abs(x-i);
		if(mn.first > k && vec.find(i) == vec.end()){
			mn.first = k;
			mn.second = i;
		}
	}
	for(int i = y-1; i >=0; i--){
		int k = abs(x-i);
		if(mn.first >= k && vec.find(i) == vec.end()){
			mn.first = k;
			mn.second = i;
		}
	}
	
	cout<< mn.second<<endl;
	
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000000000000000000
#define NMAX 100000
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 169, task b, 2020/05/31
//ms,
/*
*/

int main(void){
  int N;
  int64_t A[NMAX];
  int64_t mul=1;

  cin >>N;
  for(int i=0;i<N;i++){
    cin >>A[i];
    if(A[i]==0) {
      cout <<0 <<endl;
      return 0;
    }
  }

  for(int i=0;i<N;i++){
    if(MAX/mul<A[i]) {
      mul=-1;
      break;
    }else{
      mul *=A[i];
    }
  }

  cout <<mul <<endl;
  return 0;
}
/*
*/


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

using namespace std;

#define NUM_RATE 10

int main()
{
  int rate[NUM_RATE] = {0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, INT_MAX};
  int num[NUM_RATE];
  for(int i=0; i<NUM_RATE; i++)
    num[i] = 0;
  
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    for(int j=0; j<NUM_RATE-1; j++){
      if(rate[j] <= a && a < rate[j+1]){
        num[j]++;
        break;
      }
    }
  }
  
  int color=0;
  for(int i=0; i<NUM_RATE-2; i++){
    //cout << num[i] << endl;
    if(num[i] > 0)
      color++;
  }
  int min_color = max(color, 1);
  int max_color = color + num[NUM_RATE - 2];
  
  cout << min_color << " " << max_color << endl;
  
  return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int n;
vint a,t;

bool judge(){
  VSORT(a);
  if(n%2!=0){
    t.push_back(0);
    rep(i,(n-1)/2){
      t.push_back((i+1)*2);
      t.push_back((i+1)*2);
    }
  }
  else{
    rep(i,n/2){
      t.push_back(2*(i+1)-1);
      t.push_back(2*(i+1)-1);
    }
  }
//  for(auto x: t) cout << x;
  return a == t;
}

int main(){
  cin >> n; a.resize(n);
  rep(i,n) cin >> a[i];
 
  ll ans=0;
  
  if(judge()){
    ans=1;
    rep(i,n/2){
      ans = ans*2 % 1000000007;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1276
using System;
using System.Collections.Generic;

namespace abc143_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var n = CIn.ReadInt();
      var s = CIn.Read().ToCharArray();

      var ans = 1;

      for (var i = 1; i < n; i++)
      {
        if (s[i - 1] != s[i]) ans++;
      }

      Console.WriteLine(ans);
    }
  }

  class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }
  }
}

Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
const char nl = '\n';
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */
#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key> >
using ostree = pbds::tree<key, val, comp, pbds::rb_tree_tag,
                          pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define allOf(x) std::begin(x), std::end(x)
template <typename...Args>
ostream&operator<<(ostream&os, pair<Args...> const &p)
{return os<<'('<<p.first<<", "<<p.second<<')';}
template <typename...Args>
ostream&operator<<(ostream&os, vector<Args...> const &v)
{os<<'[';for(const auto&el:v)os<<' '<<el;return(os<<" ]");}
template <typename...Args> ostream&operator<<(ostream&os, map<Args...>const&v)
{os<<'[';for(auto const&el:v)os<<' '<<el;return(os<<" ]");}
template <typename...Args> ostream&operator<<(ostream&os, set<Args...>const&v)
{os<<'[';for(auto const&el:v)os<<' '<<el;return(os<<" ]");}
template <typename...Args>
ostream&operator<<(ostream&os, unordered_map<Args...>const&v)
{os<<'[';for(auto const&el:v)os<<' '<<el;return(os<<" ]");}
template<typename T> void trace_rec(stringstream&sst, const T&t)
{ string arg; getline(sst, arg, ','); cerr << arg << " : " << t << " }"; }
template<typename T, typename... Args>
void trace_rec(stringstream&sst, const T&t, const Args... args)
{ string arg; getline(sst, arg, ','); cerr << arg << " : " << t << ", ";
  trace_rec(sst, args...); }
template<typename... Args> void trace(const string&s, Args... args)
{stringstream sst(s); cerr << "{ "; trace_rec(sst, args...); cerr << endl;}
#define dbg(...) trace(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void dbr(const T lb, const T ub)
{cerr<<'{';for(auto it=lb; it!=ub; it++)cerr<<' '<<(*it);cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T> >
bool setMin(T &mem, const T&v, Comp comp = Comp())
{ return comp(v, mem) ? mem = v, true : false; }
template<typename T, typename Comp=less<T> >
bool setMax(T &mem, const T&v, Comp comp = Comp())
{ return comp(mem, v) ? mem = v, true : false; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

  int n; cin >> n;
  ll t, a, del = (ll)1e17;
  cin >> t >> a; t *= 1000, a *= 1000;
  int ans = 0;
  for(int i=1; i<=n; i++) {
    int h; cin >> h;
    ll temp = t - 6 * h;
    if( setMin(del, abs(a-temp)) ) ans = i;
  }
  cout << ans << endl;

  return 0;
}

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 256
N,X=map(int, input().split())
m_list=list(map(int, [input() for i in range(N)]))
sum_m_list=sum(m_list)
X_rest=X-sum_m_list

if X_rest>0:
        X_add=X_rest//min(m_list)
        print(N+X_add)
else:
        print(N)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
	int a[100] = { 0 };
	int A ;
	for (int i = 0; i < 3; i++){
		cin >> a[i];
	}
	for (int i = 0; i < 100; i++){
		for (int i = 0; i < 2; i++){
			if (a[i]>a[i + 1]){
				A = a[i];
				a[i] = a[i + 1];
				a[i + 1] = A;
			}
		}
	}
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	return 0;
}

Measured memory_bytes: 3100
N, C = map(int, input().split())
D = [[] for i in range(C)]
c = [[] for i in range(N)]
for i in range(C):
    a = list(map(int, input().split()))
    D[i] = a

for i in range(N):
    a = list(map(int, input().split()))
    c[i] = a

T = [[0] * C for i in range(3)]
for i in range(N):
    for j in range(N):
        T[(i + j) % 3][c[i][j] - 1] += 1


num = float("inf")
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i == j or j == k or k == i:
                continue
            rec = 0
            for l in range(C):
                rec += D[l][i] * T[0][l]
                rec += D[l][j] * T[1][l]
                rec += D[l][k] * T[2][l]
            num = min(num, rec)
print(num)


Measured memory_bytes: 5620
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long int n,m;
    std::cin >> n >>m;
    
    if(n*2<m){
        std::cout << n+(m-n*2)/4 << std::endl;
    }else{
        std::cout << m/2 << std::endl;
    }
}


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


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s;
    cin>>n;
    for1(n)
    {
        cin>>x;
        if(i%2==1&&x%2==1)c++;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 3604
#include<stdio.h>
long max(long ,long);
int main(void){
  long a,b;
  scanf("%ld%ld",&a,&b);
  long ma=max(a,b);
  //printf("最大公約数 %ld\n",ma);
  long ans=a*b/ma;
  printf("%ld",ans);
  
  return 0;
}
long max(long a,long b){
if(b>a){long w=a;
        a=b;
        b=w;
       }
 // printf("%ld %ld %ld",a,b,a%b); 
  if(a%b!=0){
  return max(b,a%b);}
  else return b;
}

Measured memory_bytes: 128
from collections import defaultdict
N = int(input())

def fl(x):
    f = 0
    l = x % 10
    while x != 0:
        f = x
        x = x // 10
    return (f, l)

d = defaultdict(int)

for i in range(1, N+1):
    d[fl(i)] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += d[(i, j)] * d[(j, i)]

print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define deb_arr(a,n) {cout<<#a<<":";for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';}
#define deb_mat(dist,n,m) {cout<<#dist<<"\n";for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}}
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 200001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
template< class T > bool odd(T a) { return a&1; }
template< class T > bool even(T a) { return !(a&1); }
int vis[N];
int cnt[N];
vector <int> v[N];
void init(int n)
{
    fpr(i,0,n+1)
    {
        cnt[i]=0;
        vis[i]=0;
        v[i].clear();
    }
}
int dfs(int s)
{
    vis[s]=1;
    cnt[s]=1;
    for(auto it:v[s])
    {
        if(!vis[it])
        {
            cnt[s]+=dfs(it);
        }
    }
    return cnt[s];
}
int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("../ip.txt", "r", stdin);
//    freopen("../op.txt", "w", stdout);
//#endif
    AKASH_PATEL;
    SVNIT_SURAT;
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        init(n);
        fpr(i,2,n+1)
        {
            int x;
            cin>>x;
            cnt[x]++;
        }
        fpr(i,1,n+1)
        {
            cout<<cnt[i]<<'\n';
        }
    }
    return 0;
}





Measured memory_bytes: 9908
#include <stdio.h>
#include <string.h>
char s[101],t[101];
int n, ans;

int f(){
	int k,m;
	for(int i=0;i<n;i++) {
		k=i;
		m=0;
		while(s[k]!='\0'&&s[k]==t[m]){
			k++;
			m++;
		}
		if(k==n) return m;
	}
	return 0;
}

int main() {
	scanf("%d %s %s",&n,s,t);
	ans=2*n-f();
	printf("%d",ans);
	return 0;
}

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

int main(void){
    int n;
    cin >> n;
    
    int ab[26];
    int i;
    for(i = 0; i < 26; i++){
        ab[i] = 50;
    }
    
    string s;
    int j;
    for(i = 1; i <= n; i++){
        cin >> s;
        int cnt[26] = {0};
        for(j = 0; j < s.length(); j++){
            cnt[s[j] - 'a']++;
        }
        
        for(j = 0; j < 26; j++){
            if(cnt[j] < ab[j]){
                ab[j] = cnt[j];
            }
        }
    }
    
    for(i = 0; i < 26; i++){
        for(j = 1; j <= ab[i]; j++){
            cout << (char)(i + 'a');
        }
    }
    
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define print(x) cout << (x) << endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n; cin >> n;
	string s[n]; for(ll i = 0; i < n; i++)cin >> s[i];
	
	vector<P> p, m;
	for(auto si : s){
		ll mn = 0;
		ll cnt = 0;
		
		for(auto c : si){
			if(c == '('){
				cnt++;
			}
			else{
				cnt--;
			}
			mn = min(mn, cnt);
		}
		
		ll rcnt = 0;
		ll rmin = 0;
		for(ll j = 0; j < si.size(); j++){
			if(si[si.size()-1-j] == ')'){
				rcnt++;
			}
			else{
				rcnt--;
				rmin = min(rmin, rcnt);
			}
		}
		
		if(cnt >= 0){
			p.push_back(P(mn, cnt));
		}
		else{
			m.push_back(P(rmin, cnt));
		}
	}
	sort(p.begin(), p.end(), greater<>());
	sort(m.begin(), m.end());
	
	bool ans = true;
	ll res = 0;
	for(auto x : p){
		if(res + x.first < 0)ans = false;
		res += x.second;
	}
	
	for(auto x : m){
		if(res + x.first + x.second < 0)ans = false;
		res += x.second;
	}
	
	if(res != 0)ans = false;
	print(ans? "Yes" : "No")
	
	return 0;
}

Measured memory_bytes: 50272
#include <stdio.h>

int main(){
	int N;
	int i;
	double ans=0;
	
	scanf("%d",&N);
	
	double x[N];
	char u[N][3];
	
	for(i=0;i<N;i++){
		scanf("%lf %s",&x[i],&u[i]);
	}
	
	for(i=0;i<N;i++){
		if(u[i][0]=='J')	ans+=x[i];
		else	ans+=x[i]*380000.0;
	}
	
	printf("%lf",ans);
	
	return 0;
}

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

ans = [0]*n
for _ in range(m):
    s, c = input().split()
    s = int(s)-1
    if ans[s] == 0 or ans[s] == c:
        ans[s] = c
    else:
        print(-1)
        exit()
if n > 1 and ans[0] == '0':
    print(-1)
    exit()
if n > 1 and ans[0] == 0:
    ans[0] = '1'
print(*ans, sep='')

Measured memory_bytes: 3188
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		double n = in.nextInt();
		double m = in.nextInt();
		double d = in.nextInt();
		System.out.printf("%.10f",(n - d) * (d == 0 ? 1 : 2) * (m - 1) / (n * n));
	}
}


Measured memory_bytes: 23892
#include<iostream>
using namespace std;
static const int Max = 100;
static const int Infty = (1<<21);
static const int White = 0;
static const int Gray = 1;
static const int Black = 2;

int n,M[Max][Max];

int prim(){
    int u,minv;
    int a[Max],p[Max],color[Max];

    for(int i=0;i<n;i++){
        a[i]=Infty;
        p[i]=-1;
        color[i]=White;
    }
    a[0]=0;

    while(1){
        minv=Infty;
        u=-1;
        for(int i=0;i<n;i++){
            if(minv>a[i]&&color[i]!=Black){
                u=i;
                minv=a[i];
            }
        }
        if(u==-1)break;
        color[u]=Black;
        for(int v=0;v<n;v++){
            if(color[v]!=Black&&M[u][v]!=Infty){
                if(a[v]>M[u][v]){
                    a[v]=M[u][v];
                    p[v]=u;
                    color[v]=Gray;
                }
            }
        }
    }

    int sum =0;
    for(int i=0;i<n;i++){
        if(p[i]!=-1)sum += M[i][p[i]];

    }
    return sum;
}

int main(){
    cin>>n;

    for(int i=0 ;i<n; i++){
        for(int j=0;j<n;j++){
            int e;cin>>e;
            M[i][j]=(e==-1)? Infty : e;

        }
    }
    cout << prim()<<endl;

    return 0;
}


Measured memory_bytes: 3120