akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#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)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 100005

int a[ARRAY_MAX];
int b[ARRAY_MAX];

bool check(int mid,int num){

    if(a[mid] <= num){
        return true;
    }else{
        return false;
    }
}

int binary_serch(int ok,int ng,int num){

    //[ok,ng)
    while(abs(ok - ng) > 1){
        int mid = (ok + ng)/2;
        if(check(mid,num)){
            //cout << mid << " " << ok << " a " << ng << endl;
            ok = mid;
        }else{
            //cout << mid << " " << ok << " b " << ng << endl;
            ng = mid;
        }
    }
    return ok;
}

int main(){
    
    int n,q;
    cin >> n;
    REP(i,n){
        cin >> a[i];
    }
    cin >> q;
    REP(i,q){
        cin >> b[i];
    }

    int ans = 0;
    REP(i,q){
        if(a[binary_serch(0,n,b[i])] == b[i]){
            ans++;
            //cout << i << " q " << ans << endl;
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3696
import itertools
n = int(input())
lr = [[int(i) for i in input().split()] for _ in range(n)]
max = 101010
p = [1]*max
p[0] = 0
p[1] = 0
for i in range(2, max):
    if p[i] == 1:
        for j in range(int(i*2), max, i):
            p[j] = 0
a = [0]*(max+1)
for i in range(1, max, 2):
    if p[i] == p[(i+1)//2] == 1:
        a[i+1] = 1
a = list(itertools.accumulate(a))
for l, r in lr:
    print(a[r+1] - a[l])

Measured memory_bytes: 25880
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,k;
  cin >> n >> k;
  std::vector<int> height(n);
  int ans = 0;
  for(int i=0;i<n;++i){
    int height;
    cin >> height;
    if(height>=k)ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<pair<int, int>> G(n-1);
    vector<vector<int>> T(n+1);
    for (int i=0; i<n-1; i++){
        int a, b;
        cin >> a >> b;
        G[i] = make_pair(a, b);
        T[a].push_back(b);
        T[b].push_back(a);
    }
    int ans = 0;
    map<pair<int, int>, int> anss;
    queue<pair<int, int>> next_go;
    next_go.push(make_pair(1, 0));
    vector<bool> been(n+1, false);
    while (!next_go.empty()){
        int x, c;
        tie(x, c) = next_go.front();
        next_go.pop();
        been[x] = true;
        
        int now_c = 1;
        for (auto v: T[x]){
            if (been[v]) continue;
            if (now_c == c) now_c++;
            next_go.push(make_pair(v, now_c));
            anss[make_pair(x, v)] = now_c;
            ans = max(ans, now_c);
            now_c++;
        }
    }

    cout << ans << endl;
    for (auto v: G){
        // cout << v.first << " " << v.second << endl;
        if (anss.count(v)){
            cout << anss[v] << endl;
        }
        else{
            cout << anss[make_pair(v.second, v.first)] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 13056
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
  ll n, k, ans = 0LL;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    for (ll j = i; j <= n; j += i) {
      ans += j;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
a0 = [x for x in a if x<0]
a_abs = [abs(x) for x in a]
if len(a0)%2 == 0:
    ans = sum(a_abs)
else:
    ans = sum(a_abs) - 2 *min(a_abs)
print(ans)

Measured memory_bytes: 14412
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, a, b) = (v[0], v[1], v[2]);
    let ans = min(a * n, b);
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2084
import math
def isprime(n):
    if n==1:
        return False
    elif n==2:
        return True
    k=int(math.sqrt(n))+1
    for i in range(2,k+1):
        if n%i==0:
            return False
    return True
N=int(input())
ans=0
for i in range(N):
    if isprime(int(input())):
        ans+=1
print(ans)



Measured memory_bytes: 5680
#!/usr/bin/python3

import os
import sys


def main():
    L, K = read_ints()
    print(solve(L, K))


def solve(L, K):
    D = [[0, 0] for _ in range(L + 1)]
    D[1][0] = 1
    if K <= L:
        D[K][0] = 1

    for i in range(1, L):
        D[i + 1][1] += D[i][0]
        D[i + 1][0] += D[i][1]
        if i + K <= L:
            D[i + K][0] += D[i][1]

    return sum([D[i][0] for i in range(1, L + 1)])


###############################################################################

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()



Measured memory_bytes: 5620
#include <stdio.h>

int main(void){
	int n;
	scanf("%d",&n);
	int i=1;
	int temp=1;
	for(i=1;i<n;i++){
		temp = i*i;
		if(temp>n){
			printf("%d",(i-1)*(i-1));
			return 0;
		}
	}
	printf("1");
	return 0;
}

Measured memory_bytes: 256
/*
 * @Author: RBQRBQ
 * @Date: 2020-03-21 19:24:28
 * @LastEditors: RBQRBQ
 * @LastEditTime: 2020-03-22 16:17:10
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
namespace IO{
    template<typename T>inline void read(T &x){
        x=0;ll f=1;char ch=getchar();
        while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
        while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
        x=x*f;
    }
}
using namespace IO;
int H,W;
const int maxn =200;
char mp[maxn][maxn];
int dp[maxn][maxn];
int main()
{
    read(H),read(W);
    for(int i=1;i<=H;i++)
    scanf("%s",mp[i]+1);
    for(int i=0;i<=maxn-1;i++)
    for(int j=0;j<=maxn-1;j++)
    dp[i][j]=10000000;
    for(int i=1;i<=H;i++)
    for(int j=1;j<=W;j++)
    {
        if(i==1&&j==1) {dp[i][j]=(mp[i][j]=='#');continue;}
        if(mp[i][j]=='.') 
        {
            if(i>1&&j>1)
            dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
            if(i>1&&j<=1)
            dp[i][j]=dp[i-1][j];
            if(j>1&&i<=1)
            dp[i][j]=dp[i][j-1];
        }
        else
        {
            if(i>1&&j>1)
            dp[i][j]=min((dp[i-1][j]+(mp[i-1][j]!='#')),dp[i][j-1]+(mp[i][j-1]!='#'));
            if(i>1&&j<=1)
            dp[i][j]=dp[i-1][j]+(mp[i-1][j]!='#');
            if(j>1&&i<=1)
            dp[i][j]=dp[i][j-1]+(mp[i][j-1]=='.');
        }
    }
    cout<<dp[H][W];
}

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

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

  string ans;
  vector<int> vec(N);

  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }

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

  ans = "YES";

  for (int i = 0; i < N-1; i++){

    if(vec.at(i) == vec.at(i+1)){
      ans = "NO";
      break;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int N = 100010;
VI e[N];

bool good;
int c;

int iso(VI &a){
    int n = a.size();
    int ok = n-1, ng = -1;
    while (ok - ng > 1){
        int mi = (ok + ng) / 2;
        bool f = true;
        REP(i,n/2){
            int x = i;
            if (x >= mi) x++;
            int y = n - 1 - i;
            if (y <= mi) y--;
            if (a[x] + a[y] > c) f = false;
        }
        if (f) ok = mi;
        else ng = mi;
    }
    return a[ok];
}

int dfs(int now, int past){
    if (!good) return 0;
    VI a;
    for (int next : e[now]){
        if (next == past) continue;
        a.push_back(dfs(next, now) + 1);
    }
    sort(ALL(a));
    int n = a.size();
    // cout << now << " " << n << endl;
    if (n == 0) return 0;
    if (a.back() > c) good = false;
    if (n % 2 == 0){
        // cout << "even" << endl;
        bool f = true;
        REP(i,n/2){
            if (a[i] + a[n-1-i] > c) f = false;
        }
        if (f) return 0;
        a.pop_back();
        return iso(a);
    }
    REP(i,n/2){
        if (a[i] + a[n-2-i] > c) good = false;
    }
    return iso(a);
}

int main() {
    int n;
    cin >> n;
    REP(i,n-1){
        int a, b;
        scanf("%d %d", &a, &b);
        a--;b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }

    int a = 0;
    REP(i,n) a += (e[i].size() % 2);
    a = (a + 1) / 2;

    int root;
    REP(i,n) if (e[i].size() == 1) root = i;

    // cout << "root" << root << endl;

    int ok = n, ng = 0;
    while (ok - ng > 1){
        c = (ok + ng) / 2;
        // cout << c << endl;
        good = true;
        dfs(root, -1);
        if (good) ok = c;
        else ng = c;
    }


    cout << a << " " << ok << endl;

    return 0;
}


Measured memory_bytes: 16640
import sys
input = sys.stdin.readline

N,K = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
for i in range(N-K):
  if As[i] < As[i+K]:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 31608
s = input()
t = input()
m = len(s)
n = len(t)
dp = [[0]*(n+1) for _ in range(m+1)]
for i in range(1,m+1):
    for j in range(1,n+1):
        x = s[i-1]
        y = t[j-1]
        if x == y:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = dp[i-1][j]
            if dp[i][j] < dp[i][j-1]:
                dp[i][j] = dp[i][j-1]
res = ""
while n != 0 and m != 0:
    if dp[m][n] == dp[m-1][n]:
        m -= 1
    elif dp[m][n] == dp[m][n-1]:
        n -= 1
    else:
        n -= 1
        m -= 1
        res = s[m] + res
print(res)

Measured memory_bytes: 112348
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  int D,G,ans=1000000000;
  cin >> D >> G;
  int p[D],c[D];
  rep(i,D) cin >> p[i] >> c[i];
  rep(s,1<<D){//全探索
    int res=0,tmp=0;
    bool check[D]={};
    rep(i,D){//一桁ずつチェック
      if(s>>i & 1){
        res+=((i+1)*100*p[i]+c[i]);
        tmp+=p[i];
        check[i]++;
      }
    }
    if(res>=G) chmin(ans,tmp);
    else{
      for(int i=D-1;i>=0;i--){
        if(res>=G) break;
        if(check[i]==0){
          int hoge=(G-res+(i+1)*100-1)/((i+1)*100);
          if(hoge>p[i]) break;
          else{
            tmp+=hoge;
            chmin(ans,tmp);
            break;
          }
          //if(ans==1) putb(s);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
     double a,b,h,m;
    scanf("%lf %lf %lf %lf",&a,&b,&h,&m);
     double anga;
     double angb;
    anga=(30*h)+(0.5*m);
    angb=6*m;
     double cosA;
     double ang;
    ang=(anga-angb)*M_PI/180;
    cosA=cos(ang);
     double anss;
     double ans;
    anss=a*a+b*b-2*a*b*cosA;
    ans=sqrt(anss);
    printf("%.20lf\n",ans);
    return 0;
}

Measured memory_bytes: 2600
#include<bits/stdc++.h>
    using namespace std;
	#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
	#define pb push_back
	#define mp make_pair
	#define all(v) v.begin(),v.end()
	typedef long long ll;
	#define lim 20000000000007LL

	int main()
	{
		fast
		int t=1;
		// cin>>t;
		while(t--)
		{
			ll k,n;
			cin>>k>>n;
			vector<ll>v(n);
			for(auto &x:v)cin>>x;
			vector<ll>ans;
			for(int i=1;i<n;i++)
			ans.pb(v[i]-v[i-1]);
			ans.pb(k-v[n-1]+v[0]);
			ll sum=0LL;
			for(auto x:ans)sum+=x;
			sum-=*max_element(all(ans));
			cout<<sum;

		}
	}

			

Measured memory_bytes: 4084
inf = 10**12


def main():
    import sys
    from random import randint
    input = sys.stdin.readline

    class Bit:
        def __init__(self, n):
            self.size = n
            self.tree = [0] * (n + 1)

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.tree[i]
                i -= i & -i
            return s

        def add(self, i, x):
            while i <= self.size:
                self.tree[i] += x
                i += i & -i

        def lower_bound(self, w):
            if w <= 0:
                return 0
            x = 0
            k = 1 << (self.size.bit_length() - 1)
            while k:
                if x + k <= self.size and self.tree[x + k] < w:
                    w -= self.tree[x + k]
                    x += k
                k >>= 1
            return x + 1

    D = int(input())
    C = list(map(int, input().split()))
    S = [[]]
    for _ in range(D):
        S.append(list(map(int, input().split())))
    ans = 0
    last = [0] * 26
    days = [Bit(D+1) for _ in range(26)]
    for i in range(26):
        days[i].add(D+1, 1)
    T = [-1]
    # greedy
    for d in range(1, D+1):
        plus = -inf
        t = -1
        for tt in range(26):
            plus_new = S[d][tt] + C[tt] * (d - last[tt])
            if plus_new > plus:
                t = tt
                plus = plus_new
        T.append(t)
        ans += S[d][t]
        last[t] = d
        days[t].add(d, 1)
        for i in range(26):
            ans -= C[i] * (d - last[i])

    def calc(d_list, q_list, cur):
        for d, q in zip(d_list, q_list):
            t = T[d]
            cur += S[d][q]
            cur -= S[d][t]
            k = days[q].sum(d)
            i = days[q].lower_bound(k)
            j = days[q].lower_bound(k+1)
            cur += C[q] * (d - i) * (j - d)
            k = days[t].sum(d)
            i = days[t].lower_bound(k-1)
            j = days[t].lower_bound(k+1)
            cur -= C[t] * (d - i) * (j - d)

            T[d] = q
            days[q].add(d, 1)
            days[t].add(d, -1)
        return cur

    # climb
    size = 5
    try_num = 200
    loop_num = 10
    for _ in range(loop_num):
        for x in range(D // size):
            d_list = list(range(x*size+1, (x+1)*size+1))
            for _ in range(try_num):
                t_new = [randint(0, 25) for _ in range(size)]
                for i, d in enumerate(d_list):
                    if t_new[i] == T[d]:
                        t_new[i] = (t_new[i] + 1)%26
                t_ori = []
                for d in d_list:
                    t_ori.append(T[d])
                ans_new = calc(d_list, t_new, ans)
                if ans_new < ans:
                    for i, d in enumerate(d_list):
                        T[i] = t_ori[i]
                        days[t_ori[i]].add(d, 1)
                        days[t_new[i]].add(d, -1)
                else:
                    ans = ans_new

    for t in T[1:]:
        print(t+1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 98704
N = int(input())
A = list(map(int, input().split()))

snk = A[0]
arg = sum(A)-snk
ans = abs(arg-snk)
for i in range(1, N-1):
  snk += A[i]
  arg -= A[i]
  dif = abs(arg-snk)
  ans = min(ans, dif)
print(ans)

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

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n;i++){
        for (ll j = 1; j <= n;j++){
            for (ll k = 1; k <= n;k++){
                ans += __gcd(__gcd(i,j),k);
            }
        }
    }
    cout << ans;
}

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

const long long INF = 1e17+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	string s;
	cin >> s;
	int n=s.size();
	int cnt=0;
	for(int i=0;i<n-1;i++){
		if(s[i]==s[i+1])continue;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;



void solve() {
	int n; 
	cin >> n; 
	int arr[n];
	bool flag = true;
	for(int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		if(x % 2 == 0 && (x % 3 != 0 && x% 5 != 0)) flag = false;
		}
		if(flag) cout << "APPROVED" << endl;
		else cout << "DENIED" << endl;
}


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	int t;
	solve();
	return 0;
}
 
 
 


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll k;
  cin>>k;
  string s;
  cin>>s;
  if(s.size()<=k)
    cout<<s<<endl;
  else{
    REP(i,k)
      cout<<s[i];
    cout<<"..."<<endl;
  }
}



Measured memory_bytes: 3648
#include <iostream>
#include <string.h>

#define MAX 1000000

using namespace std;

int main(void){
	bool prime[MAX];

	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i<MAX;i++)
		if(prime[i])
			for(int j=2;i*j<MAX;j++)
				prime[i*j]=false;

	for(int a,d,n;cin >> a >> d >> n,a||d||n;)
		for(int c=0,i=0;a+d*i<MAX&&c<n;i++){
			c+=prime[a+d*i];
			if(c==n)
				cout << a+d*i << endl;
		}

	return 0;
}

Measured memory_bytes: 2140
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    int n;cin>>n;

    VI buka(n);

    REP(i,n-1){
        int a;cin>>a;
        a--;
        buka[a]++;
    }

    REP(i,n){
        cout<<buka[i]<<endl;
    }


    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3976
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin = open("input.txt","r")  # <<<  Comment this line  >>> #
    sys.stdout = open("output.txt","w")  # <<<  Comment this line  >>> #
    sys.stderr = open("output.txt","w")  # <<<  Comment this line  >>> #

# for _testcases_ in range(int(input())):
import bisect
n, l = get_ints()
li = []
for i in range(n):
    s = input()
    bisect.insort(li, s)
print("".join(li))
'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Measured memory_bytes: 38256
w,h,n = map(int,input().split())
minx = 0
miny = 0
maxx = w
maxy = h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        minx = x if x > minx else minx
    elif a == 2:
        maxx = x if maxx > x else maxx
    elif a == 3:
        miny = y if y > miny else miny
    else:
        maxy = y if maxy > y else maxy
width = maxx-minx if maxx > minx else 0
height = maxy-miny if maxy > miny else 0
print(width*height)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define PI 3.14159265358979
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  double a, b, x, ans;
  cin >> a >> b >> x;
  if (2 * x > a * a * b)
    ans = atan2(2 * b - 2*x / a / a, a);
  else
    ans = atan2(a * b * b, 2 * x);
  cout << fixed<<setprecision(10)<< ans * 180 / PI << "\n";
  return 0;
}


Measured memory_bytes: 4156
def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    # temp_list = []
    count = 0
    is_ongoing = True
    while is_ongoing:
        for i, a in enumerate(a_list):
            if a % 2 == 0:
                # temp_list.append(a/2)
                a_list[i] /= 2
            else:
                is_ongoing = False
                print(count)
                break
        else:
            count += 1
        # a_list = temp_list[:]


if __name__ == '__main__':
    main()


Measured memory_bytes: 39792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 998244353;
using Graph = vector<vector<int>>;

int dp[3001][3001]{};

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

    int A,B,C,D;
    cin>>A>>B>>C>>D;

 
    dp[A][B]=1;
    for(int i=A;i<=C;i++){
        for(int j=B;j<=D;j++){
            if(i==A&&j==B)continue;
            dp[i][j]=j*dp[i-1][j]+i*dp[i][j-1]-(i-1)*(j-1)*dp[i-1][j-1];
            dp[i][j]%=MOD;
            while(dp[i][j]<0)dp[i][j]+=MOD;
        }
    }
    cout << dp[C][D]<<endl;


    



}


Measured memory_bytes: 73868
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#define pi 3.141592653589793283462
using namespace std;
int main(){
    int a;
    cin>>a;
    int m;
    string s;
    bool c[4][52]={false};
    for(int i=0;i<a;i++){
        cin>>s;   
        cin>>m;
        if(s=="S")
          c[0][m-1]=true;
        if(s=="H")
          c[1][m-1]=true;
        if(s=="C")
          c[2][m-1]=true;
        if(s=="D")
          c[3][m-1]=true;
    }
 
    for(int i=0;i<13;i++){
        if(c[0][i]==false)
            cout<<"S "<<i+1<<endl;
    }
    for(int i=0;i<13;i++){
        if(c[1][i]==false)
            cout<<"H "<<i+1<<endl;
    }
    for(int i=0;i<13;i++){
        if(c[2][i]==false)
            cout<<"C "<<i+1<<endl;
    }
    for(int i=0;i<13;i++){
        if(c[3][i]==false)
            cout<<"D "<<i+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF=1e9+7;
typedef long long ll;

int main() {
	ll N,r=1;
	bool ok = 1;
	cin >> N;
	vector<ll> A(N);

	rep(i,N) {
		cin >> A.at(i);
		if(A.at(i) == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	rep(i,N) {
		// cout << setprecision(30) << (double)A.at(i) << " " <<  (double)(1e18+1e-10)/(double)r << endl;
		if((double)A.at(i) > (double)1e18/(double)r) {
			ok = 0;
			break;
		}
		r *= A.at(i);
		// cout << r << endl;

		if(r > (ll)1e18) {
			ok = 0;
			break;
		}
	}

	cout << ((ok) ? r : -1) << endl;
}

Measured memory_bytes: 3976
N, K = map(int, input().split())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * N
dp[0] = 0
for i in range(N):
    for j in range(i + 1, min(i + K + 1, N)):
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))

print(dp[N - 1])

Measured memory_bytes: 55008
#include <bits/stdc++.h>
using namespace std;
long long int dp[101][100005];
int N,W;
int w[101];
int v[101];
// long long int MaxVal(int n,int weight)
// {   
//   if(n<0 || weight==0) return 0;
  
//   if(weight<w[n]) return MaxVal(n-1,weight);
//   else{
//       return max(v[n]+MaxVal(n-1,weight-w[n]),MaxVal(n-1,weight));
//   }
     
// }

long long int MaxValUsingDp()
{
  
    for(int i=0;i<=N;i++)
    {
        for(int j=0;j<=W;j++)
        {   
            if(i==0||j==0) dp[i][j]=0;
            else if(j<w[i-1] )
            {
                dp[i][j] = dp[i-1][j];
            }
            else{
              
                dp[i][j] = max(dp[i-1][j], v[i-1]+dp[i-1][j-w[i-1]]);
               // cout<<v[i-1]+dp[i][j-x]<<" ";
            }
        }
    }
 
    return dp[N][W];
}
int main() {
	cin>>N>>W;
	
	for(int i=0;i<N;i++) cin>>w[i]>>v[i];
	//for(int i=0;i<n;i++) cout<<w[i]<<v[i]<<endl;
	long long int ans=MaxValUsingDp();
	cout<<ans;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = (int) s.size();
    string a, b;
    for (int i = 0; i < n; i++) {
        a += (i % 2 ? '1' : '0');
        b += (i % 2 ? '0' : '1');
    }
    int ans = n + 1;
    vector <string> sol = {a, b};
    for (auto x : sol) {
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] != x[i]) {
                res++;
            }
        }
        ans = min(ans, res);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 720
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(200000)
N,M=map(int,input().split())
p=tuple(map(lambda x: int(x)-1,input().split()))
l=[[] for i in range(N)]
for i in range(M):
    x,y=map(lambda x: int(x)-1,input().split())
    l[x].append(y)
    l[y].append(x)
g=[None]*N
c=0
def hu(n,c):
    for i in l[n]:
        if g[i]==None:
            g[i]=c
            hu(i,c)
for i in range(N):
    if g[i]==None:
        g[i]=c
        hu(i,c)
        c+=1
a=0
for i in range(N):
    if g[i]==g[p[i]]:
        a+=1
print(a)

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

#define MAX_N 100000

int sizeD;

int D[200];

vector<int> cnt[200][26];

int cnt2[200];

char S[MAX_N+1];

int main(){
	int N,Q;
	cin >> N >> Q;

	cin >> S;
	
	for(int i=1; i*i<=N; ++i){
		if(N%i == 0){
			D[sizeD++] = i;
			D[sizeD++] = N/i;
		}
	}
	
	sort(D, D + sizeD);
	
	for(int j=0; j<sizeD; ++j){
		for(int i=0; i<26; ++i){
			cnt[j][i] = vector<int>(D[j]);
		}
	}

	for(int i=0; i<N; ++i){
		S[i] -= 'a';
	}

	for(int j=0; j<sizeD; ++j){
		for(int i=0; i<N; ++i){
			cnt[j][S[i]][i%D[j]]++;
		}

		for(int i=0; i<D[j]; ++i){
			for(int c=0; c<26; ++c){
				if( cnt[j][c][i] == N/D[j] ){
					cnt2[j]++;
					break;
				}else if(cnt[j][c][i] > 0){
					break;
				}
			}
		}
	}

	for(int z=0; z<Q; ++z){
		int p;
		char c;
		cin >> p >> c;
		c -= 'a';
		p --;
		
		for(int j=0; j<sizeD; ++j){
			if(cnt[j][S[p]][p%D[j]]-- == N/D[j]){
				cnt2[j]--;
			}
			if(++cnt[j][c][p%D[j]] == N/D[j]){
				cnt2[j]++;
			}
		}
		S[p] = c;
		
		for(int j=0; j<sizeD; ++j){
			if( cnt2[j] == D[j] ){
				cout << D[j] <<endl;
				break;
			}
		}
	}
}



Measured memory_bytes: 39704
#include<stdio.h>

static const int N = 100;
static const int INFTY = (1<<21);

main(){
  int n, i, j, k;
  int v, c, x, y, Mx;
  int M[N][N], a[N], X[N];

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

  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &y, &v);
    for ( j = 0; j < v; j++ ){
      scanf("%d %d", &x, &c);
      M[y][x] = c;
    }
  }

  for ( i = 0; i < n; i++ ) {
    a[i] = INFTY;
    X[i] = 0;
  }

  a[0] = 0;

  while(1){
    Mx = INFTY;
    y = -1;
    for ( i = 0; i < n; i++ ){
      if ( Mx > a[i] && !X[i] ){
        y = i;
        Mx = a[i];
      }
    }
    if ( y == -1 ) break;
    X[y] = 1;
    for ( k = 0; k < n; k++ ){
      if ( !X[k] && M[y][k] != INFTY ){
        if ( a[k] > a[y] + M[y][k] ){
          a[k] = a[y] + M[y][k];
        }
      }
    }
  }

  for ( i = 0; i < n; i++ ){
    printf("%d %d\n", i, (a[i]==INFTY?-1:a[i]));
  }

  return 0;
}


Measured memory_bytes: 2112
import Text.Printf

inner_product (ax,ay) (bx,by) = ax * bx + ay * by
vabs (ax,ay) = sqrt (ax*ax+ay*ay)
vmul a (ax,ay) = (a*ax,a*ay)
vadd (ax,ay) (bx,by) = (ax+bx,ay+by)

ans ax ay bx by px py =
  let v1 = (bx-ax,by-ay)
      v2 = (px-ax,py-ay)
      ip = inner_product v1 v2
  in
    (ax,ay) `vadd` ( (ip / (vabs v1)**2) `vmul` v1 )
    
main = do
  l0 <- getLine
  getLine
  q0 <- getContents
  let xy@(ax:ay:bx:by:_) = map read $ words l0 :: [Double]
      qs = map (map read) $ map words $ lines q0 :: [[Double]]
      o = map (\ (px:py:_) -> ans ax ay bx by px py) qs
  mapM_ (\(x,y) -> printf "%f %f\n" x y) o
  

Measured memory_bytes: 4776
X = int(input())
li = [i**5 for i in range(0,10000,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

Measured memory_bytes: 9572
import math

X = int(input())

def is_prime(n):
    if n <= 1:
        return False

    if n == 2:
        return True

    if n % 2 == 0:
        return False

    for i in range(3, math.ceil(math.sqrt(n)), 2):
        if n % i == 0:
            return False

    return True
    
while not is_prime(X):
    X += 1

print(X)

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

using namespace std;

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

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

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

signed main()
{
  int A, B, N;
  cin >> A >> B >> N;
  int x = min(N,B-1);
  cout << floor((long double)A*x/B) - A * floor((long double)x/B) << endl;
  return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> d(N);
  
  for(int i=0;i<N;i++){
    cin>>d.at(i);
  }
  
  int sum1 = 0;
  int sum2 = 0;
  
  for(int j=0;j<N;j++){
    for(int k=0;k<N;k++){
      sum1 = sum1 + d.at(j)*d.at(k);
      if(j==k){
        sum2 = sum2 + d.at(j)*d.at(k);
      }
    }
  }
  
  cout<<(sum1-sum2)/2<<endl;
  
  return 0;
}

Measured memory_bytes: 256
s = list(input())

c = 0
f = len(s)
if s.count('C') == 1:
    d = s.index('C')
else:
    d = 0
for i in range(0,len(s)):
    if s[i].isupper() == True:
        c += 1
if s[0] == 'A':
    if d < f-1 and d > 1:
        if c == 2:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

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

const int INF = 1e9;

int main() {

	int N;
	cin >> N;

	vector<int>A(N * 3);
	rep(i, N * 3)
		cin >> A[i];

	sort(A.begin(), A.end(),greater<int>());

	ll ans = 0;
	for (int i = 0; i < N; i++)
		ans += A[i * 2 + 1];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

pii p[220];
int n;
const int MOD = 998244353;

int chk(pii a, pii b, pii c) {
	pii x = pii(a.Fi - b.Fi, a.Se - b.Se);
	pii y = pii(c.Fi - b.Fi, c.Se - b.Se);
	if((ll)x.Fi * y.Se == (ll)x.Se * y.Fi) {
		if((ll)x.Fi * y.Fi + (ll)x.Se * y.Se < 0) return 1;
		else return -1;
	}
	return 0;
}

void solve(){
	scanf("%d", &n);
	rep(i, n) scanf("%d%d", &p[i].Fi, &p[i].Se);
	int ans = 1;
	rep(i, n) ans = ans * 2 % MOD;
	ans -= 1;
	ans -= n;
	ans -= n * (n - 1) / 2;
	if(ans < 0) ans += MOD;
	sort(p, p+n);
	rep(i, n) rep(j, i) {
		int cnt = 2;
		rep(k, n) if(k != i && k != j) {
			int t = chk(p[j], p[i], p[k]);
			if(t == -1) { cnt = 0; break; }
			cnt += t;
		}
		if(cnt >= 3) {
			int s = 1;
			rep(a, cnt) s = s * 2 % MOD;
			s -= 1 + cnt + cnt * (cnt - 1) / 2;
			if(s < 0) s += MOD;
			ans -= s;
			if(ans < 0) ans += MOD;
		}
	}
	printf("%d\n", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
 
    token.parse().ok().expect("failed to parse token")
}
 
//https://docs.rs/permutohedron/0.2.4/src/permutohedron/lexical.rs.html#23-30
pub trait LexicalPermutation {
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the last ordered permutation.
    fn next_permutation(&mut self) -> bool;
}
 
impl<T> LexicalPermutation for [T]
where
    T: Ord,
{
    /// Original author in Rust: Thomas Backman <serenity@exscape.org>
    fn next_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 {
            return false;
        }
 
        // Step 1: Identify the longest, rightmost weakly decreasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] >= self[i] {
            i -= 1;
        }
 
        // If that is the entire vector, this is the last-ordered permutation.
        if i == 0 {
            return false;
        }
 
        // Step 2: Find the rightmost element larger than the pivot (i-1)
        let mut j = self.len() - 1;
        //while j >= i && self[j] <= self[i - 1] {
        while self[j] <= self[i - 1] {
            j -= 1;
        }
 
        // Step 3: Swap that element with the pivot
        self.swap(i - 1, j);
 
        // Step 4: Reverse the (previously) weakly decreasing part
        self[i..].reverse();
 
        true
    }
}
 
fn main() {
    let n = read();
    let town: Vec<(i32, i32)> = (0..n).map(|_| (read(), read())).collect();
    let mut sum_d: f64 = 0.0;
    let mut count:f64 = 0.0;
    let mut data = vec![];
 
    for i in 0..n {
        data.push(i);
    }
 
    loop {
        count += 1.0;
        for i in 0..data.len()-1{
            let d = (((town[data[i]].0 - town[data[i+1]].0).pow(2u32) + (town[data[i]].1 - town[data[i+1]].1).pow(2u32)) as f64)
            .sqrt();
            sum_d += d;
            //println!("{}",d);
        }
        if !data.next_permutation() {
            break;
        }
    }
 
    println!("{}", sum_d / count);
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n;
  cin >> n;
  cout << 24 + 24 - n << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
    char c;
    cin >> c;

    cout << (char)(c + 1) << endl;
    return 0;
}


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

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

  for (int i = 1; i <= 9; i++)
    for (int j = 1; j <= 9; j++) {
      {
        if (i * j == N) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>  
                     
int main() {         
    const int NUM = 3;
    int x, y, z, last = 0;
    std::cin >> x >> y >> z;
    int num_list[] = {x, y, z};
                     
    for(int i = 0; last = NUM, i < last; i++) {
        for(int j = 0; j < last - 1; j++) {
            if(num_list[j] > num_list[j+1]) {
                int tmp = num_list[j];
                num_list[j] = num_list[j+1];
                num_list[j+1] = tmp;
            }        
        }            
        last--;      
    }                
    for(int i = 0; i < NUM; i++) {
        if(i == NUM -1) {
            std::cout << num_list[i] << std::endl;
        }else {      
            std::cout << num_list[i] << " ";
        }            
    }                
    return 0;        
}

Measured memory_bytes: 1160
import sys
sys.setrecursionlimit(10**9)


class SegmentTree1():
    """
    1-indexed Segment Tree
    """
    def __init__(self, n_, ele_id, operation_func):
        self.n = 1 << (n_ - 1).bit_length()  # size
        self.data = [ele_id] * (2 * self.n)  # binary tree
        self.ele_id = ele_id  # identity element
        self.operation_func = operation_func  # binary operation of monoid

    def __getitem__(self, idx):
        return self.data[idx + self.n]

    def build(self, data_init):
        for i in range(len(data_init)):
            self.data[i + self.n] = data_init[i]
        for i in range(self.n - 1, 0, -1):
            self.data[i] = self.operation_func(self.data[2 * i],
                                               self.data[2 * i + 1])

    def update(self, idx, x):
        # change idx-th element to x (idx : 0-indexed)
        idx += self.n
        self.data[idx] = x
        while idx > 1:
            idx = idx >> 1
            self.data[idx] = self.operation_func(self.data[2 * idx],
                                                 self.data[2 * idx + 1])

    def query(self, l, r):
        # query for interval [l, r) (l, r : 0-indexed)
        l += self.n
        r += self.n
        ret = self.ele_id
        while l < r:
            if l & 1:  # right child
                ret = self.operation_func(ret, self.data[l])
                l += 1
            if r & 1:  # right child
                r -= 1
                ret = self.operation_func(ret, self.data[r])
            # go to parent-nodes
            l = l >> 1
            r = r >> 1
        return ret


n, m = map(int, input().split())
s = input()

dp = [-1] * (n + 1)
dp[n] = 1
roulette = [0] * (n + 1)

INF = 10**10
INF_PAIR = (INF, -1)
operation_func = lambda a, b: a if a[0] < b[0] else (b if a[0] > b[0] else
                                                     (a if a[1] < b[1] else b))
rmq = SegmentTree1(n + 1, INF_PAIR, operation_func)
rmq.update(n, (0, n))
for i in range(n - 1, -1, -1):
    if s[i] == '1':
        continue
    val, idx = rmq.query(i + 1, min(n, i + m) + 1)
    if val != INF:
        roulette[i] = idx - i
        dp[i] = val + 1
        rmq.update(i, (val + 1, i))

if dp[0] == -1:
    print(-1)
else:
    ans = []
    idx = 0
    while idx < n:
        ans.append(roulette[idx])
        idx += roulette[idx]
    print(*ans)


Measured memory_bytes: 25840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x,d;
  x = 0;
  string ans="Christmas";
  cin >> d;
  x = 25-d;
  for(int i = 0; i < x; i++) {
    ans += " Eve";
  }
  cout<<ans;
}
  

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt

    N match {
      case 1 => "Hello World"
      case 2 => Array.fill(2)(sc.nextInt).sum.toString
    }
  }
}


Measured memory_bytes: 25544
n = int(input())
strlist = [input() for i in range(n)]
ans = 'Yes'
if len(strlist) != len(set(strlist)):
    ans = 'No'
else:
    for i in range(n-1):
        if strlist[i][len(strlist[i])-1] != strlist[i+1][0]:
            ans = 'No'
print(ans)

Measured memory_bytes: 3060
using System;
using System.Linq;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var k = int.Parse(_[1]);
            var l = Console.ReadLine().Split().Select(i => int.Parse(i));

            var sum = l.OrderByDescending(i => i).Take(k).Sum();
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11604
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef set<int>        si;
typedef set<ii>         sii;

#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define clr(x,v) memset(x,v,sizeof x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define re return

template<typename T> T sgn (T x)      {re x<0? -1:(x>0? 1:0); }
template<typename T> T gcd (T a, T b) {re a ? gcd (b % a, a) : b; }
template<typename T> T abs (T x)      {re x < 0 ? -x : x; }
template<typename T> T sqr (T x)      {re x*x;}

#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define popcount __builtin_popcount
#define mp make_pair
#define eb emplace_back
#define emp emplace
#define ss second
#define ff first
#define endl "\n"
#define PI 3.14159265359
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)

void reads(string& x){
    char kk[N];
    scanf("%s",kk);
    x = kk;
}
ll n,pode,a,b;
ll e(ll x){
    return x*x*x*x*x;
}

void solve(){
    pode=0;
    scanf("%lld", &n);
    for(a=0;a<=3000;a++){
        for(b=0;b<=3000;b++){
            if((e(a)-e(b))==n){
                pode=1;
            }
            else if((e(a)+e(b))==n){
                b=-b;
                pode=1;
            }
            if(pode)break;
        }
        if(pode)break;
    }
    printf("%lld %lld\n",a,b);
}
int main(){_
    int t=1;// scanf("%d",&t);
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define ll long long int
#define vr vector
#define pb push_back
#define pf push_front
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define loop(i,n) for(i=0;i<n;i++)
#define inp !cin.eof()
#define sec itr->second
#define fir itr->first

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

    while (y > 0)
    {

        if (y & 1)
            res = (res*x)%p;


        y = y>>1;
        x = ((x%p)*(x%p))%p;
    }
    return res%p;
}



int main()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     // iterating a loop until input is providing====!cin.eof()

  // ll t;cin>>t;

    // while(t--)
        {
            ll n,i,ans=0,x,a,b,k,cnt=0,sum=0,flag=0;
             vr<ll> v,v1;

            cin>>n;
            ll dp[20001];

            for(i=3;i<=2010;i++)
            {
                dp[i]=1;
            }
            dp[0]=0,dp[1]=0,dp[2]=0;

            for(i=4;i<=2010;i++)
            {
                sum=1;
                for(ll j=i-1;j>=3;j--)
                sum+=(dp[i-j])%mod;

                dp[i]=sum%mod;

            }


             cout<<dp[n];


         cout<<endl;

         }
    return 0;
}



Measured memory_bytes: 3676