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

namespace AC {
#define ll long long
#define PLL pair<ll, ll>
#define PDD pair<double, double>
#define PDPLL pair<double, PLL>
#define PLPLL pair<ll, PLL>
#define pb push_back
#define fi first
#define se second
#define ls rt << 1
#define rs rt << 1 | 1

    const ll N = 1e5 + 66;

    ll BUGS = 1;

    inline ll read(){
        ll x = 0;    bool flag = 1;   char ch = getchar();
        while(ch < '0' || ch > '9') { if(ch == '-') flag = 0; ch = getchar(); }
        while(ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); }
        if(flag) return x;  return (~(x - 1));
    }

    inline void read(ll arr[], ll s, ll e) { for(ll i = s; i <= e; ++i) arr[i] = read(); }

    inline void write(ll x){
        if(x < 0) { x = ~(x - 1); putchar('-'); }
        if(x > 9) write(x / 10); putchar(x % 10 + '0');
    }

    inline void print(ll x) { write(x); puts(""); }

    inline void print(ll arr[], ll s, ll e) {
        for(ll i = s; i <= e - 1; ++i) write(arr[i]), putchar(' ');
        write(arr[e]); puts("");
    }

    inline ll max3(ll a, ll b, ll c) { return max(a, max(b, c)); }

    inline ll min3(ll a, ll b, ll c) { return min(a, min(b, c)); }

    inline void debugNum(ll num, string ss) { cout << "BUGS" << BUGS++ << " : " << ss << " : " << num << endl; }

    inline void debugArr(ll arr[], ll s, ll e, string ss) {
        cout << "BUGS" << BUGS++ << " : " << ss << " : " << endl;
        for(ll i = s; i <= e; ++i) cout << "i : " << i << " val : " << arr[i] << endl;
    }

    inline void IO() {
        //ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
        //cout << setiosflags(ios::fixed) << setprecision(1); //保留小数点后1位
        //cout << setprecision(1); //保留1位有效数字
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
}using namespace AC;

ll n, arr[N], cnt[N];

int main() {
    //IO();
    while(~scanf("%lld", &n)) {
        for(ll i = 1; i <= n; ++i){
            cnt[i] = 0;
        }
        ll sum = 0;
        for(ll i = 1; i <= n; ++i) {
            arr[i] = read();
            sum += arr[i];
            cnt[arr[i]]++;
        }
        ll Q = read();
        while(Q--) {
            ll a = read(), b = read();
            if(cnt[a] == 0) {
                print(sum);
                continue;
            }
            sum = sum + cnt[a] * (-a + b);
            cnt[b] += cnt[a];
            cnt[a] = 0;
            print(sum);
        }
    }
    return 0;
}



Measured memory_bytes: 5312
#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 fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int k, s = 0;
  cin >> k;
  rep(i, k){
    rep(j, k){
      rep(l, k) s += __gcd(i+1, __gcd(j+1, l+1)); 
    }
  }
  cout << s << endl;
  return 0;
}

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

int main()
{
	long n;
	vector<long> data(5);
	cin >> n >> data[0] >> data[1] >> data[2] >> data[3] >> data[4];

	size_t minIndex = distance(data.begin(), min_element(data.begin(), data.end()));
	long minVal = data[minIndex];

	long NumOfGroup = ceil(n * 1.0 / minVal);
	cout << NumOfGroup - 1 + 5 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    long long a=100000;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        a*=1.05;
        if(a%1000==0)
            a-=1000;
        a/=1000;
        a*=1000;
        a+=1000;
    }
    cout<<a<<endl;
    return 0;
}
 

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

typedef complex<double> Point;

double angle(const Point& v1, const Point& v2) {
    double res = arg(v1 / v2);
    if (res < 0) res += 2*pi;
    return min(2*pi-res, res);
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n; cin >> n;
    double R, th; cin >> R >> th; th *= pi / 180;
    vector<Point> v(n);
    REP(i, n) {
        ll x, y; cin >> x >> y;
        v[i] = Point(x, y);
    }
    vector<vector<vector<bool>>> G(n, vector<vector<bool>>(n, vector<bool>(n, false)));
    REP(i, n) REP(j, n) REP(k, n) {
        if (i == j || j == k || k == i) continue;
        // i -> j -> k ??¨????????????
        Point v1 = v[j] - v[i];
        Point v2 = v[k] - v[j];
        if (angle(v1, v2) <= th+eps) {
            G[i][j][k] = true;
        }
    }
    vector<vector<double>> dist(n, vector<double>(n));
    REP(i, n) REP(j, n) dist[i][j] = abs(v[i]-v[j]);
    ll ans = 0;
    vector<vector<vector<double>>> dp(2, vector<vector<double>>(n, vector<double>(n, linf)));
    dp[0][0][0] = 0;
    REP(t, 10010) {
        dp[t+1&1].assign(n, vector<double>(n, linf));
        REP(prev, n) REP(now, n) {
            double l = dp[t&1][prev][now];
            if (l > R+eps) continue;
            ans = max(ans, t);
            REP(to, n) {
                if (prev != now && !G[prev][now][to]) continue;
                if (now == to) continue;
                dp[t+1&1][now][to] = min(dp[t+1&1][now][to], l + dist[now][to]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt(), m = in.nextInt();

		int[] len = new int[N], pCnt = new int[N];
		ArrayList<Integer>[] chldList = new ArrayList[N];
		for ( int i = 0; i < N; i++ ) {
			chldList[i] = new ArrayList<Integer>();
		}

		for ( int i = 0; i < m; i++ ) {
			int x = in.nextInt() - 1, y = in.nextInt() - 1;
			chldList[x].add(y);
			pCnt[y]++;
		}
		in.close();

		// 始点サーチ
		ArrayDeque<Integer> toCheck = new ArrayDeque<>();
		for ( int i = 0; i < N; i++ ) {
			if ( pCnt[i] == 0 ) toCheck.add(i);
		}

		// BFSで距離計算開始
		int lenMax = 0;
		while ( toCheck.size() > 0 ) {
			Integer node = toCheck.pollFirst();
			for ( Integer chld : chldList[node] ) {
				pCnt[chld]--;
				len[chld] = Math.max(len[node] + 1, len[chld]);
				lenMax = Math.max(lenMax, len[chld]);
				if ( pCnt[chld] == 0 ) {
					toCheck.add(chld);
				}
			}
		}
		System.out.println(lenMax);
	}
}

Measured memory_bytes: 104680
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<numeric>
#include<string>
#include<deque>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
const double PI = acos(-1);  // PI = 3.141593...

struct pos {
    int x;
    int y;
    pos(int x=0, int y=0):x(x), y(y) {}
};

deque<pos> dq;
int max_depth = 0;
pos last;
int h, w;

void bfs(vector<vector<int>>& maze) {
    vector<vector<int>> map(h+2, vector<int>(w+2, -1));
    pos p = dq.front();
    map[p.x][p.y] = 0;
    while(!dq.empty()) {
        p = dq.front();
        dq.pop_front();
        if(maze[p.x-1][p.y] == 0 && map[p.x-1][p.y] == -1) {
            dq.push_back(pos(p.x-1, p.y));
            map[p.x-1][p.y] = map[p.x][p.y] + 1;
        }
        if(maze[p.x+1][p.y] == 0 && map[p.x+1][p.y] == -1) {
            dq.push_back(pos(p.x+1, p.y));
            map[p.x+1][p.y] = map[p.x][p.y] + 1;
        }
        if(maze[p.x][p.y-1] == 0 && map[p.x][p.y-1] == -1) {
            dq.push_back(pos(p.x, p.y-1));
            map[p.x][p.y-1] = map[p.x][p.y] + 1;
        }
        if(maze[p.x][p.y+1] == 0 && map[p.x][p.y+1] == -1) {
            dq.push_back(pos(p.x, p.y+1));
            map[p.x][p.y+1] = map[p.x][p.y] + 1;
        }
    }
    if(max_depth < map[p.x][p.y]) {
        max_depth = map[p.x][p.y];
    }
}

int main() {
    cin >> h >> w;
    if(h == 1 && w == 1) cout << 0 << endl;

    vector<vector<int>> maze(h+2, vector<int>(w+2, -1));
    for(int i=1; i<=h; ++i) {
        for(int j=1; j<=w; ++j) {
            char tmp;
            cin >> tmp;
            if(tmp=='.') maze[i][j] = 0;
        }
    }

    for(int i=1; i<=h; ++i) {
        for(int j=1; j<=w; ++j) {
            if(maze[i][j] == 0) {
                dq.push_back(pos(i,j));
                bfs(maze);
            }
        }
    }
    cout << max_depth << endl;
    return 0;
}

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

using namespace std;

const int N = 1e5 + 10;

int n, m, h[N], ma[N];

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
		ma[i] = 0;
	}
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
	    ma[x] = max(ma[x], h[y]);
		ma[y] = max(ma[y], h[x]); 
	}
	
	int res = 0;
	for (int i = 1; i <= n; i++) res += h[i] > ma[i];
	
	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 4424
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
long long int h;
int main()
{
    cin >> h;
    long long int p = 1 , ans = 0;
    while(h > 0){
        h /= 2;
        ans += p;
        p *= 2;
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
	int i, N, A[100001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	
	int count[100001] = {}, sum = 0;
	for (i = 1; i <= N; i++) count[A[i]]++;
	for (i = 1; i <= 100000; i++) {
		if (count[i] > 0) count[0]++;
		if (count[i] > 1) sum += count[i] - 1;
	}
	
	if (sum % 2 == 0) printf("%d\n", count[0]);
	else printf("%d\n", count[0] - 1);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1024
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let mut wa: Vec<usize> = vec![0; 100001];
    for i in 1..100001 {
        if i % 2 == 0 {
            wa[i] = wa[i - 1];
        } else {
            if is_prime(i) && is_prime((i + 1) / 2) {
                wa[i] = wa[i - 1] + 1;
            } else {
                wa[i] = wa[i - 1];
            }
        }
    }

    let mut result = String::new();

    let q: usize = iterator.next().unwrap().parse().unwrap();
    for _ in 0..q {
        let l: usize = iterator.next().unwrap().parse().unwrap();
        let r: usize = iterator.next().unwrap().parse().unwrap();
        let ans = wa[r] - wa[l - 1];
        result.push_str(&format!("{}\n", ans));
    }

    return result.trim().to_string();
}

fn is_prime(n: usize) -> bool {
    if n <= 1 {
        return false;
    }
    if n == 2 {
        return true;
    }
    if n % 2 == 0 {
        return false;
    }
    let mut i: usize = 3;
    while i * i <= n {
        if n % i == 0 {
            return false;
        }
        i += 2;
    }
    return true;
}


Measured memory_bytes: 8828
C = [list(map(int, input().split())) for _ in range(3)]

x = C[0][0]
a = [c[0] - x for c in C]
b = [C[0][i]-a[0] for i in range(3)]

ans = "Yes"
for i in range(3):
    for j in range(3):
        if C[i][j] != a[i] + b[j]:
            ans = "No"

print(ans)


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

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

    int ans=1001;
    int minC=1001;

    for(int i=0;i<n;i++){
        int c,t;    cin>>c>>t;
        
        if(t<=T && c<ans)ans=c;
    }
    if(ans==1001)cout<<"TLE"<<endl;
    else cout<<ans<<endl;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std; 
typedef long long ll;
typedef unsigned long long ull;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/


int main() {
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans[4];
  ans[0]=a*c;
  ans[1]=a*d;
  ans[2]=b*c;
  ans[3]=b*d;
  ll max = -9223372036854775806;
  rep(i,4){
    if(ans[i] > max) max=ans[i];
  }
  cout << max;
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main() {
    int N, K; cin >> N >> K;
    vector<char> d;
    rep(i, K) {
        char c; cin >> c;
        d.emplace_back(c);
    }

    int ans = N;
    while (true) {
        string s = to_string(ans);
        bool flg = true;
        for (int i = 0; i < s.length(); i++) {
            for (int j = 0; j < d.size(); j++) {
                if (s[i] == d[j]) flg = false;
            }
        }
        if (flg) {
            cout << ans << endl;
            return 0;
        } else {
            ans++;
        }
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            while (a[i] != 0 && a[i] % 2 == 0) {
                a[i] /= 2;
                ans++;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 35576
program sample
	implicit none
    integer(8) :: i,j,k,l,m
    
    read(*,*) i
    
    if (mod(i,2)==0) then
    	write(*,*) (i/2)**2
    else
    	write(*,*) ((i+1)/2)*(i/2)
    end if
        
    
    
    
    stop
end program sample

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

int main(){
   string s,t,u;
   int a,b;
   cin >> s >> t >> a >> b >> u;
   if(u==s){
       cout << a-1 << " " << b << endl;
   }else{
       cout << a << " " << b-1 << endl;
   }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  string S, T; cin >> S >> T;
  map<char, char> m1, m2;
  for (int i = 0; i < S.size(); ++i) {
    if (m1.count(S[i]) && m1[S[i]] != T[i]) {
      cout << "No" << endl;
      return 0;
    } else if (m2.count(T[i]) && m2[T[i]] != S[i]) {
      cout << "No" << endl;
      return 0;
    } else {
      m1[S[i]] = T[i];
      m2[T[i]] = S[i];
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3840
#include<stdio.h>

int main(void) {
   int i;
   int k, a, b;
   int cnt = 0;

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

   for(i = a; i <= b; i++) {
      if(i%k == 0) {
         cnt = 1;
      }
   }

   if(cnt == 1) {
      printf("OK");
   } else {
      printf("NG");
   }

   return 0;
}

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

#define int long long
const int MOD = 1e9 + 7;
const int INF = 1 << 29;

struct node{
  string name;
  int id;
  int score;
};


bool cmp(node a, node b){
  if (a.name == b.name) return a.score > b.score;
  return a.name < b.name;
}

void solve(){
  int n;
  cin >> n;
  vector<node> v(n);
  for (int i = 0; i < n; i++){
    cin >> v[i].name >> v[i].score;
    v[i].id = i + 1;
  }
  sort(v.begin(), v.end(), cmp);
  for (auto it : v)
    cout << it.id << endl;
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	long long int sum = 0;
	vector<long long int> getuptime;
	for(int i = 0; i < n; i++){
		long long int a, b;
		cin >> a >> b;
		getuptime.push_back((sum + a) % 86400);
		sum += a + b;
		sum = sum % 86400;
	}
	sort(getuptime.begin(), getuptime.end());
	for(int i = 0; i < n; i++){
		getuptime.push_back(getuptime[i] + 86400);
	}
	int r = 0;
	int ans = 0;
	for(int i = 0; i < getuptime.size(); i++){
		while(r < getuptime.size() && getuptime[r] - getuptime[i] <= 10800){
			r++;
		}
		ans = max(r - i, ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
#include <bitset>
using namespace std;

#define INF 1e9
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n;
    int a = 0, b = 0, c = 0, d = 0;
    cin >> n;
    vector<string> s(n);
    rep(i, n) {
        cin >> s.at(i);
    }
    rep(i, n) {
        if (s.at(i) == "AC") a++;
        else if (s.at(i) == "WA") b++;
        else if (s.at(i) == "TLE") c++;
        else if (s.at(i) == "RE") d++;
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
}

Measured memory_bytes: 6424
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define ll long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int n; cin>>n;
    vector<int>a(n+1,0);
    rep(i,1,n-1)
    {
        int k; cin>>k;
        a[k]++;
    }
    rep(i,1,n)
    {
        cout<<a[i]<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3972
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: OddString
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  string s;
  cin >> s;

  for (int i = 0; i < s.size(); i++)
    if (! (i & 1)) putchar(s[i]);
  putchar('\n');
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

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

  string s;
  cin >> s;
  if (s == "RRR") {
    cout << 3 << endl;
    return 0;
  }
  if ((s == "RRS") || (s == "SRR")) {
    cout << 2 << endl;
    return 0;
  }
  for (int i = 0; i < 3; i++) {
    if (s[i] == 'R') {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
  
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    int a = 0;
    int b = 0;
    int cnta = 0;

    for (char c : S)
    {
        if ('(' == c)
        {
            cnta += 1;
        }else
        {
            if (cnta > 0)
            {
                cnta -= 1;
            }else
            {
                a += 1;
            }
            
        }
        
    }

    b = cnta;

    for (int i = 0; i < a; i++)
    {
        cout << '(';
    }
    
    cout << S;

    for (int i = 0; i < b; i++)
    {
        cout << ')';
    }
    
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int INF = 2e6;
 
 
int main(){
    int n; cin >> n;
    vector<ll> t(n);
    rep(i,n) cin >> t[i];
    ll g = 1,l;
    for(int i = 0;i < n - 1;i++) {
        g = __gcd(t[i+1],t[i]);
        l = (t[i+1] / g) * (t[i] / g) * g;
        t[i+1] = l;
    }
    cout << t[n-1] << endl;
}

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

int main(){
  int N, mcount=0;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++){
    cin >> A[i];
    if (A[i]<0){
      mcount++;
      A[i] *= -1;
    }
  }

  long long ans = 0;
  if (mcount%2==0){
    for (int i = 0; i < N; i++){
      ans += A[i];
    }
    printf("%llu\n", ans);
  }else{
    sort(A, A+N);
    for (int i = 1; i < N; i++){
      ans += A[i];
    }
    printf("%llu\n", ans - A[0]);
  }
  
}


Measured memory_bytes: 4532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

pair<int, bool> P[100001];
bool dame[100001];

pair<int, bool> Find(int A) {
	if (P[A].first < 0) return mp(A, 0);
	auto p = Find(P[A].first);
	P[A].first = p.first;
	P[A].second ^= p.second;
	return P[A];
}

bool Unite(int A, int B) {
	auto a = Find(A);
	auto b = Find(B);
	if (a.first == b.first) {
		if(a.second == b.second) dame[a.first] = true;
		return false;
	}
	if (P[a.first].first > P[b.first].first) swap(a, b);
	P[a.first].first += P[b.first].first;
	dame[a.first] |= dame[b.first];
	P[b.first] = mp(a.first, !(a.second ^ b.second));
	return true;
}

int Size(int A) {
	return -P[Find(A).first].first;
}

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


	int N, M;
	cin >> N >> M;
	rep1(i, N) P[i] = mp(-1, 0);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		Unite(a, b);
	}

	ll x = 0, y = 0, z = 0;
	rep1(i, N) {
		if (Find(i).first == i) {
			if (Size(i) > 1) {
				if (dame[i]) y++;
				else x++;
			}
			else z++;
		}
	}
	co(x * x + (x + y) * (x + y) + 2 * N * z - z * z);

	Would you please return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n;
	cin >> n;
	n--;
	vector<int> c(n), s(n), f(n);
	for(int i = 0; i < n; i++) {
		cin >> c[i] >> s[i] >> f[i];
	}
	for(int i = 0; i < n; i++) {
		int tim = s[i] + c[i];
		for(int j = i + 1; j < n; j++) {
			int k = 0;
			while(s[j] + f[j] * k < tim) {
				k++;
			}
			tim = s[j] + f[j] * k + c[j];
		}
		cout << tim << endl;
	}
	cout << 0 << endl;
	return 0;	
}


Measured memory_bytes: 256
M=9;main(n,i,j,k,a,b,c){
	float p=atan(1)*4/9,X[100],Y[100],x,y;
	for(;scanf("%d",&n),n;printf("%d\n",a)){
		for(i=0;i<n;i++)scanf("%f,%f",X+i,Y+i);
		for(a=i=0;i<n;a=a>b?a:b,i++)for(b=k=0;k<9;b=b>c?b:c,k++)for(x=X[i]+cos(p*k),y=Y[i]+sin(p*k),c=j=0;j<n;j++)
			if(hypot(X[j]-x,Y[j]-y)<1+1e-3)c++;
	}
exit(0);}

Measured memory_bytes: 648
import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

@njit((), cache=True)
def compute():
    f = np.zeros(10_001, np.int64)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                n = x * x + y * y + z * z + x * y + x * z + y * z
                if n > 10000:
                    continue
                f[n] += 1
    return f

f = compute()

for n in range(1, N + 1):
    print(f[n])

Measured memory_bytes: 110260
#include<bits/stdc++.h>
using namespace std;
#define fine cout<<"fine"<<endl;
#define ll long long int
#define pb push_back
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
const ll inf=(ll)2e18;
const int mod=1e9+7;
bool overflow(ll a,ll b){
    if (a <= (inf+b-1)/b) return false;
    return true;
}
int aux[1000005];
int main(){
FASTIO;
memset(aux,0,sizeof(aux));
int n,i,j,count=0;
cin>>n;
int a[n];
for(i=0;i<n;i++){
    cin>>a[i];
    aux[a[i]]++;
}
for(i=0;i<n;i++){
    aux[a[i]]--;
    for(j=1;j*j<=a[i];j++){
        if(a[i]%j==0){
            if(aux[j]){
                break;
            }
            int x=a[i]/j;
            if(aux[x])
                break;
        }
    }
    if(j*j>a[i])
        count++;
    aux[a[i]]++;
}
cout<<count<<endl;
}


Measured memory_bytes: 8336
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

template <class T>
std::vector<T> enum_div(T n) {
    std::vector<T> ret;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

bool isPrime(ll num) {
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    for (ll i = 3; i * i <= num; i += 2) {
        if (num % i == 0) { return false; }
    }

    return true;
};

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

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

template <class T>
bool is_integer(T x) {
    return std::floor(x) == x;
}

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, A, B;
    cin >> N >> A >> B;
    ll ans = (N / (A + B)) * A;
    ans += min(N % (A + B), A);
    cout << ans << endl;
    return 0;
}


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


using namespace std;

int main() {
    int N, M, tmp1,tmp2;
    long long int ans = 0;
    cin >> N >> M;
    vector<pair<long long  int, long long int>> D(N);

    for (int i = 0; i < N; i++) {
        cin >> tmp1 >> tmp2;
        D[i].first = tmp1;
        D[i].second = tmp2;
    }

    sort(D.begin(), D.end());

    int i = 0;

    while (M != 0) {
        if (M > D[i].second) {
            ans += D[i].first * D[i].second;
            M -= D[i].second;
        }
        else {
            ans += D[i].first * M;
            M = 0;
        }
        i++;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define INF 2000000000	//int型は2 * 10^9ぐらいまで
#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int x, y, ans;
	cin >> x >> y;
	bool xsei = 1, ysei = 1;
	if(x < 0) xsei = 0;
	if(y < 0) ysei = 0;

	if(xsei == 1 && ysei == 1){
		if(x < y) ans = y - x;
		else ans = x - y + 2;  
	}
	elif(xsei == 1 && ysei == 0){
		if(x <= abs(y)) ans = abs(y) - x + 1;
		else ans = x - abs(y) + 1;
	}
	elif(xsei == 0 && ysei == 1){
		if(abs(x) <= y) ans = y - abs(x) + 1;
		else ans = abs(x) - y + 1;
	}
	else{
		if(x > y) ans = abs(y) - abs(x) + 2;
		else ans = y - x;
	}

	if(x == 0){
		if(y < 0) ans = abs(y) + 1;
		else ans = y;
	}
	elif(y == 0){
		if(x < 0) ans = abs(x);
		else ans = x + 1;
	}

	cout << ans << endl;
	
	rtn 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

A,B,K = inpl()
taka = True

for i in range(K):
    if taka:
        A -= A%2
        A,B = A//2,B+A//2
    else:
        B -= B%2
        B,A = B//2,A+B//2

    taka = not taka

print(A,B)


Measured memory_bytes: 4588
n = int(input())
s = list(input())

def solve(x,y):

    sx = set(x)
    sy = set(y)
    s_com = sx & sy
    return len(s_com)

ans = 0
for i in range(n):
    x = s[:i]
    y = s[i:]
    ans = max(ans,solve(x,y))

print(ans)





Measured memory_bytes: 9068
open Scanf
open Printf

let rotation (c11, c12, c13) (c21, c22, c23) =
  if c11 = c23 && c12 = c22 && c13 = c21 then "YES" else "NO"

let c11, c12, c13 = sscanf (read_line ()) "%c%c%c" (fun a b c -> (a, b, c))
let c21, c22, c23 = sscanf (read_line ()) "%c%c%c" (fun a b c -> (a, b, c))

let () = printf "%s\n" (rotation (c11, c12, c13) (c21, c22, c23))

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



int main() {
    long long int n;
    cin>>n;
    if(n==0){
        cout <<0 << endl;
        return 0;
    }
    long long int count=0;
    if(n%2==1){
        cout <<0 << endl;
        return 0;
    }
    else{
        n/=10;
        count+=n;
        while(n>0){
            n/=5;
            count+=n;
        }
    }
    cout << count << endl;



    return 0;    
}


Measured memory_bytes: 3644
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        static long[] lucas;

        static void createLucasNumber(long max) {
            for (int i = 2; i < max; i++) {
                lucas[i] = lucas[i - 1] + lucas[i - 2];
            }
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            final int max = 87;
            lucas = new long[max];
            lucas[0] = 2;
            lucas[1] = 1;
            createLucasNumber(max);
            out.println(lucas[in.nextInt()]);
        }

    }
}



Measured memory_bytes: 23636
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
    string str;
    getline(cin,str);
    for(int i= 0;i<str.size();i++)
	{
        str[i] = toupper(str[i]);
    }
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 1176
#include <iostream>
using namespace std;
int main() {
  int N; cin >> N;
  int A[200];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }
    if (minj != i) {
      int temp = A[i];
      A[i] = A[minj];
      A[minj] = temp;
      cnt++;
    }
  }

  for (int i = 0; i < N; i++) {
    cout << A[i];
    if (i != N-1) {
      cout << " ";
    } else {
      cout << endl;
    }
  }
  cout << cnt << endl;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define INF 100000000000000000ll
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
 
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output
int main() 
{ 
	fastio;
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}

	int dp[n];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for (int i = 2; i<n; ++i)
	{
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1]<<endl;
	
} 

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    int N;
    cin >> N;
    vector <int> a(N);
    REP(i,N)cin >> a[i];
    sort(a.begin(),a.end());

    vector <ll> sum_a(N);
    REP(i,N)
    {
        if(i == 0)sum_a[i] = a[i];
        else
        {
            sum_a[i] = sum_a[i-1] + a[i];

        }
    }


    //最後まで生き残るポテンシャルを持っているやつを探す
    //lower_bound
    //自分より下は食える
    int r = a.size()-1;
    while(true)
    {
        int tar = (a[r] + 1 ) / 2;
        int pos = lower_bound(sum_a.begin(),sum_a.end(), tar) - sum_a.begin();
        if(pos == r)break;
        r = pos;
    }

    int res = a.size() - r;
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1408
Q, H, S, D = map(int, input().split()) # 横に2個
N = int(input())

com = [Q*8, H*4, S*2, D]
com.sort()
price = (N // 2) * com[0]

if N % 2 == 1:
    am = [Q*4, H*2, S]
    am.sort()
    price += am[0]

print(price)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
  int x, y;
  int g1, g2;
  scanf("%d %d", &x, &y);
  switch ( x ) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    g1 = 0;
    break;
  case 4:
  case 6:
  case 9:
  case 11:
    g1 = 1;
    break;
  case 2:
    g1 = 2;
    break;
  }
  switch ( y ) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    g2 = 0;
    break;
  case 4:
  case 6:
  case 9:
  case 11:
    g2 = 1;
    break;
  case 2:
    g2 = 2;
    break;
  }
  if ( g1 == g2 ) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>

using namespace std;

#define MAX_R 10
#define MAX_C 10000

typedef pair< int, int > P;

int main()
{
	int R, C;
	while( cin >> R >> C, R || C ) {
		bool is_failed[ MAX_R ][ MAX_C ];
		for( int i = 0; i < R; ++i ) {
			for( int j = 0; j < C; ++j ) {
				cin >> is_failed[ i ][ j ];
			}
		}

		int ans = 0;
		for( int k = 0; k < ( 1 << MAX_R ); ++k ) {
			int tmp[ MAX_R ][ MAX_C ];
			// 行をひっくり返す
			for( int i = 0; i < R; ++i ) {
				if( k & ( 1 << i ) ) {
					for( int j = 0; j < C; ++j ) { tmp[ i ][ j ] = !is_failed[ i ][ j ]; }
				} else {
					for( int j = 0; j < C; ++j ) { tmp[ i ][ j ] = is_failed[ i ][ j ]; }
				}
			}
			// 列をひっくり返す
			int cnt = 0;
			for( int j = 0; j < C; ++j ) {
				int cnttmp = 0;
				for( int i = 0; i < R; ++i ) {
					if( !tmp[ i ][ j ] ) { ++cnttmp; }
				}
				cnt += max( cnttmp, R - cnttmp );
			}
			ans = max( ans, cnt );
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int l;
    cin >> l;
    double x = (double)l / 3.0;
    cout << fixed << setprecision(10);
    cout << x * x * x <<endl;
    return 0;
}

Measured memory_bytes: 256
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)


def main():
    
    
    a,b=map(int,input().split())
    print(a//b,a%b,"{:.8f}".format(round(a/b,8)))
    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 6908
#include<stdio.h>
 
struct Card{
  char suit;
  char value;
};
 
void bubble(Card A[], int n){
  int i, j;
  Card t;
  for ( i = 1; i <= n; i++ ){
    for ( j = n; j >= i+1; j-- ){
      if ( A[j].value < A[j-1].value ){
    t = A[j]; A[j] = A[j-1]; A[j-1] = t;
      }
    }
  }
}
 
void selection(Card A[], int n){
  int i, j, mini;
  Card t;
 for ( i = 1; i <= n; i++ ){
    mini = i;
    for ( j = i; j <= n; j++ ){
      if ( A[j].value < A[mini].value ) mini = j;
    }
    t = A[i]; A[i] = A[mini]; A[mini] = t;
  }
}
 
void print(Card A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i >1) printf(" ");
    printf("%c%c", A[i].suit, A[i].value);
  }
  printf("\n");
}
 
int isStable(Card C1[], Card C2[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( C1[i].suit != C2[i].suit ) return 0;
  }
  return 1;
}
 
int main(){
  Card C1[101], C2[101];
  int n, i;
  char ch;
 
  scanf("%d\n", &n);
  for ( i = 1; i <= n; i++ ){
    scanf("%c%c ", &C1[i].suit, &C1[i].value);
  }
 
  for ( i = 1; i <= n; i++ ) C2[i] = C1[i];
 
  bubble(C1, n);
  selection(C2, n);
 
  print(C1, n);
  printf("Stable\n");
  print(C2, n);
  if ( isStable(C1, C2, n) ){
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }
 
  return 0;
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;
using ll_i = tuple<ll, int>;

int main() {
    int N, K;
    cin >> N >> K;
    vector<vector<int>> a(K);
    rep(i, N) {
        int k, x;
        scanf("%d%d", &k, &x);
        a[k - 1].pb(x);
    }
    vector<int> f(K);
    rep(k, K) {
        sort(all(a[k]));
        reverse(all(a[k]));
        f[k] = a[k][0] + a[k][1];
        a[k].erase(a[k].begin());
        a[k].erase(a[k].begin());
    }
    priority_queue<i_i> pq1;
    priority_queue<i_i> pq2;
    priority_queue<ll_i> pq3;
    priority_queue<i_i> pos;
    map<i_i, int> mp;
    rep(k, K) {
        pq2.push(i_i(f[k], k));
        for (int x: a[k]) {
            pq1.push(i_i(x, k));
            mp[i_i(x, k)]++;
        }
        if (!a[k].empty()) pq3.push(ll_i((ll)f[k] + a[k][0], k));
    }
    vector<ll> ans(N + 1, -1);
    int cnt = 0;
    ll sum = 0;
    int mi1 = INT_MAX;
    ll mi3 = LLONG_MAX;
    vector<bool> used2(K);
    vector<bool> used3(K);
    for (int i = 1; i <= N; i++) {
        int x1 = (pq1.empty() ? -1 : get<0>(pq1.top()) * 2);
        int x2 = (pq2.empty() ? -1 : get<0>(pq2.top()));
        if (x1 >= x2) {
            cnt++;
            sum += get<0>(pq1.top());
            mi1 = min(mi1, get<0>(pq1.top()));
            int k = get<1>(pq1.top());
            int x = get<0>(pq1.top());
            mp[i_i(x, k)]--;
            pq1.pop();
        }
        else if (cnt + 2 <= i) {
            cnt += 2;
            sum += get<0>(pq2.top());
            int k = get<1>(pq2.top());
            for (int x: a[k]) pos.push(i_i(x, k));
            if (!used2[k]) {
                used2[k] = true;
                mi3 = min(mi3, (ll)f[k]);
            }
            pq2.pop();
        }
        if (cnt == i) ans[i] = sum;
        else {
            while (!pos.empty()) {
                int x, k;
                tie(x, k) = pos.top();
                if (mp[i_i(x, k)] == 0) {
                    pos.pop();
                    continue;
                }
                ans[i] = max(ans[i], sum + x);
                break;
            }
            if (mi1 < INT_MAX && !pq2.empty()) ans[i] = max(ans[i], sum - mi1 + get<0>(pq2.top()));
            if (mi3 < LLONG_MAX) {
                while (!pq3.empty()) {
                    int k = get<1>(pq3.top());
                    if (used2[k]) {
                        pq3.pop();
                        continue;
                    }
                    ans[i] = max(ans[i], sum - mi3 + get<0>(pq3.top()));
                    break;
                }
            }
        }
    }
    for (int i = 1; i <= N; i++) printf("%lld\n", ans[i]);
}


Measured memory_bytes: 21616
///Author : - Code_X

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

ll power(ll x, ll y)
{
    ll res = 1;

    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}

int main()
{
    int n;
    cin>>n;
    int x;
    cin>>x;
    //vector<int> l;
    ll sum=0;
    ll ans=0;
    if(sum<=x) ans++;
    for(int i=0;i<n;i++)
    {
        int val;
        cin>>val;
        sum+=val;
        if(sum<=x) ans++;
        //l.push_back(val);
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


int main() {
	int m, n; std::cin >> m >> n;
	std::vector<int> plan(n); for (auto& p : plan) std::cin >> p;
	if (m == 2) {
		int odd{ 0 }, even{ 0 };
		for (auto i = 0; i < n; ++i) {
			if ((i + plan[i]) % 2 == 0) {
				++even;
			}
			else {
				++odd;
			}
		}
		std::cout << std::min(odd, even) << std::endl;
	}
	else {
		int prev = -1;
		int count = 0;
		for (const auto p : plan) {
			if (prev == p) {
				++count;
				prev = -1;
			}
			else {
				prev = p;
			}
		}
		std::cout << count << std::endl;
	}
}


Measured memory_bytes: 3132
import java.util.Scanner;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.Optional;
public class Main {
  public static void main(String... args) {
    Scanner scan = new Scanner(System.in);
    scan.next();
    List<Double> list = new ArrayList<>();
    while (scan.hasNextInt()) {
      list.add(Double.valueOf(scan.next()));
    }
    Collections.sort(list);
    Optional<Double> res = list.stream().reduce((acc,x)->{
      return acc==0?x:(acc+x)/2;
    });
    System.out.println(res.get());
  }
}

Measured memory_bytes: 26964