akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;

namespace mp = boost::multiprecision;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 105;
int N, W;
int w[MAX_N], v[MAX_N];

int dp[MAX_N][100005];

signed main()
{
  cin >> N >> W;
  REP(n,N) {
    cin >> w[n] >> v[n];
  }

  REP(n,N) {
    REP(ww,W+1) {
      dp[n+1][ww] = max(dp[n+1][ww], dp[n][ww]);
      if(ww+w[n] <= W) {
        dp[n+1][ww+w[n]] = max(dp[n+1][ww+w[n]], dp[n][ww]+v[n]);
      }
    }
  }

  int ans = 0;
  REP(ww,W+1) {
    ans = max(ans, dp[N][ww]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 79360
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i,j,N,M,K;
  double x=0,sum=0,ans;
  cin>>N;
  vector<ll> v(N);
  rep(i,N){
    cin>>x;
    sum+=1.0/x;
  }
  ans=1.0/sum;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let s: String = read();
    let len = s.len();

    for i in 0..len
    {
        print!("x");
    }
    println!("");
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<stdlib.h>


using namespace std;

int main()
{int  A,B,C,D,A1,A2;
cin>>A;cout<<" ";

cin>>B;cout<<" ";

cin>>C;cout<<" ";
cin>>D;
A1=A*B;
A2=C*D;
if(A1>A2)
{cout<<A1;}
else if(A2>A1)
cout<<A2;
else
{cout<<A1;}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll dp[105][2][5];
int main(){
  string n; cin >> n;
  ll k; cin >> k;
  dp[0][0][0]=1;
  rep(i,n.size()){
    ll u = (ll)(n[i]-'0');
    rep(smaller,2){
      rep(j,4){
        for(ll p=0;p<=(smaller ? 9 : u);p++){
          ll q = dp[i][smaller][j];
          if(debug){
            cout << i << " " << smaller << " " << j << "=>" << q << endl;
          }
          dp[i+1][smaller||p<u][(p==0?j:j+1)]+=dp[i][smaller][j];
        } 
      }
    }
  }
  if(debug){
    cout << dp[n.size()][0][k] << endl;
    cout << dp[n.size()][1][k] << endl;
  }
  cout << dp[n.size()][0][k]+dp[n.size()][1][k] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    vector<int> town(4, 0);

    for (int i = 0; i < 3; i++) {
        int a, b;
        cin >> a >> b;
        town[a - 1]++;
        town[b - 1]++;
    }

    for (int i = 0; i < 4; i++) {
        if (town[i] > 2) {
            puts("NO");
            return 0;
        }
    }

    puts("YES");

    return 0;
}


Measured memory_bytes: 256
/*
 * atcoder/abc115/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
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; }

const ll INF = 100000000000000000;
ll N, K, H[100001] = {0};

void solve() {
  cin >> N >> K;
  loop(n,0,N) {
    cin >> H[n];
  }
  sort(H, H+N);
  ll min_ = INF;
  for (int n=0; n+K<=N; n++) {
    // cout << "n+k=" << H[n+K-1] << " n=" << H[n] << " diff=" << H[n+K-1]-H[n] << endl;
    chmin(min_, H[n+K-1] - H[n]);
  }
  cout << min_ << endl;
}

int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


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

int main(void){
    int N;
    string str = "No";
    cin >> N;
    while(N >= 0){
        if(N % 4 == 0){
            str = "Yes";
        }
        N -= 7;
    }
    
    cout << str << endl;
    
    return 0;
}


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

#define V vector<int>
#define VV(v, n, m) vector<V> v(n, V(m));
#define _4(i, n) for(int i = 0; i < n; i++)
#define g_arr(arr, n) _4(i, n) cin >> arr[i];
#define p_vec(vec) _4(i, (int)vec.size()) cout << vec[i] << ' '; cout << endl;

typedef long long ll;

using namespace std;

int main(int argc, char * argv[]) {
    ios::sync_with_stdio(0);
    cin.tie(NULL);

    int n, k;
    cin >> n >> k;

    V h(n);

    g_arr(h, n);

    V dp(n);

    dp[0] = 0;
    V cost(k + 1);
    int c;

    for(int i = 1; i < n; i++) {
        c = 0;
        for(int j = 1; j <= k; j++) {
            if(j > i)
                break;
            cost[j] = abs(h[i] - h[i - j]);
            c++;
        }

        int _m = dp[i - 1] + cost[1];
        for(int j = 2; j <= c; j++)
            _m = min(_m, dp[i - j] + cost[j]);

        dp[i] = _m;
    }

    cout << dp[n - 1];

    return 0;
}



Measured memory_bytes: 1024
n = gets.to_i
t,a=gets.split.map(&:to_i)
h = gets.split.map(&:to_i)

ary=[]
min=999
ans = 0
# puts h.size
h.each do |i|
  ary << t-0.006*i
end
n.times do |j|
  if (ary[j]-a).abs < min
    min = (ary[j]-a).abs
    ans = j+1
  end
end
puts ans

Measured memory_bytes: 1788
#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 N=3005;
int a,b,c,d,e,f;
double mx=-1;
int water, sugar;
bool dp[N][N];
void solve(int ai, int bi, int ci, int di) {
    if ( 100*(a*ai+b*bi) + ci*c + di*d > f ) return;
    if ( (ai*a+bi*b)*e < ci*c+di*d ) return;
    if ( dp[ai*a+bi*b][ci*c+di*d] ) return;
    dp[ai*a+bi*b][ci*c+di*d]=true;
    if ( mx*(100*(ai*a+bi*b)+ci*c+di*d) < (ci*c+di*d) ) {
        water = 100*(ai*a+bi*b);
        sugar = ci*c+di*d;
        mx = (double)sugar/(water+sugar);
        // cout << ai << ' ' << bi << ' ' << ci << ' ' << di << '\n';
    }
    solve(ai, bi+1, ci, di);
    solve(ai, bi, ci, di+1);
    solve(ai+1, bi, ci, di);
    solve(ai, bi, ci+1, di);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> a >> b >> c >> d >> e >> f;
    solve(0,0,0,0);
    cout << (water+sugar) << ' ' << sugar << endl;
    return 0;
}


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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static String minS = "";
	public static void main(String[] args) throws Exception {

		int N=nextInt();
		int L=nextInt();
		String[] S = new String[N];
		for(int i=0;i<N;i++){
			S[i]=nextString();
			minS+=S[i];
		}
		Arrays.sort(S);
		boolean[] flg = new boolean[N];
		Arrays.fill(flg, true);
		int cnt=0;
		String ans = "";
		while(cnt <N){
			int min = -1;
			String tmp=null;
			int len=-1;
			for(int i=0;i<N;i++){
				if(flg[i]){
					min=i;
					tmp=S[i];
					len=tmp.length();
					break;
				}
			}

			for(int i=0;i<N;i++){
				if(flg[i]&&tmp.compareTo(S[i].substring(0,len)) > 0){
					tmp=S[i].substring(0,len);
					min=i;
				}
			}

			ans+=S[min];
			cnt++;
			flg[min]=false;
		}

		System.out.println(ans);
	}
	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 27732
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int Maxn=100010;
const int inf=2147483647;
LL read()
{
	LL x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10ll+ch-'0',ch=getchar();
	return x*f;
}
bool u[Maxn];
LL n,x,m,a[Maxn];
int main()
{
	n=read(),x=read(),m=read();
	u[x]=true;
	a[1]=x;LL ans=x,t=x;
	for(LL i=2;i<=n;i++)
	{
		t=t*t%m;
		if(u[t])
		{
//			printf("%lld %lld %lld\n",i,t,ans);
			LL s=0;LL len;int p;
			for(int j=1;j<i;j++)
			if(a[j]==t)
			{
				len=i-j;p=j;
				for(int k=j;k<i;k++)s+=a[k];
				break;
			}
//			printf("%lld\n",s);
			ans+=(n-i+1)/len*s;
			for(LL j=1;j<=(n-i+1)%len;j++)
			ans+=a[p+j-1];
			break;
		}
		else
		{
			u[t]=true;ans+=t;
			a[i]=t;
		}
		
	}
	printf("%lld",ans); 
}

Measured memory_bytes: 4244
def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v

n = int(input())
A = [int(input()) for i in range(n)]

cnt = 0
G = [1]
for i in range(99):
    if n < 1 + 3*G[-1]:
        break
    G.append(1 + 3*G[-1])
m = len(G)
G.reverse()
for i in range(m):
    insertionSort(A, n, G[i])

print(m)
print(*G)
print(cnt)
print(*A, sep='\n')


Measured memory_bytes: 53280
#include <cstdio>
#include <map>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define mp make_pair

int main() {
	while(1) {
		int n;
		scanf(" %d", &n);
		if(n == 0) break;
		map<char, char> data;
		rep(i,n) {
			char a, b;
			scanf(" %c %c", &a, &b);
			data.insert(mp(a, b));
		}
		scanf("%d", &n);
		rep(i,n) {
			char t;
			scanf(" %c", &t);
			if(data.find(t) == data.end()) {
				putchar(t);
			} else {
				putchar(data[t]);
			}
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 0
import math


def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b


def main():
    n = int(input())
    s = int(input())
    if s == n:
        print(n+1)
        return
    elif s > n:
        print(-1)
        return
    sqrt = int(math.sqrt(n))
    for b in range(2, sqrt+2):
        if f(b, n) == s:
            print(b)
            return
    for x in range(sqrt, 0, -1):
        if x > s:
            continue
        y = s - x
        b = (n - y) // x
        if b >= 2 and (n - y) % x == 0 and f(b, n) == s:
            print(b)
            return
    print(-1)


if __name__ == "__main__":
    main()


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{	rtn
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];


void solve()
{

	int sum = 0;
	cin >> n;

	lop(i, 1, n + 1)
	{
		if (i % 3 == 0  or i % 5 == 0) continue;
		sum += i;
	}
	cout << sum;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;

	// cout << setprecision(9) << fixed;
	// clock_t z = clock();
	while (test--)solve();
	// cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
}





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

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

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

  int t = 0;
  vector<int> ans(n);
  for(t = 0; t < n; t++) {
    int s1 = 0, s2 = 0;
    for(int i = 0; i <= t; i++) s1 += w[i];
    for(int i = t+1; i < n; i++) s2 += w[i];
    ans[t] = abs(s1 - s2);
  }

  int min = *std::min_element(ans.begin(), ans.end());

  cout << min;
}


Measured memory_bytes: 256
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=sorted(p)
q=sorted(q)
r=sorted(r)
print(sum(sorted(p[-x:]+q[-y:]+r[-x-y:])[-x-y:]))

Measured memory_bytes: 23328
#include <bitset>
#include <cstdio>
using namespace std;
inline char nc() {
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x) {
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
const int maxn = 2000 + 5;
const int maxS = 4000000 + 5;
int N, S; 
bitset<maxS> f; 
int main() {
//	freopen("testdata.in", "r", stdin);
	read(N);
	f[0] = 1;
	for(int i = 1; i <= N; ++i) {
		int x; read(x); S += x;
		f |= f << x;
	}
	S = (S + 1) / 2;
	while(true) {
		if(f[S]) {
			printf("%d\n", S);
			break;
		}
		++S;
	}
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
  ll n,m,c;
  ll b[100000],a,cun=0,sum[1000000]={};
  cin>>n>>m>>c;
  for(ll i=0;i<m;i++){
    cin>>b[i];
  }
  for(ll i=0;i<n;i++){
    for(ll j=0;j<m;j++){
	cin>>a;
    sum[i] += a*b[j];
    }
    sum[i] += c;
  }
  for(ll i=0;i<n;i++){
    if(sum[i]>0){
      cun++;
    }
  }
  cout<<cun<<"\n";
  return(0);
}

Measured memory_bytes: 8832
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <tuple>
#include <string>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<int> v(n);
  for (auto& vi: v) scanf("%d", &vi);

  intmax_t res = std::accumulate(v.begin(), v.end(), 0_jd);
  res -= n * (n+1_jd) / 2;
  printf("%jd\n", res);
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n; cin >> n;
  vi32 ans(n);
  rep(i, n) {
    int a; cin >> a;
    ans[a - 1] = i + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#include<chrono>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace chrono;
#define all(a) a.begin(), a.end()
#define sz(x) (int(x.size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef vector<string> vs;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int n = sz(s);
	vi res(n);
	for(int i = 1; i < n; i ++){
		if(s[i] == 'L'){
			for(int j = i; j < n && s[j] == 'L'; j ++){
				if((j - i) & 1){
					res[i - 1] ++;
				}
				else{
					res[i] ++;
				}
			}
			for(int j = i - 1; j >= 0 && s[j] == 'R'; j --){
				if((j - i) & 1){
					res[i - 1] ++;
				}
				else{
					res[i] ++;
				}
			}
			while(i < n - 1 && s[i + 1] == 'L'){
				i ++;
			}
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 1104
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef std::pair<int, int> int_pair;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {


	/*

		string s;
		cin >> s;
		ll ans = 0;

		for (int bit = 0; bit < (1 << ((int)s.size() - 1)); bit++) {//2^n
			// 1 2 3 4 5 6 ⇒　　1 10 101 …


			ll num = s[0] - '0';
			ll sum = 0;

			for (int i = 0; i < (int)s.size() - 1; i++) {
				if (bit & (1 << i)) {//1を左にシフトしていく　合致していたら合計にnumを足す


					sum += num;
					num = 0;
				}

				// 12345
				num = num * 10 + s[i + 1] - '0';

			}
			sum += num;
			ans += sum;

		}
		cout << ans << endl;

		*/

	string s,ans;
	int num = 0,sum = 0;
	cin >> s;

	for (int bit = 0; bit < (1 << (int)s.size() - 1); bit++) {
		sum = s[0] - '0';
		ans = s[0];

		for (int i = 0; i < (int)s.size()-1; i++) {
		
			if (bit & (1 << i)) {
				ans += '+';
				sum += s[i + 1] - '0';
				ans += s[i + 1];
			}
			else {
				ans += '-';
				sum -= s[i + 1] - '0';
				ans += s[i + 1];
			}
	
		}

		if (sum == 7) {
			cout << ans + "=7" << endl;
			return 0;
		}

		ans = "";
		sum = 0;
	}

}


Measured memory_bytes: 256
N, M = map(int, input().split())
a, b, c, d = [],[],[],[]

for i in range(N):
  ai, bi = map(int, input().split())
  a.append(ai)
  b.append(bi)
#  print(a, b)
for j in range(M):
  cj, dj = map(int, input().split())
  c.append(cj)
  d.append(dj)
  
#print(a,b,c,d)
  
for i in range(N):
  dist, min_dist = 0, 10**9
  ans = 1
  for j in range(M):
    dist = abs(c[j] - a[i]) + abs(d[j] - b[i])
    if dist < min_dist:
      ans = j+1
      min_dist = dist
#    print("ai:{}, bi:{}, cj:{}, dj:{}, dist:{}, ans:{}".format(a[i], b[i], c[j], d[j], dist, ans))
#    print("i:{}, j:{}, dist:{}, min_dist:{}, ans:{}".format(i, j, dist, min_dist, ans))
#    min_dist = min(dist, min_dist)
  print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;
const int mod1=998244353;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	vector<int> a(100010);
	rep(i,m){
		int l,r;cin >> l >> r;
		a.at(l)++;
		a.at(r+1)--;
	}
	rep(i,100001) a.at(i+1)+=a.at(i);
	int ans=0;
	rep(i,100001){
		if(a.at(i)==m) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
import math


def abs(num):
    if num < 0:
        return -num
    return num


def main():
    abhm = [int(_x) for _x in input().split()]
    HL = abhm[0]
    ML = abhm[1]
    H = abhm[2]
    M = abhm[3]

    radian = 2.0 * math.pi * abs(M / 60.0 - (H + M / 60.0) / 12.0)

    length = math.sqrt(HL * HL + ML * ML - 2 * HL * ML * math.cos(radian))
    print(length)


main()


Measured memory_bytes: 9408
import java.util.*;

public class Main {
    private static final double INF = Double.MAX_VALUE;

    class Circle {
        int x, y, r;
        Double minCost = INF;
        boolean visit;
        List<Road> child = new ArrayList<>();

        public Circle(int x, int y, int r) {
            this.x = x;
            this.y = y;
            this.r = r;
            visit = false;
        }
    }

    class Road {
        int src, dst;
        double cost;

        public Road(int src, int dst, double cost) {
            this.src = src;
            this.dst = dst;
            this.cost = cost;
        }
    }

    public void main(Scanner sc) {
        Circle s = new Circle(sc.nextInt(), sc.nextInt(), 0);
        Circle t = new Circle(sc.nextInt(), sc.nextInt(), 0);
        int n = sc.nextInt();
        Circle c[] = new Circle[n + 2];
        c[0] = s;
        for (int i = 1; i <= n; i++) {
            c[i] = new Circle(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        c[n + 1] = t;
        sc.close();

        for (int i = 0; i < n + 2; i++) {
            for (int j = i + 1; j < n + 2; j++) {
                double len = getLength(c[i], c[j]);
                c[i].child.add(new Road(i, j, len));
                c[j].child.add(new Road(j, i, len));
            }
        }

        c[0].minCost = 0.0;
        Queue<Circle> queue = new PriorityQueue<>((o1, o2) -> o1.minCost.compareTo(o2.minCost));
        queue.add(c[0]);
        while (!queue.isEmpty()) {
            Circle tmp = queue.poll();
            if (tmp.visit) {
                continue;
            }

            tmp.visit = true;
            for (Road r : tmp.child) {
                if (c[r.dst].visit) {
                    continue;
                }

                c[r.dst].minCost = Math.min(c[r.dst].minCost, tmp.minCost + r.cost);
                queue.add(c[r.dst]);
            }
        }

        System.out.println(String.format("%.10f", c[n + 1].minCost));
    }

    private double getLength(Circle c1, Circle c2) {
        return Math.max(Math.hypot(c1.x - c2.x, c1.y - c2.y) - c1.r - c2.r, 0);
    }

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


Measured memory_bytes: 109252
n, Y = map(int, input().split())
fin = True
for x in range(n + 1):
    if fin:
        for y in range(n - x + 1):
            z = n - x - y
            if 10000 * x + 5000 * y + 1000 * z == Y:
                print(x, y, z)
                fin = False
                break
    else:
        break

if fin:
    print('-1 -1 -1')

Measured memory_bytes: 3060
a = int(input())
b = int(input())
if a==1:
    if b==2:
        print(3)
    else:
        print(2)
if a==2:
    if b==1:
        print(3)
    else:
        print(1)
if a==3:
    if b==1:
        print(2)
    else:
        print(1)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{

    static int count = 0;

    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int w = 0,h = 0;
	int[] firstSearch = new int[2];

	while(sc.hasNext()){
	    w = sc.nextInt();
	    h = sc.nextInt();

	    if(w == 0 && h == 0) break;

	    int[][] islands = new int[h][w];

	    // テ・ツウツカテ、ツスツ愿ヲツ按?
	    for(int i = 0;i<h;i++){
	    	for(int j = 0;j<w;j++){
	    		islands[i][j] = sc.nextInt();
	    	}
	    }
	    
	    while(search(islands,firstSearch)){ // テ」ツ?ッテ」ツ?佚」ツつ?」ツ?ォティツ。ツ古」ツ?湘・ツウツカテ」ツつ津ヲツアツコテ・ツョツ?
	    	checkIslands(firstSearch[0],firstSearch[1],islands,true);
	    }

	    System.out.println(count);
	    count = 0;
	    }

    }

    static void checkIslands(int y,int x,int[][] islands,boolean first){
    	// 8テヲツ鳴ケテ・ツ青妥」ツつ津ィツヲツ凝」ツつ凝」ツ?づ」ツ?ソテ」ツ?淌」ツ?ィテ」ツ?禿」ツつ津ヲツオツキテ」ツ?ォテ」ツ?療」ツ?ヲテ」ツ??」ツ?湘」ツ??
    	// テ」ツ?ッテ」ツ?佚」ツつ?」ツ?ョテ、ツスツ催ァツスツョテ」ツ?凝」ツつ嘉」ツ?ソテ」ツ?ヲテ・ツ?ィテゥツδィテヲツオツキテ」ツ?ォテ」ツ?ェテ」ツ?」テ」ツ?ヲテ」ツ?淌」ツつ嘉」ツ?療」ツ?セテ」ツ??」ツ?」テ」ツ?禿」ツ?」テ」ツ?ヲテ」ツつォテ」ツつヲテ」ツδウテ」ツδ暗」ツ?凖」ツつ?
    	
    	if(y>islands.length-1 || y<0 || x<0) return;
    	if(x>islands[y].length-1 || islands[y][x]==0) return;
    	
    	islands[y][x] = 0;
    	
    	// テ、ツクツ?テ・ツ渉ウテ、ツクツ?テ・ツ渉ウ テ・ツ渉ウテ、ツクツ?テ、ツクツ?テ・ツキツヲテ、ツクツ?テ・ツキツヲ テ・ツキツヲテ、ツクツ甘」ツ?ョテゥツ??ァツ閉ェ
    	checkIslands(y-1,x,islands,false);
    	checkIslands(y-1,x+1,islands,false);
    	checkIslands(y,x+1,islands,false);
    	checkIslands(y+1,x+1,islands,false);
    	checkIslands(y+1,x,islands,false);
    	checkIslands(y+1,x-1,islands,false);
    	checkIslands(y,x-1,islands,false);
    	checkIslands(y-1,x-1,islands,false);
    	
    	if(first) count++;
    }

    static boolean search(int[][] islands,int[] firstSearch){
	for(int i = islands.length-1;i>=0;i--){
	    for(int j = islands[i].length-1;j>=0;j--){
		if(islands[i][j] == 1){
		    firstSearch[0] = i; // y
		    firstSearch[1] = j; // x
		    return true;
		}
	    }
	}
	return false;
    }

}

Measured memory_bytes: 54944
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int x, n;
  cin >> x >> n;
  int litter = 0, pumi = 1, ind = x, p;
  if (n == 0) {
    cout << x << endl;
    return 0;
  }
  vector<int> num(100);
  for (int i = 0; i < 100; i++)
  {
    num[i] = 0;
  }
  for (int i = 0; i < n; i++)
  {
    cin >> p;
    num[p-1] = 1;
  }
  while(1) {
    ind += pumi*litter;
    // cout << ind << ' ' << litter << ' ' << num[ind-1] << endl;
    if (num[ind-1]==0) {
      cout << ind << endl;
      return 0;
    }
    litter++;
    pumi *= -1;
  }
  
}
// 6 
// 5 -1
// 7 +2
// 4 -3
// 8 +4

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

int main() {
  int H, W;
  cin >> H >> W;

  vector<string> vec(H); //stringは配列として使える！！
  for (int i = 0; i < H; i++){
    cin >> vec.at(i);
  }
  
  vector<bool> row(H,false);
  vector<bool> col(W,false);
  
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (vec[i][j] == '#'){//一つでも＃が含まれていたらそのrow・colはtrueにする
        row[i] = true;
        col[j] = true;
      }
    }
  }
  
  for (int i = 0; i < H; i++){
    if (row[i]){
      for (int j = 0; j < W; j++){
        if (col[j])
          cout << vec[i][j];
      }
    cout << endl;
    }
  }
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int dp[100][100];
int a[100], b[100];

int main() {
	int n;
	cin >> n;
	REP(i, n) scanf("%d %d", &a[i], &b[i]);
	
	fill(dp[0], dp[100], INF);
	REP(i, n) dp[i][i] = 0;
	FOR(w, 1, n) REP(i, n - w) FOR(j, i, n) {
		dp[i][i + w] = min(dp[i][i + w], dp[i][j] + dp[j + 1][i + w] + a[i] * b[j] * a[j + 1] * b[i + w]);
	}
	cout << dp[0][n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
int main(void){
	
	int b,f,r,v;
	int count[5][4][11];
	int i,j,k,n;
	
	scanf("%d",&n);
	for(i=1;i<=4;i++){
		for(j=1;j<=3;j++){
			for(k=1;k<=10;k++){
				count[i][j][k]=0;
			}
		}
	}
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		count[b][f][r]+=v;
	}
	for(i=1;i<=4;i++){
		for(j=1;j<=3;j++){
			for(k=1;k<=10;k++){
				if(count[i][j][k]<0)count[i][j][k]=0;
				if(count[i][j][k]>9)count[i][j][k]=9;
				printf(" %d",count[i][j][k]);
			}
			printf("\n");
		}
		if(i!=4)printf("####################\n");
	}
	
	return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int minu[3]={2,1,0};
int an[3][3]={
  {0,0,0},{0,1,1},{0,1,2}
};
int o[3][3]={
  {0,1,2},{1,1,2},{2,2,2}
};
int p,q,r;

int solve(string s){
  if(s=="0"||s=="1"||s=="2") return stoi(s);
  if(s=="P") return p;
  if(s=="Q") return q;
  if(s=="R") return r;
  if(s[0]=='-'){
    return minu[solve(s.substr(1))];
  }else{
    int count=0;
    for(int i=0;i<s.length();i++){
      if(s[i]=='('){
        count++;
      }else if(s[i]==')'){
        count--;
      }
      if(count==1&&s[i]=='*'){
        return an[solve(s.substr(1,i-1))][solve(s.substr(i+1,s.length()-i-2))];
      }
      if(count==1&&s[i]=='+'){
        return o[solve(s.substr(1,i-1))][solve(s.substr(i+1,s.length()-i-2))];
      }
    }
  }
}

int main(){
  while(1){
    string s;
    cin >> s;
    if(s==".") return 0;
    int ans=0;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        for(int k=0;k<3;k++){
          p=i,q=j,r=k;
          if(solve(s)==2) ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
 
int N;
int x[10], y[10];
 
double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> v(N);
    for(int i = 0; i < N; i++) v[i] = i + 1;
    do {
        for(int i = 0; i < N - 1; i++) sum += dist(v[i], v[i+1]);
    } while(next_permutation(v.begin(), v.end()));
    int Factorial = 1;
    for(int i = 2; i <= N; i++) Factorial *= i;
    cout << fixed << setprecision(10) << sum / Factorial << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}

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

int solve(int n) {
    int d, next_n;

    int count = 0;

    while(n >= 10) {
        ++count;
        d = 1000000;
        next_n = 0;

        while(d > 0) {
            next_n = max(next_n, (n / d) * (n % d));
            d /= 10;
        }

        n = next_n;
    }

    return count;
}

int main() {
    int Q, N;
    cin >> Q;
    for(int i = 0; i < Q; ++i) {
        cin >> N;
        cout << solve(N) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1)(r(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,t){function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}e.exports=function(e){var t=r(e[0].split(" ").map(function(e){return Number(e)}),3),n=t[0],o=t[1],u=t[2];console.log(Math.min(n*o,u))}},function(e,t){e.exports=require("fs")}]);

Measured memory_bytes: 7372
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void) {

	string s;

	cin >> s;

	bool c = false, f = false;

	for (int k = 0; k < s.size(); k++) {
		if (s.at(k) == 'C')c = true;
		if (c == true && s.at(k) == 'F')f = true;
	}

	if (f == true)cout << "Yes\n";
	else cout << "No\n";


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll h, w; cin >> h >> w;
    vvi d(10, vi(10, 0));
    rep(i, 10) rep(j, 10) cin >> d[i][j];

    // warshall-floyd
    for(ll i=0; i<10; i++){
        for(ll j=0; j<10; j++){
            for(ll k=0; k<10; k++){
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }    
    // h*wで1と-1を除く数字を1にする魔力の総和を求める
    ll total = 0;
    rep(i, h){
        rep(j, w){
            ll tmp; cin >> tmp;
            if(tmp != 1 && tmp != (-1)) total += d[tmp][1];
        }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

int main() {
	int a, b, c, n;
	string s;
	cin >> a >> b >> c;
	cout <<a*b /2<<endl;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int count = 0;
  
  if(a == 1 && b == 1 && c == 1)cout << 0 << endl;
  else if(a == b && b == c && b == a)cout << -1 << endl;
  
  else {
    bool hantei = true;
    while(hantei == true){
      if((a + 2) % 2 != 0)hantei = false;
      if((b + 2) % 2 != 0)hantei = false;
      if((c + 2) % 2 != 0)hantei = false;
      
      if(hantei == false)continue;
      
      int ak = a;
      int bk = b;
      int ck = c;
      
      a = (bk + ck) / 2;
      b = (ck + ak) / 2;
      c = (ak + bk) / 2;
      
      count ++;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  string s1; cin >> s1;
  string ans(s1.size(),'x');
  cout << ans;
  

  return 0;
}

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

using namespace std;

int main(){
  int i,j,k,n;
  string s;
  cin >> n;
  long long a[n],ans=0;
  for(i=0;i<n;i++){
    cin >> a[i];
    ans+=a[i]-1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
W,H,N=map(int,input().split())
w=[0]*2
h=[0]*2
w[1]=W
h[1]=H
for _ in range(N):
    x,y,a,=map(int,input().split())
    if a==1:
        if w[0]<=x:
            w[0]=x
    if a==2:
        if w[1]>=x:
            w[1]=x
    if a==3:
        if h[0]<=y:
            h[0]=y
    if a==4:
        if h[1]>=y:
            h[1]=y
W=max((w[1]-w[0]),0)
H=max((h[1]-h[0]),0)
print(H*W)

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n,num;
  double k;
  cin >> n >> k;
  double ans=0.0,nd;
  REP(i,1,n+1){
    ll tmp = i;
    nd = 1.0/n;
    while(tmp < k){
      tmp *= 2;
      nd /= 2;
    }
    ans += nd;
  }
  printf("%.12lf\n",ans);
  return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function permutation(a,n)
	ans = Array{Int,1}[copy(a)]
	c = ones(Int,n)
	i = 1
	while i<=n
		if c[i]<i
			if i%2==1
				tmp = a[1]
				a[1] = a[i]
				a[i] = tmp
			else
				tmp = a[c[i]]
				a[c[i]] = a[i]
				a[i] = tmp
			end
			c[i] += 1
			i = 1
			push!(ans,copy(a))
		else
			c[i] = 1
			i += 1
		end
	end
	ans
end

function main()
    n = readline() |> parseInt
    a = zeros(Int,2,n)
    for i in 1:n
        a[:,i] = readline() |> split |> parseMap
    end
    g = zeros(Float64,n,n)
    for i in 1:n
        for j in 1:n
            g[i,j] = sqrt((a[1,i]-a[1,j])^2+(a[2,i]-a[2,j])^2)
        end
    end
    arr = Int[i for i in 1:n]
    rev = factorial(n)
    prm = permutation(arr,n)
    s = 0.0
    for i in 1:length(prm)
        for j in 2:n
            s += g[prm[i][j-1],prm[i][j]]/rev
        end
    end
    println(s)
end
main()

Measured memory_bytes: 178096
Q = int(input())
N = int(10e5)

queries = []

def get_all_prime_numbers(N):
    values = list(range(1, N + 1))
    flags = [1] * N
    flags[0] = 0  # delete 1
    for i in range(N):
        if flags[i] == 0:
            continue

        prime = values[i]
        for mult in range(2, N // prime + 1):
            cand = mult * prime
            if flags[cand - 1] == 1:
                flags[cand - 1] = 0

    prime_numbers = []
    for i in range(N):
        if flags[i] == 1:
            prime_numbers.append(values[i])
    return prime_numbers

prime_numbers_list = set(get_all_prime_numbers(N))

accum_sum = [0]  # should contain accumulated sum for [], [1], [1, 3], [1, 3, 5], ...
for i in range(N // 2):
    num = 2 * i + 1
    if num in prime_numbers_list and (num + 1) // 2 in prime_numbers_list:
        accum_sum.append(accum_sum[-1] + 1)
    else:
        accum_sum.append(accum_sum[-1])

for i in range(Q):
    l, r = list(map(int, input().split()))
    l_ind, r_ind = (l + 1) // 2, (r + 1) // 2
    print(accum_sum[r_ind] - accum_sum[l_ind - 1])

Measured memory_bytes: 51888
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
    double x, h;
    while( scanf("%lf", &x), scanf("%lf", &h), x||h ){
        printf("%lf\n",x*x + x*sqrt(x*x+4*h*h));
    }
    return 0;
}

Measured memory_bytes: 1072
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);

		//入力表示
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int ans = 0;
		ans = b * 2 - a ;

	
		if (a <= b*2) {
			System.out.println(0);
		} else {
			System.out.println( Math.abs(ans));
		}
    }
}

Measured memory_bytes: 21844
fun main(args: Array<String>) {
    val dishes_time_ms = IntArray(5){ readLine()!!.toInt() }
    
    var ans_time = 0
    var min_diff_time = 0
    
    for(dishe_time in dishes_time_ms){
        ans_time += dishe_time
        val time: Int = when(dishe_time){
            in 0..99 -> dishe_time % 10
            in 100..123 -> (dishe_time % 100) % 10
            else -> 0
        }
        if(time != 0){
            val diff_time = 10 - time
            ans_time += diff_time
            
            if(min_diff_time < diff_time){
                min_diff_time = diff_time
            }
        }
    }
    
    println(ans_time - min_diff_time)
}


Measured memory_bytes: 31744
#pragma GCC optimize("O3")
/*{{{*/
#include <bits/stdc++.h>
#ifdef LOCAL
int c_ = 0;
#define cout (c_?cerr:cout)
#define debug(...) \
{if(!c_++)cerr<<"\033[96;1m"; \
__VA_ARGS__; \
if(!--c_)cerr<<"\033[0m";}
#else
#define debug(...) {}
#endif
#define assrt(...) debug(\
if (not (__VA_ARGS__)) \
    exit((cerr << __LINE__ << ": " << #__VA_ARGS__ << '\n', 0));\
)
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using namespace std; using ll = long long;
template < typename t > using V = vector< t >;
template < typename t, size_t s > using A = array< t, s >;
void print() {cout << '\n';}
template< typename t, typename... v >
void print(const t& a, const v&... b)
{cout << a << (sizeof...(b)?" ":""); print(b...);}
template< typename t > void print_range(t a, const t& b)
{ while (a != b) cout << (*a++) << ' '; cout << '\n';}
#define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__))
#define dump_range(...) debug(cerr<<#__VA_ARGS__ << ": "; print_range(__VA_ARGS__))
/*}}}*/

constexpr int nax = 2e5;

int n, a, b, c, d;
string s;

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

    cin >> n >> a >> b >> c >> d >> s;

    bool fl = false;
    while (b < d)
    {
        if (b > 1 and b < n and s[b - 1 - 1] == '.' and s[b + 1 - 1] == '.')
        {
            fl = true;
            dump(b);
        }
        if (s[b + 1 - 1] != '#')
            ++b;
        else if (s[b + 2 - 1] != '#')
            b += 2;
        else
            return print("No"), 0;
        if (b > 1 and b < n and s[b - 1 - 1] == '.' and s[b + 1 - 1] == '.')
        {
            fl = true;
            dump(b);
        }
    }

    while (a < c)
    {
        if (s[a + 1 - 1] != '#')
            ++a;
        else if (s[a + 2 - 1] != '#')
            a += 2;
        else
            return print("No"), 0;
    }

    if (c > d and not fl)   
        return print("No"), 0;
    
    print("Yes");
}

Measured memory_bytes: 592
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
typedef long long ll;
string s;
int n;
ll x;
ll term(int &it){
	ll now=s[it]-'0';
	it++;
	while(s[it]=='*'){
		it++;
		now*=(s[it]-'0');
		it++;
	}
	return now;
}
bool ism(int &it){
	ll now=term(it);
	while(s[it]=='+'){
		it++;
		ll l=term(it);
		now+=l;
	}
	return now==x;
}
bool isl(int it){
	ll now=s[it]-'0';
	it++;
	while(s[it]=='*'||s[it]=='+'){
		if(s[it]=='+'){
			it++;
			now+=(s[it]-'0');
			it++;
		}
		if(s[it]=='*'){
			it++;
			now*=(s[it]-'0');
			it++;
		}
	}
	return now==x;
}
int main(){
	cin>>s>>x;
	s+='$';
	n=s.size();
	int it=0;
	bool m=ism(it);
	it=0;
	bool l=isl(it);
	if(m&l) cout<<"U\n";
	if(m&!l) cout<<"M\n";
	if(!m&&l) cout<<"L\n";
	if(!m&&!l) cout<<"I\n";
}

Measured memory_bytes: 1180
// Aizu 0360: Reservation System
// 2017.9.19 bal4u@uu
#include <stdio.h>

int main()
{
	int a, b, n, s, f, k;
	scanf("%d%d%d", &a, &b, &n); 
	k = 0; while (n-- > 0) {
		scanf("%d%d", &s, &f);
		if (a < f && b > s) k = 1;
	}
	putchar(k+'0'), putchar('\n');
	return 0;
}

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

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)
string s;
ll h;
const ll INF=1e9+7;
ll si(string c){
	ll a=0;
	rep0(i,c.size()){
		a=a*10+c[i]-'0';
	}
	return a;
}
void cut(int p,int q,ll sum){
	if(p==s.size()){
		h+=sum;
		return;
	}
	if(q!=s.size()){
		cut(p,q+1,sum);
	}
	sum+=si(s.substr(p,q-p));
	cut(q,q+1,sum);
	return;
}
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>s;
	cut(0,1,0);
	cout<<h;
	return 0;
}


Measured memory_bytes: 256