akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fast ios::sync_with_stdio(0),cin.tie(0)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define ls (rt<<1)
#define rs (rt<<1|1)
#define All(a) (a).begin(),(a).end()
#define clr(a) memset((a),0,sizeof(a))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,a,b) for(int i=(a);i>=(b);--i)
#define FOR_edge(i,u)  for(int i=hd[u];i;i=e[i].nxt)
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};

inline char in() {
	static char buf[10001],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,10000,stdin),p1==p2)?EOF:*p1++;
}
template <class Tp> inline void read(register Tp &s) {
	s=0;
	register bool neg=0;
	register char c;
	while(!isdigit(c=in())) if(c=='-') neg=1;
	while(s=(s<<3)+(s<<1)+c-48,isdigit(c=in()));
	s=(neg?-s:s);
}
template <class Tp> inline void write(register Tp x) {
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
template <class Tp> inline void print(const Tp &x,const char &end) {write(x); putchar(end);}
template <class Tp> inline Tp pow(register Tp x,register Tp p,const Tp &mod) {
	register Tp res=1;
	for(;p;p>>=1,x=(x*x)%mod) if(p&1) res=(res*x)%mod;
	return res;
}
inline int comp(const double &x,const double &y) {
	const double d=x-y,eps=1e-8;
	return (d<=eps&&d>=-eps)?0:(d>eps?1:-1);
}
template <class Tp> inline Tp sqr(const Tp &x) {return x*x;}
template <class Tp> inline Tp gcd(const Tp &x,const Tp &y) {return(y==0?x:gcd(y,x%y));}
template <class Tp> inline Tp inv(const Tp &x,const Tp &MOD) {return POW(x,MOD-2,MOD);}
template <class Tp> inline Tp lowbit(const Tp &x) {return x&-x;}

#define N 12
int n,pro,p[N],c[N],s,f[1005],g[1005],h[1005];
int main() {
	read(n); read(s);
	FOR(i,1,n) read(p[i]),read(c[i]),pro+=p[i];
	FOR(i,1,n) {
		REP(j,pro,p[i]) f[j]=max(f[j],f[j-p[i]]+100*i*p[i]+c[i]);
		REP(j,p[i]-1,1) REP(k,p[i]-1,1) f[k]=max(f[k],f[k-1]+100*i);
	}
	FOR(i,0,pro) if(f[i]>=s) return printf("%d",i),0;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String p = "", q = "";
        for (int i = 0; i < n; i++) {
            p += sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            q += sc.nextInt();
        }
        List<String> list = new ArrayList<String>();
        list = permutation(p, "", list);
        Collections.sort(list);
        System.out.println(Math.abs((list.indexOf(p) + 1) - (list.indexOf(q) + 1)));
    }

    public static List<String> permutation(String q, String ans, List<String> list){
        if(q.length() <= 1) {
            list.add(ans + q);
        } else {
            for (int i = 0; i < q.length(); i++) {
                permutation(q.substring(0, i) + q.substring(i + 1),
                        ans + q.charAt(i), list);
            }
        }
        return list;
    }
}

Measured memory_bytes: 46140
// Author: πα

#include <bits/stdc++.h>
using namespace std;
#define long int64_t

int main()
{
    int n, i;
    cin >> n;
    vector<int> v(n);
    for(i = 0; i < n; ++i)
        cin >> v[i];
    sort(v.begin(), v.end());
    cout << v[n/2] - v[n/2 - 1];
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define mod 1000000007 
#define eps 1e-9
#define PI 3.14159265358979323846
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define Fr(i,a,b) for(int i=a;i<=b;i++)
#define RF(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pii>
#define int long long
using namespace std;
vi bb;
int dp[3005][3005][2];
int rec(int l,int r,int flag){
	if(l>r){return 0;}
	if(dp[l][r][flag]!=-1)return dp[l][r][flag];
	return dp[l][r][flag]=bb[r+1]-bb[l]-min(rec(l+1,r,!flag),rec(l,r-1,!flag));
}
signed main(){
    
    int t=1;
    //cin>>t;
    int coco=1;
    while(t--){
        int n;
        cin>>n;
        bb.pb(0);
        int prev=0;int x;
        for(int i=0;i<n;i++){
        	cin>>x;
        	prev+=x;
        	bb.pb(prev);
        }
        memset(dp,-1,sizeof(dp));
        int ans=rec(0,n-1,1);
        cout<<ans-(bb[n]-ans);
    }   
    return 0;
}

Measured memory_bytes: 141568
<?php
/*
	AOJ 0240
	title:Interest Rates
	@kankichi573
*/
	function expt($x,$n)
	{
		if($n==0)
			return(1.0);
		return($x*expt($x,$n-1));
	}

	while(fscanf(STDIN,"%d",$n) && $n)
	{
		$max=0;		
		$maxbank=0;		

		fscanf(STDIN,"%d",$y);
		for($i=0;$i<$n;$i++)
		{
			fscanf(STDIN,"%d %d %d",$b,$r,$t);	
			if($t==1)
				$amount = 1 + ($r/100)*$y;
			else	
				$amount = expt(1+$r/100,$y);
				
				//echo $b.":".$amount."\n";
			if($amount>$max)
			{
				$max=$amount;		
				$maxbank=$b;
			}
		}
		fprintf(STDOUT,"%d\n",$maxbank);
	}
	return(0);
?>

Measured memory_bytes: 6608
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>

using namespace std;

namespace MyLib {
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}

using namespace MyLib;



int main() {
	int n;	
	string buf;
	while (cin >> n, n) {
		int lef = 0, rig = 0, pre = 0;
		int co = 0;
		REP(i, n) {
			cin >> buf;
			if (buf == "lu")
				lef = 1;
			else if (buf == "ld")
				lef = 0;
			else if (buf == "ru")
				rig = 1;
			else
				rig = 0;
			if (pre == 0 && lef == 1 && rig == 1)
				pre = 1, co++;
			if (pre == 1 && lef == 0 && rig == 0)
				pre = 0, co++;


		}
		cout << co << endl;


	}
	
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
template <typename T, typename U>ostream &operator<<(ostream &out, const pair<T, U> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>void print(const ContainerType<ValueType, Args...> &c){for (const auto &v : c)cout << v << ' ';cout << '\n';} void print(){cout<<'\n';}
template <typename T, typename... Args>void print(T a, Args... args){cout << a << " ";print(args...);}
lli llipower(lli x, lli y, lli p = LLONG_MAX){lli res = 1;x = x % p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}

//8====================================D

int main(){
   int n;
   cin>>n;
    vector<int> a(n);
    fori(n) cin>>a[i];
    sort(a.begin(),a.end());
    lli ans=0;
    int curr=n -1;
    int ind=1;
    for(int i=n-2;i>=0;i--){
        ans+=a[curr];
        if(ind==1){
            curr--;
            ind=0;
        }
        else{
            ind++;
        }

    }
    cout<<ans<<endl;
}

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



int main(){
    ll n,m;cin>>n>>m;
    ll a[100010],sum=0,cn=0;
    rep(i,0,n){
        cin>>a[i];
        sum+=a[i];
    }
    rep(i,0,n){
        if(a[i]>=(double)sum/(4*m))cn++;
    }
    if(cn>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
    









Measured memory_bytes: 256
K=input()

def sunuke(m):
	a=sum( map(int,list(str(m))) )
	return float(m)/a

def f(n):
	res=n
	snk=sunuke(n)

	for keta in range(1,15):
		val=n%10
		n/=10
		for i in range(val,10):
			t=n*(10**keta)+i*(10**(keta-1))+(10**(keta-1))-1
			if sunuke(t)<snk:
				snk=sunuke(t)
				res=t
	return res


N=1
for i in range(K):
	N=f(N)
	print N
	N+=1



Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A[N];
    int maxv = 0,cnt = 0;
    REP(i,N){
        cin >> A[i];
        if(i != 0){
            if(A[i-1] >= A[i]){
                cnt++;
            }
            else cnt = 0;
        }
        maxv = max(maxv,cnt);
    }
  cout << maxv << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

const Int MAX_DIGIT = 50;
//Int dp[100][2];

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

auto dp = make_vec(100, 2, -1LL);

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, K;
	cin >> N >> K;

	vector<Int> A(N);
	for (Int i = 0; i < N; i++) {
		cin >> A[i];
	}
	
	dp[MAX_DIGIT][0] = 0; 

	for (Int digit = MAX_DIGIT - 1; digit >= 0; digit--) {
		Int mask = 1LL << digit; // 下からdigit桁目を立てたマスク

		// Aでもともと下からdigit桁目にビットが立っているものの個数
		Int num = 0;
		for (Int i = 0; i < N; i++) {
			if (A[i] & mask) {
				num++;
			}
		}

		// マスク値の下からdigit桁目を0, 1にしたときのスコア
		Int score0 = mask * num;
		Int score1 = mask * (N - num);

		//未満→未満
		if (dp[digit + 1][1] != -1) {
			dp[digit][1] = max(dp[digit][1], max(dp[digit + 1][1] + score0, dp[digit + 1][1] + score1));
		}

		// ちょうど→未満
		//digit桁目が1の場合のみ起こる遷移
		if (dp[digit + 1][0] != 1) {
			if (K & mask) { // Kの下からdigit桁目が立っていたら引っ込める
				dp[digit][1] = max(dp[digit][1], dp[digit + 1][0] + score0);
			}
		}

		// ちょうど→ちょうど
		if (dp[digit + 1][0] != -1) {
			if (K & mask) { // Kの下からdigit桁目が1
				dp[digit][0] = max(dp[digit][0], dp[digit + 1][0] + score1);
			}
			else { // Kの下からdigit桁目が0
				dp[digit][0] = max(dp[digit][0], dp[digit + 1][0] + score0);
			}
		}
	}

	cout << max(dp[0][1], dp[0][0]) << endl;

}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, y;
	cin >> x >> y;
	int ans = 0;
	while(x <= y){
		x *= 2;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int X = sc.nextInt();

        int[] dist = new int[N];

        for (int i = 0; i < N; i++) {
            dist[i] = Math.abs(sc.nextInt() - X);
        }

        int gcd = dist[0];
        for (int i = 1; i < N; i++) {
            if (gcd > dist[i]) {
                gcd = gcd(gcd, dist[i]);
            } else {
                gcd = gcd(dist[i], gcd);
            }
        }

        System.out.println(gcd);
    }

    static int gcd(int a, int b) {
        int r = -1;
        while (r != 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}

Measured memory_bytes: 49220
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back

using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef long long LL;

static const int INF = INT_MAX;
static const LL L_INF = LLONG_MAX;
static const int MOD = (1000000000 + 7);

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

    int i = 1;
    while( i++ ) {
        int x;
        cin >> x;
        if( !x ) break;
        cout << "Case " << i - 1 << ": " << x << endl;
    }

    return 0;
}


Measured memory_bytes: 3012
#include <bits/stdc++.h> // {{{
// clang-format off
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define USE1(T) template <typename T> inline
#define USE2(T, U) template <typename T, typename U> inline
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

template <typename T> using duo = std::pair<T, T>;
template <typename T> using vec = std::vector<T>;
using ll = long long;
using pii = duo<int>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE1(T=int)vec<T>in(int n){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE1(T)vec<std::pair<T,int>>zipi(const vec<T>&x,int s=0){int N=x.size();vec<std::pair<T,int>>v;v.reserve(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(10);
    std::cerr.precision(10);
  }
} iosetup; //}}}
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() {
  int N = in(), L = in();
  auto S = in<string>(N);
  sort(ALL(S));
  for (auto s : S) {
    cout << s;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
// Problem : B - Comparison
// Contest : AtCoder - AtCoder Beginner Contest 059
// URL : https://atcoder.jp/contests/abc059/tasks/abc059_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

double pi=acos(-1.0);
const int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
string s,t;cin>>s>>t;
if(size(s)>size(t))
{
	cout<<"GREATER";
}
else if(size(t)>size(s))
{
	cout<<"LESS";
}
else
{
	for(int i=0;i<size(s);i++)
	{
		if(s[i]>t[i])
		{
			cout<<"GREATER";
			return;
		}
		else if(t[i]>s[i])
		{
			cout<<"LESS";
			return;
		}
	}
	cout<<"EQUAL";
}
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, D: int, E: int):
    m = [A, B, C, D, E]
    print(sum(-(-mi // 10) * 10 for mi in m) - max(-mi % 10 for mi in m))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    solve(A, B, C, D, E)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

int main() {

    int N,c=0,A,B,a,b;
    cin >> N;
    for (int i = 1; i <= N; i++) 
    { 
      A=i;
      if(A<10){a=A;b=A;}
      else if(A<100){a=A/10;b=A%10;}
      else if(A<1000){a=A/100;b=A%10;}
      else if(A<10000){a=A/1000;b=A%10;}
      else if(A<100000){a=A/10000;b=A%10;}
      else if(A<1000000){a=A/100000;b=A%10;}
      if(b!=0){
      //if(a==b){B=b;while(B<=N){c++;cout<<A<<","<<B<<endl;B=(B*10+b);}} //1-9  
      if(a==b)B=b;
      if(B<=N)c++;       
      B=10*b+a; 
      if(B<=N)c++;
      B=100*b+a;//100-999
      while(B<=N&&B<100*(b+1)){c++;B+=10;}
      B=1000*b+a;
      while(B<=N&&B<1000*(b+1)){c++;B+=10;}
      B=10000*b+a;
      while(B<=N&&B<10000*(b+1)){c++;B+=10;}
      B=100000*b+a;
      while(B<=N&&B<100000*(b+1)){c++;B+=10;}
      }
    }
cout<<c<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigDecimal;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        double L = sc.nextDouble();
        
        double a = L/3;
        double b = a*a*a;
        
        System.out.println(BigDecimal.valueOf(a*a*a).toPlainString());
        
    }
}


Measured memory_bytes: 37576
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,i,x;
	cin>>a>>b>>c;
	i=max(a,max(b,c));
	x=i;
	int k;
	cin>>k;
	i=i*pow(2,k);
	cout<<a+b+c+i-x<<endl;
	return 0;
} 

Measured memory_bytes: 256
H,W=map(int,input().split())
s=[list(input())for i in range(H)]
c=[['.']*W for i in range(H)]
for i in range(H):
    countX=0
    nowX=s[i][0]
    for j in range(W):
        if nowX==s[i][j]:
            countX+=1
            if 1<countX and nowX=='#':
                c[i][j-1],c[i][j]='#','#'
        else:
            countX=1
        nowX=s[i][j]
for i in range(W):
    countY=0
    nowY=s[0][i]
    for j in range(H):
        if nowY==s[j][i]:
            countY+=1
            if 1<countY and nowY =='#':
                c[j-1][i],c[j][i]='#','#'
        else:
            countY=1
        nowY=s[j][i]
print('Yes' if c==s else 'No')

Measured memory_bytes: 9284
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a < c) {
		if (d < b) {
			cout << d - c << endl;
		}
		else {
			cout << max(b - c, 0) << endl;
		}
	}
	else {
		if (b < d) {
			cout << b - a << endl;
		}
		else {
			cout << max(d - a, 0) << endl;
		}
	}
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v = {a, b, c};
    sort(v.begin(), v.end());
    if (v.at(2) == v.at(0)+v.at(1)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
s=input()
if s == 'SUN':
  print(7)
if s == 'MON':
  print(6)
if s == 'TUE':
  print(5)
if s == 'WED':
  print(4)
if s == 'THU':
  print(3)
if s == 'FRI':
  print(2)
if s == 'SAT':
  print(1)


Measured memory_bytes: 3060
/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,a1,a2,i;
    cin>>a>>b;
	for (i=1;i<=1000;++i)
    {
		a1 = i*0.08;
		a2 = i*0.1;
		if (a1 == a && a2 == b)
        {
			cout<<i;
			return 0;
		}
	}
	cout<<-1;
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	N := ReadInt()
	a := ReadInts(5)
	min := Min(a...)
	fmt.Println((N+min-1)/min + 4)
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
mod = 998244353
N,K = map(int,input().split())
move = [list(map(int,input().split())) for _ in range(K)]

dp = [0]*(N+1)
dp_sum = [0]*(N+1)
dp[1] = dp_sum[1] = 1
for i in range(2,N+1):
    for l,r in move:
        if 0<i-l:
            dp[i] += dp_sum[i-l]
            if 0<i-r-1:
                dp[i] -= dp_sum[i-r-1]
        dp[i] %= mod
    dp_sum[i] = dp_sum[i-1] + dp[i]
            
print(dp[-1]%mod)


Measured memory_bytes: 71452
def f(num):
    s = 0
    for char in str(num):
        s += int(char)

    return num / s

K = int(input())
num = 1
power = 1
for _ in range(K):
    print(num)
    if f(num + 10 ** (power - 1)) > f(num + 10 ** power):
        power += 1
    num += 10 ** (power - 1)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n,a,b;
  cin>>n;   
  a=n/100;
  b=n-a*100;
  if(a>0&&a<13&&b>0&&b<13)cout<<"AMBIGUOUS"<<endl;
  else if(b>0&&b<13)cout<<"YYMM"<<endl;
  else if(a>0&&a<13)cout<<"MMYY"<<endl;
  else cout<<"NA"<<endl;
  
  
}

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

int power(int a,int n)
{
        int ans=1;
    while(n>0){

        int last_bit=(n&1);
        if(last_bit==1)
            ans=ans*a;

        a=a*a;
        n=n>>1;

    }

    return ans;

}




int main()
{
    int a;
    cin>>a;
    int k=power(a,3);
    int z= k/a;
    int sum=k+z+a;

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        Pattern space = Pattern.compile(" ");
        int[] first = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int n = first[0];
        int m = first[1];

        List<Set<Integer>> parents = IntStream.range(0, n).mapToObj(unused -> new HashSet<Integer>()).collect(Collectors.toList());
        List<Set<Integer>> children = IntStream.range(0, n).mapToObj(unused -> new HashSet<Integer>()).collect(Collectors.toList());

        for (int i = 0; i < n - 1 + m; i++) {
            int[] line = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
            int a = line[0] - 1;
            int b = line[1] - 1;
            parents.get(b).add(a);
            children.get(a).add(b);
        }

        Deque<Integer> queue = new ArrayDeque<>();
        int[] answers = new int[n];
        Integer root = IntStream.range(0, n).filter(i -> parents.get(i).isEmpty()).boxed().findAny().get();
        queue.addLast(root);
        while (!queue.isEmpty()) {
            Integer parent = queue.pollFirst();
            for (Integer child : children.get(parent)) {
                parents.get(child).remove(parent);
                if (parents.get(child).isEmpty()) {
                    answers[child.intValue()] = parent.intValue() + 1;
                    queue.add(child);
                }
            }
        }

        Arrays.stream(answers).forEach(stdout::println);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}


Measured memory_bytes: 109920
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int INF=1e9;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    int n,k,c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> L; // L[i]: 從頭開始第i次工作是哪一天
    vector<int> R; // R[i]: 從尾開始第i次工作是哪一天
    // L.push_back(-1e9); // 先放入第0次工作的天
    // R.push_back(-1e9);

    for(int i=0; i<n; i++) {
    	if ( s[i]=='x' ) continue;
    	if ( (int)L.size()>=k ) break;
    	L.push_back(i);
    	i+=c; // i+=c+1
    }
    reverse(ALL(s));
    for(int i=0; i<n; i++) {
    	if ( s[i]=='x' ) continue;
    	if ( (int)R.size()>=k ) break;
    	R.push_back(n-i-1);
    	i+=c; // i+=c+1
    }
    reverse(ALL(R));
    if ( R.size()<k || L.size()<k ) return 0;
    for(int i=0; i<k; i++) {
    	if ( L[i]==R[i] ) cout << L[i]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3468
#include <iostream>
#include <algorithm>
#include <vector>

struct _restaurant {
    std::string s;
    int score;
    int idx;
};

using restaurant = struct _restaurant;

bool compare(restaurant &a, restaurant &b) {
    if (a.s != b.s) {
        return a.s < b.s;
    } else {
        return a.score > b.score;
    }
}

int main() {
    int n;
    std::vector< restaurant > vec;
    std::cin >> n;
    for (int i=0; i<n; ++i) {
        restaurant res;
        std::cin >> res.s >> res.score;
        res.idx = i+1;
        vec.push_back(res);
    }
    std::sort(vec.begin(), vec.end(), compare);
    for (auto v : vec) std::cout << v.idx << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const ll LINF = 1e18;

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

// パスカルの三角形
mint c[4005][4005];

// パスカルの三角形を前計算する
void init() {
  c[0][0] = 1;
  REP(i,4001) REP(j,i+1) {
    c[i+1][j] += c[i][j];
    c[i+1][j+1] += c[i][j];
  }
}

mint comb(int n, int k) {
  return c[n][k];
}

mint f2(int n, int k) {
  return comb(n+k-1,k-1);
}

// n個の中から、k個選ぶ
mint f(int n, int k) {
  if (n < k) return 0;
  if (n == 0 && k == 0) return 1;
  if (k < 1) return 0;
  return f2(n-k,k);
}

int main() {
  IOS;
  init();
  int n, k; cin >> n >> k;

  for (int i = 1; i <= k; i++) {
    mint blue = f(k,i);
    mint red = f2(n-k-(i-1), i+1);
    /* 場合わけする場合
    mint red = 0;
    {
      red += f(n-k,i-1); // 両端を含まない
      red += f(n-k,i); // 片方の端を含む
      red += f(n-k,i); // 片方の端を含む
      red += f(n-k,i+1); // 両端を含む
    }
    */
    mint ans = blue * red;
    COUT(ans);
  }
  return 0;
}

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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

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

    int ans = 0;

    for (int i = a; i <= b; ++i) {
        string s = to_string(i);
        string rev = s;

        reverse(rev.begin(), rev.end());

        if (s == rev) {
            ++ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL INF=1e18;


int main(){
    int N,M,pp;
    cin >> N >> M >> pp;
    vector<P> vec[3000];
    for(int i=0;i<M;i++){
        int a,b; LL c;
        cin >> a >> b >> c;
        vec[a].push_back(make_pair(b,pp-c));
    }
    LL dist[N+1];
    fill(dist,dist+N+1,INF);
    dist[1]=0;
    for(int loop=0;loop<N;loop++){
        for(int i=1;i<=N;i++){
            for(int j=0;j<vec[i].size();j++){
                P p=vec[i][j];
                if(dist[p.first]>dist[i]+p.second){
                    dist[p.first]=dist[i]+p.second;
                }
            }
        }
    }
    bool ch[N+1];
    memset(ch,false,sizeof(ch));
    for(int loop=0;loop<2*N;loop++){
        for(int i=1;i<=N;i++){
            for(int j=0;j<vec[i].size();j++){
                P p=vec[i][j];
                if(dist[p.first]>dist[i]+p.second){
                    dist[p.first]=dist[i]+p.second;
                    ch[p.first]=true;
                }
            }
        }
    }
    if(ch[N]) puts("-1");
    else cout << max(0LL,-dist[N]) << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String b = sc.next();
		
		if (b.equals("A")) {
		System.out.println("T");
		}else if (b.equals("T")) {
			System.out.println("A");
		}else if (b.equals("C")) {
			System.out.println("G");
		}else  {
			System.out.println("C");
			
		}
		
	}
}

Measured memory_bytes: 22612
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, K = map(int, input().split())
Hs = list(map(int, input().split()))
ans = 0
for h in Hs:
    ans += h >= K
print(ans)



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

int dp[100010];

int  main() {
	int n;
	cin >> n;
	for (int i = 0;i < n;i++)dp[i + 1] = 1000000;
	dp[0] = 0;
	for (int i = 0;i < n;i++) {
		dp[i + 1] = min(dp[i + 1], dp[i] + 1);
		for (int j = 6;i + j <= n;j *= 6) {
			dp[i + j] = min(dp[i + j], dp[i] + 1);
		}
		for (int j = 9;i + j <= n;j *= 9) {
			dp[i + j] = min(dp[i + j], dp[i] + 1);
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 640
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<i32>();
    let mut f=0;
    for i in 0..n/4+1{
        if (n-i*4)%7<1{f+=1}
    }
    println!("{}",if f>0{"Yes"}else{"No"})
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n, ans;
vector<Int> a;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	a.resize(n);
	for(auto &i:a) cin >> i;
	for(Int i=1; i<=n-1; ++i){
		Int tmp = 0;
		if((n-1) % i == 0){
			for(Int j=0; i*j<n-1-i*j; ++j){
				tmp += a[i*j] + a[n-1-i*j];
				ans = max(ans, tmp);
			}
		}else{
			for(Int j=0; i*j+i<n-1; ++j){
				tmp += a[i*j] + a[n-1-i*j];
				ans = max(ans, tmp);
			}
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 1024
from collections import deque
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p_1 = deque(sorted(p))
q_1 = deque(sorted(q))
r_1 = sorted(r)
while len(p_1) > x:
  p_1.popleft()
while len(q_1) > y:
  q_1.popleft()
pqr = deque(sorted(list(p_1) + list(q_1) + r_1))
i = 0
ans = 0
while i < x+y:
  ans += pqr.pop()
  i += 1
print(ans)

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

int main(){
    int n,m,c,ans(0),x;
    cin >> n >> m >> c;

    int a[n][m],b[m];
    rep(i,m)    cin >> b[i];
    rep(i,n){
        rep(j,m){
            cin >> a[i][j];
        }
    }

    rep(i,n){
        x = 0;
        rep(j,m){
            
            x += b[j]*a[i][j];
        }
        x += c;
        if(x>0){
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
A = deque(map(int, input().split()))

blk = 1
cnt = 0

for i in range(N):
    a = A.popleft()

    if a == blk:
        blk += 1
    else:
        cnt += 1

if blk == 1:
    cnt = '-1'

print(cnt)


Measured memory_bytes: 25244
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
bool contain(int mask, int position) {//positionbit目が立っているか判定
	if ((mask&(1 << position)) != 0)return true;
	else return false;
}
int main() {
	string s;
	cin >> s;
	int n = s.size() - 1;
	ll sum = 0;
	for (int mask = 0; mask < (1 << n); mask++) {
		int l = 0;//左端
		int r;//右端
		ll tmp = 0;
		for (r = 0; r < n; r++) {
			if (contain(mask, r)) {
				string t = s.substr(l, r - l + 1);
				ll num = stoll(t);
				tmp += num;
				l = r + 1;
			}
		}
		string t = s.substr(l, r - l + 1);
		ll num = stoll(t);
		tmp += num;
		sum += tmp;
	}
	printf("%lld\n", sum);
}








Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    double x1,y1,x2,y2,dist;
    cin >> x1 >> y1 >> x2 >> y2;
    dist = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
    printf("%lf\n",dist);
    return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int MAXN = 200005;
const int MAXM = 1000005;
const int INF = 0x3f3f3f3f;

template <typename T> inline void read(T &AKNOI) {
    T x = 0, flag = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') flag = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    AKNOI = flag * x;
}

int n, a[MAXN], b[MAXN], aid[MAXN], bid[MAXN], ID;
int S, T, level[MAXN], q[MAXN], head, tail, ans;

struct Edge {
	int v, w, nxt;
} e[MAXM << 1];
int first[MAXN], used[MAXN], eCnt;

inline void AddEdge(int u, int v, int w) {
	e[++eCnt].v = v;
	e[eCnt].w = w;
	e[eCnt].nxt = first[u];
	first[u] = eCnt;
}

inline void Add(int u, int v, int w) {
	AddEdge(u, v, w);
	AddEdge(v, u, 0);
}

bool BFS() {
	for (int i = 1; i <= T; ++i) {
		level[i] = -1;
		used[i] = first[i];
	}
	level[S] = 0;
	q[head = tail = 1] = S;
	while (head <= tail) {
		int u = q[head++];
		if (u == T) return 1;
		for (int i = first[u]; i; i = e[i].nxt) {
			int v = e[i].v;
			if (e[i].w && level[v] == -1) {
				level[v] = level[u] + 1;
				q[++tail] = v;
			}
		}
	}
	return 0;
}

int DFS(int u, int flow) {
	if (u == T) return flow;
	int ret = 0;
	for (int i = used[u]; i; i = e[i].nxt, used[u] = i) {
		int v = e[i].v;
		if (e[i].w && level[v] == level[u] + 1) {
			int tmp = DFS(v, min(flow, e[i].w));
			e[i].w -= tmp;
			e[i ^ 1].w += tmp;
			flow -= tmp;
			ret += tmp;
			if (!flow) break;
		}
	}
	return ret;
}

void init() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i]); ++a[i];
	}
	for (int i = 1; i <= n; ++i) {
		read(b[i]); ++b[i];
		ans += (a[i] != b[i]);
	}
	for (int i = 1; i <= n; ++i) {
		if (aid[i]) continue;
		++ID; int x = i;
		while (!aid[x]) {
			aid[x] = ID;
			x = a[x];
		}
	}
	for (int i = 1; i <= n; ++i) {
		if (bid[i]) continue;
		++ID; int x = i;
		while (!bid[x]) {
			bid[x] = ID;
			x = b[x];
		}
	}
}

void solve() {
	S = ID + 1; T = S + 1;
	eCnt = 1;
	for (int i = 1; i <= n; ++i) {
//printf("%d %d\n", aid[i], bid[i]);
		if (a[i] == b[i]) {
			if (a[i] == i) continue;
			++ans;
			Add(aid[i], bid[i], 1);
			Add(bid[i], aid[i], 1);
		} else {
			if (a[i] == i) {
				Add(S, bid[i], 1);
			} else if (b[i] == i) {
				Add(aid[i], T, 1);
			} else {
				Add(aid[i], bid[i], 1);
			}
		}
	}
	while (BFS()) {
		ans -= DFS(S, INF);
	}
	printf("%d\n", ans);
}

int main() {
	init();
	solve();
	return 0;
}


Measured memory_bytes: 13952
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int h = sc.nextInt();
    int ans = (a + b) * h / 2;
    System.out.println(ans);
  }
}

Measured memory_bytes: 21076
n = int(input())
s = input()

r_num, g_num, b_num = 0, 0, 0
for i in s :
    if i == "R":
        r_num+=1
    elif i== "G":
        g_num +=1
    else:
        b_num+=1

ans = r_num * g_num *b_num

for i in range(len(s)):
    for j in range(i,len(s)):
        k = 2*j -i 
        if k <= j :
            continue
        else:
            if len(s) > k and k > 0  and s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                ans  -=1

print(ans)



Measured memory_bytes: 80324
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] blue = new String[n];
        for (int i = 0;i < n;++i){
            blue[i] = sc.next();
        }
        int m = sc.nextInt();
        String[] red = new String[m];
        for (int i = 0;i < m;++i){
            red[i] = sc.next();
        }
        int max = 0;
        for (int i = 0;i < n;++i){
            if(blue[i] == null){
                continue;
            }
            int k = 1;
            for (int j = 0;j < n;++j){
                if(i == j)continue;
                if(blue[j]!=null&&blue[i].equals(blue[j])){
                    ++k;
                    blue[j] = null;
                }
            }
            for (int j = 0;j < m;++j){
                if(red[j]!=null&&blue[i].equals(red[j])){
                    --k;
                    red[j] = null;
                }
            }
            if(k > max)max = k;
            blue[i] = null;
        }
        System.out.println(max);

    }



}

Measured memory_bytes: 25556
#include <cstdio>

using namespace std;

bool valid(int a, int b, int c) {
  int a2 = a*a, b2 = b*b, c2 = c*c;
  return (a2+b2==c2) || (b2+c2==a2) || (c2+a2==b2);
}

int main() {
  int N;
  scanf("%d", &N);
  for (int i=0;i<N;i++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (valid(a, b, c)) puts("YES");
    else puts("NO");
  }
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> d(3);
  for(int i = 0; i < 3; i++) {
    d.at(2 - i) = n % 10;
    n /= 10;
  }
  int i, s;
  for(i = 0; i < 8; i++) {
    s = n;
    for(int j = 1; j < 8; j *= 2) {
      if(i & j)
        s += d.at(j / 2);
      else
        s -= d.at(j / 2);
    }
    if(s == 7)
      break;
  }
  cout << n;
  for(int j = 1; j < 8; j *= 2) {
    if(i & j)
      cout << '+';
    else
      cout << '-';
    cout << d.at(j / 2);
  }
  cout << "=7" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());//昇順ソート
#define usort(a) sort(a.rbegin(),a.rend());//降順ソート

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  string S;cin>>S;
  rep(i,0,S.length()){
    cout<<S[i];
    if(i==3) cout<<" ";
  }
  cout<<endl;
  
  
}




// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  char c[1000]="",k;
  scanf("%d\n",&k);
  scanf("%s\n",c);
  int i,s=0;
  for(i=0;c[i]!='\0';i++)
  {
      s++;
  }
  
      if(k<s){
          for(i=0;i<k;i++)
          {
              printf("%c",c[i]);
          }
          printf("...");
      }
      else
      {
          
          for(i=0;i<s;i++)
          {
              printf("%c",c[i]);
          }
      }
    
  }
 
 

Measured memory_bytes: 1712
def s():
 def b(M,x,y,n=1):
  M[x][y]=0;a=n
  for p,q in[(-1,0),(0,-1),(1,0),(0,1)]:
   if M[x+p][y+q]:
    t=b(M,x+p,y+q,n+1)
    if a<t:a=t
  M[x][y]=1
  return a
 for e in iter(input,'0'):
  n,m=int(e),int(input())
  P=[[0]*(n+2)for _ in[0]*(m+2)]
  for i in range(m):P[i+1][1:-1]=map(int,input().split())
  print(max(b(P,i,j)for i in range(1,m+1)for j in range(1,n+1)if P[i][j]))
if'__main__'==__name__:s()


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

int n;
constexpr long long INF = 1e18+9;
class Edge{
	public:
		long long cost;
		int from, to;
		Edge(long long c, int f, int t){
			cost = c;
			from = f;
			to = t;
		}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void readGraph(Graph &g, int E, bool D, bool C){ // E:NumofEdges, D:Directed, C:Costed
	for(int i=0; i<E; ++i){
		Edge e(0, 0, 0);
		if(!C) cin >> e.from >> e.to;
		else cin >> e.from >> e.to >> e.cost;
		--e.from;
		--e.to;
		g[e.from].push_back(e);
		if(!D){
			swap(e.from, e.to);
			g[e.from].push_back(e);
		}
	}
}
bool operator < (const Edge &e, const Edge &f){
	return e.cost != f.cost ? e.cost > f.cost : e.from != f.from ? e.from < f.from : e.to < f.to;
}
void dijkstra(int s, const Graph &g, vector<long long> &dist){
	int V = g.size();
	dist = vector<long long>(V, INF);
	dist[s] = 0;
	priority_queue<Edge> q;
	q.push(Edge(0, s, s));
	while(!q.empty()){
		Edge e = q.top();
		q.pop();
		if(dist[e.to] < e.cost) continue;
		for(int i=0; i<(int)g[e.to].size(); ++i){
			Edge f = g[e.to][i];
			if(dist[f.to] > dist[e.to] + f.cost){
				dist[f.to] = dist[e.to] + f.cost;
				q.push(Edge(dist[f.to], s, f.to));
			}
		}
	}
}

int main(){
	cin >> n;
	Graph g(n);
	readGraph(g, n-1, false, true);
	int q, k;
	cin >> q >> k;
	--k;
	vector<long long> d;
	dijkstra(k, g, d);
	for(int i=0; i<q; ++i){
		int x, y;
		cin >> x >> y;
		cout << d[x-1] + d[y-1] << "\n";
	}
//	for(int i=0; i<n; ++i)
//		cout << i << " " << d[i] << "\n";
}

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

#define MOD 1000000007

int main()
{
    ll N, K; cin >> N >> K;

    vector<ll> fact(2*N);
    vector<ll> finv(fact.size());
    vector<ll> inv(fact.size());
    
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[0] = 0; inv[1] = 1;
    for (int i = 2; i < fact.size(); i++) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

    auto C = [&](ll n, ll r) {
        return fact[n] * finv[n-r] % MOD * finv[r] % MOD;
    };
    auto H = [&](ll n, ll r) {
        return C(n+r-1, r);
    };

    ll ans = 0;

    for (int i = 0; i <= min(N-1, K); i++) {
        ans = (ans + C(N, i) * H(N-i, i) % MOD) % MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 9600
N = int(input())
W = []
for i in range(N):
    W.append(str(input()))
ans = "No"
startwith = []
endwith = []
if len(set(W)) == len(W):
   for i in W:
       startwith.append(i[0])
       endwith.append(i[-1])
   startwith.pop(0)
   endwith.pop(-1)
   if startwith == endwith:
    ans = "Yes"

print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::cout << (N - 1) / 2 << std::endl;
  return 0;
}

Measured memory_bytes: 256