akhauriyash/Code-Regression huggingface dataset:
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, m;
    cin >> n;
    vi x(n);
    forn(i, n)
    {
        cin >> x[i];
        if (x[i] % 2 == 1) cout << "first", exit(0);
    }
    cout << "second";
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=1005,maxe=4005,P=1e9+7;
int n,m;
LL pw[maxe],MST,W,ans;
struct Edge{
  int x,y,w,flg;
  Edge(int t1=0,int t2=0,int t3=0){ x=t1; y=t2; w=t3; flg=0; }
  bool operator < (const Edge &A)const{ return w<A.w; }
} Es[maxe];
int fir[maxn],nxt[maxe],w[maxe],son[maxe],tot;
void add(int x,int y,int z){
  son[++tot]=y; w[tot]=z; nxt[tot]=fir[x]; fir[x]=tot;
}
int fa[maxn];
int getfa(int x){ return fa[x]==x?x:fa[x]=getfa(fa[x]); }
void merge(int x,int y){
  x=getfa(x); y=getfa(y);
  if(x!=y) fa[x]=y;
}
void Kruskal(){
  sort(Es+1,Es+1+m);
  for(int i=1;i<=n;i++) fa[i]=i;
  for(int i=1;i<=m;i++){
    if(getfa(Es[i].x)==getfa(Es[i].y)) continue;
    MST+=Es[i].w; add(Es[i].x,Es[i].y,Es[i].w); add(Es[i].y,Es[i].x,Es[i].w);
    merge(Es[i].x,Es[i].y); Es[i].flg=1;
  }
}
int anc[maxn][11],_max[maxn][11],dep[maxn];
void dfs_info(int x,int pre,int w_pre){
  anc[x][0]=pre; _max[x][0]=w_pre;
  for(int i=1;i<=10;i++){
    anc[x][i]=anc[anc[x][i-1]][i-1];
    _max[x][i]=max(_max[x][i-1],_max[anc[x][i-1]][i-1]);
  }
  for(int j=fir[x];j;j=nxt[j])
    if(son[j]!=pre) dep[son[j]]=dep[x]+1, dfs_info(son[j],x,w[j]);
}
int getMax(int x,int y){
  int res=0;
  if(dep[x]<dep[y]) swap(x,y);
  for(int i=10;i>=0;i--)
    if(dep[anc[x][i]]>=dep[y]) res=max(res,_max[x][i]), x=anc[x][i];
  if(x==y) return res;
  for(int i=10;i>=0;i--)
    if(anc[x][i]!=anc[y][i]){
      res=max(res,max(_max[x][i],_max[y][i]));
      x=anc[x][i]; y=anc[y][i];
    }
  return max(res,max(_max[x][0],_max[y][0]));
}
int num_low,num_eq,num_upp;
int main(){
  scanf("%d%d%lld",&n,&m,&W);
  for(int i=1;i<=m;i++) scanf("%d%d%d",&Es[i].x,&Es[i].y,&Es[i].w);
  Kruskal(); dfs_info(1,1,0);
  if(MST>W) return puts("0"),0; 
  for(int i=1;i<=m;i++){
    if(Es[i].flg) continue;
    LL t=MST-getMax(Es[i].x,Es[i].y)+Es[i].w;
    t==W?num_eq++:(t>W?num_upp++:num_low++);
  }
  pw[0]=1; for(int i=1;i<=2000;i++) pw[i]=pw[i-1]*2%P;
  if(MST<W) ans=(pw[num_eq]-1)*pw[num_upp]%P*2%P;
  else ans=(pw[n-1]-2)*pw[m-n+1]%P+(pw[num_eq]-1)*pw[num_upp]%P*2%P;
  printf("%d\n",(ans%P+P)%P);
  return 0;
}


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

int main(){
int a, b, n, ax, in;
cin >> n >> a >> b;
if(a > b){
  ax = b;
}else{
  ax = a;
}

if (n > a+b){
  in = 0;
}else{
  in = a+b -n;
}

  cout << ax << ' '<< in << endl;
}

Measured memory_bytes: 256
INF = 10 ** 18

N, A, B, C = map(int,input().split())
ls = [int(input()) for i in range(N)]

def func(pos, a, b, c):return abs(a - A) + abs(b - B) + abs(c - C) - 30 + INF * max(0, 1 - a * b * c) if pos == N else min(func(pos + 1, a + ls[pos] * (i == 0), b + ls[pos] * (i == 1), c + ls[pos] * (i == 2)) + 10 * (i < 3) for i in range(4))
print(func(0, 0, 0, 0))

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

typedef long long LL;
const LL INF=1e15;

int main(){
	LL n;
	LL MIN=INF;
	LL MAX=-1;
	cin>>n;
	LL a,b;
	while(n--){
		cin>>a>>b;
		MAX=max(MAX,a);
		MIN=min(MIN,b);
	}
	cout<<MAX+MIN<<endl;
	return 0;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(string, "s", long, "p");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    auto x = lread();
    writeln(2 * (x / 11) + (x % 11 ? (x % 11 > 6 ? 2 : 1) : 0));
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 2644
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
const ll inf =
 1e9 + 5 ;
 //1e18L + 5;
const ll nax = 2e5 + 5;
void min_self(ll&a , ll b){a=min(a,b);}
void max_self(ll&a , ll b){a=max(a,b);}
void add_self(ll&a , ll b){a=(a+b)%mod;}
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
ll query(vector<ll>& bit , ll x){

	ll res = 0 ; 
	while(x>0){
		max_self(res,bit[x]);
		x-=(x&-x);
	}
return res; 

}
void update(vector<ll>& bit , ll x , ll val){

	ll n = bit.size() ; 
	while(x<n){
		max_self(bit[x]  , val);
		x+=(x&-x);
	}
}


signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n ; cin >> n ;
vector<ll> arr (n) ; for(ll i = 0 ; i<n ; i++)cin>> arr[i] ;
vector<ll>bit(n+1) ; 
ll ans = 0  ;
for(ll i = 0;  i< n ; i++){
	ll k ; cin >> k ;
	ll res = query(bit , arr[i] - 1);
	// cout << arr[i] -1 << "  "<< res <<endl;
	max_self(ans , res + k );
	update(bit , arr[i] , k + res);
	// for(auto it : bit)cout <<it<<" " ; cout << endl;

	
}
cout << ans << endl;

	
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> v;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			v.push_back(i*j);
		}
	}
	for(int i=0;i<v.size();i++){
		if(v[i]==n){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


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

class Program
{
    static void Main()
    {
        var x = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Console.WriteLine(Enumerable.Range(x[0], x[1] - x[0] + 1).Count(q => x[2] % q == 0));
    }
}


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

using namespace std;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

int main() {
  
  double a, b, x;
  cin >>  a >> b >> x;
  double tan, theta;
  

  
  if(x >= a*a*b/2) {
    tan  = a*a*a / 2 / (a*a*b-x);
    theta = atan(tan);
    theta = 90 - rad_to_deg(theta);
  }
  else{
    tan = 2 * x / (b*b*a);
    theta = atan(tan);
    theta = 90 - rad_to_deg(theta);
  }
  
  
  //cout << 90 - rad_to_deg(theta) << endl;
  printf("%lf", theta);

  
}


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

def count_diff2(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

a = 1e9
for i in range(len(s)-len(t)+1):
    le = s[i:i+len(t)]
    a = min(a, count_diff2(le, t))
print(a)


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int n;
	cin >> n;
	vector<int> vec;

	rep(i, n){
		int x;
		cin >> x;
		vec.push_back(x);
	}

	vector<int> dp(n);

	dp[0] = 0;
	dp[1] = abs(vec[1] - vec[0]);

	for(int i = 2; i < n; i++){
		if(dp[i - 2] + abs(vec[i] - vec[i - 2]) < dp[i - 1] + abs(vec[i] - vec[i - 1])){
			dp[i] = dp[i - 2] + abs(vec[i] - vec[i - 2]);
		}
		else{
			dp[i] = dp[i - 1] + abs(vec[i] - vec[i - 1]);
		}
	}

	/*
	rep(i, n){
		cout << dp[i] << endl;
	}
	cout << endl;
	*/

	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll k, n;
  cin >> k >> n;
  vector<ll> vec(n);
  rep(i, n) cin >> vec[i];
  ll s = 0;
  
  ll ans = vec[n-1] - vec[0];
  for(int i = 1; i < n; i++) {
    ans = min(ans, vec[i-1] + k - vec[i]);
  }
  cout << ans << endl;
  
  
  return 0;
}

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

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

    int n;
    cin >> n;
    vector<int> arr(n), l(n+1), r(n+1);
    for(int i=0;i<n;i++){
        cin >> arr[i];
        l[i+1] = arr[i];
        r[i] = arr[i];
    }

    for(int i=1;i<n;i++){
        l[i+1] = __gcd(l[i+1], l[i]);
    }

    for(int i=n-1;i>0;i--){
        r[i-1] = __gcd(r[i], r[i-1]);
    }


    int maxi = 0;
    for(int i=0;i<n;i++){
        maxi = max(maxi, __gcd(l[i],r[i+1]));
    }
    cout << maxi << '\n';
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int cou = 0;
  int cous = 0;
  cin >> n;
  for(int i = 1;i<=n;i++){
    if(i%2==1){
    for(int m = 1;m<=n;m++){
      if(i%m == 0){
        cou++;
      }
    }
    if(cou == 8){
      cous++;
      cou = 0;
    } else {
      cou = 0;
    }
  }
  }
  cout << cous << endl;
}


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

int main(){
    string str;
    cin >> str;
    bool flag = true;
    int arr[26] = {};
    for(int i=0;i<str.length();i++){
    	arr[str[i]-97]++;
    }
    for(int i=0;i<26;i++){
    	if(arr[i]%2==1){
    		flag = false;
            break;
    	}
    }
    if(flag){
    	cout << "Yes" << endl;
    }
    else{
    	cout << "No" << endl;
    }
	return 0;
}

Measured memory_bytes: 3596
# -*- coding: utf-8 -*-
INF=10**10
from collections import Counter
import scipy.misc as scm

def ncr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result

def main():
    N,A,B=list(map(int,input().split()))
    v=list(map(int,input().split()))
    cnt=Counter(v)
    ary=[]
    first=True
    
    for num,count in sorted(cnt.items(),reverse=True):
        if count>A:
            if first:
                a2=0
                print("{:.6f}".format(float(num)))
                for k in range(A,min(B,count)+1):
                    a2+=ncr(count,k)
                print(a2)
                return 0
            
            ary+=[num]*A
            print("{:.6f}".format(sum(ary)/len(ary)))
            print(ncr(count,A))
            return 0
        elif A==0:
            print("{:.6f}".format(sum(ary)/len(ary)))
            print(1)
        else:
            ary+=[num]*count
            A-=count
        first=False
    
        
      
if __name__=="__main__":
    main()
    

Measured memory_bytes: 13276
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <utility>
#include <map>
#include <functional>
#include <initializer_list>
#include <string>
using namespace std;

typedef long long int ll;

int main(){
    ll N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<ll> Count(N), A(Q);

    for(int i=1; i<N; i++){
        Count[i] = Count[i-1];
        if(S[i] == 'C' && S[i-1] == 'A'){
            Count[i]++;
            }
        }
    ll Start, Stop;
    for(int i=0; i<Q; i++){
        cin >> Start >> Stop;
        Start--;
        Stop--;
        A[i] =  Count[Stop] - Count[Start];
        }
    for(int i=0; i<Q; i++){
        cout << A[i] << endl;
        }


}

Measured memory_bytes: 2560
import math

a = list(map(int,input().split()))
A = a[0]
B = a[1]
H = a[2]
M = a[3]
theta = abs(30*H-5.5*M)
ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(theta))
print(math.sqrt(ans))

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

int main(void) {
    int n;
    long long ans = 0;
    vector<int> a;
    cin >> n;
    a.resize(n * 3);
    for (int i = 0; i < n * 3; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++)
        ans += a[n + i * 2];
    cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<int> even(1e5+1, 0);
  vector<int> odd(1e5+1, 0);
  rep(i,n) {
    int v;
    cin >> v;
    if (i%2) {
      odd[v]++;
    } else {
      even[v]++;
    }
  }
  pair<int, int> mx_odd = make_pair(0, 0);
  pair<int, int> mx_even = make_pair(0, 0);
  pair<int, int> mx_odd_2 = make_pair(0, 0);
  pair<int, int> mx_even_2 = make_pair(0, 0);

  rep(i, 1e5+1) {
    if (odd[i] > mx_odd.second) {
      mx_odd_2 = mx_odd;
      mx_odd = make_pair(i, odd[i]);
    } else {
      if (odd[i] > mx_odd_2.second) mx_odd_2 = make_pair(i, odd[i]);
    }
    if (even[i] > mx_even.second) {
      mx_even_2 = mx_even;
      mx_even = make_pair(i, even[i]);
    } else {
      if (even[i] > mx_even_2.second) mx_even_2 = make_pair(i, even[i]);
    }
  }
  int h = n/2;
  int odd_diff = (n/2 - mx_odd.second);
  int even_diff = (n/2 - mx_even.second);
  int ans = 0;
  if (mx_even.first == mx_odd.first) {
    int a = (h - mx_even.second) + (h - mx_odd_2.second);
    int b = (h - mx_odd.second) + (h - mx_even_2.second);
    ans = min(a, b);
  } else {
    ans = (h - mx_odd.second) + (h - mx_even.second);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4052
str = input().split()
N = int(str[0])
A = int(str[1])
B = int(str[2])

SUM = 0
for i in range(N+1):
    a = i % 10
    b = int(i / 10) % 10
    c = int(i/100) % 10
    d = int(i/1000) %10
    e = int(i/10000) % 10
    if a+b+c+d+e >= A and a+b+c+d+e <= B:
        SUM = SUM + i
        
print(SUM)

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

int main() {

	int n;
	char s[10000];
	int k;

	cin >> n;
	cin >> s;
	cin >> k;

	char t = s[k - 1];

	for (int i = 0; i < n; i++) {
		if (s[i] == t) {
			cout << s[i];
		}
		else {
			cout << '*';
		}
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  string a,b;
  cin >> a;
  cin >>b;
  
  reverse(b.begin(),b.end());
  if(a==b){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  
   return 0;
}


Measured memory_bytes: 632
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_ABC144
{
    class MainClass
    {

        static long[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            long srt = (long)Ceiling(Sqrt(s[0]));
            //WriteLine(srt);
            long u = s[0];
            for(long i = srt;i>=1;i--){
                //WriteLine("i : {0}  u : {1}",i,u);
                if(u%i==0){
                    WriteLine((u/i - 1)+i - 1);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
#include<string.h>
int main(){
  char s[11];
  int flag[10]={};
  scanf("%s",s);
  for(int i=0;i<strlen(s);i++){
    if(s[i]!='B')
      flag[i]=1;
    else{
      for(int j=i-1;j>=0;j--){
        if(flag[j]==1){
          flag[j]=0;
          break;
        }
      }
    }
  }
  for(int i=0;i<strlen(s);i++)
    if(flag[i])
      printf("%c",s[i]);
  printf("\n");
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#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 Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

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

ll gcd(ll a, ll b){
  if(a < b)
    return gcd(b, a);
  if(b == 0)
    return a;

  return gcd(b, a%b);
}


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

  ll n;
  cin >> n;

  vector<ll> t(n);
  REP(i, n)
    cin >> t[i];

  ll ans = t[0];
  REP1(i, n)
    ans *= t[i] / gcd(ans, t[i]);

  cout << ans << endl;

  
  
}


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

#ifdef _DEBUG
    #include "/home/v-o_o-v/deb.h"
    #define deb(x...)cerr << "[" << #x << "] = [";_print(x);
#else
    #define deb(x...)
#endif

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int cnt[55];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int a, b, c;
    cin >> a >> b >> c;
    c %= b;
    int z = a;
    for(int i = 0; i <= 1e5; i++){
        a += z;
        if(a % b == c){
            puts("YES");
            return 0;
        }
    }
    puts("NO");
    return 0;
}
// Write Here


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

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  bool j = 0;
  rep(i,s.size()) {
    if(s==t) j = 1;
    s = s.substr(1) + s[0];
  }
  cout << ((j) ?"Yes" :"No") << endl;  
}

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

int main() {
    ll N, M;
    cin >> N >> M;

    ll res;
    ll t = M/N;
    for(ll i=t; i>=1; i--) {
        if(!(M%i)) {
            res = i;
            break;
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;

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

	cout << 24 + (24 - M) << endl;
	


	return 0;
}



Measured memory_bytes: 764
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1

n=int(input())
A=list(map(int,input().split()))
for i in range(n-1):
    for j in range(i+1,n):
        ans=max(ans,abs(A[j]-A[i]))
    # print(ans)
print(ans)

Measured memory_bytes: 39152
n,m=map(int,input().split())
h=list(map(int,input().split()))
s=[]
for i in range(n):
    s.append(i)
res=0
a=[]
for i in range(m):
    a.append(list(map(int,input().split())))
    if h[a[i][0]-1]<=h[a[i][1]-1]:
        s[a[i][0]-1]=-1
    if h[a[i][0]-1]>=h[a[i][1]-1]:
        s[a[i][1]-1]=-1
for ss in s:
    if ss!=-1:
        res=res+1
print(res)


Measured memory_bytes: 34420
// 

// g++ -std=c++11 abc145_c.cc && ./a.out 
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int memo[50];
int n;

int fibo(int i) {
    if (memo[i] != 0) { return memo[i]; }

    int result = fibo(i - 1) + fibo(i - 2);
    memo[i] = result;
    return result;
}

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

    rep(i, n) memo[i] = 0;
    memo[0] = 1;
    memo[1] = 1;

    cout << fibo(n) << endl;

    return 0;
}



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

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

  uint64_t ans = 0;

  for (uint64_t i = 2; i <= 1'000'000; i++) {
    if (i * i > n) break;
    if (n % i == 0) {
      for (uint64_t x = i; x <= n; x *= i) {
        if (n % x == 0) {
          n /= x;
          ans++;
        }
      }
      while (n % i == 0) {
        n /= i;
      }
    }
  }

  if (n > 1) ans++;

  cout << ans << endl;
}


Measured memory_bytes: 3608
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tommy6073
 */

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

class CNotSoDiverse {
public:
    void solve(std::istream &in, std::ostream &out) {
        ll N, K;
        in >> N >> K;
        int A[N];
        for (int i = 0; i < N; ++i) {
            in >> A[i];
        }

        map<int, int> num_map;
        for (int i = 0; i < N; ++i) {
            ++num_map[A[i]];
        }

        int num_cnt = num_map.size();
        int num_array[num_cnt];
        int i = 0;
        for (auto num: num_map) {
            num_array[i] = num.second;
            ++i;
        }
        sort(num_array, num_array + num_cnt);

        int result = 0;
        for (int i = 0; i < num_cnt - K; ++i) {
            result += num_array[i];
        }

        out << result << endl;
    }
};


int main() {
	CNotSoDiverse solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 11136
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		string[] args = Console.ReadLine().Split(' ');
		int N = Int32.Parse(args[0]);
		int M = Int32.Parse(args[1]);

		double pAC = 1/(double)(1 << M);
		double runtime = 1900 * M + (N - M) * 100;

		Console.WriteLine((int)Math.Round(runtime/pAC));
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;

int main(){
    ll x;
    cin >> x;
    bool prime = true;
    FOR(i, x, pow(10, 5)+4){
        FOR(j, 2, i){
            if(j*2 > i){
                break;
            }else{
                if(i%j==0){
                    prime = false;
                    break;
                }else{
                    prime = true;
                }
            }
        }
        if(prime){
            cout << i;
            break;
        }
    }
    return 0;
}


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

int main(){
    int n;cin >> n;
    vector<P> a(n),b(n);

    for(int i = 0; i < n ; i++){
        int x,y;cin >> x >> y;
        a[i] = make_pair(x,y);
    }
    for(int i = 0; i < n ; i++){
        int x,y;cin >> x >> y;
        b[i] = make_pair(x,y);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());

    vector<P> ans;
    for(int i = 0; i < b.size() ; i++){
        int ax = -1;
        int flag = false;
        for(int j = 0 ; j < a.size() ; j++){
        if(a[j].first < b[i].first && a[j].second < b[i].second){
            if(flag){
                P prev = ans.back();
                if(prev.second < a[j].second){
                    ans.pop_back();
                    ans.push_back(a[j]);
                    ax = j;
                }
            }else{
              ans.push_back(a[j]);
              ax = j;  
              flag = true;
            }
            
        }
       
        }
        if(ax != -1)a.erase(a.begin()+ax);
    }
    cout << ans.size() << endl;
    return 0;
}

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

using namespace std;


#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()


#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>

void print(T x)
{
	std::cout << x << '\n';
}


int main() {
	char a[50];
	int count = 0;
	scanf("%4s", a);

	if ((a[0] == a[1] and a[2] == a[3] and a[0] != a[2]) or (a[0] == a[2] and a[1] == a[3] and a[1] != a[2]) or (a[0] == a[3] and a[2] == a[1] and a[0] != a[2]))
		print("Yes");
	else print("No");

}

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

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

#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 1e9+7

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

map<int, int> m;

int main() {
  ll n, f = 0, s = 0;
  cin >> n;
  vector<int> a(n);
  rep(i, 0, n) cin >> a[i];
  sort(a.begin(), a.end());

  for(int i = n - 2; i >= 0; i--) {
    if(a[i] == a[i + 1]) {
      if(f) {
        s = a[i];
        break;
      }
      else f = a[i];
      i--;
    }
  }

  cout << f * s << endl;
}


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

int main() {
  ll n; cin >> n;
  vector<ll>v(n);
  ll a,b;
  rep(i,n){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  cout << abs(v.at(n-1)-v.at(0)) << endl;
  
  
  return 0;
}

Measured memory_bytes: 3644
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	f = 0
	for i in 1:3500
		if f==1
			break
		end
		ff = 0
		for j in 1:3500
			if ff==1
				break
			end
			if (4*i*j-n*i-n*j)>0&&n*i*j%(4*i*j-n*i-n*j)==0
				f = 1
				ff=1
				println(i," ",j," ",div(n*i*j,(4*i*j-n*i-n*j)))
				break
			end
		end
	end
end

main()

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

const double PI = 3.14159265359;
const int INF = (int)1e9;
const ll LINF = 1e18;
const int IMOD = 1000000007;
const int dr[4] = {1, 0, -1, 0};
const int dc[4] = {0, 1, 0, -1};

using namespace std; 

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

int main(void)
{
    int n, m;
    cin >> n >> m;
    
    v_int possible(n);
    v_int ball(n,1);
    possible[0] = 1;

    irep(i, m) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        if(possible[x]) {
            if(ball[x] == 1) {
                possible[x] = 0;
                possible[y] = 1;
            } else {
                possible[y] = 1;
            }
            ball[x] = max(0, ball[x]-1);
            ball[y]++;
        } else {
            ball[x] = max(0, ball[x]-1);
            ball[y]++;
        }
        //irep(i, n) { printf("%d,%d\n", possible[i], ball[i]); }
    }
    int ans = 0;
    irep(i, n) {
        if(possible[i]) { ans++; }
    }
    cout << ans << endl;
    return 0;
}
/** atcoder **/



Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

int main(void){
    unsigned long long int h;
    unsigned long long int ans;
    unsigned int count = 0;
    scanf("%llu", &h);
    
    while(h){
        h = h >> 1;
        count++;
    }
    ans = pow(2, count);
    printf("%llu", ans-1);
    return 0;
}

Measured memory_bytes: 256
// ~maqsat~
/*
```````````````````````¶¶
````````````````````¶¶¶¶¶¶¶¶
```````````````````¶¶¶¶¶¶¶¶¶¶
```````````````````¶¶¶¶¶¶``¶¶¶
``````````````````¶````¶````¶¶
``````````````````¶```¶¶¶```¶¶¶
`````````````````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
````````````````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶```````````¶¶
```````````````¶¶¶¶¶````¶¶¶¶¶`¶¶¶¶¶``````¶¶¶¶¶¶¶¶¶
`````````````¶¶¶¶¶````````````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶`
`````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶```¶¶¶
```¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
`¶¶``¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
``````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
```````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
```````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
`````````¶¶``````¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
```````````````````¶¶¶¶¶¶¶¶¶¶¶¶¶¶
```````````````````¶¶¶¶¶¶¶¶¶¶¶¶¶¶
````````````````````¶¶¶¶¶¶¶¶¶¶¶¶
`````````````````````¶¶¶¶¶¶¶¶¶¶¶
``````````````````````¶¶¶¶¶¶¶¶¶
````````````````````````¶¶¶¶¶
                 ready for halloween
*/
 
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
 
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }
 
const int oo = 0x3f3f3f3f;
const ll N = 2e5 + 345;
const ll MOD = 1e9 + 7;
const ll INF = 1e15 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int main() {
    fre("");
    ACCELERATE;
    
    #define int ll
    
    int n, k;
    cin >> n >> k;
    
    int a[N];
    for(int i = 0; i < n; i++) cin >> a[i];
    
    ll dp[N];
    memset(dp, INF, sizeof dp);
    
    dp[0] = 0;
    for(int i = 1; i < k; i++) {
	    for(int j = 0; j < i; j++) {
	        cmin(dp[i], abs(a[i] - a[j]) + dp[j]);
	    }
    }
    
    for(int i = k; i < n; i++) {
    	for(int j = i - k; j < i; j++) {
    	    cmin(dp[i], abs(a[i] - a[j]) + dp[j]);
    	}
    }
    
    cout << dp[n-1];
    return 0;
}
/*
 
*/

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

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

    int n,k;
    cin >> n >> k;
    bool havesweet[n]={false};

    rep(i,k){
        int d;
        cin >> d;
        rep(i,d){
            int a;
            cin >> a;
            havesweet[a-1] = true;
        }
    }
    int ans = 0;
    rep(i,n){
        if (havesweet[i] == false) ans++;
    } 

    cout << ans;
}


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

class MainClass
{

    public static void Main(string[] args)
    {
        var n = LnStr();
        var one = n[n.Length - 1];
        switch (one.ToString())
        {
            case "2":
            case "4":
            case "5":
            case "7":
            case "9":
                print("hon");
                break;
            case "3":
                print("bon");
                break;
            default:
                print("pon");
                break;
        }
    }


    public static long SumAtoB(long a, long b) { var length = b - a + 1; return (a + b) * (length / 2) + (length % 2 == 1 ? (a + b) / 2 : 0); }
    public static long PowLite(long n, long p, int mod = (int)1e9 + 7) { long ans = 1; long now = n; for (; p > 0; p >>= 1) { if ((p & 1) == 1) { ans *= now; ans %= mod; } now *= now; now %= mod; } return ans; }
    public static void print(object obj) { Console.WriteLine(obj); }
    public static long Gcd(long a, long b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
    public static int Gcd(int a, int b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
    public static int[] LnInts() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new int[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]); return ins; }
    public static int LnInt() { var vs = Console.ReadLine().Trim(); return int.Parse(vs); }
    public static long[] LnLngs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new long[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = long.Parse(vs[i]); return ins; }
    public static long LnLng() { var vs = Console.ReadLine().Trim(); return long.Parse(vs); }
    public static string[] LnStrs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); return vs; }
    public static string LnStr() { var vs = Console.ReadLine().Trim(); return vs; }
    public static List<T[]> AllPermutation<T>(params T[] array) where T : IComparable { var a = new List<T>(array).ToArray(); var res = new List<T[]>(); res.Add(new List<T>(a).ToArray()); var n = a.Length; var next = true; while (next) { next = false; int i; for (i = n - 2; i >= 0; i--) { if (a[i].CompareTo(a[i + 1]) < 0) break; } if (i < 0) break; var j = n; do { j--; } while (a[i].CompareTo(a[j]) > 0); if (a[i].CompareTo(a[j]) < 0) { var tmp = a[i]; a[i] = a[j]; a[j] = tmp; Array.Reverse(a, i + 1, n - i - 1); res.Add(new List<T>(a).ToArray()); next = true; } } return res; }
}


Measured memory_bytes: 25792
// AtCoder template
// 最近sabaがかまってくれないからキレて暴れてる
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

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

    int k; cin >> k;
    string s; cin >> s;
    if(s.size() <= k){
        cout << s << endl;
        return 0;
    }

    cout << s.substr(0,k) + "..." << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = (int)Math.ceil(N/1.08);
        int b = (int)Math.floor(N/1.08);

        if(Math.floor(a * 1.08) == N){
            System.out.println(a);
            return;
        }else if(Math.floor(b * 1.08) == N){
            System.out.println(b);
            return;
        }else{
            System.out.println(":(");
        }
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	ll a;
	double b;
	cin >> a >> b;
	ll x = b * 100 + EPS;
	ll ans = a * x / 100;
	cout << ans << endl;
}

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

int main() {
    int n; cin>>n;
    vector<int> a(n); rep(i,0,n) cin>>a[i];

    int sw = 0;
    rep(i,0,n){
        int minj = i;
        rep(j,i,n) if(a[j] < a[minj]) minj = j;
        if(i != minj) {
            swap(a[i], a[minj]);
            sw++;
        }
    }

    rep(i,0,n){
        if(i) cout<<" ";
        cout<<a[i];
    }
    cout<<endl;
    cout<<sw<<endl;

    return 0;
}


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

using namespace std;

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

	string s,t;
	int res = 0;
	int n;

	cin >> s;
	cin >> t;
	n = s.length();

	for(int i=0;i<n;i++)
	{
		if(s[i]!=t[i])
		{
			res++;
		}
	}

	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=10e17;
//------------------------------------------------------------
ll A;
float B;

void solve() {
  cin>>A>>B;

  int ib = int(floor(B));
  ll a = A*ib;

  double db = (B-floor(B))*100;
  ll lb = round(db);
  ll b = (long long)(floor(A*lb/100));

  print(a+b);
  return;
}

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


int main()
{
  int n;
  cin >> n;
  vector<pair<int, ll>> t(n);
  rep(i, n)
    cin >> t[i].second >> t[i].first;
  sort(t.begin(), t.end());
  ll tm = 0;
  rep(i, n)
  {
    tm += t[i].second;
    if (tm > t[i].first)
    {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
          int n = Input.ScanInt();
          int[] a = Input.ScanIntArray(); // T A
          List<int> h = Input.ScanIntArray().ToList();
          
          h = h.Select(x=>Math.Abs(1000*a[0] - x*6 -1000*a[1])).ToList();
          
          int i;
          for(i=0;i<n;i++)
            if(h[i]==h.Min()) break;
          Console.WriteLine(i+1);
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11420
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int w = sc.nextInt();
		if(s <= w){
			System.out.print("un");
		}
		System.out.println("safe");
	}
}


Measured memory_bytes: 35820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
template <typename T>
struct BinaryIndexedTree
{
  vector<T> data;

  BinaryIndexedTree(ll sz)
  {
    data.assign(++sz, 0);
  }

  T sum(ll k)
  {
    T ret = 0;
    for (++k; k > 0; k -= k & -k)
      ret += data[k];
    return (ret);
  }

  void add(ll k, T x)
  {
    for (++k; k < data.size(); k += k & -k)
      data[k] += x;
  }
};
int main()
{
ll n ;
cin >> n ;
string s ;
cin >> s ;
vector<BinaryIndexedTree<ll>> v;
rep(i,26){
  BinaryIndexedTree<ll> bit(n);
  v.push_back(bit);
}
rep(i,n){
  v[s[i]-'a'].add(i,1);
}
ll q ;
cin >> q ;
rep(i,q){
  ll a , b ;
  cin >> a >> b ;
  if(a==1){
    char c;
    cin >> c;
    v[s[b-1]-'a'].add(b-1,-1);
    s[b-1]=c;
    v[c-'a'].add(b-1,1);
  }
  if(a==2){
    ll c;
    cin >> c;
    ans=0;
    rep(j,26){
      ll kk=0;
      if(b==1)kk=0;
      else kk=v[j].sum(b-2);
      if(v[j].sum(c-1)-kk>0)ans++;
    }
    cout << ans << endl;
  }
}

return 0;
}

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

int main(void) {
	int i, j;
	int len;
	int coinside;
	char s[32];

	fgets(s, sizeof(s), stdin);
	len = strlen(s);
	if(s[len - 1] == '\n') {
		len -= 1;
	}
	coinside = 0;
	for(i = 0; i < len; i += 1) {
		for(j = 0; j < i; j += 1) {
			if(s[i] == s[j]) {
				coinside = 1;
				break;
			}
		}
		if(coinside == 1) {
			break;
		}
	}

	if(coinside == 0) {
		printf("yes\n");
	} else {
		printf("no\n");
	}

	return 0;
}


Measured memory_bytes: 1960
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
int main() {
	int a, b;
	cin >> a >> b;
	cout << max(a + b, max(a - b, a * b));
}

Measured memory_bytes: 256