akhauriyash/Code-Regression huggingface dataset:
//gauravsinghh
#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 ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define MOD 1000000007
#define MAXI (1<<32)
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100005
#define SIZ 1000005
#define SIZE 200005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(int i = a; i <= b; i++)
#define ffo(i, a, b) for(int i = a; i >= b; i--)
#define MAX 100005
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")

void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

bool comp(const pair<ll,ll>&a,const pair<ll,ll>&b){
	return a.ss < b.ss;
}

//ll p[20000005]={0};
//vector<ll>ans;
/*void sieve(){
    ll i,j;
    p[0]=p[1]=1;
    for(i=2;i*i<=20000005;i++){
        if(!p[i]){
            for(j=2*i;j<20000005;j+=i){
                p[j]=1;
            }
        }
    }
    fo(i,2,20000005){
        if(!p[i]){
            ans.pb(i);
        }
    }
}*/

ll sum(ll n){
    ll s = 0;
    while(n){
        s += (n%10);
        n/=10;
    }
    return s;
}

signed main(){ 
    IOS
    //io_set();
    ll n, a, b, c = 0;
    cin >> n >> a >> b;
    fo(i, 1, n){
        ll x = sum(i);
        if(x >= a && x <=b){
            c += i;
        }
    }
    cout << c << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
using namespace std;
const int table[] = { 0, 1, 2, 3, 5, 7, 8, 9 };
void solve(int n){
   
    if(n >= 8){
        solve(n / 8);
    }
    
    printf("%d", table[n % 8]);
}

int main(){
    int n;
    
    while(scanf("%d", &n), n > 0){
        solve(n);
        printf("\n");
    }
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e11;

int main() {
  int n, kk;
  cin >> n >> kk;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];
  int m = min(n, kk);
  ll ans = -1LL * INF;
  for (int i = 0; i <= m; ++i) {
    for (int j = 0; i + j <= m; ++j) {
      ll ta = 0;
      vector<ll> t;
      int c = kk - i - j;
      for (int k = 0; k < i; ++k) t.push_back(v[k]);
      for (int k = 0; k < j; ++k) t.push_back(v[n - 1 - k]);
      for (auto x : t) ta += x;
      sort(t.begin(), t.end());
      for (int k = 0; k < c && k < t.size() && t[k] < 0 ; ++k) ta -= t[k];
//      for (int k = 0; k < c && k < t.size() && t[k] < 0; k++) ta -= t[k];
      ans = max(ans, ta);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

      int a = sc.nextInt();
      int b = sc.nextInt();

      int ans = 0;

      for(int i=0;i<b;i++){
        if(1+(a-1)*i>=b){
          ans = i;
          break;
        }
      }

      System.out.println(ans);

    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  
  string s, t;
  cin >> s >> t;
  
  int cnt = 0;
  
  for(int i=0;i<s.size();i++){
    cnt += s[i] != t[i];
  }

  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 3768
n=int(input())
f=[list(map(int,input().split()))for i in range(n)]
p=[list(map(int,input().split()))for i in range(n)]
ans=-float("inf")
for i in range(1,1<<10):
    score=0
    for j in range(n):
        cnt=0
        for k in range(10):
            if i&(1<<k) and f[j][k]==1:
                cnt+=1
        score+=p[j][cnt]
    ans=max(ans,score)
print(ans)



Measured memory_bytes: 3064
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int[] a = new int[n];
    double sum = 0;
    for(int i=0; i<n; i++){
      a[i] = Integer.parseInt(sc.next());
      sum += 1.0/a[i];
    }

    sum = 1.0 / sum;
    System.out.println(sum);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
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;
}

void dfs(int now, vector<vector<int>> G, vector<bool> &connected) {
  connected[now] = true;
  for (auto next : G[now]) {
    if (connected[next] == false) {
      dfs(next, G, connected);
    }
  }
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  rep(i, M) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }

  int ans = 0;
  rep(m, M) {
    vector<vector<int>> G(N);
    rep(i, M) {
      if (i == m)
        continue;
      G[a[i]].pb(b[i]);
      G[b[i]].pb(a[i]);
    }

    vector<bool> connected(N, false);
    dfs(0, G, connected);

    int con = true;
    rep(i, N) {
      if (connected[i] == false)
        con = false;
    }

    if (!con)
      ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
N,K = map( int, input().split())
ans = 0
if K == 0:
    ans = N**2
else:
    for b in range(K+1,N+1):
        ans += ((N+1)//b)*(b-K) + max(0, N - ((N+1)//b)*b-(K -1))
print(int(ans))

Measured memory_bytes: 3060
#include <iostream>
 
using namespace std;
 
int main(){
  int W, H, x, y, r;
 
  cin >> W >> H >> x >> y >> r;
  if(x-r < 0 || x+r > W || y-r < 0 || y+r > H){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
 
  return 0;
}

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

int main() {
	int N, X;
	cin >> N >> X;
	vector<int>M(N);
	int nmin = 1e9;
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		int num;
		cin >> num;
		nmin = min(nmin, num);
		ans++;
		X -= num;
	}
	ans += X / nmin;
	cout << ans << endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int N,T;
    cin >> N >> T;
    int cost = 1 << 30;
    int ans = 0;
    bool flag = false;
    for(int i = 0; i < N; i++){
        int c, t;
        cin >> c >> t;
        if(t <= T){
            flag = true;
            if(cost > c){
                cost = c;
            }
        }        
    }
    if(flag){
        cout << cost << endl;    
    }else{
        cout << "TLE" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int get_rand(int a, int b) {  // [a, b]
    return uniform_int_distribution<int>(a, b)(rng);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d = 365, n = 26;
    vector<int> c(n);
    vector<vector<int>> s(d, vector<int>(n));
    if (true) {
        cin >> d;
        for (int i = 0; i < n; i++) {
            cin >> c[i];
        }
        for (int i = 0; i < d; i++) {
            for (int j = 0; j < n; j++) {
                cin >> s[i][j];
            }
        }
    } else {
        for (int i = 0; i < n; i++) {
            c[i] = get_rand(0, 100);
        }
        for (int i = 0; i < d; i++) {
            for (int j = 0; j < n; j++) {
                s[i][j] = get_rand(0, 20000);
            }
        }
    }
    auto beg = clock();
    int cnt = 0;
    int wid = 10;
    int lrand = 20;
    vector<vector<int>> que(wid, vector<int>(d));
    for (int i = 0; i < wid; i++) {
        for (int j = 0; j < d; j++) {
            que[i][j] = get_rand(0, n - 1);
        }
    }
    auto get = [&](int id) {
        int res = 0;
        vector<int> last(n, -1);
        for (int i = 0; i < d; i++) {
            res += s[i][que[id][i]];
            int x = i - last[que[id][i]] - 1;
            res -= c[que[id][i]] * x * (x + 1) / 2;
            last[que[id][i]] = i;
        }
        for (int i = 0; i < n; i++) {
            int x = d - last[i] - 1;
            res -= c[i] * x * (x + 1) / 2;
        }
        return res;
    };
    while (true) {
        cnt++;
        if (clock() - beg > 1919191) {
            break;
        }
        vector<pair<int, vector<int>>> nxt(wid + 1);
        for (int i = 0; i < wid; i++) {
            nxt[i].first = -1e9;
        }
        for (int i = 0; i < wid; i++) {
            for (int j = 0; j < lrand; j++) {
                int p = get_rand(0, n - 1);
                int q = get_rand(0, d - 1);
                swap(p, que[i][q]);
                nxt[wid] = make_pair(get(i), que[i]);
                for (int k = wid - 1; k >= 0; k--) {
                    if (nxt[k].first < nxt[k + 1].first) {
                        swap(nxt[k], nxt[k + 1]);
                    } else {
                        break;
                    }
                }
                swap(p, que[i][q]);
            }
        }
        for (int i = 0; i < wid; i++) {
            que[i] = nxt[i].second;
        }
    }
    for (int i = 0; i < d; i++) {
        cout << que[0][i] + 1 << '\n';
    }
  	cerr << get(0) << '\n';
    debug(cnt);
    debug(get(0));
    return 0;
}

Measured memory_bytes: 3772
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int a = read.to!int;
	int b = read.to!int;
	
	max(a + b, a - b, a * b).writeln;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define mod 1000000007
#define mk make_pair


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

    string s,t;
    cin>>s>>t;
    ll i,j;
    vector<vector<ll>> pos(27);
    for(i=0;i<s.length();i++){
        pos[s[i]-'a'].pb(i+1);
        pos[s[i]-'a'].pb(i+1+s.length());
    }
    for(i=0;i<27;i++)
        sort(pos[i].begin(),pos[i].end());

    ll ans=0,ind=0;
    for(i=0;i<t.length();i++){
        if(pos[t[i]-'a'].size()==0){
            cout<<"-1";
            return 0;
        }
        ll next=*upper_bound(pos[t[i]-'a'].begin(),pos[t[i]-'a'].end(),ind);
        ans+=(next-ind);
        ind=next%s.length();
    }
    cout<<ans;
    return 0;  
}

Measured memory_bytes: 2756
#include <iostream>
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define MAXN 0x3f3f3f3f3f3f3f
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vll vector<ll>
#define ALL(x) x.begin(), (x).end()
#define LB(x, v) lower_bound(ALL(x),v)
#define UB(x, v) upper_bound(ALL(x),v)
#define vvl vector<vll>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    cout.tie(nullptr);
    int n; cin >> n;
    vi num(n); for(auto &x : num) cin >> x;
    ll pairs = 0;
    for (int i = 0; i < n; ++i) {
        if(num[i] == 0)continue;
        if(num[i] % 2 == 0){
            pairs += ((num[i] >> 1) - 1);
            num[i] = 2;
        } else {
            pairs += num[i] >> 1;
            num[i] = 1;
        }
    }
    for (int j = 0; j <= n - 1; ++j) {
        if(j == n - 1){
            pairs = (num[j] == 2)? pairs + 1 : pairs;
            continue;
        }
        if(num[j] == 1 && num[j + 1] == 2){
            ++pairs;
            num[j] = 0;
            num[j + 1] = 1;
            continue;
        }
        if(num[j] == 2){
            ++pairs;
            num[j] = 0;
            continue;
        }
        if(num[j] == 1 && num[j + 1]){
            ++pairs;
            num[j] = num[j + 1] = 0;
        }
    }
    cout << pairs << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int n,k;
 int a=1;
 cin>>n >>k;
 for(int i=1;i<=n;i++){
 
 		 if(a+k<2*a) a+=k;
		  else a =a*2;	
}
	
cout<< a<<endl;	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll sumSubarrayMins(ll A[], ll n) 
{ 
    ll left[n], right[n]; 
  
    stack<pair<ll, ll> > s1, s2; 
 
    for (ll i = 0; i < n; ++i) { 
        ll cnt = 1; 
  
        while (!s1.empty() && (s1.top().first) >= A[i]) { 
            cnt += s1.top().second; 
            s1.pop(); 
        } 
  
        s1.push({ A[i], cnt }); 
        left[i] = cnt; 
    } 
   
    for (ll i = n - 1; i >= 0; --i) { 
        ll cnt = 1; 

        while (!s2.empty() && (s2.top().first) > A[i]) { 
            cnt += s2.top().second; 
            s2.pop(); 
        } 
  
        s2.push({ A[i], cnt }); 
        right[i] = cnt; 
    } 
  
    ll result = 0; 
  
    // calculating required result
    for (ll i = 0; i < n; ++i) 
        result = (result + A[i] * left[i] * right[i]); 
  
    return result; 
} 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin >> a[i];
    ll z = sumSubarrayMins(a, n);
    cout << z << endl;
    return 0;
}

Measured memory_bytes: 8700
n,m=map(int,input().split())
result=[]
for _ in range(m):
    a,b=map(int,input().split())
    result.append(a)
    result.append(b)
count=0
for x in range(1,n+1):
    for i in result:
        if x==i:
            count+=1
    print(count)
    count=0


Measured memory_bytes: 3060
n = int(input())


days = [] 
for _ in range(n):
  temp = list(map(int,input().split()))
  days.append(temp)
  
dp = [0]*3

for i in range(3):
  dp[i]= days[0][i]
#print(dp) 
for cur_day in range(1,n):
  m = [0]*3
  for i in range(3):
    for j in range(3):
      if i!=j:
        m[i] = max(m[i],dp[j]+days[cur_day][i])
  dp = m
#  print(dp)
  
print(max(dp))
  

Measured memory_bytes: 61784
function Main(input) {
  "use strict";
	const lines = input.split("\n");
  let S = lines[0]
  let L = Number.parseInt(S.substring(0,2))
  let R = Number.parseInt(S.substring(2))
  if (0 < L && L <= 12 && 0 < R && R <= 12) {
    console.log("AMBIGUOUS")
    return;
  }
  if ((L > 12 || L === 0) && (R > 12 || R === 0)) {
    console.log("NA")
    return;
  }
  if (L <= 12 && ( R > 12 || R === 0)) {
    console.log("MMYY")
    return;
  }
  console.log("YYMM")



}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    double x[3],y[3],z[3],l,s,S,r,left,right,mid;
    for(int i=0;i<3;i++){
        scanf("%lf %lf",&x[i],&y[i]);
    }
    for(int i=0;i<3;i++){
        z[i]=(x[i]-x[(i+1)%3])*(x[i]-x[(i+1)%3])+(y[i]-y[(i+1)%3])*(y[i]-y[(i+1)%3]);
        z[i]=sqrt(z[i]);
    }
    s=(z[0]+z[1]+z[2])/2;
    S=sqrt(s*(s-z[0])*(s-z[1])*(s-z[2]));
    r=S/s;
    l=max(z[0],z[1]);
    l=max(l,z[2]);
    left=0;
    right=r;
    while(right-left>0.000000000001){
        mid=(left+right)/2;
        if((1-mid/r)*l<2*mid){
            right=mid;
        }
        else{
            left=mid;
        }
    }
    printf("%.12f\n",left);
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

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

	int num = 1;
	for (int i = 0; i < K-1; i++) {
		num += 2;
	}

	if (num <= N) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	
	
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;

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

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

        boolean ans = true;

        for (int i = 0; i < n; i++) {
            words[i] = sc.next();
            for (int j = 0; j < i; j++) {
                if (words[j].equals(words[i])) {
                    ans = false;
                    break;
                }
            }

            if (i > 0) {
                char a = words[i].charAt(0);
                char b = words[i - 1].charAt(words[i - 1].length() - 1);

                if (a != b) {
                    ans = false;
                    //System.out.println("---");
                    //System.out.println(i + ", " + a + ", " + b);
                }
            }
            if (!ans) {
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    }
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

string s,t;

int main()
{
	cin>>s>>t;
	int ans=0;
	rep(i,s.size()) if(s[i]!=t[i]) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3892
#include <cstdio>
#include <algorithm>
#define rep(i, a, b) for (int i = a; i <= b; ++ i) 
const int N = 2e5 + 5 ;
using namespace std ;

int n, ans = 0, a[N], b[N], d[N], fa[N] ;

int find(int x) {
	int l = 1, r = d[0] ; 
	for ( ; l <= r ; ) {
		int mid = (l + r) / 2 ;
		if (d[mid] == x) return mid ;
		if (x < d[mid]) r = mid - 1 ; else l = mid + 1 ;
	}
	return 0 ;
}

int getfa(int x) {
	return (fa[x] == x ? x : fa[x] = getfa(fa[x])) ;
}

int main() {
	scanf("%d", &n) ;
	rep(i, 1, n) scanf("%d", &a[i]), a[0] ^= a[i] ;
	rep(i, 1, n) scanf("%d", &b[i]), b[0] ^= b[i] ;
	rep(i, 1, n) if (a[i] != b[i]) d[++ d[0]] = a[i], d[++ d[0]] = b[i] ;
	d[++ d[0]] = a[0], d[++ d[0]] = b[0] ;
	sort(d + 1, d + d[0] + 1) ;
	d[0] = unique(d + 1, d + d[0] + 1) - (d + 1) ;
	rep(i, 1, d[0]) fa[i] = i ;
	rep(i, 1, n) if (a[i] != b[i]) ++ ans, fa[getfa(find(a[i]))] = getfa(find(b[i])) ;
	sort(a, a + n + 1) ;
	sort(b, b + n + 1) ;
	rep(i, 0, n) if (a[i] != b[i]) {
		puts("-1") ;
		return 0 ;
	}
	rep(i, 1, d[0]) ans += getfa(i) == i ;
	printf("%d\n", ans - 1) ;
	return 0 ; 
}

Measured memory_bytes: 3712
/*
       ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄
      ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌
      ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌
      ▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌
      ▐░▌ ▄▄▄▄▄▄▄▄ ▐░▌       ▐░▌▐░▌       ▐░▌
      ▐░▌▐░░░░░░░░▌▐░▌       ▐░▌▐░▌       ▐░▌
      ▐░▌ ▀▀▀▀▀▀█░▌▐░▌       ▐░▌▐░▌       ▐░▌
      ▐░▌       ▐░▌▐░▌       ▐░▌▐░▌       ▐░▌
      ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌
      ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌
       ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀  
 
 #can_change_the_world_with_the_help_of_0_1
                                    -darshan786    */
 
  
 
 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false);cin.tie(0); 
#define F first 
#define MAXN   1010
#define int long long
#define S second
#define all(v) v.begin(),v.end() 
#define PI pair<int,int>
#define PIS pair<int,string>





int values[41];
   
void value()
{
   values[0]=1;
    for(int i=1;i<=40;i++)
    {
        values[i]=2*values[i-1];
    }
}


int32_t main() {
    boost
   

    
    int k;
    cin>>k;

    while(k--)
    {
      cout<<"ACL";
    }
}



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

int main(){
	string a;
	cin >> a;
	int n = 0,s = 0,e = 0,w = 0;
	for(int i = 0; i < a.size(); i++){
		if(a[i] == 'S')s = 1;
		if(a[i] == 'N')n = 1;
		if(a[i] == 'W')w = 1;
		if(a[i] == 'E')e = 1;
	}
	if(s == n && e == w){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, x, t;

	scanf("%d %d %d", &n, &x,  &t);

	if(n % x == 0) {
		printf("%d\n", n/x*t);
	} else {
		printf("%d\n", n/x*t+t);
	}

	return 0;
}


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


int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,0,n) cin >> a[i];
  ll ans=0;
  ll val=a[0];
  rep(i,1,n){
    if(a[i]>val) val=a[i];
    else ans += val - a[i];
  }
  cout << ans << endl;
  return 0;

}

Measured memory_bytes: 4780
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int r, c;
int g[11][10001];
int get() {
    int ans = 0;
    for (int i = 0; i < c; ++i) {
        int t = 0;
        for (int j = 0; j < r; ++j) t += g[j][i];
        ans += t > r - t ? t : r - t;
    }
    return ans;
}
int helper(int rr) {
    if (rr == r) return get();
    int ans = helper(rr + 1);
    for (int i = 0; i < c; ++i) g[rr][i] = 1 - g[rr][i];
    ans = max(ans, helper(rr + 1));
    return ans;
}
int main() {
    while(~scanf("%d %d", &r, &c) && r && c) {
        for (int i = 0; i < r; ++i)for (int j = 0; j < c; ++j)
                scanf("%d", &g[i][j]);
        printf("%d\n", helper(0));
    }
    return 0;
}



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

int main(){
    int S,h,H,m,s;
    cin>>S;
    h=S/3600;
    H=S%3600;
    m=H/60;
    s=H%60;

    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3080
import numpy as np
import heapq

N = int(input())
A = list(map(int,input().split()))

if len([i for i in A if i < 0]) % 2 == 0:
    A = np.abs(A)
    ans = sum(A)
else:
    A = np.abs(A)
    A = list(A)
    heapq.heapify(A)
    a = heapq.heappop(A)
    ans = sum(A) - a
print(ans)

Measured memory_bytes: 23336
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	long long n, i, j, k, ans = 0, x;
	cin >> n;
	for (i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			x = i - 1;
			if (x != 0) {
				if (n / x == n % x)
					ans += x;
			}

			if (i != sqrt(n)) {
				x = (n / i) - 1;
				if (n / x == n % x)
					ans += x;
			}
		}
	}
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define MOD2 998244353
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;

template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}

int main(){
    FAST;
    ll n;
    cin >> n;
    ll m15 = n /15, m5 = n / 5, m3 = n/3;
    ll sum = n*(n+1)/2 -5*m5*(m5+1)/2 - 3*m3*(m3+1)/2 + 15*m15*(m15+1)/2;
    cout << sum << '\n';
    return 0;
}

Measured memory_bytes: 3600
n = gets.to_i
station = (n - 1).times.map { gets.split.map(&:to_i) }
n.times do |i|
  total = 0
  station[i..-1].each do |c, s, f|
    total = s if total < s
    total += f - total % f unless total % f == 0
    total += c
  end
  puts total
end


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

#include <boost/range/adaptors.hpp>
#include <boost/range/combine.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    std::array<int64_t, 5> x;
    for (auto&& xx : x) {
        cin >> xx;
    }

    for (auto i : irange(0L, 5L)) {
        if (x[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3620
N = int(input())
list_price = [int(input()) for i in range(N)]
minv = list_price[0]
maxv = list_price[1] - list_price[0]
for x in list_price[1:]:
    maxv = max(maxv, x - minv)
    minv = min(minv, x)        
print(maxv)

Measured memory_bytes: 17148
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x,ans=12345678;
  cin >> n >> m >> x;
  vector<vector<int>> A(n,vector<int>(m));
  vector<int> c(n);
  for(int i=0;i<n;i++){
    cin >> c[i];
    for(int j=0;j<m;j++){
      cin >> A[i][j];
    }
  }
  for(int mask=0;mask<(1<<n);mask++){
    vector<int> lev(m);
    int cost=0;
    for(int i=0;i<n;i++){
      if(mask&(1<<i)){
        cost+=c[i];
        for(int j=0;j<m;j++)lev[j]+=A[i][j];
      }
    }
    bool t=true;
    for(int j=0;j<m;j++)if(lev[j]<x)t=false;
      if(t)ans=min(ans,cost);
  }
  if(ans==12345678)cout << -1 << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 3636
a = sorted(list(map(int, input().split())), reverse = True)

ans = 0
if (a[0] - a[2]) % 2 == 0:
    ans += (a[0] - a[2]) // 2
    if (a[0] - a[1]) % 2 == 0:
        ans += (a[0] - a[1]) // 2
    else: # 6 3 2
        a[0] += 1
        a[2] += 1
        ans += 1 # 7 3 3
        ans += (a[0] - a[1]) // 2
else:
    if (a[0] - a[1]) % 2 == 0: # 5 3 2
        a[0] += 1
        a[1] += 1
        ans += 1 # 6 4 2
        ans += (a[0] - a[2]) // 2
        ans += (a[0] - a[1]) // 2
    else: # 7 4 2
        a[1] += 1
        a[2] += 1
        ans += 1 # 7 5 3
        ans += (a[0] - a[2]) // 2
        ans += (a[0] - a[1]) // 2
print(ans)


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


#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";

int dx[] = { 0,0,1,-1,-1,-1,1,1 };
int dy[] = { 1,-1,0,0,-1,1,1,-1 };



template <class T> inline T biton(T n, T pos)
{
    return n | ((T)1 << pos);
}
template <class T> inline T bitoff(T n, T pos)
{
    return n & ~((T)1 << pos);
}
template <class T> inline T ison(T n, T pos)
{
    return (bool)(n & ((T)1 << pos));
}
template <class T> inline T gcd(T a, T b)
{
    while (b)
    {
        a = a % b;
        swap(a, b);
    }
    return a;
}
template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
};



#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::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) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif




void solve()
{
   long double n;
   cin>>n;

   long double per=n/3.00;

   long double res=per*per*per;

   cout<<res<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    cout.tie(nullptr);
    cin.tie(nullptr);

    int t = 1;

    while (t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 384
import sys

input = sys.stdin.readline
import numpy as np
A, B = [int(x) for x in input().split()]
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
print(lcm(A, B))

Measured memory_bytes: 21028
#include <cassert>
#include "limits.h"
#include <limits>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long,long long>;

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

  std::string s,t;
  std::cin>>s>>t;

  std::cout<<t<<s<<"\n";

  return 0;
}


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

#define ll long long
#define ff(i,c,n) for(ll i=c;i<n;i++)

int main(){
    ll n;
    cin>>n;
    ll a[n],b[n],c[n];
    ff(i,0,n) cin>>a[i]>>b[i]>>c[i];
    ll dp[n][3];
    dp[0][0]=a[0];dp[0][1]=b[0];dp[0][2]=c[0];
    ff(i,1,n){
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 4992
use proconio::{fastout, input};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        s: Chars,
    }

    let string: String = s.clone().into_iter().collect();
    if s.iter().last().unwrap() == &'s' {
        println!("{}", format!("{}{}", string, "es"));
    } else {
        println!("{}", format!("{}{}", string, "s"));
    }
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int P[N];
  for(int i=0;i<N;i++)cin >> P[i];

  int count = 1;
  int min = P[0];

  for(int i=1;i<N;i++){
    if(min>P[i]){
      min = P[i];
      count += 1;
    }
  }

  cout << count << endl;

  return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

signed main(){
    int N,X;
    cin>>N>>X;
    vint L(N+1);
    rep(i,N){
        cin>>L[i+1];
        L[i+1]+=L[i];
    }
    cout<<upper_bound(all(L),X)-L.begin()<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],arr1[1000000],dp[10000009];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    long long h,n,i,j,k,x,y,z;
	cin>>h>>n;
	for (i=0;i<=10000000;i++)
	{
		dp[i]=1e18;
	}
	for (i=0;i<n;i++)
	{
		cin>>arr[i]>>arr1[i];
		dp[arr[i]]=min(dp[arr[i]],arr1[i]);
	}
	for (i=0;i<=50000;i++)
	{
		for (j=0;j<n;j++)
		{
			x=dp[i]+arr1[j];
			dp[i+arr[j]]=min(dp[i+arr[j]],x);
		}
	}
	z=1e18;
	for (i=h;i<=50000;i++)
	{
		z=min(z,dp[i]);
	}
	cout<<z<<endl;
}


Measured memory_bytes: 82176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll>a(N);
    rep(i,N){
        cin>>a[i];
    }
    ll ans=INF;
    rep3(i,-100,101){
        ll sum=0;
        rep(j,N){
            sum+=(a[j]-i)*(a[j]-i);
        }
        chmin(ans,sum);
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
long long t1,t2,a1,a2,b1,b2,a,b,s,ret;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>t1>>t2;
	cin>>a1>>a2;
	cin>>b1>>b2;
	a=a1-b1;
	b=a2-b2;
	if(a<0){
		a=-a;
		b=-b;
	}
	s=a*t1+b*t2;
	if(s==0){
		cout<<"infinity"<<endl;
		return 0;
	}
	if(s>0){
		cout<<"0"<<endl;
		return 0;
	}
	if(s<0){
		ret=a*t1/(-s)+(-b)*t2/(-s);
		if((-b)*t2%(-s)==0LL)
			ret-=1LL;
		cout<<ret<<endl;
		return 0;
	}
	return 0;
}


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

int main() {
  int n, a, b, c;
  cin >> a >> b >> c >> n;
  while (a >= b) {
    b *= 2;
    n--;
  }
  while (b >= c) {
    c *= 2;
    n--;
  }
  cout << (n >= 0 ? "Yes" : "No") << endl;
}

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

int main() {
  int res=0, A=0, B=0;
  string S;
  cin >> S;
  
  for (int i=0; i<S.length(); i++) {
    if(i%2==0) {
      if(S[i]=='0') A++;
      else B++;
    } else {
      if(S[i]=='0') B++;
      else A++;
    }
  }
  cout << min(A, B) << endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define T 50
#define P 10

struct Cell
{
  int sv;
  int p;
  int no;
};
typedef struct Cell Cell;
#define CELL(X) \
  ( *( (const Cell *)(X) ) )

Cell d[ T + 1 ];
int wa[ T + 1 ][ P + 1 ];

static int
compare (
  const void * a,
  const void * b
  )
{
  int res = CELL( b ).sv - CELL( a ).sv;
  if ( res ) return ( res );
  res = CELL( a ).p - CELL( b ).p;
  if ( res ) return ( res );

  return ( CELL( a ).no - CELL( b ).no );
}

int
main (
  void
  )
{
  int i;

  for ( ; ; )
  {
    int t, p, r;

    scanf ( " %d %d %d", &t, &p, &r );
    if ( !( t | p | r ) ) break ;

    memset ( d, 0, sizeof ( d ) );
    for ( i = 1; i <= t; ++i )
    {
      d[ i ].no = i;
    }
    memset ( wa, 0, sizeof ( wa ) );

    while ( r-- )
    {
      int tid, pid, time;
      char msg[ 32 ];

      scanf ( " %d %d %d %s", &tid, &pid, &time, msg );
      if ( !strcmp ( msg, "CORRECT" ) )
      {
        d[ tid ].p += time + wa[ tid ][ pid ] * 1200;
        ++d[ tid ].sv;
      }
      else
      {
        ++wa[ tid ][ pid ];
      }
    }
    qsort ( d + 1, t, sizeof ( Cell ), compare );

    for ( i = 1; i <= t; ++i )
    {
      printf ( "%d %d %d\n", d[ i ].no, d[ i ].sv, d[ i ].p );
    }
  }

  return ( 0 );
}

Measured memory_bytes: 0
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    h = list(map(int, input().split()))

    max = 0
    count = 0

    for i in range(1, n):
        if h[i] <= h[i - 1]:
            count += 1
        else:
            if count > max:
                max = count
            count = 0

    if count > max:
        max = count

    print(max)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 58224
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

class binomial_coefficients {
public:
	long long MAX_VAL;
	vector<long long> fac, mmi;


	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = x;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N, M;
	int ans = 0;
	binomial_coefficients bc;
	vector<int> a;
	
	cin>>N>>M;
	
	bc.init(N+M+10);
	
	for(int i = 0; i <= N; i++){
		if(i%2) {
			ans += MOD - (bc.combination(M, N) * bc.fac[N] % MOD * bc.combination(N, i) % MOD * bc.combination(M - i, N - i) % MOD * bc.fac[N-i]) % MOD;
			ans %= MOD;
		} else {
			ans += bc.combination(M, N) * bc.fac[N] % MOD * bc.combination(N, i) % MOD * bc.combination(M - i, N - i) % MOD * bc.fac[N-i] % MOD;
			ans %= MOD;
		}
	}

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

Measured memory_bytes: 18636
const BKRT = "\n";
const SPAC = " ";
const NOSP = "";

function Main(input){
	input = [].concat(...input.split(BKRT).map(a=>a.split(SPAC)));
  const strShift = ()=>input.shift();
  const intShift = ()=>~~input.shift();
  
  var A = parseInt(strShift(),16);
  var B = parseInt(strShift(),16);
  
  if(A>B)return ">";
  if(A==B)return "=";
  if(A<B)return "<";
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
A B
`);

Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>

using namespace std;
 
int main()
{
	double a;
	while(cin>>a){
		printf("%.10f\n",(81+162+54+108+36+72+24+48+16+32)*a/81);
	}


	return 0;
}

Measured memory_bytes: 1228
N = int(input())
a = list(map(int, input().split()))
mincost = 10000000000000000000
for i in range(-100, 101):
    cost = 0
    for j in a:
        cost += (j - i) * (j - i)
    if cost < mincost:
        mincost = cost
print(mincost)
        



Measured memory_bytes: 2940
n,m = map(int, input().split())
h = list(map(int, input().split()))
path = []

for i in range(m):
  path.append(list(map(int, input().split())))
  
root = [[0] for i in range(n+1)]

for i in range(m):
  root[path[i][0]].append(path[i][1])
  root[path[i][1]].append(path[i][0])

count = 0

for i in range(1, n+1):
  flag = 0
  for j in range(1, len(root[i])):
    if h[i-1] <= h[root[i][j]-1]:
      flag = 1
      break
  if flag == 0:
    count += 1
  
print(count)

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

int main(){
  int n;
  cin >> n;
  int sum = 0;
  for (int i; i<n; i++){
    int a;
    cin >> a;
    sum +=a;
  }
  cout << (sum%2==0 ? "YES":"NO") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main(void)
{
    cin>>s;
    int len = s.length();
    int maxx = 0;
    for(int i = 0;i < len;i++)
        maxx += s[i] - '0';
    int uma = s[0] - '0' - 1;
    uma += (len-1)*9;
    maxx = max(uma,maxx);
    cout<<maxx<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define prin(num) cout << num << endl;
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef priority_queue<P> PQ;

int main(void) {
    ll n, i;
    ll t[1001]={0}, a[1001]={0};
    cin >> n;
    for(i=0; i<n; i++) {
        cin >> t[i] >> a[i];
    }
    ll k, ta=t[0], ao=a[0];
    for(i=0; i<n; i++) {
        k=max(ta/t[i]+(ta%t[i]==0 ? 0 : 1), ao/a[i]+(ao%a[i]==0 ? 0 : 1));
        ta=t[i]*k;
        ao=a[i]*k;
    }
    
    prin(ta+ao)
}


Measured memory_bytes: 256
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, int n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n in O(log(n)) time

const int MOD = 1000000007; //10^9+7
const double PI = 3.1415926535897932384626;

/*********** variables ************/
int N;
int t[1010];
int a[1010];
/**********************************/


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin>>t[i] >> a[i];

    lng nowT = t[0];
    lng nowA = a[0];
    UP(i, 1, N-1) {
        lng x = max((nowT + t[i] - 1) / t[i], (nowA + a[i] - 1) / a[i]);
        nowT = x * t[i];
        nowA = x * a[i];
    }
    cout << nowA + nowT << endl;
}


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

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

  map<int, queue<int> > p;
  vector<int> ans(m + 1);
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    p[a].push(b);
    p[b].push(a);
  }

  int i = 1;
  queue<int> q;

  while (p.size() != 0) {
    while (p[i].size() != 0) {
      int x = p[i].front();
      if (ans[x] == 0) {
        ans[x] = i;
        q.push(x);
      }
      p[i].pop();
    }
    p.erase(i);
    i = q.front();
    q.pop();
  }

  cout << "Yes" << endl;
  for (int i = 2; i <= n; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 76140
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;
void solve()
{
	string s, t;
	cin>>s>>t;
	cout<<t<<s<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3612
N = int(input())
status_lst = [0] * (N-1)
for _ in range(N-1):
    status_lst[_] = list(map(int, input().split()))

# simple solution
# 0: C
# 1: S
# 2: F
# print(status_lst)

rev_res = []
for ix, st_i in enumerate(status_lst):
    elapsed = st_i[1] + st_i[0]
    for next_st in range(ix+1, N-1):
        st_n = status_lst[next_st]
        if elapsed < st_n[1]:
            elapsed = st_n[1] + st_n[0]
        else:
            wait_time = elapsed % st_n[2]
            if wait_time == 0:
                elapsed = elapsed + st_n[0]
                # else:
                # elapsed = elapsed + st_n[2] - (elapsed % st_n[2]) + st_n[0]
            elif wait_time == elapsed:
                # elaplsed < F
                # ?
                elapsed = st_n[2] + st_n[0]
            else:
                elapsed = elapsed + st_n[2] - wait_time + st_n[0]

    rev_res.append(elapsed)

rev_res.append(0)

for ans in rev_res:
    print(ans)

Measured memory_bytes: 3188