akhauriyash/Code-Regression huggingface dataset:
#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; }

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

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  int k = 1;
  for (int i = 1; i*i <= N; ++i) {
    chmax(k, i*i);
  }
  cout << k << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

int main(){
  int m,n,kotae;
  cin>>n>>m;
  for(;;n++){
    if(m%n==0){
      break;
    }
    if(n>=500000000){
      cout<<1;
      return 0;
    }
  }
  kotae=m/n;
  cout<<kotae;
}

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

#define BUF 4
int main(void) {
  char num[BUF];
  scanf("%s", num);
  if (num[0] == '7' || num[1] == '7' || num[2] == '7') {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 1660
import bisect
from sys import stdin

N = int(input())

lines = stdin.readlines

l = [[int(i) for i in line.split()] for line in lines()]

An = l[0]
Bn = l[1]
Cn = l[2]


def main():
    An.sort()
    Cn.sort()

    ans = 0

    for Bi in Bn:
        # 以上
        lx = bisect.bisect_left(An, Bi)

        # より大きい
        ux = bisect.bisect(Cn, Bi)

        ans += lx * (N - ux)

    print(ans)
    return


main()


Measured memory_bytes: 25232
import java.util.Scanner;

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

    String s = input.nextLine();

    if (s.equals("SUN")) {
      System.out.println("7");
    } else if (s.equals("MON")) {
      System.out.println("6");
    } else if (s.equals("TUE")) {
      System.out.println("5");
    } else if (s.equals("WED")) {
      System.out.println("4");
    } else if (s.equals("THU")) {
      System.out.println("3");
    } else if (s.equals("FRI")) {
      System.out.println("2");
    } else if (s.equals("SAT")) {
      System.out.println("1");
    }
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

struct Monster {
    ll x, h;
};

std::istream &operator>>(std::istream &in, Monster &o) {
    cin >> o.x >> o.h;
    return in;
}

int main() {
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<Monster> monsters(n);
    rep(i, n) cin >> monsters[i];

    sort(monsters.begin(), monsters.end(), [](Monster &m1, Monster &m2) {
        return m1.x < m2.x;
    });

    vector<ll> positions(n);
    rep(i, n) positions[i] = monsters[i].x;
    vector<ll> damages(n);


    ll ans = 0;
    rep(i, n) {
        if (i != 0) damages[i] += damages[i - 1];
        ll h = monsters[i].h;
        ll da = damages[i] * a;
        h -= da;
        if (h <= 0) continue;
        ll c = (h + a - 1) / a;
        ans += c;
        damages[i] += c;
        ll r = monsters[i].x + (d * 2);
        auto it = upper_bound(positions.begin(), positions.end(), r);
        if (it == positions.end()) continue;
        int ri = distance(positions.begin(), it);
        damages[ri] -= c;
    }
    cout << ans << endl;
}


Measured memory_bytes: 9544
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
 
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
 
const int MAX_N = 17;
const int inf = (int)1e8;
int V;
 
int d[MAX_N][MAX_N];
int dp[MAX_N][1 << MAX_N];
int eat[MAX_N];
 
int tsp(int v, int b) {
    if(dp[v][b] != -1) return dp[v][b];
    if(v == 0 && b == 0) return 0;
    int res = inf;
    for(int i = 0; i < V; i++) {
        if(b & (1 << i)) {
            res = min(res, tsp(i, b ^ (1 << i)) + d[i][v] + eat[i]);
        }
    }
    return dp[v][b] = res;
}
 
int main() {
    while(true) {
        int N, M, L, S, T;
        cin >> N >> M >> L >> S >> T;
        if(N == 0 && M == 0 && L == 0 && S == 0 && T == 0) break;
        vector<vector<int> > D(N, vector<int>(N, inf));
        for(int i = 0; i < N; i++) {
            D[i][i] = 0;
        }
        for(int i = 0; i < M; i++) {
            int a, b, c; cin >> a >> b >> c;
            a--, b--;
            D[a][b] = c;
            D[b][a] = c;
        }
 
        REP(k,N) REP(i,N) REP(j,N) {
            D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
        }
 
 
        V = L + 1;
        vector<int> LS(V);
        S--;
        LS[0] = S;
        eat[0] = 0;
        for(int i = 1; i < V; i++) {
            cin >> LS[i];
            cin >> eat[i];
            LS[i]--;
        }
        REP(i,V) {
            REP(j,V) {
                d[i][j] = D[LS[i]][LS[j]];
            }
        }
 
        // REP(i,V) REP(j,V) cerr << i << "," << j << " = " << d[i][j] << endl;
 
        memset(dp, -1, sizeof(dp));
        int ans = 0;
        for(int b = 0; b < (1 << V); b++) {
            if(b & 1) { // 0 is houmonzumi
                int cost = tsp(0, b);
                if(cost <= T) ans = max(ans, __builtin_popcount(b) - 1);
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 10060
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
//to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */

int a = 0, n = 0, x = 0, y = 0, ans = 0, cnt = 0, sum = 0;
string s="";

int main(void) {

	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 1) {
		cout << "Borys" << rt;
	}
	else {
		cout << "Alice" << rt;
	}

	please AC;
}
//参考：---;

Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    X, A, B = ii(), ii(), ii()
    print((X - A) % B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10168
#include<iostream>
#include<queue>
#include<algorithm>
#include<string>

int main() {
	std::string str;
	std::priority_queue<int> v;

	std::cin >> str;

	while (str != "end") {
		if (str == "insert") {
			int num;
			std::cin >> num;
			v.push(num);
		} else {
			std::cout << v.top() << std::endl;
			v.pop();
		}
		std::cin >> str;
	}

	return 0;
}

Measured memory_bytes: 5980
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int n;
	int ans;
	int dp[35];
	dp[0]=0;
	dp[1]=0;
	dp[2]=1;
	while(cin>>n){
		if(n==0){
			break;
		}
		for(int i=3;i<n+3;i++){
			dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
		}
		if(dp[n+2]%3650==0){
			ans=dp[n+2]/3650;
		}
		else{
			ans=dp[n+2]/3650+1;
		}
		cout<<ans<<endl;
	}
}

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

int main() {
  int A, B, C, D, e, f;
  cin >> A >> B >> C >> D;
  e = C / B;
  f = A / D;
  if (C % B) e++;
  if (A % D) f++;
  if (e > f) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int s=0;
    for(;a<=b;a++){
	if(c%a==0)s++;
	}
	printf("%d\n",s);
}

Measured memory_bytes: 3204
import java.util.Scanner;


public class Main
{
   public static void main(String[] args)
   {
     Scanner in=new Scanner(System.in);
     int t,s,m,h;
     t=in.nextInt();
     h=t/3600;
     m=(t%3600)/60;
     s=t%60;
     System.out.println(h+":"+m+":"+s);
      
   }

}

Measured memory_bytes: 26256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;


int main()
{
	int K;
	int N[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

	
	cin >> K;
	
	cout << N[K - 1];
	

	return 0;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N;
	cin >>N;
	int S=N;
	for (int i=1; i*2<=N; i++) {
		int A=i;
		int B=N-i;
		int SS=0;
		while (A+B>0) {
			SS +=A%10;
			SS +=B%10;
			A /=10;
			B /=10;
		}
		S=min(S, SS);
	}
	cout <<S <<endl;
	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;

int main()
{
  string a,b;
  cin>>a>>b;
  if(floor(sqrt(stoi(a+b))) == ceil(sqrt(stoi(a+b)))) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int map[][] = new int[n][n];
        for (int i = 0; i < n; i++) {
            char c = s.charAt(i);
            for (int j = i + 1; j < n; j++) {
                char cc = s.charAt(j);
                if (c == cc) {
                    // 同じ数字を記録しておく
                    map[i][j] = 1;
                }
            }
        }
        int max = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n - 1; j++) {
                if (map[i + 1][j + 1] == 0) {
                    continue;
                }
                if (j + 1 - map[i][j] == i + 1) {
                    continue;
                }
                map[i + 1][j + 1] = map[i][j] + 1;
                max = Math.max(max, map[i + 1][j + 1]);
            }
        }
        System.out.println(max);
        sc.close();
    }
}


Measured memory_bytes: 168096
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;

const int MAXN = 300005;
int a[MAXN], s[MAXN], tr[MAXN << 2], ans, l, r;
vector<int> p[MAXN];

void build(int l, int r, int p)
{
    if(l == r)
    {
        tr[p] = a[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(l, mid, p << 1);
    build(mid + 1, r, p << 1 | 1);
    tr[p] = max(tr[p << 1], tr[p << 1 | 1]);
}

int query(int L, int R, int p)
{
    if(l <= L && R <= r)
        return tr[p];
    int mid = (L + R) >> 1, res = 0;
    if(l <= mid)
        res = max(res, query(L, mid, p << 1));
    if(r > mid)
        res = max(res, query(mid + 1, R, p << 1 | 1));
    return res;
}

int main()
{
    int h, w, m, x, y;
    scanf("%d%d%d", &h, &w, &m);
    for (int i = 1; i <= m; ++i)
    {
        scanf("%d%d", &x, &y);
        a[y] += 1;
        s[x] += 1;
        p[x].push_back(y);
    }
    build(1, w, 1);
    for (int i = 1; i <= h; ++i)
    {
        l = r = -1;
        int n = p[i].size();
        sort(p[i].begin(), p[i].end());
        for (int j = 0; j < n; ++j)
        {
            l = r + 2;
            r = p[i][j] - 1;
            if(r < l)
                continue;
            ans = max(ans, s[i] + query(1, w, 1));
        }
        l = r + 2;
        r = w;
        if(l <= r)
            ans = max(ans, s[i] + query(1, w, 1));
        for (int j = 0; j < n; ++j)
        {
            l = r = p[i][j];
            ans = max(ans, s[i] + query(1, w, 1) - 1);
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 26084
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int main(){
  int A, B;
  rd(A);
  rd(B);
  if((A+B)%2){
    wt_L("IMPOSSIBLE");
    wt_L('\n');
  }
  else{
    wt_L((A+B)/2);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// {
//   int A, B;
//   rd(A,B);
//   wt( if[(A+B)%2, "IMPOSSIBLE", (A+B)/2] );
// }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int g = m/n;
		while (m%g!=0) g--;
		System.out.println(g);
	}
}

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

using ll = long long;
using pii = pair<int, int>;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

#ifdef LOCAL
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else 
#define dump(x) true
#endif

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

constexpr ll INF = TEN(18);
constexpr int maxn = 200010;

map<int, ll> dp[maxn][2];

int main() {
	int N; cin >> N;
	V<int> a(N); rep(i, N) cin >> a[i];

	dp[0][0][0] = 0;

	auto reachable = [&](int i, int num, bool use) {
		return num + use + (N - i - use) / 2 >= N / 2;
	};

	rep(i, N) {
		rep(pr, 2) {
			for (auto p : dp[i][pr]) {
				int lnum = p.fi;
				rep(nx, 2) if (!(pr and nx)) {
					ll nval = p.se + (nx ? a[i] : 0);
					if (reachable(i, lnum, nx)) {
						if (dp[i+1][nx].count(lnum + nx)) {
							chmax(dp[i+1][nx][lnum + nx], nval);
						} else {
							dp[i+1][nx][lnum + nx] = nval;
						}
					}
				}
			}
		}
	}

	ll ans = -INF;
	rep(f, 2) {
		if (dp[N][f].count(N / 2)) {
			chmax(ans, dp[N][f][N / 2]);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 60252
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    int n,i;
    cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    int f=1;
    rep(i,n){
        if(a[i]%2==0){
            if(a[i]%3==0 || a[i]%5==0){
                f=1;
            }else{
                f=0;
                break;
            }
        }
    }
    if(f){
        cout<<"APPROVED";
    }else{
        cout<<"DENIED";
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  int t = 100*(N-M) + 1900*M;
  cout<<t*(1<<M)<<"\n";
  /*
  long double s = 0;
  rep(i, M) {
    (1/2)* 
  }
  cout << (long long)s << "\n";
  */
  return 0;
}


Measured memory_bytes: 256
function isInteger(inVal)
    return inVal%1 ..""=="0.0"
end

N, D = io.read("*n", "*n", "*l")
X = {}
for i = 1, N do
    X[i] = {}
    for j = 1, D do
        X[i][j] = io.read("*n")
    end
end

counter = 0
for i = 1, N do
    for j = 1, N do
        if i < j then
            sum = 0
            for k = 1, D do
                sum = sum + (X[i][k] - X[j][k])^2
                if k == D and isInteger(math.sqrt(sum)) then
                    counter = counter + 1
                end
            end
        end
    end
end
print(counter)

Measured memory_bytes: 376
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef unsigned long long ll;

#define INF 10e10
#define REP(i,n) for(int i=0; i<n; i++)
#define REP_R(i,n,m) for(int i=m; i<n; i++)
#define MAX 100

ll N;
ll T[MAX + 5];

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  // cout << "gcd: " << a << " " << b << endl;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  // cout << "lcm: " << (a * b) / g << endl;
  return a / g * b;
}

int main() {
  cin >> N;
  REP(i,N) cin >> T[i];

  ll ans = 1LL;

  REP(i,N) {
    ll target = T[i];
    // cout << "target: " << target << endl;
    ans = lcm(ans, target);
    // cout << "ans: " << ans << endl;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

int main(){
  string s;
  cin >> s;
  cout << s.at(0) << s.size()-2 << s.at(s.size()-1) << endl;
}

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

using namespace std;

int main()
{
	int A, B;
	int ans1, ans2;

	cin >> A >> B;

	ans1 = A * 12.5 + 0.5;
	ans2 = B * 10;

/*	for(int i = ans2;; i++){
		if(int(i * 0.08) == A && int(i * 0.1) == B){
			cout << i << endl;
			return 0;
		}else if(A < int(i * 0.08))
			break;
	}
*/
	// O(1)
	if(ans1 < ans2 && A == int(ans2 * 0.08)){
		cout << ans2 << endl;
		return 0;
	}else if(ans2 <= ans1 && B == int(ans1 * 0.1)){
		cout << ans1 << endl;
		return 0;
	}

	cout << "-1" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)

signed main() {
  ll n,k; cin >> n >> k;
  vector<ll> p(n), c(n);
  rep(i,n) {cin >> p[i]; p[i]--;}
  rep(i,n) cin >> c[i];

  vector<int> loopsize(n);
  vector<ll> loopvalue(n);
  vector<vector<ll>> a(n, vector<ll>(n, 0));

  rep(i,n) {
    ll current = i;
    ll ss = 0;
    ll val = 0;
    rep(j,n) {
      ss++;
      ll pnext = p[current];
      val += c[pnext];
      a[i][j] = c[pnext] + (j>0 ? a[i][j-1] : 0);
      current = pnext;
      if(current==i) {
        loopsize[i] = ss;
        loopvalue[i] = val;
        break;
      }
    }
  }

  ll ans = -1000000000;
  rep(i,n) {
    if(loopvalue[i] <= 0) {
      rep(j,loopsize[i]) ans = max(ans, a[i][j]);
    }
    else {
      ll loops = k / loopsize[i];

      ll base = loops * loopvalue[i];
      ans = max(ans, base);
      rep(j,k%loopsize[i]) ans = max(ans, base+a[i][j]);

      ll base2 = (loops-1) * loopvalue[i];
      rep(j,n) ans = max(ans, base2+a[i][j]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 198864
/*
userid : rakeshpvan333
*/
#include<bits/stdc++.h>

using namespace std;

#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define M 1000000007
#define MXN 1000007

int main()
{
    ll n;
    cin>>n;
    map<string,ll>m;
    string str,ans="Yes\n";
    char tmp = 'Z';
    while(n--)
    {
        cin>>str;
        m[str]++;
        if(m[str]>1)ans="No\n";
        if(tmp=='Z'||tmp==str[0])tmp=str[str.size()-1];
        else ans="No\n";
    }
    cout<<ans;
}

Measured memory_bytes: 256
from itertools import accumulate,chain
n,*s=open(0).read().split()
st=[[min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0)),2*s_.count("(")-len(s_)] for s_ in s]
now=0
for c,d in chain(sorted([x for x in st if x[1]>=0])[::-1],sorted([x for x in st if x[1]<0],key=lambda z:z[1]-z[0])[::-1]):
    if now+c<0:
        print("No");break
    now+=d
else:
    print("No" if now else "Yes")

Measured memory_bytes: 119380
#include<stdio.h>

int main(void){
 int i,j,k,l,n,count=0;
    while(scanf("%d",&n) != EOF){
count =0;
 for(i=0;i<10;i++){
      for(j=0;j<10;j++){
            for(k=0;k<10;k++){
                for(l=0;l<10;l++){
                    if(i+j+k+l == n) count++;
                }
            }
        }
 }
 printf("%d\n",count);


}
return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
   
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string n;
    cin>>n;
    long long int sum=0;
    for (int i=0;i<n.size();i++) sum+=n[i]-'0';
    if(sum%9) cout<<"No\n";
    else cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			while (true) {
				int n = sc.nextInt();
				if (n == 0)
					break;
				double sum = 0;
				int[] s = new int[n];
				for (int i = 0; i < n; i++) {
					s[i] = sc.nextInt();
					sum += s[i];
				}
				//平均値
				double m = sum / n;
				//α2 = (∑ni=1(si - m)2)/n
				double aa = 0;
				for (int i = 0; i < n; i++) {
					aa += Math.pow(s[i] - m, 2) / n;
				}
				System.out.println(Math.sqrt(aa));

			}

		}
	}
}


Measured memory_bytes: 31644
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int A[26] = {};
	bool ans = true;
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++)A[S[i] - 'a']++;
	for (int i = 0; i < 26; i++)if(A[i] % 2 != 0)ans = false;
	cout << (ans ? "Yes" : "No");
}


Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = {}
    ans = 0
    for i in range(n):
        x = a[i] - (i+1)
        if x in dic:
            ans += dic[x]
        y = -1 * a[i] - (i+1)
        if y in dic:
            dic[y] += 1
        else:
            dic[y] = 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 40320
from collections import deque
h, w, k = map(int, input().split())
maze = [input() for _ in range(h)]
visited = [[-1]*w for j in range(h)]
for i in range(h):
    if 'S' in maze[i]:
        sy, sx = i, maze[i].index('S')
queue = deque([[sy, sx]])
visited[sy][sx] = 0
r = 10**18
while queue:
    y, x = queue.popleft()
    r = min(r, y, x, h-1-y, w-1-x)
    if visited[y][x] == k: continue
    for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        new_y, new_x = y+i, x+j
        if new_y < 0 or new_y >= h: continue
        if new_x < 0 or new_x >= w: continue
        if maze[new_y][new_x] == '.' and visited[new_y][new_x] == -1:
            visited[new_y][new_x] = visited[y][x] + 1
            queue.append([new_y, new_x])
print(1 -(-r // k))

Measured memory_bytes: 58972
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    count=0
    for a in A:
        if a>=K:
            count+=1

    print(count)



if __name__ == "__main__":
    main()

Measured memory_bytes: 20172
#include <bits/stdc++.h>
#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(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#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 show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
inline ll lin() { ll x; scanf("%lld",&x); return x;}
inline char chin() { char x; scanf("%c",&x); return x;}
inline string stin() { string x; cin >> x; return x;}
inline double din() { double x; scanf("%lf",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }
char itoa(int n) { return n + '0';}
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  rep(i,m) {
    sum += in();
  }
  cout << (n-sum>=0 ? n-sum : -1) << endl;
  return 0;
}

Measured memory_bytes: 3744
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<complex>
#include<list>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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




const ll INF = 1e18+7;


/******************************************************************************************/

struct Point {
	double x;
	double y;
};


void koch(int n, Point p1, Point p2) {

	if (n == 0)return;

	Point s, t, u;

	double th = acos(-1) * 60.0 / 180.0;

	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

	koch(n - 1, p1, s);
	cout << s.x << " " << s.y << endl;
	koch(n - 1, s, u);
	cout << u.x << " " << u.y << endl;
	koch(n - 1, u, t);
	cout << t.x << " " << t.y << endl;
	koch(n - 1, t, p2);

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	int n;
	cin >> n;

	Point p1, p2;
	p1.x = 0;
	p1.y = 0;
	p2.x = 100;
	p2.y = 0;

	cout << p1.x << " " << p1.y << endl;
	koch(n, p1, p2);
	cout << p2.x << " " << p2.y << endl;


	return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A;
  cin >> A;
  if(A.at(0) == A.at(1)) {
    cout << "Bad" << endl;
  }
   else if(A.at(2) == A.at(1)) {
    cout << "Bad" << endl;
  }
  else if(A.at(2) == A.at(3)) {
    cout << "Bad" << endl;
  }
  else {
    cout << "Good" << endl;
  }
}

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

using namespace std;
typedef long long ll;

#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
const int maxn=1e5+5;
int a[maxn],b[maxn];

int main()
{
    int a,b;
    cin>>a;
    cin>>b;
    for(int i=1;i<=3;i++)
        if(i!=a&&i!=b)
        cout<<i<<endl;
    return 0;
}


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

#include<iomanip>
using namespace std;
// استغفر الله العظيم
// عليه افضل الصلاه والسلام

int main()
{
	int n, m; cin >> n >> m;
	vector<vector<long long>>s(n, vector<long long>(2));
	vector<vector<long long>>ch(m, vector<long long>(2));
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < 2; ++j)
		{
			cin >> s[i][j];
		}
	}
	for (int i = 0; i < m; ++i)
	{
		for (int j = 0; j < 2; ++j)
		{
			cin >> ch[i][j];
		}
	}
	long long mn, sum = 0,t=0;
	for (int i = 0; i < n; ++i)
	{
		 mn = 10e11;
		for (int j = 0; j < m; ++j)
		{
			sum = 0;
			for (int k = 0; k < 2; ++k)
			{
				sum += abs(s[i][k] - ch[j][k]);
			}
			if (mn > sum)
			{
				mn = sum;
				t = j + 1;
			}
		}
		cout << t << endl;
	}

}

Measured memory_bytes: 3172
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

L = int(sys.stdin.buffer.readline())

ans = (L / 3) ** 3
print(ans)


Measured memory_bytes: 23932
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pri = lambda x: print(*x, sep='\n')

L = list(map(int, input().split()))
K = int(input())

L.sort()
val = L[0] + L[1] + L[2]*pow(2, K)
print(val)

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

int main()
{
  string s;
  cin>>s;
  for(int i=0;i<s.length();i++)
  {
    if(s[i] == '1')
      s[i]='9';
    else if(s[i] == '9')
      s[i] = '1';
  }
  cout<<s;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

	int N;
	cin >> N;
	vector<int> inputs(N);
	for (int i = 0; i < N; i++) {
		cin >> inputs[i];
	}

	vector<int> ans(N);
	for (int i = 1; i < N; i++) {
		ans[0] = ans[0] xor inputs[i];
	}
	for (int i = 1; i < N; i++) {
		ans[i] = inputs[0] xor inputs[i] xor ans[0];
	}

	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
	return 0;

}


Measured memory_bytes: 4820
def check_subseq(s):
    subseq_list = []
    tmp_length = 1
    for i in range(1, len(s)):
        if s[i - 1] == s[i]:
            tmp_length += 1
        else:
            if tmp_length >= 2:
                subseq_list.append(tmp_length)
            tmp_length = 1
        
    if tmp_length >= 2:
        subseq_list.append(tmp_length)

    return subseq_list


s = input()
k = int(input())

if s[0] == s[-1]:
    if len(set(s)) == 1:
        ans = len(s) * k // 2
    else:
        i = 1
        while True:
            if s[i] != s[-1]:
                first_subseq_length = i
                break
            i += 1

        i = 1
        while True:
            if s[-(i + 1)] != s[0]:
                last_subseq_length = i
                break
            i += 1

        # print(first_subseq_length, last_subseq_length)
        s = s[first_subseq_length:] + s[:first_subseq_length]
        subseq_list = check_subseq(s)
        ans = sum(map(lambda x: x // 2, subseq_list)) * k
        ans += first_subseq_length // 2 + last_subseq_length // 2 - subseq_list[-1] // 2
else:
    subseq_list = check_subseq(s)
    ans = sum(map(lambda x: x // 2, subseq_list)) * k
print(ans)



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

int main() {
  int x = 1;
  int N, K;
  cin >> N >> K;
  for(int i = 0;i < N;i++){
    int A = 2 * x;
    int B = x + K;
    x = min(A , B);
  }
  cout << x << endl;
}


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

using namespace std;

int main()
{
    int N, M;
    int A[128];
    int sc[128] = {0};
    
    scanf("%d %d", &N, &M);
    
    for (int i = 0; i < M; i++) scanf("%d", A + i);
    
    for (int i = 0; i < M; i++){
        int wa = 0;
        for (int j = 0; j < N; j++){
            int x;
            scanf("%d", &x);
            sc[j + 1] += A[i] == x;
            wa += A[i] != x;
        }
        sc[A[i]] += wa;
    }
    
    for (int i = 1; i <= N; i++) printf("%d\n", sc[i]);
    
    return (0);
}

Measured memory_bytes: 1188
import java.util.Scanner;
public class Main{ 
public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
    int h,m,s=0;
      int S = sc.nextInt();
       h=S/3600;
       m=(S%3600)/60;
       s=S%60;
    
      
 
      System.out.println(h+":"+m+":"+s);
		 sc.close();

 
    }
}


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

int main() {
  int X;
  cin >> X;
  
  if(X >= 400 & X <= 599){
    cout << 8 << endl;
  }
   if(X >= 600 & X <= 799){
    cout << 7 << endl;
  }
   if(X >= 800 & X <= 999){
    cout << 6 << endl;
  }
   if(X >= 1000 & X <= 1199){
    cout << 5 << endl;
  }
   if(X >= 1200 & X <= 1399){
    cout << 4 << endl;
  }
   if(X >= 1400 & X <= 1599){
    cout << 3 << endl;
  }
   if(X >= 1600 & X <= 1799){
    cout << 2 << endl;
  }
   if(X >= 1800 & X <= 1999){
    cout << 1 << endl;
  }
  
}

Measured memory_bytes: 3572
#include<stdio.h>
#include<string>
#include<iostream>

using namespace std;

int main(void){


int a,b;

cin >> a;
cin >> b;

int k;

if ((a+b) %2 == 0){
  k = (a+b)/2;
}
else{
  k = (a+b)/2 + 1;
}

  cout << k << endl;

return 0;



}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a*b)>c)
        {
            cout<<c;
        }
    else if ((a*b)<c)
        {
            cout<<a*b;
        }
    else if((a*b)==c)
        {
            cout<<a*b||c;
        }
    return 0;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n, m = map(int, input().split())
    all = []
    for i in range(n):
        all.append(list(map(int, input().split())))
    all.sort()
    for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 27316
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n;
    cin >> n;
    long long a[n+1];
    rep(i,n+1){
        cin >> a[i];
    }
    long long b[n];
    rep(i,n){
        cin >> b[i];
    }
    long long ans = 0;
    rep(i,n){
        if(a[i]<=b[i]){
            b[i]-=a[i];
            ans+=a[i];
            if(a[i+1]<=b[i]){
                ans+=a[i+1];
                a[i+1]=0;
            }
            else{
                a[i+1]-=b[i];
                ans+=b[i];
            }
        }
        else{
            ans+=b[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<
    pair<int, int>,
    null_type,
    less_equal<pair<int, int>>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define lb(v, z) lower_bound(all(v), z)
#define ub(v, z) upper_bound(all(v), z)
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define rdp(i, a, b) for (int i = (a); i >= (b); i--)
#define rlt(i, a, b) for (int i = (a); i < (b); i++)
#define cns(z) cout << (z) << ' '
#define cnl(z) cout << (z) << '\n'
#define M1 1000000007
#define M2 998244353
#define MAXN 300005
#define INF (1ll << 60)
#define endl "\n"
#define garr(ip)       \
    for (auto &x : ip) \
        cin >> x;
#define parr(ip)          \
    for (auto &x : ip)    \
        cout << x << " "; \
    cout << endl;
#define nl cout << endl
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vp;

void solve(int testCaseNumber = 1)
{
    int n, k;
    cin >> n >> k;
    set<int> s;
    rep(i, 1, k)
    {
        int d;
        cin >> d;
        rep(j, 1, d)
        {
            int foo;
            cin >> foo;
            s.insert(foo);
        }
    }
    cnl((n - (int)s.size()));
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

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

int main()
{
	string str;
	cin >> str;
	sort(str.begin(), str.end());
	if (str == "abc") {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
typedef long long ll;
int main() {
	ll a, b, c, k;
	ll sa;
	std::cin >> a >> b >> c >> k;
	sa = a - b;
	if (sa > 1000000000000000000) {
		std::cout << "Unfair" << std::endl;
	}
	if (k % 2 == 1) {
		std::cout << -1 * sa << std::endl;
	}
	else {
		std::cout << sa << std::endl;
	}
}

Measured memory_bytes: 256