akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define N 100

main(){
  int i, j, n, c=0, key=0, A[N], mini=0;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }

  if(n != 1){
    for(i = 0; i < n; i++){
      mini = i;
      for(j = i; j < n; j++){
	if(A[j] < A[mini]) mini = j;
      }
      if(mini != i){
      key = A[i];
      A[i] = A[mini];
      A[mini] = key;
      c++;
      }
    }
  }
  for(i = 0; i < n; i++){
    if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 604
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        String s = sc.next();
        int count_r = 0;
        int count_g = 0;
        int count_b = 0;
        for(int i = 0; i < n; i++){
        	if(s.charAt(i) == 'R'){
            	count_r++;
            }else if(s.charAt(i) == 'G'){
            	count_g++;
            }else{
            	count_b++;
            }
        }
        long ans = (long)count_r * count_g * count_b;
        for(int i = 0; i < n - 2; i++){
        	for(int j = i + 1; j <= n - 2; j++){
                int x = j * 2 - i;
                if(x < n && s.charAt(i) != s.charAt(j) && s.charAt(j) != s.charAt(x) && s.charAt(x) != s.charAt(i)){
                	ans--;
                }
            }
        }
        System.out.println(ans);
	}
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair
using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  vector<vector<int>> c(3, vector<int>(3));
  REP(i, 3){
    REP(j, 3) cin >> c[i][j];
  }
  REP(i, 101){
    REP(j, 101){
      REP(k, 101){
        bool flag = true;
        vector<int> a;
        a.push_back(i);
        a.push_back(j);
        a.push_back(k);
        vector<int> b;
        int b1 = c[0][0] - i;
        int b2 = c[0][1] - i;
        int b3 = c[0][2] - i;
        b.push_back(b1);
        b.push_back(b2);
        b.push_back(b3);
        REP(l, 3){
          REP(m, 3){
            if (a[l] + b[m] != c[l][m]) {
              flag = false;}
          }
        }
        if (flag){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 3664
s = input()
t = input()

len_s = len(s)
len_t = len(t)
INF = float('inf')

dp = [[0] * (len_t+1) for _ in range(len_s+1)]

dp[0][0] = 0

for i in range(len_s+1):
    for j in range(len_t+1):
        if i+1 <= len_s and j <= len_t:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if i <= len_s and j+1 <= len_t:
            dp[i][j+1] = max(dp[i][j+1], dp[i][j])
        if i+1 <= len_s and j+1 <= len_t and s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)

i = len_s
j = len_t
ans = ""
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans += s[i - 1]
        i -= 1
        j -= 1

print(ans[::-1])


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

typedef long long ll;

// chmax, chmin
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() {
    ll A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    
    ll ans = 0;
    
    if ( A + B <= 2 * C ){
        ans = A * X + B * Y;
    } else {
        ans = ans + 2 * C * min(X,Y);
        //cout << ans << endl;
        if ( X > Y ){
            if ( A < 2 * C ) ans = ans + A * llabs(X-Y);
            else ans = ans + 2 * C * llabs(X-Y);
        } else {
            if ( B < 2 * C ) ans = ans + B * llabs(X-Y);
            else ans = ans + 2 * C * llabs(X-Y);
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3524
import Control.Applicative
import Control.Monad

fight :: String -> (Int, Int) -> (Int, Int)
fight str (a, b) =
  let (t:h:_) = words str
  in
      if t < h
        then (a, b+3)
      else if t > h
        then (a+3, b)
      else
        (a+1, b+1)

solver :: [String] -> (Int, Int) -> String
solver [] (a, b) = show a ++ " " ++ show b
solver (x:xs) (a, b) = solver xs (fight x (a, b))

main :: IO()
main = do
  n <- (read :: String -> Int) <$> getLine
  cards <- replicateM n getLine
  putStrLn $ solver cards (0, 0)

Measured memory_bytes: 4308
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<set>
#include <limits>
#include <numeric>
#include <type_traits>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
#define MAX_B 1001001
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL
ll N,W;
ll w[110],v[110];
ll dp[110][MAX];//dp[i][j]:=i番目までの品物で(最大の)価値を達成する重さの最小値
int main(){
    cin>>N>>W;
    rep(i,N)cin>>w[i]>>v[i];
    rep(i,110)rep(j,MAX)dp[i][j]=INFTY;
    dp[0][0]=0;
    rep(i,N)rep(j,MAX){
        if(j>=v[i])
        dp[i+1][j]=min(dp[i][j-v[i]]+w[i],dp[i][j]);
        else dp[i+1][j]=dp[i][j];
    }
    ll res=0;
    rep(i,N+1)rep(j,MAX){
        if(dp[i][j]<=W && res<j && dp[i][j]!=INFTY)res=j;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 86400
using System;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            for(string cards; (cards = Console.ReadLine()).ToString() != "-"; Console.WriteLine(cards)) {
                for(int i = int.Parse(Console.ReadLine()), l = cards.Length; i > 0 ; --i){
                    cards = (cards + cards).Substring(int.Parse(Console.ReadLine()), l);
                }
            }
        }
    }
}

Measured memory_bytes: 5400
N = int(input())
s = input()
s += s[0]

T = ['' for _ in range(N+2)]
for T[0],T[1] in [['S','S'],['S','W'],['W','S'],['W','W']]:
  for i in range(2,N+2):
    if (T[i-1] == 'S' and s[i-1] == 'o') or (T[i-1] == 'W' and s[i-1] == 'x'):
      T[i] = T[i-2]
    else:
      if T[i-2] == 'S':
        T[i] = 'W'
      else:
        T[i] = 'S'
  #print(T)
  if T[:2] == T[-2:]:
    print(''.join(T[:N]))
    exit()
print(-1)

Measured memory_bytes: 45296
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

int i, p, n;
using pii = std::pair<int, int>;

int main() {
    std::cin >> n;
    std::priority_queue<pii, std::vector<pii>, std::greater<pii>> q;
    for (int i = 1; i <= n; i++) {
        std::cin >> p;
        q.push(std::make_pair(p, i));
    }
    int t = q.size();
    for (int i = 0; i < t; i++) {
        auto x = q.top();
        std::cout << x.second << " ";
        q.pop();
    }
    std::cout << std::endl;
}

Measured memory_bytes: 1780
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_N = 150;
int N, X;
int L[MAX_N];
int D[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N >> X;

    for (int i = 1; i <= N; i++) {
        std::cin >> L[i];
    }

    
    D[1] = 0;
    int ret = 1;
    for (int i = 2; i <= N + 1; i++) {
        D[i] = D[i-1] + L[i-1];
        if (D[i] <= X) {
            ret++;
        }
    }

    std::cout << ret << std::endl;

    return 0;
}

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

using namespace std;
int num = 0;
vector< string > S;
void combi(int A[], int p, int w, int n, int r);

int main(){
    int X;
    cin >> X;
    
    if (X==5 || X==7 || X==3) cout << "YES\n";
    else cout << "NO\n";
}

   

Measured memory_bytes: 256
/*
  "I knew I shouldn't have
   gotten out of bed today."
   - Squidward Tentacles
*/
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstring>
#include<climits>
#include<numeric>

#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<unordered_map>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#include<iomanip>
#include<fstream>
#include<chrono>
using namespace std;
using namespace __gnu_pbds;

#define int          long long
#define pii          pair<int,int>
#define vi           vector<int>
#define peque        priority_queue
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define brep(i,s,e)  for(int i=s;i>=e;i--)
#define all(x)       x.begin(),x.end()
#define ball(x)      x.rbegin(),x.rend()
#define mem(x,y)     memset(x,y,sizeof(x))
#define oset         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define VR46         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

vector<double> pl;
bool vis[9];

void REC(long double lev, long double dist, long double n, long double pidx, vector<pair<long double,long double> > &c)
{
    if( lev==n )
    {
        pl.pb( dist );
        return;
    }
    rep(i,0,n-1)
    {
        if( vis[i] ) continue;
        vis[i] = true;
        long double d = sqrt( (c[i].ff-c[pidx].ff)*(c[i].ff-c[pidx].ff) + (c[i].ss-c[pidx].ss)*(c[i].ss-c[pidx].ss) );
        REC( lev+1, dist + d, n, i, c );
        vis[i] = false;
    }
}

signed main()
{
    VR46 ofstream out("output.txt");
    // auto start = chrono::high_resolution_clock::now();

    // GANDU THODE TEST CASE BNAKE TEST KRLE
    int t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        int n;
        cin>>n;
        vector<pair<long double,long double> > c(n);
        for(auto &i:c) cin>>i.ff>>i.ss;

        mem( vis,false );
        rep(i,0,n-1)
        {
            vis[i] = true;
            REC( 1,0,n,i,c );
            vis[i] = false;
        }

        long double ans = 0;
        for(auto i:pl) ans += i;
        long double sz = pl.size();
        long double sol = (long double)ans/(long double)sz;
        printf("%.10LF\n", sol);

    }

    // auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout<<"Time taken by function: "<<duration.count()<<" milliseconds"<<endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

signed main(){
	int n;
	scanf("%lld", &n);
	if(n == 0 or n == 2)printf("1\n");
	else if(n == 1)printf("2\n");
	else printf("0\n");
	return 0;
}








Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double PI = 3.14159265358979323846;
typedef long long ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) for (ll i = 0; i < (n); ++i)

int main() {
  ll n, m, k[11] = {0}, p[11] = {0}, count = 0, light = 0, ans = 0;
  ll s[11][11] = {0};
  cin >> n >> m;
  REP(i, m) {
    cin >> k[i];
    REP(j, k[i]) cin >> s[i][j];
  }
  REP(i, m) cin >> p[i];
  for (ll bit = 0; bit < (1 << n); ++bit) {
    for (ll i = 0; i < m; ++i) {
      for (ll j = 0; j < k[i]; ++j) {
        if (bit & (1 << (s[i][j] - 1))) ++count;
      }
      if (count % 2 == p[i]) ++light;
      count = 0;
    }
    if (light == m) ++ans;
    light = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
K, N = map(int, input().split())
A = [int(i) for i in input().split()]

A.sort()
l_max = A[0] + (K - A[N-1])
for i in range(N-1):
    l = A[i+1] - A[i]
    if l > l_max:
        l_max = l

print(K - l_max)


Measured memory_bytes: 26420
#include <stdio.h>
#include<string.h>
int main()
{
    long int a,b,c,k;
    scanf("%ld %ld %ld %ld",&a,&b,&c,&k);
    if(k<a)
    printf("%ld",k);
    if(k>=a&k<=a+b)
    printf("%ld",a);
    if(k<=a+b+c&k>a+b)
    printf("%ld",a-(k-a-b));
}


Measured memory_bytes: 1732
#include<iostream>
#define I(i,n)for(int i=0;i<n;i++)
long long M=1e9+7,n,a[2],s[100000],w[2][100001],e[2],l[2][100000],p;
int main(){
	std::cin>>n>>*a>>a[1];
	I(i,n)std::cin>>s[i];
	I(k,2){
		p=0;w[k][0]=1;
		I(i,n){
			while(s[i]-s[p]>=a[k]&&p<i-1)p++;
			l[k][i]=p;
		}
	}
	I(i,n){if(i){
		I(k,2)w[k][i]=(e[!k]<=l[k][i])*w[!k][l[k][i]];
		I(k,2)if(s[i]-s[i-1]<a[k])e[k]=i;else(w[k][i]+=w[k][i-1])%=M;
	}
	}
	std::cout<<(w[0][--n]+w[1][n])%M;
	return 0;
}

Measured memory_bytes: 4224
import java.util.*;



public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a<1200) {
			System.out.println("ABC");
		}
		else if(a>=1200 && a<2800) {
			System.out.println("ARC");
		}
		else {
			System.out.println("AGC");
		}
	}
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
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 ll MOD = 1e9+7;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    REP(i,N){
        int p;
        cin >> p;
        P[i] = p;
    }

    int num = 0;
    int last = -1;
    vector<int> X(N);
    REP(i,N){
        int p = P[i];
        if(p > last){
            num++;
        }
        else{
            num = 1;
        }

        X[i] = num;
        last = p;
    }

    //int ans = N - K + 1;
    int ans = 0;
    bool first = true;
    set<int> se;
    REP(i,N){
        int p = P[i];
        se.insert(p);
        int low = *se.begin();
        auto iter = se.end();
        iter--;
        int high = *iter;
        //chmax(high, p);
        if(i > K-1){
            if(low == P[i-K] && high == P[i]){
                //ans--;
            }
            else if(X[i] >= K && !first){
                //ans--;
            }
            else ans++;
        }
        else if(i == K-1)
            ans++;

        //chmin(low, p);

        if(i >= K)
            se.erase(P[i-K]);

        if(X[i] >= K){
            first = false;
        }

        //cout << ans << endl;
    }

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


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

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

    int amax = -1e7, amin = 1e7;
    long long int asum = 0;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        amax = max(amax, tmp);
        amin = min(amin, tmp);
        asum += tmp;
    }
    cout << amin << " " << amax << " " << asum << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
#ifdef BOOST_RANGE_ALGORITHM_FOR_EACH_HPP_INCLUDED
  boost::for_each(vc, [&os](T value) {
#else
  std::for_each(vc.begin(), vc.end(), [&os](T value) {
#endif
    os << value << ' ';
    });
  return os;
    }

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  //string S{}; std::cin >> S;
  ui N{}; cin >> N;
  map<string, ull> res{};

  rep(0, N)
  {
    string str;
    cin >> str;
    vector<char> vc{};
    for (auto c : str) vc.push_back(c);
    boost::sort(vc);
    str = "";
    rep_uj(0, vc.size())
    {
      str += vc[j];
    }
    if (res.count(str))
    {
      ++res[str];
    }
    else
    {
      res[str] = 1;
    }
  }

  auto calc = [](ull n) {
    return n * (n - 1) / 2;
  };

  auto ans = boost::accumulate(res, 0ULL, [&calc](auto res, pair<string, ull> p) {
    return res + (p.second > 1 ? calc(p.second) : 0);
    });

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

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

  solve();

  return 0;
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n;
    cin >> n;
    cout << ((n + 1) / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=2000+10;
const int mod=924844033;

int n,k;
int a[N<<1],cnt=0;
int fac[N],dp[N<<1][N][2];

int main() {
    n=read(),k=read();
    for (re int i=1;i<=k;++i) {
        for (re int j=i;j<=n;j+=k) a[++cnt]=j==i;
        for (re int j=i;j<=n;j+=k) a[++cnt]=j==i;
    }
    dp[0][0][0]=1;
    for (re int i=0;i<cnt;++i)
        for (re int j=0;j<=n;++j) {
            dp[i+1][j][0]=(dp[i][j][0]+dp[i][j][1])%mod;
            if (!a[i+1]) dp[i+1][j+1][1]=dp[i][j][0];
        }
    fac[0]=1;
    for (re int i=1;i<=n;++i) fac[i]=1ll*fac[i-1]*i%mod;
    int ans=0;
    for (re int i=0;i<=n;++i) {
        int w=1ll*(dp[cnt][i][0]+dp[cnt][i][1])*fac[n-i]%mod;
        if (i&1) ans=(ans-w+mod)%mod;
        else ans=(ans+w)%mod;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 63104
//#define _GLIBCXX_DEBUG
//#include <atcoder/all>
#include <bits/stdc++.h>

#ifndef ATCODER_DSU_HPP
#define ATCODER_DSU_HPP 1

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

#endif  // ATCODER_DSU_HPP

using namespace std;
using namespace atcoder;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N,M; cin>>N>>M;
  dsu uf(N);
  rep(i,M){
    ll A,B; cin>>A>>B; A--; B--;
    uf.merge(A,B);
  }
  
  ll ans=0;
  for(auto u:uf.groups()){
    chmax(ans,(ll)u.size());
  }
  
  cout<<ans<<'\n';
  
  return 0;
}


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

int main(void)
{
	ll int n, k, cost=0;
	cin >>n >> k;
	ll int h[n];
	for(int i=0; i<n; i++)
		cin>>h[i];

	long long int dp[n];
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2; i<n; i++)
		dp[i]=INT_MAX;


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

	cout<<dp[n-1]<<"\n";
	return 0;
}

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

#define ll long long

inline ll read() {
    ll x = 0, f = 1; char ch = getchar();
    for(; ch < '0' || ch>'9'; ch = getchar())
        if(ch == '-') f = -f;
    for(; ch >= '0' && ch <= '9'; ch = getchar())
        x = x * 10 + ch - '0';
    return x * f;
}

inline void chkmin( int &a, int b ) { if(a > b) a = b; }

inline void chkmax( int &a, int b ) { if(a < b) a = b; }

#define _ read()

#define ln endl

int main()
{
	int d1 = _, t1 = _;
	int d2 = _, t2 = _;
	if(d1 != d2)
		puts("1");
	else 
		puts("0");
}

Measured memory_bytes: 256
#!/usr/bin/env python2
# coding: utf-8

def caesar(s, n):
  d = {}
  for c in (65, 97):
    for i in range(26):
      d[chr(i+c)] = chr((i+n) % 26 + c)

  return "".join([d.get(c, c) for c in s])

while True:
  try:
    encrypttxt = raw_input()
    for i in range(26):
      t = caesar(encrypttxt, i)
      if  "the" in t or "this" in t or "that" in t:
        print t

  except EOFError:
    break

Measured memory_bytes: 6268
#include<stdio.h>
#define max 100000

int parent(int);
int left(int);
int right(int);

int main(){

  int n,i,A[max+1];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i) >= 1) printf("parent key = %d, ",A[parent(i)]);
    if(left(i) <= n) printf("left key = %d, ",A[left(i)]);
    if(right(i) <= n) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return (2*i)+1;
}



Measured memory_bytes: 2056
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;


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

	// long long?
	ll N, K, Q;
	cin >> N >> K >> Q;

	vector<int> vA(Q, 0);
	rep(i, Q) cin >> vA[i];
	rep(i, Q) vA[i]--;

	vector<ll> vPt(N, K);
	vector<ll> vAns(N, 0);

	for (int i = 0; i != Q; ++i) {
		vAns[vA[i]]++;
	}

	for (int i = 0; i != N; ++i) {
		vAns[i] = Q - vAns[i];
	}

	for (int i = 0; i != N; ++i) {
		if (vAns[i] >= K) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	
	return 0;

}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << '\n'
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    dsu u(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        u.merge(a, b);
    }
    int ans = 0;
    rep(i, n) {
        int x = u.leader(i);
        if (x==i) ans++;
    }
    ans--;
    
    
    pr(ans);
    return 0;
}


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


	/* constants */
	#define inf (int)1e+9
	#define VIS 1
	#define UNVIS 0
	#define null NULL
	#define MAX (int)1e+6
	#define MIN -(int)1e+6
	
// ------------------------------------------------------------------------

int n;
vector<vector<int>> v;

int memo[(int)1e5+5][3];

int maxPoints(int day, int notodo) {

	if (memo[day][notodo]!=-1)
		return memo[day][notodo];

	if (day==n)
		return 0;

	int answer=-inf;
	for (int i=0; i<3; i++) {
		if (i!=notodo) {
			answer=max(answer, v[day][i] + maxPoints(day+1,i));
		}	
	}

	memo[day][notodo]=answer;
	return answer;
}

int main()
{
	
	cin.tie(NULL);
	cout.tie(NULL);

	/*Start*/
	
	scanf("%d",&n);

	v.resize(n);

	for (int i=0; i<n; i++)
		v[i].resize(3);

	for (int i=0; i<n; i++) {
		scanf("%d%d%d",&v[i][0],&v[i][1],&v[i][2]);
	}

	memset(memo,-1,sizeof(memo));	
	cout<<maxPoints(0,3)<<endl;

    return 0;
}


Measured memory_bytes: 17704
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n,m; cin>>n>>m;
  int cnt[n]; CLR(cnt);
  rep(i,m){
    int a,b; cin>>a>>b;
    cnt[a-1]++; cnt[b-1]++;
  }
  bool flg = true;
  rep(i,n) if(cnt[i]%2==1) flg=false;
  if(flg) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  // K * ((K-1)^(N-1))
  int ans = K;
  for(int i=0; i < N-1; i++){
      ans *= (K-1);
  }
  cout << ans << endl;
  return 0;
}

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

int check_number(int n) {
    int i = 0;
    while(1) {
        if(n>i&&i+10>=n) {
            break;
        }
        i+=10;
    }
    return i+10;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[5], b[5];
    for(int i = 0;i < 5;i++) {
        cin >> a[i];
        b[i] = check_number(a[i]);
    }
    int min = b[0]-a[0];
    int flag = 0;
    for(int i = 1;i < 5;i++) {
        int num = b[i]-a[i];
        if(min<num) {
            min = num;
            flag = i;
        }
    }
    int result = 0;
    for(int i = 0;i < 5;i++) {
        if(flag==i) {
            result+=a[i];
        } else {
            result+=b[i];
        }
    }
    cout << result << endl;
}


Measured memory_bytes: 256
Main = input => {
  input = input.trim().split(" ");
  const a = Number(input[0]);
  const b = Number(input[1]);
  
  const gcd = ((p, q) => p === 0 ? q : gcd(q%p, p));
  
  var x = gcd(a, b);
  
  var cnt = 1;
  for (var i = 2; i*i <= x; i++) {
    if (x%i === 0) {
      cnt++;
      while (x%i === 0) {
        x /= i;
      }
    }
  }
  if (x !== 1) {
    cnt++;
  }
  
  console.log(cnt);
}

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

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

int main() {

  int X;
  cin >> X;

  vector<long long> A;
  vector<long long> B;

  long long currentA = 0;
  long long currentB = 0;
  long long currentC = 0;
  int count = 0;
  
  bool flg = true;

  while (flg) {
    A.push_back(currentA);
    B.push_back(currentB);
    count++;
    currentC = currentA;
    currentA = pow(count,5);
    currentB = pow(0 - count,5);
    if (X <= currentA - currentC) {
      flg = false;
    }
  }
  A.push_back(currentA);
  B.push_back(currentB);

  for (int i = 0; i < A.size(); i++) {
    for (int j = 0; j < A.size(); j++) {
      if (A[i] - A[j] == X) {
        cout << i << " " << j << endl;
        return 0;
      }
      if (A[i] - B[j] == X) {
        cout << i << " " << 0 - j << endl;
        return 0;
      }
      if (B[i] - A[j] == X) {
        cout << 0 - i << " " << j << endl;
        return 0;
      }
      if (B[i] - B[j] == X) {
        cout << 0 - i << " " << 0 - j << endl;
        return 0;
      }
    }
  }

  return 0;

}

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

int d[200001],t[200001];

int main()
{
	int n,m;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>d[i];
	}
	cin>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>t[i];
	}
	sort(d+1,d+n+1);
	sort(t+1,t+m+1);
	int i=1,j=1;
	int res=0;
	while(i<=n && j<=m)
	{
		if(d[i]<t[j])
		{
			i++;
		}
		else if(d[i]>t[j])
		{
			j++;res++;
		}
		else
		{
			i++;j++;
		}
	}
	if(j<=m)
	{
		res+=m-j+1;
	}
	if(res==0)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
}

Measured memory_bytes: 1792
import std.stdio;

void main(){
	int a, b, s;
	while (readf("%d %d\n", &a, &b), (s = a + b) > 0) {
		char ch = 'A';
		foreach (i; 1..5) {
			readf("%d %d\n", &a, &b);
			if (s < a + b) {
				s = a + b;
				ch = cast(char)('A' + i);
			}
		}
		writeln(ch, " ", s);
	}
}

Measured memory_bytes: 976
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <map>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn=101000;
int n;
ll d[maxn];
int size[maxn];
ll dis[maxn];
map<ll,int> mp;
vector<int> G[maxn];
ll sum=0;

void dfs1(int u,int fa){
    for(int i=0;i<G[u].size();i++){
        int v=G[u][i];
        if(v==fa) continue;
        dis[v]=dis[u]+1;
        dfs1(v,u);
    }
    sum+=dis[u];
}

void dfs2(int u,int fa){
    for(int i=0;i<G[u].size();i++){
        int v=G[u][i];
        if(v==fa) continue;
        printf("%d %d\n",u,v);
        dfs2(v,u);
    }
}

int main(){
    //初始化
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&d[i]);
        mp[d[i]]=i;
    }
    sort(d+1,d+n+1);
    for(int i=1;i<=n;i++) size[i]=1;
    //构树
    for(int i=n;i>1;i--){
        int k=mp[d[i]];
        int tmp=n-2*size[k];
        //printf("%d   111\n",i);
        if(tmp<=0) {printf("-1\n");return 0;}
        ll ss=d[i]-tmp;
        //printf("%d    222\n",i);
        if(mp.count(ss)==0){printf("-1\n");return 0;}
        int pos=mp[ss];
        size[pos]+=size[k];
        G[pos].push_back(k);
        G[k].push_back(pos);
    }
   // printf("sbsbsb\n");
    dis[mp[d[1]]]=0;
    dfs1(mp[d[1]],-1);
    if(sum!=d[1]){
        printf("-1\n");
    }else{
        dfs2(1,-1);
    }
    return 0;
}


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

int main(){
  int n, m;
  cin >> n;
  int a[36];
  for(int i = 36; ;i--){
    if(n < 0){
      if(-n%2 == 0 ) a[i] = 0;
      if(-n%2 == 1 ) {
        a[i] = 1;
        n = n-1;
      }
    }
    if(n > 0){
      if(n%2 == 0) a[i] = 0;
      if(n%2 == 1) {
        a[i] = 1;
        n = n-1;
      }
    }
    if(n == 0){
      m = i;
      break;
    }
    n = n / (-2);
  }
  for(int i = m ; i < 37; i++) cout << a[i];
  cout << endl;
  return 0;
}

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

using namespace std;

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

	int n;
	cin >> n;
	int a[100005];
	a[0] = 0;
	long long sum = 0;
	for (int i = 1;i <= n;i++){
		cin >> a[i];
		sum += abs(a[i-1] - a[i]);
	}
	a[n+1] = 0;	
	sum += abs(a[n]);

	int ans;

	for (int i = 1;i <= n;i++){
		ans = sum - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1]);
		cout << ans << endl;
	}


	return 0;

}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int x, h;
    while(cin >> x >> h, x|h){
        printf("%.10lf\n", x*hypot(x, h*2)+x*x);
    }
    return 0;
}


Measured memory_bytes: 3180
#include<iostream>
#include<algorithm>
#include<vector>
#include <iomanip>
#include <math.h>
 
using namespace std;
 
int main(){

	int n;
	int x;
  
  	while(1){
  		cin >> n >> x;
  		if(n==0 && x==0)
      	break;
      
      int cnt =0;
      for(int k=1; k<=n; k++){
      	for(int j=1; j<=n; j++){
      		for(int i=1; i<=n; i++){
              if(i+j+k>x || j<=i || k<=i || k<=j){
                break;
              }
                 
        	   int kumiawase= i + j + k;
              	if(kumiawase==x){
                cnt++;
                }

             }
        }
      }
      cout << cnt <<endl;
    }
      
  return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main(){


  int N,X;

  cin>>N>>X;

  int x[100001];

  cin>>x[0];
  
  int ans=abs(X-x[0]);
  
  for(int i=1;i<N;i++){
    cin>>x[i];

    ans=__gcd(ans,abs(x[i]-x[i-1]));
    
  }

  cout<<ans<<endl;
  
  return 0;

}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>








const int oo = 100000000, N = 1e6 + 10;

int n, cntOpn[N], cntCls[N], idx[N], crrCntOpn, crrCntCls;
string s;







bool cmpCntCls(int i, int j)
{
	return cntCls[i] < cntCls[j];
}




int getCntOpn()
{
	int crrCntOpn = 0;
	for(int i = 1, j; i <= n; i++)
	{
		j = idx[i];
		if(cntOpn[j] >= cntCls[j])
		{
			if(crrCntOpn >= cntCls[j])crrCntOpn += cntOpn[j] - cntCls[j];
			else
			{
				return -1;
			}
		}
	}
	return crrCntOpn;
}





void solve()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> s;
		cntOpn[i] = 0;
		cntCls[i] = 0;
		for(int j = 0; j < s.size(); j++)
		{
			if(s[j] == '(')cntOpn[i]++;
			else if(cntOpn[i] > 0)cntOpn[i]--;
			else cntCls[i]++;
		}
		idx[i] = i;
	}
	sort(idx + 1, idx + n + 1, cmpCntCls);
	crrCntOpn = getCntOpn();
	if(crrCntOpn == -1)
	{
		cout << "No\n";
		return;
	}
	for(int i = 1, j; i <= n; i++)
	{
		j = idx[i];
		swap(cntOpn[j], cntCls[j]);
	}
	sort(idx + 1, idx + n + 1, cmpCntCls);
	crrCntCls = getCntOpn();
	if(crrCntCls == -1)
	{
		cout << "No\n";
		return;
	}
	if(crrCntOpn == crrCntCls)cout << "Yes\n";
	else cout << "No\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt", "r", stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 15196
while(1):
	char_list = list(input())
	int_list = [0 for i in range(len(char_list))]

	if char_list[0] == '0':
		break
	for i in range(len(char_list)):
		int_list[i] = int(char_list[i])
	print(sum(int_list))

Measured memory_bytes: 7612
object Main extends App {
	val a = new Array[Int](5)

	for(i<-0 until 5){
		a(i) = scala.io.StdIn.readInt
	}

	val k = scala.io.StdIn.readInt

	var flag = true

	for(i<-0 to 3){
		for(j<-i to 4){
			if((a(j) - a(i)).abs > k) flag = false
		}
	}

	if(flag) println("Yay!")
	else println(":(")

}

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

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  long double pattern = a*a*b/2.0;
  long double theta1 = 2.0*b/a - 2.0*x/(a*a*a);
  long double theta2 = a*b*b/(2.0*x);
  long double ans;
  if(pattern < x)
    ans = atan(theta1);
  else
    ans = atan(theta2);
  cout << fixed << setprecision(10) << ans*180.0/M_PI << endl;
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1000000007;


int main() {
  ll n,y;
  cin >> n >> y;
  if(10000*n<y){
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
  }
  ll ten=min(n,y/10000);
  for(ll i=0;i<ten+1;i++){
    ll five=min(n-i,y/5000);
    for(ll j=five;j>=0;j--){
      if(10000*i+5000*j+1000*(n-i-j)==y){
        cout << i << " " << j << " " << n-i-j << endl;
        return 0;
      }
      else if(10000*i+5000*j+1000*(n-i-j)<y)
      break;
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<map>
#define int long long int

using namespace std;

signed main(){

    int a[5], i;
    int tmp = 1000000;
    int pp;

    for(i = 0; i < 5; i++){
        cin >> a[i];
        
        if(a[i] % 10 == 0){
            continue;
        }

        if(tmp > a[i] % 10){
            tmp = a[i] % 10;
            pp = i;
        }
    }

    int ans = 0;
    for(i = 0; i < 5; i++){
        if(i == pp){
            ans = ans + a[pp];
        }else{
            if(a[i] % 10 != 0){
                ans = ans + a[i] + (10 - a[i] % 10);
            }else{
                ans = ans + a[i];
            }
        }
    }

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

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

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

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

int n, x, y, z;
int memo[45][1<<19];
int ng;

int dfs(int i, int m){
  if(i == n) return 1;
  int &res = memo[i][m];
  if(res >= 0) return res;
  res = 0;
  rep(v, 1, 11){
    int t = (m<<v)+(1<<v);
    t &= (1<<18)-1;
    if((t & ng) != ng) res += dfs(i+1, t);
    res %= mod;
  }
  return res;
}

signed main(){
  cin >> n >> x >> y >> z;

  memset(memo, -1, sizeof(memo));
  ng |= 1<<z;
  ng |= 1<<(z+y);
  ng |= 1<<(z+y+x);

  int p = 1;
  rep(i, 0, n) (p *= 10) %= mod;

  int q = dfs(0, 0);
  cout << (p-q+mod)%mod << endl;

  return 0;
}


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

using namespace std;

const int MAXN = 1e5 + 10;
bool dp[MAXN];

int main() {
    #ifdef BLAT
        freopen("input", "r", stdin);
    #endif
     
    int n, k;
    cin >> n >> k;

    vector< int > v(n);
    for(int i = 0; i < n; ++i) cin >> v[i];

    for(int i = 1; i <= k; ++i) {
    	for(auto &x : v) {
    		if(i >= x) dp[i] |= (!dp[i-x]);
    	}
    }

    cout << (dp[k]?"First":"Second");
}   	

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

#define rep(i, n)     for(int i = 0;      i < int(n); ++i)
#define rep3(i, a, b) for(int i = int(a); i < int(b); ++i)
#define all(x)        (x).begin(),(x).end()
#define sz(x)         int(x.size())
#define mp            make_pair
#define pb            push_back


typedef long long ll;

using namespace std;

int main(){
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;

  int Xmax = X;
  int Ymin = Y;

  rep(i, N){
    int x;
    cin >> x;
    Xmax = max(Xmax, x);
  }

  rep(i, M){
    int y;
    cin >> y;
    Ymin = min(Ymin, y);
  }

  if(Xmax < Ymin){
    cout << "No War" << endl;
  }else{
    cout << "War" << endl;
  }


  return 0;
}


Measured memory_bytes: 256