akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 3e5 + 10;

int t[4*N];

int query(int v, int tl, int tr, int l, int r) {
	if (l > r) 
		return 0;
	if (l == tl && r == tr) {
		return t[v];
	}
	int tm = (tl + tr) / 2;
	return max(query(v*2, tl, tm, l, min(r, tm)), query(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
	if (tl == tr) {
		t[v] = new_val;
	} else {
		int tm = (tl + tr) / 2;
		if (pos <= tm)
			update(v*2, tl, tm, pos, new_val);
		else
			update(v*2+1, tm+1, tr, pos, new_val);
		t[v] = max(t[v*2], t[v*2+1]);
	}
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 0; i < n; i++) {
		int mx = query(1, 0, 300000, max(0LL, a[i] - k), min(300000LL, a[i] + k));
		update(1, 0, 300000, a[i], mx + 1);
	}
	cout << t[1];

	return 0;
}

Measured memory_bytes: 14192
def nCr(n,r):
    return fac[n]//fac[r]//fac[n-r]

N,A,B=map(int,input().split())
v=sorted(map(int,input().split()),reverse=True)

fac=[1]
for i in range(N):
    fac.append(fac[-1]*(i+1))

print(sum(v[:A])/A)

Cnt=v.count(v[A-1])
res=0

if v[0]==v[A-1]:
    for i in range(A,B+1):
        res+=nCr(Cnt,i)

else:
    M=v[:A].count(v[A-1])
    res=nCr(Cnt,M)

print(res)

Measured memory_bytes: 62040
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

vector<VecP> tree;
Vec dist;

void dijkstra(ll node){
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(mp(0, node));
	while(!que.empty()){
		P o = que.top(); que.pop();
		if(o.fs >= dist[o.sc]) continue;
		dist[o.sc] = o.fs;
		for(P i : tree[o.sc]) que.push(mp(o.fs+i.fs, i.sc));
	}
}

int main(void){
	ll n;
	cin >> n;
	tree.resize(n);
	dist.resize(n);
	fill(all(dist), LINF);
	rep(i, n-1){
		ll a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		tree[a].pb(mp(c, b));
		tree[b].pb(mp(c, a));
	}

	ll q, k;
	cin >> q >> k;
	k--;
	dijkstra(k);

	rep(i, q){
		ll x, y;
		cin >> x >> y;
		x--, y--;
		co(dist[x]+dist[y]);
	}

	return 0;
}


Measured memory_bytes: 11120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main{

	public static void main(String args[]) throws Exception {
		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		int ar[] = new int[n];
		
		for(int i = 0; i < n; i++)
			ar[i] = sc.nextInt();
		
		Arrays.parallelSort(ar);
		
		long cost = 0;
		
		for(int i = 0; i < k; i++)
			cost += ar[i];
		
		pr.println(cost);
		pr.close();
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


Measured memory_bytes: 33000
#include <stdio.h>

int main(void){
  
  char st[16];
  scanf("%s",st);
  int i=0,win=0;
  
  while(st[i]!='\0'){
    if(st[i]=='x'){
    win++;
    }
  i++;
  }
  if(win>=8){
  printf("NO\n");
  }else{
    printf("YES\n");}
    return 0;
}

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

const int SIZE = 100000;

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

  vector<int> v(SIZE, 0);
  rep(i, N) {
    int a;
    cin >> a;
    if (a - 1 > 0)
      v[a - 1]++;
    v[a]++;
    if (a + 1 < SIZE)
      v[a + 1]++;
  }

  int ans = 0;
  rep(i, v.size()) ans = max(ans, v[i]);

  cout << ans << endl;
}

Measured memory_bytes: 640
#include <array>
#include <functional>
#include <iostream>
#include <limits>
#include <string>

int main(int argc, char const* argv[])
{
    std::string in_str;
    std::cin >> in_str;

    int sum = in_str[0] - '0';

    for (int i = 0; i < 2; ++i)
    {
        for (int j = 0; j < 2; ++j)
        {
            for (int k = 0; k < 2; ++k)
            {
                int sum = in_str[0] - '0';
                if(i == 0)
                {
                    sum += in_str[1] - '0';
                }
                else
                {
                    sum -= in_str[1] - '0';
                }

                if(j == 0)
                {
                    sum += in_str[2] - '0';
                }
                else
                {
                    sum -= in_str[2] - '0';
                }

                if(k == 0)
                {
                    sum += in_str[3] - '0';
                }
                else
                {
                    sum -= in_str[3] - '0';
                }

                if(sum == 7)
                {
                    std::cout <<  in_str[0];
                    if(i ==0 )
                    {
                        std::cout << "+";
                    }
                    else
                    {
                        std::cout << "-";
                    }

                    std::cout <<  in_str[1];
                    if(j == 0)
                    {
                        std::cout <<  "+";
                    }
                    else
                    {
                        std::cout <<  "-";
                    }
                    std::cout << in_str[2];
                    if(k == 0)
                    {
                        std::cout <<  "+";
                    }
                    else
                    {
                        std::cout <<  "-";
                    }
                    std::cout << in_str[3] << "=7"<< std::endl;;
                    return 0;
                }
            }
        }
    }
}

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

int main() {
  int N,M;
  cin >> N >> M;
  multiset<int> A;
  REP(i,N) {
    int ain;
    cin >> ain;
    A.emplace(ain);
  }
  REP(i,M) {
    auto ait = A.end();
    ait--;
    int amax = *ait;
    A.erase(ait);
    A.emplace( amax>>1 );
  }
  ll ans = 0;
  for( auto x: A ) {
    ans += x;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4992
#include <iostream>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int linearSearch(int A[], int n, int key)
{
    int i = 0;
    A[n] = key;
    while ( A[i] != key ) ++i;
    return i != n;
}

int main()
{
    int n, q, A[10001], key, sum = 0;

    scanf("%d", &n);
    rep(i, n) scanf("%d", &A[i]);

    scanf("%d", &q);
    rep(i, q){
        scanf("%d", &key);
        if (linearSearch(A, n, key)) ++sum;
    }
    printf("%d\n", sum);

    return 0;
}


Measured memory_bytes: 3232
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(n,x);
  M cnt;
  REP(i,n){
    IN2(a,b);
    cnt[a] += b;
  }
  int now = 0;
  for(auto p :cnt){
    now += p.second;
    if(now >= x){
      OUT(p.first);
      break;
    }
  }
}

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

int main(){
    int n;
    while(cin >>n){
        if(n == 0) break;
        multimap<int, int> m;
        for(int i = 0; i < n; i++){
            int w, limit;
            cin >>w >>limit;
            m.insert( multimap<int, int>::value_type(limit, w) );
        }
        int sum = 0;
        bool flag = true;
        for(multimap<int, int>::iterator it = m.begin(); it != m.end(); it++){
            sum += (*it).second;
            if(sum > (*it).first){
                flag = false;
                break;
            }
        }
        if(flag){
            cout <<"Yes";
        } else{
            cout <<"No";
        }
        cout <<endl;
    }
    return 0;
}

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

int main() {
  int K;
  cin >> K;
  long long int ans = 0;
  for (int a = 1; a <= K; a++) {
    for (int b = 1; b <= K; b++) {
      for (int c = 1; c <= K; c++) {
        ans += __gcd(__gcd(a, b), c);
      }
    }
  }
  cout << ans << endl;
}


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

int main()
{
    int n;
    cin>>n;
    int *a = new int[n];

    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    
    cout<<a[n-1];

    for (int i = 2; i <= n; i++)
    {
        cout<<" "<<a[n-i];
    }
    cout<<endl;

    delete[] a;
    return 0;
}


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



int main(){
	string S[3];
	cin>>S[0]>>S[1]>>S[2];
	int now[3]={};
	int player = 0;
	
	while(true){
		if(now[player]==S[player].size()){
			cout<<(char)('A'+player)<<endl;
			return 0;
		}
		int a = now[player];
		now[player]++;
		player=S[player][a]-'a';
	}
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

typedef long long ll;

using namespace std;

int main(){

    string s, t;
    cin >> s;
    cin >> t;

    cout << t << s << endl;



    return 0;
}


Measured memory_bytes: 256
def euclid(a,b):
    if b % a == 0:
        return a 
    else:
        return euclid(b % a, a)
#aもbも割り切る正の整数のうちK番目に大きいもの
#最大公約数の約数のうちK番目に大きいものを求めればよいでしょう
a,b,k = map(int,input().split())

ans = 0
gcd = euclid(a,b)
count = 0
for i in range(gcd,0,-1):
    if gcd % i == 0:
        count += 1
        if count == k:
            ans = i
            break 
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
int main()
{
    int A, B, C, D;
    scanf("%d %d %d %d", &A, &B, &C, &D);
    if (A*B >= C*D)
    {
        printf("%d", A*B);
    }
    if (A*B < C*D)
     {
         printf("%d", C*D);
     }
    
        
    return 0;
}



Measured memory_bytes: 128
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

class Main {
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    ArrayList<Integer> H = new ArrayList<>();
    
    for (int i = 0; i < N; i++) {
      H.add(sc.nextInt());
    }
    
    Collections.sort(H);
    
    long A = 0;
    for (int i = 0; i < N; i++) {
      if (N - i > K) {
        A += H.get(i);
      }
    }
    
    System.out.println(A);
    
  }
}

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


int main()
{
	int n, x,a[100],k=0;
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

	}
	sort(a, a + n);
	for (int i = 0; i < n-1; i++) {
		if (x < a[i])break;
		else {
			k++;
			x -= a[i];
		}
	}
	if (x == a[n - 1])k++;
	cout << k << endl;
    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

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

	vector<int> a(n);

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i] -= i + 1;
	}

	sort(ASC(a));

	/*
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
	*/

	int mid;
	if (n % 2 == 1) mid = n / 2;
	else mid = n / 2 - 1;

	ll ans = 0;
	for (int i = 0; i < a.size(); i++)
	{
		ans += abs(a[i] - a[mid]);
	}
	cout << ans << endl;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

signed main(){

	lli n;
	cin>>n;

	lli data[100010];
	vector<lli> a(n);
	REP(i,0,n){
		cin>>data[i];
		a[i] = data[i];
	}

	sort(data,data+n);

	lli cnt=0;

	REP(i,0,n){
		lli num = a[i];
		lli index = (lli)(lower_bound(data,data+n,num)-data);
		if(DEBUG)cout<<"num="<<num<<" index-i="<<abs(index-i)<<endl;
		index -= i;
		if(abs(index)%2==1)cnt++;
	}
	cout<<cnt/2<<endl;

	return 0;
}

Measured memory_bytes: 1792
def binom(n,k)
  k = [k, n-k].min

  if k==0
     val = 1
  else
     val = binom(n-1,k-1)*n/k
  end

  return val
end

n,k = gets.chomp.split.map(&:to_i)
mod = (1e9+7).to_i
r = n - k

(1..k).each do |i|
  next puts 0 if i-1 > r
  cnt = 0
  cnt += binom(k-1,i-1) % mod
  cnt *= binom(r+1,r-i+1)
  puts cnt % mod
end



Measured memory_bytes: 2044
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdint>
#include <utility>
#include <tuple>
#include <map>    
#include <queue> 
#include <set>  
#include <stack> 
#include <deque>  
#include <unordered_map> 
#include <unordered_set> 
#include <bitset>

using namespace std;

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

	int64_t  M = 0;
	for (int i = 0; i < N; i++) {
		M += i;
	}
	cout << M << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define fastio ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define ict int t; cin >> t
#define lct ll t; cin >> t;
#define in(a) int a; cin >> a
#define ln(a) ll a; cin >> a
#define loop(i,n) for (ll i = 0; i < n; ++i) 
#define looprev(i,n) for (ll i=n-1; i>=0 ; --i)
#define LOOP(i,k,n) for (ll i = k; i <= n; ++i) 
#define LOOPREV(i,k,n) for (ll i = k; i >= n; --i) 
#define mp make_pair 
#define pa pair <ll,ll>
#define vec vector<ll>
#define vecpa vector<pa>
#define vec2D vector <ll<ll>>
#define que queue<ll>
#define deq deque<ll> 
#define stk stack<ll>
#define iterate vector<ll>::iterator
#define pub push_back
#define pob pop_back
#define pof pop_front
#define puf push_front
#define emp emplace_back
#define all(a) a.begin(),a.end();

using namespace std;

void solve(){
    ll n;
    cin >> n;
    vec a(n);
    loop(i,n) cin >> a[i];
    ll res = 0;
    for(ll i = 0 ; i<n-1 ; i++){
        if(a[i]> a[i+1]) {
            res += a[i]-a[i+1];
            a[i+1] = a[i]; 
        }
    }
    cout << res << endl;
}

int main()
{
    fastio;
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
}

Measured memory_bytes: 4740
#include<stdio.h>
 
int main(){
		int n,t;
		scanf("%d%d",&n,&t);
		int i,small=1000,a,b,flag=0;
		for(i=0;i<n;i++){
			scanf("%d%d",&a,&b);
			if(b<=t){
				if(a<small)small=a;
				flag=1;
			}
		}
		if(flag==0)puts("TLE");
		else printf("%d",small);
		return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  if(A%3==0 || B%3==0 || (A+B)%3==0){
	cout << "Possible" << endl;
  }else{
	cout << "Impossible"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();
    let t: Vec<char> = input::<String>().chars().collect();

    let mut tbl = vec![vec![]; 26];
    for i in 0..s.len() {
        let c = s[i] as u8 - b'a';
        tbl[c as usize].push(i);
    }

    let mut ans = 0;
    let mut i = 0;
    let mut ok = true;
    for j in 0..t.len() {
        let c = t[j] as u8 - b'a';
        if tbl[c as usize].is_empty() {
            ok = false;
            break;
        }
        let k = tbl[c as usize].lower_bound(&(i));
        if k == tbl[c as usize].len() {
            let rem = s.len() - i - 1;
            i = tbl[c as usize][0] + 1;
            ans += (rem + i + 1) as i64;
        } else {
            ans += (tbl[c as usize][k] - i + 1) as i64;
            i = tbl[c as usize][k] + 1;
        }
    }

    if !ok {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}

trait LowerBound<T: Ord> {
    fn lower_bound_by<F: FnMut(&T) -> std::cmp::Ordering>(&self, f: F) -> usize;
    fn lower_bound(&self, x: &T) -> usize {
        self.lower_bound_by(|e| e.cmp(x))
    }
    fn lower_bound_by_key<U: Ord, F: FnMut(&T) -> U>(&self, x: &U, mut f: F) -> usize {
        self.lower_bound_by(|e| f(e).cmp(x))
    }
}
impl<T: Ord> LowerBound<T> for [T] {
    fn lower_bound_by<F: FnMut(&T) -> std::cmp::Ordering>(&self, mut f: F) -> usize {
        let mut l = -1 as i64;
        let mut r = self.len() as i64;
        while r - l > 1 {
            let m = ((l + r) / 2) as usize;
            if f(&self[m]) == std::cmp::Ordering::Less {
                l = m as i64;
            } else {
                r = m as i64;
            }
        }
        r as usize
    }
}


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

using namespace std;

const double PI = acos(-1);

int main(){
  double a,b,x;
  cin >> a >> b >> x;
  double ans_radian;
  if(x < (a*a*b)/2)ans_radian = atan((a*b*b/2/x));
  else ans_radian = atan((2*(a*a*b-x)/a/a/a));
  cout << fixed << setprecision(13);
  cout << ans_radian*180/PI;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
int main()
{
	ll a,b,n;
	cin>>a>>b>>n;
	cout<<((a*min(b-1,n))/b)-a*(ll)(min(b-1,n)/b)<<endl;
	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n;
	cin>>n;
	vector<int>a(n),b(n);
	int mxa=-1,mxb=-1,mna=1e10,mnb=1e10;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		mxa=max(mxa,a[i]);
		mxb=max(mxb,b[i]);
		mna=min(mna,a[i]);
		mnb=min(mnb,b[i]);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	int ans;
	if(n%2)
		ans=b[n/2]-a[n/2];
	else
		ans=b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1];
	ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6356
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

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

	string k = "keyence";
	FOR(i, 0, 7) {
		string k1 = k.substr(0, 7 - i);
		string k2 = k.substr(7 - i, i);
		int k1l = k1.length();
		int k2l = k2.length();
		int sl = S.length();

		if (S.substr(0, k1l) == k1 && S.substr(sl-k2l, k2l) == k2) {
			cout << "YES" << endl;
			return 0;
		}
	}

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

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

int main()
{
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	if (N <= K) {
		cout << N * X << endl;
	}
	else {
		cout << K * X + (N - K) * Y << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/**
 * Я слил Atcoder Beginner Contest 172, решив всего две задачи!
 * Я не могу апнуть синего!
 * Я постоянно сливаю раунды, либо не решив тупую задачу, либо набрав штрафа!
 * Я постоянно уступаю всем своим друзьям и знакомым в контестах и нахожу этому оправдания!
 * Я постоянно придумываю сложные неверные решения к простым задачам!
 * -------------------------------------------------------------
 * -Решать сложные задачи
 * -Участвовать в контестах
 * -Делать виртуальные соревнования
 * -------------------------------------------------------------
 * Не уберу это, пока не начну нормально решать задачи, а не заниматься ерундой!!!
**/
  
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

typedef long long  ll;
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define halt {cout<<"NO"; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const int N = 200010;
const int INF = 1e8;
const ll LL_INF=1e10;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// Template functions
string bin_rep(ll n)
{
     string s="";
      for(int i=63;i>=0;i--)
   {
           if(n&(1LL<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int first_bit(int n)
{
  for(int i=0;i<=31;i++)
   {
           if(n&(1<<i)) return i;
   }
}

//------------------------------

int main()
{
    #if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 int l,r,d;
 cin>>l>>r>>d;
 int cnt=0;
 for(int i=l;i<=r;i++) if(i%d==0) cnt++;
 cout<<cnt;
 

 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

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

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);

    for(int i=0;i<h;i++){
        cin >> s[i];
    }

    const int dx[8]={-1,0,1,-1,1,-1,0,1};
    const int dy[8]={-1,-1,-1,0,0,1,1,1};
    
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#') continue;

            int num = 0;
            rep(d,8){
                const int ni = i + dx[d];
                const int nj = j + dy[d];

                if(ni < 0 || h <= ni) continue;
                if(nj < 0 || w <= nj) continue;
                if(s[ni][nj]=='#') num++;
            }
            s[i][j]=char(num+'0');
            
        }
    }

    rep(i,h){
        cout << s[i] << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    string s;cin>>s;
    int n=s.size();
    int ans=n+1;
    for(char c='a';c<='z';c++){
        int pos=-1;
        int ma=0;
        rep(i,n){
            if(s[i]==c)ma=max(i-pos-1,ma),pos=i;
        }
        ma=max(n-pos-1,ma);
        ans=min(ans,ma);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
int main() {
    for (int i = 0; i < 3; i++)
    {
        string s; cin >> s;
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        HashMap<Long, Integer> h = new HashMap<>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            long sum_a = a[i] + i;
            if (h.get(sum_a) == null) h.put(sum_a, 1);
            else h.put(sum_a, h.get(sum_a) + 1);
        }

        long ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            long sum = i - a[i];
            if (h.get(sum) != null) ans += h.get(sum);
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 71184
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int N, T;

int main(void){
	//IO("test.in", "test.out");
	scanf("%d", &N);
	for(int i = 1; i <= N; i += 2){
		int t = 0;
		for(int j = 1; j <= i; j++)
			if(i % j == 0) t++;
		if(t == 8) T++;
	}
	printf("%d\n", T);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  long a[100010],c[100010],cnt=0,l[100010],r[100010],t[100010];
  int n;
  char s[100010];
  scanf("%s",s);
  n=strlen(s);
  if(s[0]=='A')
    a[0]=1;
  else
    a[0]=0;
  if(s[n-1]=='C')
    c[n-1]=1;
  else
    c[n-1]=0;
  if(s[0]=='?')
    l[0]=1;
  else
    l[0]=0;
  if(s[n-1]=='?')
    r[n-1]=1;
  else
    r[n-1]=0;
  for(int i=1;i<n;i++){
    if(s[i]=='A')
      a[i]=a[i-1]+1;
    else
      a[i]=a[i-1];
    if(s[n-1-i]=='C')
      c[n-1-i]=c[n-1-i+1]+1;
    else
      c[n-1-i]=c[n-1-i+1];
    if(s[i]=='?')
      l[i]=l[i-1]+1;
    else
      l[i]=l[i-1];
    if(s[n-1-i]=='?')
      r[n-1-i]=r[n-1-i+1]+1;
    else
      r[n-1-i]=r[n-1-i+1];
  }
  t[0]=t[1]=t[2]=t[3]=1;
  for(int i=1;i<n;i++)
    t[i+3]=t[i+2]*3%1000000007;
  for(int i=1;i<n-1;i++){
    if(s[i]=='B'){
      cnt+=a[i-1]*c[i+1]*t[r[0]+3]%1000000007;
      cnt+=a[i-1]*r[i+1]*t[r[0]+2]%1000000007;
      cnt+=l[i-1]*c[i+1]*t[r[0]+2]%1000000007;
      cnt+=l[i-1]*r[i+1]*t[r[0]+1]%1000000007;
    }
    if(s[i]=='?'){
      cnt+=a[i-1]*c[i+1]*t[r[0]+2]%1000000007;
      cnt+=a[i-1]*r[i+1]*t[r[0]+1]%1000000007;
      cnt+=l[i-1]*c[i+1]*t[r[0]+1]%1000000007;
      cnt+=l[i-1]*r[i+1]*t[r[0]]%1000000007;
    }
  }
  cnt%=1000000007;
  printf("%ld\n",cnt);
}

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

typedef long long ll;
typedef pair < int , int > Pi;
typedef pair < ll , ll > Pl;

const int INF = (1 << 30) - 1;
const ll LLINF = 1LL << 60;
vector < Pi > G[100005];
int pos[100005];

bool dfs(int v, int p)
{
    bool ret = true;
    if(pos[v] != -INF && pos[v] != p) return (false);
    if(pos[v] != -INF) return (true);
    pos[v] = p;
    for(int i = 0; i < G[v].size(); i++) {
        int u = G[v][i].first, np = G[v][i].second + p;
        ret &= dfs(u, np);
    }
    return (ret);
}

int main()
{
    int N, M;
    cin >> N >> M;
    fill_n(pos, 100005, -INF);
    for(int i = 0; i < M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        G[a].push_back(Pi(b, c));
        G[b].push_back(Pi(a, -c));
    }
    bool flag = true;
    for(int i = 1; i <= N; i++) {
        if(pos[i] == -INF) flag &= dfs(i, 0);
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return (0);
}

Measured memory_bytes: 12032
#include <iostream>
#include <vector>

using namespace std;

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

	vector<int> c(n - 1), s(n - 1), f(n - 1);
	for (int i = 0; i < n - 1; i++) {
		cin >> c[i] >> s[i] >> f[i];
	}

	for (int i = 0; i < n - 1; i++) {
		long long ans = 0;
		for (int j = i; j < n - 1; j++) {
			if (ans <= s[j]) {
				ans = s[j] + c[j];
			} else {
				int t = ans - s[j];
				t %= f[j];
				ans += t == 0 ? 0 : f[j] - t;
				ans += c[j];
			}
		}
		cout << ans << endl;
	}
	cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define     debug       printf("\n<<CameHere<<\n")
#define     mem(x,y)    memset(x, y, sizeof(x))
#define     all(qz)     qz.begin(),qz.end()
#define     rall(qz)    qz.rbegin(),qz.rend()
#define     inf         LLONG_MIN
#define     INF         LLONG_MAX
#define     mod         1000000007
#define     Sqr(x)      ((x)*(x))
#define     ll          long long
#define     mk          make_pair
#define     pb          push_back
#define     pi          acos(-1.0)
#define     cos(a)      cos(a*pi/180)
#define     sin(a)      sin(a*pi/180)
#define     tan(a)      tan(a*pi/180)

ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}
/*---------AL ASAD NUR RIYAD------------*/


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n;
    cin>>n;
    vector<ll> v(n);
    for(ll i=0;i<n;i++) cin>>v[i];
    sort(v.rbegin(),v.rend());
    ll cnt=v[0];
    for(ll i=1,j=1;i<n-1;){
        if(i<n-1){
            cnt+=v[j];
            i++;
        }
        if(i<n-1){
            cnt+=v[j];
            i++;
        }
        j++;
    }
    cout<<cnt<<endl;
    return 0;
}


















Measured memory_bytes: 4760
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    vector<pair<int, int>> food(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        food[i] = make_pair(a, b);
    }
    sort(food.begin(), food.end());  // かかる時間について昇順ソートするとfood[k]を最後に食べるときfood[k+1]以降は食べない

    vector<vector<int>> dp(n+1, vector<int>(t));  // dp[i+1][j] : i番目(iは0-index)までの料理をかかる時間がj以下となるように食べたときの美味しさの合計の最大値
    rep(i, n) {
        rep(j, t) {
            if(j >= food[i].first) {
                dp[i+1][j] = max(dp[i][j], dp[i][j - food[i].first] + food[i].second);
            }
            else {
                dp[i+1][j] = dp[i][j];
            }
        }
    }

    int ans = 0;
    rep(k, n) {  // 最後に食べる料理をfood[k]とする
        ans = max(ans, dp[k][t-1] + food[k].second);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
using PII = pair<int,int>;
#define IOS cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false);

int main()
{
    IOS;
    char ch;
    cin >> ch;
    cout << char(ch + 1) << '\n';
}

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

using namespace std;

typedef long long ll;
bool isprime[100000 + 10];
ll ans;
void sieve(int n)
{
    memset(isprime,true,sizeof(isprime));

    isprime[1]=isprime[0]=false;
    for(int i=2; i*i<=n; i++)
    {
        if(isprime[i])
        {
            ans=i;

            for(int j=i*i; j<=n; j+=i)
            {
                isprime[j]=false;
            }
        }
    }


}


int main(void)
{
  ll a,b,x;
  cin>>a>>b>>x;


  ll i,j;
   i = b/x;
   j = a/x;


  ll ans = i-j;
  if(a%x==0)
  {
      ans++;
  }

  cout<<ans<<endl;

}







Measured memory_bytes: 3644
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;


	Int a, b;
	if (N<=111) {
		cout << 111 << "\n";
	}
	else {
		for (Int i = 1; i < 10; i++) {
			a = i * 111;
			b = (i + 1) * 111;
			if (N>a&&N<=b) {
				cout << b << "\n";
				return 0;
			}
			else {
				continue;
			}
		}
	}
}


Measured memory_bytes: 256
import java.util.*;

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

    int n = sc.nextInt();
    int[] h = new int[n];

    for (int i = 0; i < n; i++) {
      h[i] = sc.nextInt();
    }
    
    String s = "Yes";
    int pre = -1;
    for (int i = 0; i < n; i++) {
      if (pre <= h[i] - 1) {
        pre = h[i] - 1;
      } else if (pre <= h[i]) {
        pre = h[i];
      } else {
        s = "No";
        break;
      }
    }

    System.out.println(s);
  }
}


Measured memory_bytes: 50500
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
signed main(void){
    int n; cin>>n;
    string s; cin>>s;
 
    vector <vector<bool>> l(n+1,vector <bool>(12));
    vector <vector<bool>> r(n+1,vector <bool>(12));
    vector<vector<vector<bool>>> ans (10, vector<vector<bool>>(10, vector<bool>(10)));
    rep(i,n){
        l[i][s[i]-'0'] = true;
        rep(j,10){
            l[i+1][j] = l[i][j];
        }
    }
    rrep(i,n){
        if(i == 0) break;
        r[i][s[i]-'0'] = true;
        rep(j,10){
            r[i-1][j] = r[i][j];
        }
    }

    
    /*rep(i,n){
        rep(j,10){
            if(l[i][j]) cout<<j<<' ';
        }
        cout<<endl;
    }*/

    /*rep(i,n){
        rep(j,10){
            if(r[i][j]) cout<<j<<' ';
        }
        cout<<endl;
    }*/
    rep(i,n){
        if(i == 0|| i == n-1) continue;
        rep(j,10){
            rep(k, 10){
                if(l[i-1][j]&&r[i+1][k]){
                    ans[j][s[i]-'0'][k] = true;
                }
            }
        }
    }
    int cnt = 0;
    rep(i,10)rep(j,10)rep(k,10){
        if(ans[i][j][k]) cnt++;
    }
    cout<<cnt<<endl;
}


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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

li h[100100];
li dp[100100];

inline li cost(li from, li to) {
    return abs(h[from] - h[to]);
}

int main(void)
{
    li t, x;
    cin >> t >> x;
    printf("%.12f\n", t * 1.0 / x);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

int main()
{
	int A,B;
	cin>>A>>B;

	int result = max(A+B,A*B);
	result = max(result,A-B);

	cout<<result<<endl;
}

Measured memory_bytes: 256
A,B=map(int,input().split())
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def fa(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
if A ==1 or B == 1:
  print(1)
else:
  ans=fa(gcd(A,B))
  if ans == [1]:
    print(1)
  else:
    print(len(ans)+1)

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

using namespace std;

int main()
{
    long long int a,b,x,k;

    cin >> a >> b >> x;

    k=(b/x)-(a/x);

    if(a%x==0)
    {
        cout << k+1 <<endl;
    }
    else
        cout << k << endl;


    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

vector<ll> par;
vector<ll> counts;
vector<ll> scores;

ll GetScore(ll u) {
  if (scores[u] == -1) {
    scores[u] = counts[u] + GetScore(par[u]);
  }
  return scores[u];
}

int main() {
  ll N, Q;
  cin >> N >> Q;
  vector<vector<ll> > g(N);
  for (ll i = 0; i < N - 1; ++i) {
    ll a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  par = vector<ll>(N);
  vector<bool> visited(N, false);
  queue<ll> q;
  q.push(0);
  visited[0] = true;
  par[0] = -1;
  while (not q.empty()) {
    ll u = q.front();
    q.pop();
    for (auto v : g[u]) {
      if (not visited[v]) {
	q.push(v);
	visited[v] = true;
	par[v] = u;
      }
    }
  }
  counts = vector<ll>(N);
  for (ll i = 0; i < Q; ++i) {
    ll p, x;
    cin >> p >> x;
    --p;
    counts[p] += x;
  }
  scores = vector<ll>(N, -1);
  scores[0] = counts[0];
  for (ll i = 0; i < N; ++i) {
    cout << GetScore(i) << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 24064
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=2e5+5;
const int mod=1e9+7;
int a[maxn];
int fa[maxn];
int find(int x){
    if(x==fa[x])return x;
    else return fa[x]=find(fa[x]);
}
void Merge(int x,int y){
     int xx=find(x);
     int yy=find(y);
     if(xx!=yy){
        fa[xx]=yy;
     }
     return ;
}
int f[maxn];
signed  main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N,M;
    cin>>N>>M;
    int a,b;
    for(int i=1;i<=N;i++)fa[i]=i;
    for(int i=1;i<=M;i++){
        cin>>a>>b;
        Merge(a,b);
    }
    for(int i=1;i<=N;i++){
        f[find(i)]++;
    }
    int ans=0;
    for(int i=1; i<=N;i++){
       ans=max(ans,f[i]);
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 11400
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
	while(true){
	vi ans(5000,0);
	int num; cin >> num; if(!num) break;
	for(int k = 1; k <=num;k++){
		int sum = 0;
		for(int l = k; l<=num;l++){
			sum+=l;
			if(sum >1000) break;
			if(l != k) ans[sum]++;
	}
	}
	cout << ans[num] << endl;
	
}
}

Measured memory_bytes: 3092
n,k = map(int,input().split())
A = list(map(int,input().split()))
A.sort()

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
'''
ここは任意
'''

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = 0
for i in range(n+1):
    tmp = n -i -1
    if n-i < k:
        continue
    kei = cmb(tmp,k-1,mod)
    ans += A[tmp] * kei % mod
    ans -= A[i] * kei %mod
print(ans % mod)
    

Measured memory_bytes: 20304
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

signed main(){
	IO_STREAM;
	int N;
	cin>>N;
	vi A(N);
	int x[N][N]={0},y[N][N]={0};
	rep(i,0,N){
		cin>>A[i];
		rep(j,0,A[i]){
			cin>>x[i][j];	cin>>y[i][j];
			x[i][j]--;
		}
	}
	int ans=0;
	rep(bit,0,(1<<N)){
		int ng=0;
		int cnt=0;
		DBG("bit=",bit,"","");
		rep(i,0,N){
			if (bit & (1<<i)){
				rep(m,0,A[i]){
					if(y[i][m]==1&& (bit&(1<<x[i][m]))==0  ){
						ng=1;break;
					}
					if(y[i][m]==0&&(bit&(1<<x[i][m]))){
						ng=1;break;
					}
				}
				if(ng) break;
				cnt++;
			}
		}
		DBG("cnt=",cnt,"ng=",ng);
		if(ng==0){
			ans=max(ans,cnt);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <cctype>
//小文字を大文字 c-0x20;


#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define vvll(z,a,b) vector<vector<ll>>z(a,vector<ll>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define fix(k) fixed<<setprecision(k)
#define PI 3.141592653589793
using namespace std;


int main(){
  int a,b,c;
  db s,l,h;
  cin>>a>>b>>c;
s=a*b/2*sin((c*(PI/180)));
db j=a*a+b*b-2*a*b*cos((c*(PI/180)));
l=a+b+sqrt(j);
h=b*sin((c*(PI/180)));

cout<<fix(5);
cout<<s<<endl;
cout<<l<<endl;
cout<<h<<endl;
}


Measured memory_bytes: 3464
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Mat = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5+10;

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

    int cnt = 0;
    int ans = 0;
    int l = (int)s.size();
    for(int i=0; i<l; ++i){
        if(s[i]!='A' && s[i]!='C' && s[i]!='G' && s[i]!='T'){
            cnt = 0;
        }
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            ++cnt;
        }
        if(ans<cnt) ans = cnt;
    }
    cout(ans);
    return 0;
}

Measured memory_bytes: 256