akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

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

const int md = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abst(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
    map<str,int> mp;
    str s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    mp[s]=a;
    mp[t]=b;
    str u;
    cin>>u;
    mp[u]--;
    cout<<mp[s]<<" "<<mp[t]<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int H,W;
	int i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0)break;
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				if(i==0 || i==H-1 || j==0 || j==W-1){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2524
#include <iostream>
#include <algorithm>

using namespace std;
int A[10],B[10];
int main() {
int sum;
for (int i = 0; i < 5; ++i){
    cin >> A[i];
}
for (int i = 0; i < 5; ++i){
    B[i] = A[i] % 10;
    if(B[i] !=0) B[i] = 10 - B[i];
}
sort(B, B + 5);
for (int i = 0; i < 4; ++i){
    sum += A[i] + B[i];
}
sum += A[4];
cout << sum << endl;
return 0;

}


Measured memory_bytes: 256
N = input()
A = [0]*N
B = [0]*N
for i in range(N):
  A[i], B[i] = map(int, raw_input().split())

AB = zip(B, A)
AB.sort()
x = 10**9
for b, a in AB[::-1]:
  x = min(x, b)-a
print "Yes" if x>=0 else "No"


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

int main(){
  vector<vector<int>> card(4, vector<int>(13));
  for(int i = 1; i < 5; i++){
    for(int j = 1; j < 14; j++){
      card.at(i - 1).at(j - 1) = j;
    }
  }
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    string s;
    int x;
    cin >> s >> x;
    if(s == "S"){
      card.at(0).at(x - 1) = 0;
    }
    else if(s == "H"){
      card.at(1).at(x - 1) = 0;
    }
    else if(s == "C"){
      card.at(2).at(x - 1) = 0;
    } 
    else if(s == "D"){
      card.at(3).at(x - 1) = 0;
    }
  }
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 13; j++){
      if(i == 0 && card.at(i).at(j) != 0){
        cout << "S" << " " << card.at(i).at(j) << endl;
      }
      else if(i == 1 && card.at(i).at(j) != 0){
        cout << "H" << " " << card.at(i).at(j) << endl;
      }
      else if(i == 2 && card.at(i).at(j) != 0){
        cout << "C" << " " << card.at(i).at(j) << endl;
      }
      else if(i == 3 && card.at(i).at(j) != 0){
        cout << "D" << " " << card.at(i).at(j) << endl;
      }
    }
  }
}




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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            int N = int.Parse(Console.ReadLine());
            var pos = new Vector2(0, 0);
            long beforTime = 0;
            for(int i = 1;i <= N; i++)
            {
                long[] input = Console.ReadLine().Split(' ').Select(val => long.Parse(val)).ToArray();
                long t = input[0];
                long nx = input[1];
                long ny = input[2];

                if(Math.Abs(nx - pos.x) + Math.Abs(ny - pos.y) > t - beforTime)
                {
                    //距離が遠すぎる
                    Console.WriteLine("No");
                    return;
                }

                if(Math.Abs(nx - pos.x) + Math.Abs(ny - pos.y) == t - beforTime)
                {
                   // Console.WriteLine("just " + (Math.Abs(nx - pos.x) + Math.Abs(ny - pos.y)));
                    pos.x = nx;
                    pos.y = ny;
                    beforTime = t;
                    continue;
                }

                if((t - beforTime - Math.Abs(nx - pos.x) - Math.Abs(ny - pos.y)) % 2 == 0)
                {
                    //Console.WriteLine("modottekorareru " + (t - beforTime - Math.Abs(nx - pos.x) + Math.Abs(ny - pos.y) % 2));

                    pos.x = nx;
                    pos.y = ny;
                    beforTime = t;
                    continue;
                }
                else
                {
                   //Console.WriteLine((t - beforTime - Math.Abs(nx - pos.x) + Math.Abs(ny - pos.y) % 2));
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }
    }

    struct Vector2
    {
        public Vector2(long x, long y)
        {
            this.x = x;
            this.y = y;
        }
        public long x;
        public long y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 17448
from math import *

def L(xi, di):
    return xi - di

def R(xi, di):
    return xi + di

def D(yi, di):
    return yi - di

def U(yi, di):
    return yi + di

def main():
    N = int(input())
    x_list = [list(map(int, input().split())) for i in range(N)]
    sum_list = [x[0] + x[1] for x in x_list]
    checker = sum_list[0] % 2

    for wa in sum_list:
        if wa % 2 != checker:
            print("-1")
            return

    arm_list = []
    if checker == 0:
        arm_list.append(1)

    pow_i = 0
    max_sum = max(sum_list)
    while max_sum > sum(arm_list):
        arm_list.insert(0, 2 ** pow_i)
        pow_i += 1
    print(len(arm_list))
    print(" ".join(map(str, arm_list)))

    for c in x_list:
        now_c = [0,0]
        order = ""

        for arm in arm_list:
            dx = c[0] - now_c[0]
            dy = c[1] - now_c[1]

            if abs(dx) > abs(dy):
                if dx > 0:
                    order += "R"
                    now_c[0] = R(now_c[0], arm)
                else:
                    order += "L"
                    now_c[0] = L(now_c[0], arm)
            else:
                if dy > 0:
                    order += "U"
                    now_c[1] = U(now_c[1], arm)
                else:
                    order += "D"
                    now_c[1] = D(now_c[1], arm)
        print(order)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3444
//I have to work harder than anyone else to make it! I’ll never catch up otherwise…
//Don’t worry about what other people think. Hold your head up high and plunge forward.

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

#define P pair<int,int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define str std::string 
#define pb push_back
#define itrt(yo) for(auto x:yo){std::cout<<x<<nl;} 
#define vec(x) std::vector<x> 
#define nl '\n'
#define F first
#define S second
#define ll long long int
#define ALL(x) x.begin(),x.end() 
#define BN(x) x.begin()
#define ED(x) x.end()
#define MAP_traverse(it,x)  for(auto it = BN(x); it!= ED(x); it++)
#define PI 3.14159265358979323846264338327950L
const unsigned int M = 1000000007;




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

	ll ans;
	ans = n + n*n + n*n*n;
	cout<<ans;
	
	
	
}



Measured memory_bytes: 3604
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.insert(0,0)
B = {1:1}
x = A[1]
st = 0
while True:
    if x not in B:
        B[x] = 1
        x = A[x]
    else:
        st = x
        break
x = 1
t = 0
while x!=st:
    x = A[x]
    t += 1
x = st
x = A[x]
T = 1
while x!=st:
    x = A[x]
    T += 1
if K<=t:
    x = 1
    cnt = 0
    while cnt<K:
        x = A[x]
        cnt += 1
    print(x)
else:
    K -= t
    K = K%T
    x = st
    cnt = 0
    while cnt<K:
        x = A[x]
        cnt += 1
    print(x)

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n; cin >> n;
    ll res = 0;
    rep1(i,n+1){
        if(i%3 == 0|| i%5 == 0);
        else res+=i;
    }
    cout << res << endl;
}


Measured memory_bytes: 3648
H,W = map(int,input().split())

anss = []

def vertical_twice(H,W):
    if W % 3 == 0:
        return 0
    else:
        return H

def vertical_horizontal(H,W):
    if W % 3 != 2:
        left_width = W//3
        left_area = H*left_width
        right_width = W - left_width
        if H % 2 == 0:
            right_upper_area = H//2*right_width
            right_lower_area = H//2*right_width
#             return left_area - right_upper_area
        else:
            right_upper_area = (H//2+1)*right_width
            right_lower_area = H//2*right_width
#             return max(left_area,right_upper_area) - right_lower_area
    
    if W % 3 == 2:
        left_width = W//3+1
        left_area = H*left_width
        right_width = W - left_width
        if H % 2 == 0:
            right_upper_area = H//2*right_width
            right_lower_area = H//2*right_width
#             return left_area - right_upper_area
        else:
            right_upper_area = (H//2+1)*right_width
            right_lower_area = H//2*right_width
#             return max(left_area,right_upper_area) - right_lower_area
    return (max([left_area,right_upper_area, right_lower_area])-
            min([left_area,right_upper_area, right_lower_area]))
            
anss.append(vertical_twice(H,W))
anss.append(vertical_twice(W,H))
anss.append(vertical_horizontal(H,W))
anss.append(vertical_horizontal(W,H))

print(min(anss))

Measured memory_bytes: 38256
import math

N = int(input())

ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
  if i > N / 2:
    continue
  tmp = int((N - i) / i)
  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
    ans += tmp

print(ans)

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

int main() {
        int a, b;
        scanf("%d %d", &a, &b);
        puts((a * b) & 1 ? "Odd" : "Even");
        return 0;
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    map<P, ll> mp;
    rep(bit,(1<<n)){
        string t = "", u = "";
        rep(i,n){
            if(bit>>i & 1) t += s[i];
            else u += s[i];
        }
        reverse(u.begin(), u.end());
        mp[P(t, u)]++;
    }
    ll ans = 0;
    rep(bit,(1<<n)){
        string t = "", u = "";
        for(int i = n; i < n*2; ++i){
            if(bit & (1<<(i - n))) t += s[i];
            else u += s[i];
        }
        reverse(u.begin(), u.end());
        ans += mp[P(u, t)];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 60892
<?php
while(1) {
    list($h, $w) = explode(" ", fgets(STDIN));
    if($h==0 && $w==0) break;
    for($y=0; $y<$h; $y++) {
        echo(str_repeat("#", (int)$w));
        echo("\n");
    }
    echo("\n");
}



Measured memory_bytes: 9220
#include <iostream>

using namespace std;

int main() {
	int a[] = { 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
	int x, y;
	cin >> x >> y;
	if (a[x] == a[y]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[1005], b, c[1005], x;
long long dp[5005][1005];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i=1; i< 1<<n; i++) dp[i][0] = 100000007;
for (int i=1;i<=m;i++){
	cin >> a[i] >> b;
	for (int j=0;j<b;j++){
		cin >> x; c[i]=c[i]|(1<<(x-1));
	} 
}
for (int i=1; i<=m; i++){
	for (int mask=0; mask < (1<<n); mask++){
		dp[mask][i]=min(dp[mask][i-1], dp[(mask^c[i])&mask][i-1]+a[i]);
	}
}
if (dp[(1<<n)-1][m]==100000007) cout << "-1";
else cout << dp[(1<<n)-1][m]; 
return 0;
}

Measured memory_bytes: 33024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N; cin >> N;
    vector<double> v(N);
    for(int i = 0; i < N; i++) cin >> v[i];
    sort(v.begin(), v.end());
    double ans = (v[0] + v[1]) / 2;
    for(int i = 2; i < N; i++){
        ans = (ans + v[i]) /2;
    }
    printf("%.3f\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

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

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } 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; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N; cin >> N;
  auto ans = (N+1)*N / 2;
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int n, m;
            Read2Ints(out n,out m);
           var dpl= Enumerable.Range(1, n + 1).Select(x=>new long[m + 1]).ToArray();
            for (int i = 1; i < n + 1; i++) {
                int w, v;
                Read2Ints(out w,out v);
                for(int j = 1; j < m + 1; j++)
                {
                    if (j - w >= 0)
                    {
                        dpl[i][j]=Max(dpl[i-1][j],dpl[i-1][j-w]+v);
                    }
                    else
                    {
                        dpl[i][j] = dpl[i - 1][j];
                    }
                }
            }
           Write( dpl.Last().Max());

        }

        private static void Read2Ints(out int a,out int b)
        {
            var temp = ReadInts();
            a = temp[0];
            b = temp[1];
        }
        private static void Read3Ints(out int a,out int b,out int c)
        {
            var temp = ReadInts();
            a = temp[0];
            b = temp[1];
            c = temp[3];
        }       
 
        private static void Write<T>(IEnumerable<T> target,string sep=" ") { Console.WriteLine(string.Join(sep,target)); }
        private static void Write<T>(T str) { Console.WriteLine(str); }
        private static string[] ReadStrings() { return Console.ReadLine().Split(' '); }
        private static int ReadInt() { return int.Parse(Console.ReadLine()); }
        private static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        private  static int[] ReadInts() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        private static double[] ReadDoubles() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        
    }

}

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

using namespace std;

typedef long long ll;

int main(){
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  
  vector<ll> a(x);
  vector<ll> b(y);
  vector<ll> c(z);
  
  for(int i = 0; i < x; i++) cin >> a[i];
  for(int i = 0; i < y; i++) cin >> b[i];
  for(int i = 0; i < z; i++) cin >> c[i];
  
  vector<ll> d;
  for(int i = 0; i < x; i++){
    for(int j = 0; j < y; j++){
      d.push_back(a[i] + b[j]);
    }
  }
  
  sort(d.rbegin(), d.rend());
  sort(c.rbegin(), c.rend());
  
  vector<ll> ans;
  for(int i = 0; i < min(k, x * y); i++){
    for(int j = 0; j < min(k, z); j++){
      ans.push_back(d[i] + c[j]);
    }
  }
  
  sort(ans.rbegin(), ans.rend());
  
  for(int i = 0; i < k; i++) cout << ans[i] << endl;
  
  return 0;
}

Measured memory_bytes: 43368
#include<iostream>
#include<cstdio>
#define N 101
using namespace std;

typedef struct{
  int q[10000];
  int head;
  int tail;
}Queue;

Queue que;
int g[N][N]; 
int n;
int d[N];
bool us[N];
void Enque(int data){
  que.q[que.tail]=data;
  que.tail++;
}

int Deque(void){
  int data;
  data=que.q[que.head];
  que.head++;
  return data;
}

bool isEmpty(){
  if(que.tail-que.head==0)return true;
  else return false;
}


void bfs(int s){
  int u,v;
  Enque(s);
  while(true){

    if(isEmpty()==true) {
      break;
    }
    u=Deque();
    //  cout << "u = " << u << endl;
      for(int i=1;i<= n;i++){
 
      if(us[i]==false && g[u][i] == 1){
	v=i;
	//	cout << "i - " << i <<endl;
	us[i]=true;
	d[v]=d[u]+1;
	Enque(v);
      }
    }
  }
}

int main(){

  int n2,data,u;

 //load n
  cin >>n;

  //initialize
  que.tail=0;
  que.head=0;
  for(int i=0;i<N;i++){
    us[i]=false;
    d[i]=-1;
    for(int j=0;j<N;j++){
      g[i][j]=0;
    }
  }

  //load data
  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&n2);
    for(int j=0;j<n2;j++){
      scanf("%d",&data);
      g[u][data]=1;
    }
  }
  //execute

  d[1]=0;
  us[1]=true;
  bfs(1);


  //print
  for(int i=1;i<=n;i++){
    printf("%d %d\n",i,d[i]); 
  }

  return 0;
}

Measured memory_bytes: 0
n,m,x=map(int,input().split())
a=[]
c=[]
ma=[0]*m
for i in range(n):
  cc,*aa=map(int,input().split())
  a.append(aa)
  c.append(cc)
  for j in range(m):ma[j]+=aa[j]
if min(ma)<x:exit(print(-1))
ans=sum(c)
for i in range(1,1<<n):
  f=[0]*m
  cc=0
  for j in range(n):
    if i&(1<<j):
      cc+=c[j]
      for k in range(m):
        f[k]+=a[j][k]
  if min(f)>=x:ans=min(ans,cc)
print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
const int mod = 1000000007;
ll modpow(ll a,ll n){
    ll res=1;
    while(n>0){
        if(n&1){
            res=res*a%mod;
        }
        a=a*a%mod;
        n>>=1;
    }
    return res;
}
ll modchoose(int n,int a){
    ll x=1,y=1;
    rep(i,a){
        x=(x*(n-i))%mod;
        y=(y*(i+1))%mod;
    }
    return (x*modpow(y,mod-2))%mod; // x/y
}
 
int main(){
    int n,k;cin>>n>>k;
    vector<ll>  ans(k,0);
    int x=n-k+1;
    for(int i=0;i<k;i++){
        cout<<(modchoose(x,i+1)*modchoose(k-1,i))%mod<<endl;
    }

}

Measured memory_bytes: 3644
import math
a,b,X = map(float,input().split())
T = math.atan(a/b)
if X <= a**2*b/2.0:
    c = 2*X/(a*b**2)
    theta = 90.0 -math.atan(c)*180/math.pi
else:
    Y = a**2*b-X
    theta = math.atan(2*Y/a**3)*180/math.pi
print(theta)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


bool check[4];

int main(){

	for(int i = 1; i <= 3; i++){

		check[i] = true;
	}

	int a,b;
	scanf("%d %d",&a,&b);

	check[a] = false;
	check[b] = false;

	for(int i = 1; i <= 3; i++){
		if(check[i]){

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

	return 0;
}


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

const int INF = 1e+8;
const int E_MAX = 1000000;

int main() {
	int e;
	while(cin >> e && e){
		int ans = INF;
		for(int z = 0; z * z * z <= E_MAX; ++z){
			if(z > e)
				break;
			for(int y = 0; y * y <= E_MAX; ++y){
				if(z * z * z + y * y > e)
					break;
				ans = min(ans, z + y + (e - (y * y + z * z * z)));
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	swap(a,b);
	swap(a,c);
	printf("%d %d %d",a,b,c);
	
	
	
	
	
 } 

Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().rstrip("\r\n")
def List(): return list(map(int, input().split()))
def Num(): return int(input())


n = Num()
a = List()
# a.sort()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if a[i] != a[j] and a[j] != a[k] and a[k] != a[i] and a[i] + a[k] > a[j] and a[i] + a[j] > a[k] and a[j] + a[k] > a[i]:
                ans += 1
print(ans)


Measured memory_bytes: 9084
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s, t;
  cin >> n >> s >>t;
  REP(i, n) cout << s[i] << t[i];

  return 0;
}


Measured memory_bytes: 256
def f():
 c=0
 for W in iter(input,'0'):
  c+=1
  W=int(W)
  d=[0]*-~W
  for _ in[0]*int(input()):
   v,w=map(int,input().split(','))
   for i in range(W,w-1,-1):
    if d[i]<d[i-w]+v:d[i]=d[i-w]+v
  print(f'Case {c}:\n{d[W]}\n{d.index(d[W])}')
f()


Measured memory_bytes: 5628
n=int(input())
a=sorted(list(map(int,input().split())))

DIV=10**9+7

if n%2==1:
  if a[0]!=0:
    print(0)
    exit(0)
  a=a[1:]
  for i in range(len(a)):
    a[i]=a[i]-1
    
for i in range(len(a)):
  if a[i]!=i+(i%2==0):
    print(0)
    exit(0)
    
print((2**(len(a)//2))%DIV)
    
    


       


Measured memory_bytes: 13812
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

int main(){
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  int ans=0;
  rep(i,n-k){
    if(a[i] < a[i+k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 4840
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    int N,H[101];
    int ans=0;
    cin>>N;
    for(int i = 0;i < N;i++){
        cin>>H[i];
    }
    H[N]=0;
    for(int h = 1;h <= 100;h++){
        for(int i = 0;i < N;i++){
            if(H[i]>=h&&H[i+1]<h){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

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


typedef long long ll;
typedef pair<int, int> p;

int dp[500][10500];

int n, w;

vector<int> vv;
vector<int> wv;

void solve(){
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= w; j++) {
      if(j < wv[i]){
        dp[i+1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - wv[i]] + vv[i]);
      }
    }
  }

  cout << dp[n][w] << endl;
}

int main(){
  cin >> n >> w;
  for (int i = 0; i < n; i++) {
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    vv.push_back(tmp1);
    wv.push_back(tmp2);
  }

  solve();
}



Measured memory_bytes: 7264
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

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

  // 完全グラフから辺を除く方針で。
  // 完全グラフの場合。頂点iのスコアはn * (n + 1) / 2 - i
  // 除くべき片
  // 1 - n - 1
  // 2 - n - 2
  // ...
  // 偶数の場合はこれでおｋ
  // 奇数の場合はペアが作れないやつがいるけど。。。

  int m = n - n % 2;
  vector<pair<int, int>> ans;
  for (int i = 0; i < m; ++i) {
    for (int j = i + 1; j < m; ++j) {
      if (j == m - i - 1) continue;
      ans.emplace_back(i, j);
    }
  }
  if (n % 2 == 1)
    for (int i = 0; i < m; ++i) ans.emplace_back(i, m);

  cout << ans.size() << '\n';
  for (int i = 0; i < (int)ans.size(); ++i)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << '\n';
  return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rei register int
#define int long long
using namespace std;
const int maxn = 200010;
int n,Q;
int nowx,nowy;
int remain;
int r[maxn],c[maxn];
signed main(){
	cin >> n >> Q; remain = (n - 2) * (n - 2);
	nowx = nowy = n - 1;
	while(Q--){
//		cerr << nowx << " " << nowy << " " << remain << endl;
		int opt,x; scanf("%lld%lld",&opt,&x);
		if(opt == 1){
			if(c[x]) remain -= c[x];
			else {
				remain -= nowy - 1;
				for(rei i = x;i <= nowx;++i) c[i] = nowy - 1;
				nowx = x - 1;
			} 
		} else {
			if(r[x]) remain -= r[x];
			else {
				remain -= nowx - 1;
				for(rei i = x;i <= nowy;++i) r[i] = nowx - 1;
				nowy = x - 1;
			}
		} 
	} printf("%lld\n",remain); return 0;
}

Measured memory_bytes: 6812
#include<stdio.h>
main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a+b+c)==(5+5+7)&&(a*b*c)==(5*7*5)){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

		

Measured memory_bytes: 128
a = list(input())

b = a[0:4]

c = a[5:7]

d = a[8:10]

su = 0
bb = 0
cc =0
dd = 0
for i in range(4):
	bb = 10*bb + int(b[i])
for i in range(2):
	cc = 10*cc + int(c[i])
for i in range(2):
	dd = 10*dd + int(d[i])


if bb == 2019:
	if cc >= 5:
		print("TBD")
	elif cc == 4:
		if dd == 30:
			print("Heisei")
		else:
			print("Heisei")
	else:
		print("Heisei")
elif bb > 2019:
	print("TBD")
else:
	print("Heisei")


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct myBitset {
    myBitset()
            : bit(0) {
    }

    ll test(ll x) {
        return (bit >> x) & 1;
    }

    void set(ll x) {
        bit |= (1LL << x);
    }

    void clear(ll x) {
        bit &= ~(1LL << x);
    }

    void flip(ll x) {
        if ((bit >> x) & 1)
            bit &= ~(1LL << x);
        else
            bit |= 1LL << x;
    }

    ll all() {
        if (count() == 64)
            return 1;
        return 0;
    }

    ll any() {
        if (bit == 0)
            return 0;
        return 1;
    }

    ll none() {
        if (bit == 0)
            return 1;
        return 0;
    }

    ll count() {
        ll ret = 0;
        REP(i, 64) {
            ret += ((bit >> i) & 1);
        }
        return ret;
    }

    unsigned long long int val() {
        return bit;
    }

    unsigned long long int bit;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll Q;
    cin >> Q;
    myBitset bit;
    REP(_, Q) {
        ll q;
        cin >> q;
        if (q == 0) {
            ll x;
            cin >> x;
            cout << bit.test(x) << endl;
        }
        else if (q == 1) {
            ll x;
            cin >> x;
            bit.set(x);
        }
        else if (q == 2) {
            ll x;
            cin >> x;
            bit.clear(x);
        }
        else if (q == 3) {
            ll x;
            cin >> x;
            bit.flip(x);
        }
        else if (q == 4) {
            cout << bit.all() << endl;
        }
        else if (q == 5) {
            cout << bit.any() << endl;
        }
        else if (q == 6) {
            cout << bit.none() << endl;
        }
        else if (q == 7) {
            cout << bit.count() << endl;
        }
        else {
            cout << bit.val() << endl;
        }
    }
    return 0;
}


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

int WaterTrans(int A, int B, int C){
    int CapaWater = A-B;
    /*if(CapaWater>=C){
        return 0;
    }
    else{
        return C-CapaWater;
    }*/

    return max(0,C-CapaWater);
}

int main(){
    int A,B,C; cin >> A >> B >> C;
    cout << WaterTrans(A,B,C) << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
L = IL()

L.sort()

x = L[0]
for i in range(1,N):
  x = (x+L[i])/2
  
P(x)

Measured memory_bytes: 38384
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int cnt[26]; CLR(cnt);
  FOR(i,0,(int)s.length()) {
    cnt[s[i]-'a']++;
  }
  FOR(i,0,26) {
    if(cnt[i] == 0) {
      cout << char('a' + i) << '\n';
      return 0;
    }
  }
  cout << "None" << '\n';
  return 0;
}

Measured memory_bytes: 512
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

void answer(bool ok){
	if(ok) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
}

vector<ll> dividedNum(ll n){
    //n == 2 && n == 1の時エラー
    vector<ll> res;
	ll lim = sqrt(n)+1;
    for(ll i=1; i<lim; i++){
        if(n%i==0){
            res.push_back(i);
            if(i != n / i && lim <= n/i){
                res.push_back(n/i);
            }
        }
    }
    return res;
}


int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll N, K; cin >> N >> K;
	vector<ll> v(N);
	rep(i, N) cin >> v[i];
	sort(ALL(v));

	if(K > v[N-1]){
		answer(false);
		return 0;
	}
	if(N == 1){
		answer(v[0] == K);
		return 0;
	}
	if(v[0] == 1) {
		answer(true);
		return 0;
	}

	bool hasTwoBaisu = true;
	auto divs = dividedNum(v[0]);
	ll res = 1;
	for(ll x : divs){
		// print(x);
		if(x == 1) continue;
		bool ok = true;
		rep(i, N){
			if(v[i] % x != 0) ok = false;
		}
		if(ok) {
			chmax(res, x);
			hasTwoBaisu = false;
		}
	}
	// print(hasTwoBaisu);
	// print(res);

	if(!hasTwoBaisu){
		answer(K % res == 0);
	}
	else{
		answer(true);
	}

	return 0;
}


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

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  if(b<a)swap(a,b);
  if((b-a)%2==0)cout<<(b-a)/2<<endl;
  else if(n-b>a-1)cout<<a-1+(b-a+1)/2<<endl;
  else cout<<n-b+(b-a+1)/2<<endl;
}

Measured memory_bytes: 256
#144d
import math
a,b,x = map(int, input().split())


#底が見えるか否か(こぼれるときに断面が三角形か台形か)を確認する
if x <= b*a/2*a: #三角形
    c = 2*x / (a*b) #こぼれるときの三角形の高さ
    print(math.atan(b/c)*180/math.pi)
else: #台形
    c = 2*x/(a*a) -b #こぼれるときの台形上辺
    print(math.atan((b-c)/a)*180/math.pi)

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

long long A;

int main() {
  cin >> A;
  if(A % 10 == 3) {
    cout << "bon\n";
  }else if(A % 10 == 0 || A % 10 == 1 || A % 10 == 6 || A % 10 == 8) {
    cout << "pon\n";
  }else cout << "hon\n";
}

Measured memory_bytes: 3632
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitsf(n) __builtin_popcount(n)
ll power(ll x, ll y); 

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll a;
    long double b;
    cin >> a >> b;
    a *= b;
    cout << a;
}
 
ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}


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

int main() {
  string S;
  cin >> S;
  
  int max_s = 0;
  for ( int i = 0 ; i < S.size() ; i++ ){
    int count = 0 ;
  	bool judge = true ;
    int j = i ;
    while (judge && j < S.size()){
    	if ( S.at(j) == 'A' || S.at(j) == 'C' || S.at(j) == 'G' || S.at(j) == 'T' ){
          count++;
          j++;
    	}
        else 
          judge = false ;
    }    
  	if ( count > max_s )
      max_s = count ;
  }
  
  cout << max_s << endl;
}

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

int main() {
	long n,sum=0,sim=0;
	cin>>n;
	vector<long>v(n);
	for(int i=0;i<n;i++){
		long a;
		cin>>a;
		v.at(i)=(a-i-1);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++){
		
		sum+=v.at(i);
	}
	
		if(n%2==0){
			for(int i=0;i<n/2;i++){
			sim+=v.at(i);
			}
		}
		else{
			for(int i=0;i<(n+1)/2;i++){
			sim+=v.at(i);
			}
		}
	
	
	if(n%2==0){
		
			cout<<sum-2*sim<<endl;
		
	}
	else{
		cout<<v.at((n-1)/2)+sum-2*sim<<endl;
	}
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int w,h;
char map[200][200];
class Node{
public:
	int x,y;
	int c;
	Node(int _x,int _y,int _c):x(_x),y(_y),c(_c){

	}
};
void show(){
	for(int i=0;i<h*2-1;i++){
		for(int j=0;j<w*2-1;j++)cout<<map[i][j];
		cout<<endl;
	}
	cout<<endl;
}
bool visited[200][200];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int bfs(){
//	for(int i=0;i<100;i++)fill(visited[i],visited[i]+100,false);
	queue<Node> q;
	q.push(Node(0,0,1));
//	visited[0][0]=true;
	int gw=2*w-2;
	int gh=2*h-2;
	while(!q.empty()){
		Node cur=q.front();q.pop();
		if(cur.x==gw&&cur.y==gh)return cur.c;
		for(int i=0;i<4;i++){
			int nx=cur.x+dx[i];
			int ny=cur.y+dy[i];
			if(nx<0||ny<0||nx>gw||ny>gh||map[ny][nx]=='1')continue;
			nx=nx+dx[i];
			ny=ny+dy[i];
			if(nx<0||ny<0||nx>gw||ny>gh||map[ny][nx]=='1')continue;
			map[ny][nx]='1';
			q.push(Node(nx,ny,cur.c+1));
		}
	}
	return 0;
}
void solve(){
	cout<<bfs()<<endl;
}
int main(){
	while(cin>>w>>h&&(w||h)){
		for(int i=0;i<100;i++)for(int j=0;j<100;j++)map[i][j]='0';
		int hline=h*2-1;
		for(int i=0;i<hline;i++){
			if(i%2){
				for(int j=0;j<w;j++)cin>>map[i][2*j];
			}
			else {
				for(int j=0;j<w-1;j++)cin>>map[i][1+2*j];

			}
		}
//		show();
		solve();
	}
	return 0;
}

Measured memory_bytes: 0
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> A;


  return (A>=30 ? "Yes" : "No");
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}


Measured memory_bytes: 3632
fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }.sortedDescending()

    var sum = 0L
    for (i in 0 until n) {
        sum += aa[2*i+1]
    }

    println(sum)
}

Measured memory_bytes: 83044
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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

template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main() {
	double d, t, s;
	cin >> d >> t >> s;
	if (t >= d / s) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

const int K = 1e5 + 5;
const int N = 105;

int a[N];
bool win[K];
int n, k;

void read() {
  cin >> n >> k;
  for (int i = 0 ; i < n ; i++)
    cin >> a[i];
}

string work() {
  for (int i = 1 ; i <= k ; i++) {
    for (int j = 0 ; j < n ; j++)
      if (i >= a[j]) {
        win[i] |= (!win[i - a[j]]);
      }
  }
  return win[k] ? "First" : "Second";
}

int main() {
  read();
  cout << work() << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
// #define mod 1000000007LL
#define fi first
#define se second
const ll p = 1000000007;
const ll mod = 1000000007;
int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n+1),b(n+1);
    ll i,j;
    for(i=1;i<=n;i++)
        cin>>a[i]>>b[i];
    a[0] = -1;
    b[0] = -1;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    if(n%2!=0)
    {
        ll k = (n+1)/2;
        cout<<b[k]-a[k]+1;
    }
    else
    {
        ll x = n/2;
        ll y = n/2+1;
        ll m = a[x]+a[y];
        ll n = b[y]+b[x];
        if(m>n)
            swap(m,n);
        ll ans = n-m+1;
        cout<<ans;
    }
}   


Measured memory_bytes: 6424