akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    map<pair<int, int>, int> cnt;
    rep(i, n){
        double x;
        cin >> x;
        ll j = llround(x*1e9);
        int two = 0, five = 0;
        while(j%2==0){
            two++;
            j /= 2;
        }
        while(j%5 == 0){
            five++;
            j /= 5;
        }
        ++cnt[{two, five}];
    }
    ll answer = 0;
    for(auto p1 : cnt){
        for(auto p2 : cnt){
            if(p1.first.first + p2.first.first >= 18 && \
                p1.first.second + p2.first.second >= 18){
                    if(p1 < p2){
                        answer += (ll) p1.second * p2.second;
                    }
                    else if(p1 == p2){
                        answer += (ll)p1.second*(p1.second-1)/2;
                    }
                }
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3816
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()

r = [2,1]
for i in range(2,n+1):
    r.append(r[i-1]+r[i-2])
print(r[-1])


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll inf = 10e17;
const ld eps = 10e-9;



ll solve(void);
ll gcd(ll x, ll y);

int main(void)
{
	while (solve())
	{
	}
	return 0;
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}

ll solve(void)
{
	ll x;
	cin >> x;
	ll p500 = (x / 500) * 1000;
	ll p5 = (x - (x / 500) * 500) / 5 * 5;
	
	cout << p5 + p500 << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	ll a, b;
	cin >> a >> b;
	ll i; ll mi = INF; ll x[3];
	for (i = (ll)1; i <= a; i++) {
		x[0] = i * b;
		x[1] = (a - i)*(b / 2);
		x[2] = (a - i)*((b + 1) / 2);
		sort(x, x + 3);
		mi = min(mi, x[2] - x[0]);
	}
	for (i = (ll)1; i <= b; i++) {
		x[0] = i * a;
		x[1] = (b - i)*(a / 2);
		x[2] = (b - i)*((a + 1) / 2);
		sort(x, x + 3);
		mi = min(mi, x[2] - x[0]);
	}
	if (a % 3 == 0 || b % 3 == 0)mi = 0;
	else mi = min(mi,min(a,b));
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

#define  N_MAX 5000

int main()
{
	int n;
	while (cin >> n,n) {
		ll ans = INF,num;
		rep(i, N_MAX / 200) {
			rep(j, N_MAX / 300) {
				rep(k, N_MAX / 500) {
					num = 0;
					if (i * 200 + j * 300 + k * 500 != n) continue;
					int a = i - (i / 5)*5;
					int b = j - (j / 4) * 4;
					int c = k - (k / 3) * 3;
					num += a * 380 + (i / 5) * 5 * 380 * 0.8;
					num += b * 550 + (j / 4) * 4 * 550 * 0.85;
					num += c * 850 + (k / 3) * 3 * 850 * 0.88;
					ans = min(ans,num);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
 
using namespace std ;
 
 
int main()
{
	ios::sync_with_stdio(false) ;
 
 
	int W, H, N ;
 
	cin >> W >> H >> N ;
 
	int x1 = 0, x2 = W, y1 = 0, y2 = H ;
 
	int x, y, a ;
	for(int i = 0 ; i < N ; i++)
	{
		cin >> x >> y >> a ;
 
		if(a == 1)
			x1 = max(x1, x) ;
		else if(a == 2)
			x2 = min(x2, x) ;
		else if(a == 3)
			y1 = max(y1, y) ;
		else if(a == 4)
			y2 = min(y2, y) ;
	}
 
	int newW = x2-x1 ;
	int newH = y2-y1 ;

	if(newW <= 0 || newH <= 0)
		cout << "0" ;
	else
		cout << newH * newW ;
 
	
	return 0;
} 

Measured memory_bytes: 384
import numpy as np
n,m,c = map(int,input().split())
b = np.array(list(map(int,input().split())))
ans = 0
for i in range(n):
  a = np.array(list(map(int,input().split())))
  if np.dot(a,b) > -c:
    ans += 1
print(ans)

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

#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int, int>>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int, int>
#define int long long int
#define inf INT_MAX
#define _inf INT_MIN
#define prDouble(x) cout<< fixed<<setprecision(10) << x
#define whilet int t;cin>>t;while(t--)
const int N = 100005;
const int mod = 1e9 + 7;

double prob[N];

double MinHead(int n) {

	int minHead = (n / 2) + 1;
	double dp[n + 1][minHead + 1];

	for (int j = 0; j <= minHead; j++) dp[0][j] = 0;
	for (int i = 0; i <= n; i++) dp[i][0] = 1;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= minHead; j++) {
			dp[i][j] = prob[i] * dp[i - 1][j - 1] + (1 - prob[i]) * dp[i - 1][j];
		}
	}
	return dp[n][minHead];
}

void solve() {

	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> prob[i];
  
	prDouble(MinHead(n));
}

void init() {
	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("../input.txt", "r", stdin);
	freopen("../output.txt", "w", stdout);
#endif
}

int32_t main()
{
	init();
	// whilet solve();
	solve();
}

Measured memory_bytes: 38944
solve :: [Int] -> [String]
solve [h,w] = take h $ repeat $ take w $ repeat '#'

main :: IO ()
main  = getContents
    >>= return . map (map read) . map words . lines
    >>= return . takeWhile (/= [0,0])
    >>= return . map solve
    >>= mapM_ (\ x -> mapM_ putStrLn x >> putStrLn "")

Measured memory_bytes: 4080
a,b,c,k=map(int,input().split())
count=0
if k>=a:
    count+=(1)*a
    k-=a
    if k>=b and k!=0:
        k-=b
        if k>=c and k!=0:
            count+=(-1)*c
        else:
            count+=(-1)*k  
else:
    count+=k  
print(count)

Measured memory_bytes: 9096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define array_s(a) sizeof(a) / sizeof(*a)
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool is_palindrome(string str)
{
    string rs = str;
    reverse(rs.begin(), rs.end());
    return (str == rs);
}

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

    if (!is_palindrome(s))
    {
        cout << "No" << endl;
        return 0;
    }

    string fs = s.substr(0, (s.size() - 1) / 2);

    if (!is_palindrome(fs))
    {
        cout << "No" << endl;
        return 0;
    }

    int x = (s.size() + 3) / 2;
    string es = s.substr(x - 1, s.size() - x + 1);

    if (!is_palindrome(es))
    {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
    char S[3],T[3];
    cin >> S >> T;
    int count;

    for(int i=0;i<3;i++){
        if (S[i] == T[i]){
            count++;
        }
    }

    printf("%d\n",count);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define mod 1000000007
#define inf (1LL<<60)
#define f(i,a,b) for (int i= a; i <b; ++i)
using namespace std;

signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,w;
    cin>>n>>w;
    pair<int,int> p[n];
    for(int i=0;i<n;i++)
        cin>>p[i].first>>p[i].second;
    int dp[n+1][w+1];
    memset(dp,0,sizeof dp);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(p[i-1].first<=j)
                dp[i][j]=max(dp[i][j],p[i-1].second+dp[i-1][j-p[i-1].first]);
        }
    }
    cout<<dp[n][w];
}



Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb(n) push_back(n)
const int N=2e5+5;
const ll M=1e9+7;
const ll inf=1e18;

ll tree[4*N];

ll query(int node,int st,int ed,int l, int r)
{
	if(l<=st and ed<=r)
	{
		return tree[node];
	}
	if(r<st || ed<l)
		return 0;
	int mid = (st+ed)/2;
	ll ans1 = query(2*node,st,mid,l,r);
	ll ans2 = query(2*node+1,mid+1,ed,l,r);

	return max(ans1,ans2);
}
void update(int node,int st,int ed,int pos,ll val)
{
	if(st==ed)
	{
		tree[node] = max(tree[node],val);

		return ;
	}
	int mid = (st+ed)/2;
	if(pos<=mid)
	{
		update(2*node,st,mid,pos,val);
	}
	else update(2*node+1,mid+1,ed,pos,val);

	tree[node] = max(tree[2*node],tree[2*node+1]);
}

int main()
{
	var(n);
	ll h[n],b[n];
	rep(i,0,n)
		lscn(h[i]);

	rep(i,0,n)
		lscn(b[i]);

	ll store[n+1]={0};

	for(int i=0;i<n;i++)
	{
		ll res = query(1,1,N-1,1,h[i]-1);
		// printf("querying %lld and got %lld\n",h[i]-1,res);
		store[h[i]] = max(store[h[i]],res+b[i]);

		update(1,1,N-1,h[i],store[h[i]]);
		// printf("updating %lld %lld\n",h[i],store[h[i]]);
	}
	ll ans = 0;
	for(int i=0;i<=n;i++)
	{
		ans = max(ans,store[i]);
		// lpri(store[i]);
	}

	lpri(ans);

}

Measured memory_bytes: 11008
# ある数Nのみで割っていく関数
def div_by_N(inpt, N):
    if inpt < N:
        return inpt
    else:
        ans = 0
        while inpt>0:
            ans += inpt%N
            inpt = inpt // N
        return ans
        
def main():
    inpt = int(input())
    ans = 1000000
    for i in range(inpt+1):
        ans = min(ans, div_by_N(i,6)+div_by_N(inpt-i,9))
    print(ans)
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    int A, B, C, D, E, F; //物理、化学、生物、地学、歴史、地理
    int score[6];
    cin >> A >> B >> C >> D >> E >> F;

    score[0] = A;
    score[1] = B;
    score[2] = C;
    score[3] = D;
    score[4] = E;
    score[5] = F;

    int min1 = score[0], max2 = score[4];
    for(int i = 1; i < 4; i++){
        if(score[i] < min1) min1 = score[i];
    }
    if(score[5] > max2) max2 = score[5];

    cout << (A + B + C + D - min1 + max2) << endl;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vector<long> a(n);
  rep(i,n) cin >> a.at(i);
  int j = 0;
  long sum = 0;
  long x = 0;
  long ans = 0;
  rep(i,n){
    while(i <= j && j < n){
      sum += a.at(j);
      x = (x ^ a.at(j));
      if(sum != x){
        sum -= a.at(j);
        x = (x ^ a.at(j));
        break;
      }
      j++;
    }
    sum -= a.at(i);
    x = (x ^ a.at(i));
    ans += (j - i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main{

  public static void main (String[] args){
    
    Scanner scanner = new Scanner (System.in);
    
    String letter = scanner.nextLine();
    
    if(letter.equals("a")||
       letter.equals("e")||
       letter.equals("i")||
       letter.equals("o")||
       letter.equals("u")){
   		System.out.println("vowel");
    } else {
    	System.out.println("consonant");
    }
    
  }
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  vint s(N);
  int sum = 0;
  rep(i, N) {
    cin >> s[i];
    sum += s[i];
  }
  sort(all(s));
  if(sum%10 != 0) {
    cout << sum << endl;
    return 0;
  }
  rep(i, N) {
    if(s[i]%10 != 0) {
      sum -= s[i];
      break;
    }
  }
  cout << (sum%10 == 0 ? 0 : sum) << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 505
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll n,num;
vector<ll> v;
ll mat[MAXN][MAXN];
int prime[10005],now;
bool is_prime[10005];
int sieve(int n)
{
    int p=0;
    memset(is_prime,true,sizeof(is_prime));
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=n;i++)
    {
        if(is_prime[i]) prime[p++]=i;
        for(int j=0;j<p;j++)
        {
            if(prime[j]*i>n) break;
            is_prime[prime[j]*i]=false;
            if(i%prime[j]==0) break;
        }
    }
    return p;
}
ll lcm(ll a,ll b)
{
    return a/__gcd(a,b)*b; 
}
void fill_diag_left(int x,int y)
{
    while(x<=n&&y<=n)
    {
        mat[x][y]*=prime[now];
        x++;y++;
    }
    now++;
}
void fill_diag_right(int x,int y)
{
    while(x<=n&&y>=1)
    {
        mat[x][y]*=prime[now];
        x++;y--;
    }
    now++;
}
void fill()
{
    for(ll i=1;i<=n;i++)
        for(ll j=2-(i&1);j<=n;j+=2)
            mat[i][j]=1;
    now=0;
    for(int i=1;i<=n;i+=2) fill_diag_left(1,i);
    for(int i=3;i<=n;i+=2) fill_diag_left(i,1);
    for(int i=1;i<=n;i+=2) fill_diag_right(1,i);
    for(int i=n;i>=2;i-=2) fill_diag_right(i,n);
}
bool check()
{
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=n;j++)
        {
            if(!mat[i][j])
            {
                ll g=1;
                if(i>1) g=lcm(g,mat[i-1][j]);
                if(j>1) g=lcm(g,mat[i][j-1]);
                if(i<n) g=lcm(g,mat[i+1][j]);
                if(j<n) g=lcm(g,mat[i][j+1]);
                mat[i][j]=g+1;
            }
        }
    }
    return true;
}
void print()
{
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=n;j++)
            printf("%lld ",mat[i][j]);
        puts("");
    }
}
int main()
{
    sieve(10000);
    scanf("%lld",&n);
    if(n==2)
    {
        puts("4 7\n23 10");
        return 0;
    }
    fill();
    assert(check());
    print();
    return 0;
}



Measured memory_bytes: 4992
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll abc = __gcd(c, d);
    abc = (c * d)/abc;
    ll ar = (a - 1)/c + (a - 1)/d - (a - 1)/(abc);
    ll br = b/c + b/d - b/(abc);
    cout << (b - a + 1) - (br - ar);

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::VecDeque;

fn main() {
    input!{
        n: usize,
        a: [i64; n],
    }

    let mut a = a;
    a.sort();

    let mut b = VecDeque::new();
    for i in 0..a.len() / 2 {
        let j = a.len() - 1 - i;

        if i % 2 == 0 {
            b.push_front(a[i]);
            b.push_back(a[j]);
        } else {
            b.push_front(a[j]);
            b.push_back(a[i]);
        }
    }
    if a.len() % 2 == 1 {
        let v = a[a.len() / 2];
        if (b[0] - v).abs() > (b[b.len() - 1] - v).abs() {
            b.push_front(v);
        } else {
            b.push_back(v);
        }
    }

    let mut ans = 0;

    // println!("{:?}", b);

    for i in 0..a.len() - 1 {
        ans += (b[i] - b[i + 1]).abs();
    }

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


Measured memory_bytes: 6396
D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
M[9][9][9],z[2];main(n,m,p,I,x,y,i,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,0,sizeof(M)),c=1,I=0;I<p;c*=-1){
		scanf("%d%d",&x,&y),I++;
		for(i=1;;i++)if(!M[x][y][i]){M[x][y][i]=c;break;}
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(z[j]=0;z[j]<m;z[j]+=2*j-1)if(M[x+D[d][0]*z[j]][y+D[d][1]*z[j]][i+D[d][2]*z[j]]!=c)break;
			if(z[1]-z[0]-1>=m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;I<p;I++)scanf("%d%d",&x,&y);
}exit(0);}

Measured memory_bytes: 612
n = int(input())
a = list(map(int, input().split()))
ok = True
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            ok = False
if ok:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 l, a[200001], dp[200001][5];
int main() {
  cin >> l; read_n(a, l, 1);
  for (i64 i = 1; i <= l; ++i) {
    for (i64 s = 0; s < 5; ++s) {
      i64 c = i64(1) << 50;
      for (i64 t = 0; t <= s; ++t) {
        c = min(c, dp[i - 1][t]);
      }
      i64 d;
      if (s == 0 || s == 4) d = a[i];
      else if (s == 1 || s == 3) d = a[i] == 0 ? 2 : a[i] % 2;
      else d = a[i] == 0 ? 1 : (a[i] + 1) % 2;
      dp[i][s] = c + d;
    }
  }
  i64 res = *min_element(&dp[l][0], &dp[l][4] + 1);
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 9728
N, K = input().split()

sunuke = []
for n in range(int(N)):
  sunuke.append([])
for k in range(int(K)):
  people = input()
  no = input().split()
  for i in no:
    sunuke[int(i)-1].append(int(K))
target = []
for i in range(int(N)):
  if len(sunuke[i]) == 0:
    target.append(i)
print(len(target))

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

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}


int main(void){
    int bells[3];
    scanf("%d %d %d", &bells[0], &bells[1], &bells[2]);
    qsort(bells, 3, sizeof(int), ascending_compare);
    printf("%d\n", bells[0]+bells[1]);
    

    
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
int f[200005];
int main() 
{   
	int n,t;
	long long ans = 0;
	scanf("%d %d",&n,&t);
    for (int i=1;i<=n;i++) scanf("%d",&f[i]);
    for (int i = 1;i<n;i++) ans += min(f[i+1] - f[i],t);
    printf("%d\n",ans + t);
}

Measured memory_bytes: 896
import java.util.Scanner; 

class Main{

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

		int roop = scan.nextInt();
		
		for(int i=0;i<roop;i++){
			int year  = scan.nextInt();
			int manth = scan.nextInt();
			int day = scan.nextInt();
			
			System.out.println(dayCount(year,manth,day));
		}
	
	}

	static int dayCount(int year,int manth,int day){

		int fyear=year;
		int maxday=0;
		int daycount=0;

		for(;year<=1000;year++){

			if(year==fyear){
				for(;manth<=10;manth++){
					if(year%3==0||manth%2!=0){
						maxday=20;		
					}
					else{
						maxday=19;
					}
					
//					System.out.println(year+"年"+manth+"月"+day+"日");

					for(;day<=maxday;day++){
						daycount++;	
					}
					day=1;
				}
			}
			else if(year==1000){
			}
			else{
				for(manth=1;manth<=10;manth++){
					if(year%3==0||manth%2!=0){
						maxday=20;		
					}
					else{
						maxday=19;
					}
					
//					System.out.println(year+"年"+manth+"月"+day+"日");

					for(day=1;day<=maxday;day++){
						daycount++;	
					}
					day=1;
				}
			}

		}
		return daycount;
	}

}

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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define uset unordered_set
#define umap unordered_map

#define endl "\n"

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define all(a) a.bg, a.ed

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

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    string s;
    cin >> s;
    if (s[0] != 'A') {
        cout << "WA";
        return 0;
    }
    int ic = -1;
    for (int i = 2; i < s.size() - 1; i++) {
        if (s[i] == 'C') {
            if (ic == -1) {
                ic = i;
            } else {
                cout << "WA";
                return 0;
            }
        }
    }
    if (ic == -1) {
        cout << "WA";
        return 0;
    }
    for (int i = 0; i < s.size(); i++) {
        if ('A' <= s[i] && s[i] <= 'Z' && i != 0 && i != ic) {
            cout << "WA";
            return 0;
        }
    }
    cout << "AC";
}


Measured memory_bytes: 3656
import numpy as np
N = int(input())
S = input()

left = 0
right = S.count('E')

if S[0] == 'E' :
    right -= 1

sum_ = left + right

for i in range(len(S) - 1):
    now = S[i]
    nxt = S[i+1]

    if now == 'W':
        left += 1
    if nxt == 'E':
        right -=1

    if left + right < sum_:
        sum_ = left + right

# when the last one is a leader
left = S.count('W')
right = 0

if S[-1] == 'W':
    left -= 1
if left + right < sum_:
    sum_ = left + right

print(sum_)

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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+7;

ll cnt = 0; 

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

struct BIT {
  private:
   vector<ll> bit;
   ll N;
 
  public:
   BIT(ll size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(ll a, ll w) {
     for (ll x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(ll a) {
     ll ret = 0;
     for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };
 

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

  ll l = S.length();
  ll i = 0;
  while(i<l){
    if(i<l-1){
      if(S[i]=='B' && S[i+1]=='C'){
	S = S.substr(0, i) + '1' + S.substr(i+2);
	l--;
      }
    }
    if(S[i]=='A') S[i] = '2';
    i++;
  }

  //cout << S << endl;
  
  ll ans =0;
  ll tmp = 0;
  rep(i, l){
    if(S[i]=='B' || S[i]=='C'){
      string tmp_S = S.substr(tmp, i-tmp);
      //cout << tmp<<" "<<tmp_S <<endl;
      //cout << tmp_S<<endl;
      
      BIT b(3);
      rep(j, tmp_S.length()){
	ans += j -b.sum(ll(S[tmp+j] - '0'));
	b.add(ll(S[tmp+j] - '0'), 1);
      }
      tmp = i+1;
      //cout << ans<<endl;
    }
  }

  //cout << S<<endl;
  if(S[l-1]=='1' || S[l-1]=='2'){  
    string tmp_S = S.substr(tmp, l-tmp);
    //cout << tmp_S<<endl;
    BIT b(3);
    rep(j, tmp_S.length()){
      ans += j -b.sum(ll(S[tmp+j] - '0'));
      b.add(ll(S[tmp+j] - '0'), 1);
    }
  }
  cout << ans<<endl;
  
}


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

using namespace std;

int main() {
    long long n, t, ans = 0, last = 0;
    cin >> n >> t;
    for(long long i = 0; i < n; ++i){
        long long tmp; cin >> tmp;
        if(i == 0)ans += t;
        else if(tmp - last > t)ans += t;
        else ans += (tmp - last);
        last = tmp;
    }
    cout << ans;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i<n; i++)
int main()
{
	string S;
	cin >> S;
	ll num = S.size();

	if(S[num-1]=='s'){
		for(int i = 0; i<num; i++)
			cout << S[i];
		cout << "es";
	}
	else{
		for(int i = 0; i<num; i++)
			cout << S[i];
		cout << "s";
	}

	cin >> S;
	
	return 0;	
}


Measured memory_bytes: 3592
import Control.Monad
import Control.Monad.ST
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV

main = B.interact$B.pack.show.f.unfoldr(B.readInt.B.dropWhile isSpace)
f (n:k:h) = minimum $ zipWith (\s h->h-s) ss hs
    where
        hh = sort h
        ss = take (n-k+1) hh
        hs = drop (k-1) hh

Measured memory_bytes: 16764
def root(x):
  if par[x] == x:
    return x
  par[x] = root(par[x])
  return par[x]

def same(x, y):
  return root(x) == root(y)

def unite(x, y):
  x = root(x)
  y = root(y)
  par[x] = y

v, e = map(int,input().split())
adj = [list(map(int, input().split())) for i in range(e)]
adj.sort(key = lambda x:x[2])
par = [i for i in range(v)]
sum = 0

for i, j, k in adj:
  if not same(i, j):
    sum += k
    unite(i, j)
print(sum)



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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0
//fill(a, a+n, 5) //fill for any value

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}
//_____________________________________________________\\

map<ll,ll>m;

void findPrimeFactors(ll n)
{

    while (n%2== 0) m[2]++, n = n/2;

    for (ll i = 3; i*i <= n; i = i+2)
    {
        while (n%i == 0)
        {
            m[i]++;
            n = n/i;
        }
    }

    if (n > 2) m[n]++;
}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        long double a,b;
        cin>>a>>b;
        long long c = a*b;
        cout<<c;
    
    }
}

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

const int mod = 998244353;

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}

inline int mul(int a, int b) {
  return (a * (ll) b) % mod;
}

inline int pw(int x, int n) {
  int res = 1;
  while (n > 0) {
    if (n % 2) {
      res = mul(res, x);
      n--;
    } else {
      x = mul(x, x);
      n /= 2;
    }
  }
  return res;
}

inline int inv(int x) {
  return pw(x, mod - 2);
}

const int N = 2e5 + 7;

vector <int> fact(N);

int C(int n, int k) {
    return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}

int main() {
    ios::sync_with_stdio(0);                                                                                                                               
    cin.tie(0); 
    fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = mul(fact[i - 1], i);
    }
    int n, m, k;
    cin >> n >> m >> k;
    int ans = 0;
    for (int g = n - k; g <= n; g++) {
        int ways = C(n - 1, g - 1);
        int kek = mul(m, pw(m - 1, g - 1));
        add(ans, mul(ways, kek));
    }
    cout << ans << '\n';
    return 0;   
}

Measured memory_bytes: 3904
import java.util.Scanner;
 
public class Main {
    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int[] numbers = new int[n];
        for (int i = 0; i < n; i++) {
            numbers[i] = scanner.nextInt();
        }
 
        int q = scanner.nextInt();
        int[] patterns = new int[q];
        for (int i = 0; i < q; i++) {
            patterns[i] = scanner.nextInt();
        }
 
        int count = 0;
        for (int i = 0; i < q; i++) {
            int pattern = patterns[i];
            for (int j = 0; j < n; j++) {
                if (pattern == numbers[j]) {
                    ++count;
                    break;
                }
            }
        }
 
        System.out.println(count);
    }
}

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

int main()
{
    string s;
    cin >> s;
    for (char &t : s)
        if (t == ',')
            t = ' ';

    cout << s << endl;
}

Measured memory_bytes: 3560
package main

import (
  	"bufio"
	"fmt"
	"os"
	"strconv"
	"sync"
)

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func maxt(a ...int) int {
	t := a[0]
	for _, x := range a {
		t = max(t, x)
	}
	return t
}

func main() {
	n := ReadInt()
	m := ReadInt()
	dp := make(map[int]int)
	dp[0] = 0
	ans := 0
	for i := 0; i < n; i++ {
		w := ReadInt()
		c := ReadInt()
		s := make(map[int]int)
		for a, b := range dp {
			if b + w <= m {
				s[a + c] = b + w
			}
		}
		for a, b := range s {
			if _, exs := dp[a]; exs {
				dp[a] = min(dp[a], b)
			} else {
				dp[a] = b
			}
			ans = max(ans, a)
		}
	}
	fmt.Println(ans)
}


var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup
func ReadString() string {
	in.Scan()
	return in.Text()
}
func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}
func ReadInt() int {
	intStr := ReadString()
	i, _ := strconv.ParseInt(intStr, 10, 32)
	return int(i)
}
func ReadIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}
func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)
 
	//set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)
 
	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(write *bufio.Writer) {
		defer outWg.Done()
		defer write.Flush()
 
		for line := range out {
			write.WriteString(line + "\n")
		}
	}(writer)
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n,k,s;
  cin >> n >> k >> s;
  vector<ll> ans(n,-1);
  rep(i,k){
    ans.at(i)=s;
  }
  rep(i,n){
    if(ans.at(i)==-1){
      if(s==1e9){
        ans.at(i)=1;
      }else{
        ans.at(i)=1e9;
      }
    }
  }
  rep(i,n){
    cout << ans.at(i) << " ";
  }
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define mod (long long)(1e9+7)
int main()
{
    //int t;
    //cin >> t;
    //while(t--){
	unsigned long long int n, k;
	cin >> n >> k;
	unsigned long long int s = 0;
    while (k <= n + 1) {
        s = (s + ((2 * n - k + 1) * k / 2 - (k - 1) * k / 2 + 1) % mod) % mod;
        k++;
    }
	cout<<s<<"\n";
    //}
	return 0;
}


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

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve(){
    int n,k;
    cin >> n >> k;
    vector<llint>mp(n+1,0);
    for(int i=0;i<k;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int a;
            cin >> a;
            mp[a]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(mp[i]==0)ans++;
    }
    cout << ans << endl;
}

int main(){
    solve();
    return 0;
}


Measured memory_bytes: 3552
N = int(input())
li = [list(map(int, input().split())) for x in range(N)]
length = 0
for i in range(len(li)):
	for j in range(len(li)):
		if i != j:
			length += ((li[i][0]-li[j][0])**2+(li[i][1]-li[j][1])**2)**0.5
print(length/N)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>

int main() {
    int a, b;
    std::cin >> a >> b;

    int n = std::stoi(std::to_string(a) + std::to_string(b));
    int root = (int)std::sqrt(n);
    std::cout << (root * root == n ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  vi cnt_min(26,INF);
  rep(i,n) {
    string s;
    cin >> s;
    vi cnt(26,0);
    rep(j,sz(s)) {
      //DEBUG(s[j]-'a');
      cnt[s[j]-'a']++;
    }
    rep(j,26) {
      cnt_min[j] = min(cnt_min[j],cnt[j]);
    }
  }

  //rep(i,26) {
  //  cout << i << " :" << cnt_min[i] << endl;
  //}


  rep(i,26) {
    rep(j,cnt_min[i]) {
      putchar('a'+i);
    }
  }
  printf("\n");
}

Measured memory_bytes: 256
number = int(input())
word =input()
word_list = list(word)
word_number = len(word_list)
cnt = 0
empty_word = ""
if word_number <= number:
    print(word)
else :
    while cnt <= number - 1 :
        empty_word += word_list[cnt]

        cnt += 1

    empty_word += "..."
    print(empty_word)






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

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

}

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

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  auto x_sorted = x;
  sort(x_sorted.begin(), x_sorted.end());
  int front_index = n / 2 - 1, back_index = n / 2;
  for (int i = 0; i < n; i++) {
    if (x[i] <= x_sorted[front_index]) {
      cout << x_sorted[back_index] << endl;
    } else {
      cout << x_sorted[front_index] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, n;
  in(n);
  vector<ll> c(n), d(n);
  rep(i, n){
    in(c[i]);
    d[i] = c[i];
  }
  sort(all(c));
  a = (n - 1) / 2ll;
  rep(i, n){
    if(d[i] >= c[a + 1]){
      out(c[a]);
      memi;
    }
    else{
      out(c[a + 1]);
      memi;
    }
  }
}

Measured memory_bytes: 5376
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long x = Integer.parseInt(sa[1]);
		long[] a = new long[n];
		sa = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		Arrays.parallelSort(a);

		int ans = 0;
		for (int i = 0; i < n; i++) {
			x -= a[i];
			if (x >= 0) {
				ans++;
			} else {
				break;
			}
		}
		if (x > 0) {
			ans--;
		}
		System.out.println(ans);
	}
}


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

int main(){
  int k, s;
  cin >> k >> s;
  
  int n, sum;
  sum = 0;
  for (int i=0; i<=k; i++){
    for (int j=0; j<=k; j++){
      n = s - i - j;
      if(n>=0 && n<=k) sum++;
    }
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-

# N = int(input())
# N = int(input().split())
# N, K = [int(x) for x in input().split()]

K, X = [int(x) for x in input().split()]

if K * 500 >= X:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 3060
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;
//const long long int MOD = 998244353;

int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<int>p;
	vector<int>m;
	for (int i = 0; i < N; i++) {
		cin >> M;
		if (M < 0)m.push_back(M);
		else p.push_back(M);
	}
	sort(p.begin(), p.end());
	sort(m.begin(), m.end());
	vector<pair<int,int>>ret;
	if (m.empty()) {
		if (p.size() == 2) {
			ret.push_back({ p.back(), p.front() });
		}
		else {
			ret.push_back({ p[0],p[1] });
			for (int i = 2; i < N - 1; i++) {
				ret.push_back({ ret.back().first - ret.back().second,p[i] });
			}
			ret.push_back({ p.back(),ret.back().first - ret.back().second });
		}
	}
	else if (p.empty()) {
		reverse(m.begin(), m.end());
		ret.push_back({ m[0],m[1] });
		for (int i = 2; i < N; i++) {
			ret.push_back({ ret.back().first - ret.back().second,m[i] });
		}
	}
	else {
		for (int i = 1; i < p.size(); i++) {
			ret.push_back({ m.back(),p[i] });
			m.back() -= p[i];
		}
		for (int i = 0; i < m.size(); i++) {
			ret.push_back({ p[0], m[i] });
			p[0] -= m[i];
		}
	}
	cout << ret.back().first - ret.back().second << endl;
	for (auto i : ret)cout << i.first << " " << i.second << endl;
}

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
    string s;
    cin>>s;
    int ans=10000;
    for(int i=0;i<s.size()-2;i++){
        int x=0;
        for(int j=0;j<3;j++){
            char t=s[i+j];
            x+=(t-'0')*pow(10,2-j);
        }
        ans=min(ans,abs(x-753));
    }
    cout<<ans<<endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int lt;
typedef vector<ll> vi;
typedef vector<int> vin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
#define all(a) a.begin(),a.end()
#define rep(i,a,b) for(int i=a;i<b;++i)
#define f(i,b) for(int i=0;i<b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define test(t) int t; cin>>t; while(t--) solve()
#define endl "\n"
#define p1 cout<<"YES"<<endl
#define p0 cout<<"NO"<<endl
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int mod=1e9+7;

ll mod_pow(ll a,ll n,ll mod)	//(a^n)%mod
{	ll res=1;
	while(n){	if(n&1)	res=(res*a)%mod; n/=2; a=(a*a)%mod;	}
	return res;
}

void solve();

int main()
{
    fst;
    //test(t);
     solve();
}

/**********************<="Actual code strats here"=>*****************************/


void solve()
{
    vi a(5);
    rep(i,0,5) cin>>a[i];
    rep(i,0,5)
    {
        if(a[i]==0)
            cout<<i+1<<endl;
    }
}

Measured memory_bytes: 3612
import Control.Applicative

getInt :: IO Int
getInt = (\a -> read a :: Int) <$> getLine

getInteger :: IO Integer
getInteger = (\a -> read a :: Integer) <$> getLine

sum_all :: Integer -> Integer
sum_all n = n * (n + 1) `div` 2

main = do
    print =<< sum_all <$> getInteger


Measured memory_bytes: 380
using System;

namespace Dodecagon
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, R;
            A = Convert.ToInt32(Console.ReadLine());
            R = 3 * (A * A);
            Console.WriteLine("{0}",R);
            Console.ReadLine();
        }
    }
}

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

using namespace std;

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

	int x = N % 10;

	if (x == 3) {
		cout << "bon" << endl;
	} else if (x == 0 || x == 1 || x == 6 || x == 8) {
		cout << "pon" << endl;
	} else {
		cout << "hon" << endl;
	}

	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
inline void read(int &x){
	x=0;char ch=getchar();int f=1;
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=10*x+ch-'0';ch=getchar();}x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
typedef long long i64;
i64 n,a,b;
int main(){
	cin>>n>>a>>b;
	i64 v1=(n-1)*a+b,v2=(n-1)*b+a;
	cout<<max(0ll,v2-v1+1);
}

Measured memory_bytes: 256
n = int(input())
s = input().strip()
ans = 0
for i in range(len(s)):
    s1 = list(set(s[:i]))
    s2 = list(set(s[i:]))
    count_inner = 0
    for c in s1:
        if c in s2:
            count_inner += 1
    ans = max(ans, count_inner)
print(ans)


Measured memory_bytes: 3060