akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>










const ll N=3510;
ll n,a,b,c,p,s;



void solve()
{
	cin>>n;
	for(a=1;a<=N;a++)
	{
		for(b=1;b<=N;b++)
		{
			p=a*b;
			s=a+b;
			if((4*p-n*s)>0&&(n*p)%(4*p-n*s)==0&&(n*p)/(4*p-n*s)>0)
			{
				c=(n*p)/(4*p-n*s);
				cout<<a<<" "<<b<<" "<<c<<"\n";
				return;
			}
		}
	}
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define fr first
#define val second
#define N 100000000
#define fo(i,m,n) for(int i=m;i<n;i++)
#define M 7
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
using ul=unsigned long long;
using pii=pair<int,int>;
using vvi=vector<vector<int>>;
using vi=vector<int>;
using pll=pair<ll,ll>;
using vsi=vector<set<int>>;
using vll=vector<ll>;

ll power(ll a,ll n){
    ll j=0;
    ll x=1;
    while(1ll<<j<=n){
        if(1ll<<j&n)
            x=(x*a)%mod;

        a=a*a%mod;
        j++;
    }

    return x;
}

int gcd(int a,int b){
    if(b==0)
        return a;
    else
        return gcd(b,a%b);

}

int lb(vi &a,int x){
    int n=a.size();
    int l=0;
    int r=n-1;
    int ind=-1;
    while(l<=r){
        int mid=(l+r)/2;
        if(x>=a[mid]){
            l=mid+1;
            ind=mid;
        }
        else
            r=mid-1;

    }

    return ind+1;

}

int up(vll &a,ll x){
    int n=a.size();
    int l=0;
    int r=n-1;
    int ind=-1;

    while(l<=r){
        int mid=(l+r)/2;

        if(a[mid]>x){
            l=mid+1;
            ind=mid;
        }
        else
            r=mid-1;

    }

    return ind;
}

ll max(ll a,ll b){
    if(a>b)
        return a;
    else
        return b;

}

ll min(ll a, ll b){
    if(a>b)
        return b;
    else
        return a;

}
template<typename T>
void pra(T a[],int n){
    fo(i,0,n)
            cout<<a[i]<<' ';
    cout<<endl;

}

ifstream input;
ofstream output;
int t;
const ll inf=1e16;
int cs;
int tcs;
void build(vll &F,int ind,int tl,int tr,vll &st){

    if(tl==tr)
        st[ind]=F[tl];
    else{
        int mid=(tl+tr)/2;
        build(F,2*ind+1,tl,mid,st);
        build(F,2*ind+2,mid+1,tr,st);
        st[ind]=min(st[2*ind+1],st[2*ind+2]);
    }

}

void update(int j,ll nv,int ind,int tl,int tr,vll &st){

    if(j<tl||j>tr)
        return;
    else if(tl==tr)
        st[ind]=nv;
    else{
        int mid=(tl+tr)/2;
        update(j,nv,2*ind+1,tl,mid,st);
        update(j,nv,2*ind+2,mid+1,tr,st);
        st[ind]=min(st[2*ind+1],st[2*ind+2]);
    }

}


ll query(int ind,int tl,int tr,int l,int r,vll &st){
    int mid=(tl+tr)/2;
    if(r<tl||l>tr)
        return inf;
    else if(tl==l&&tr==r)
        return st[ind];
    else
        return min(query(2*ind+1,tl,mid,l,min(mid,r),st),query(2*ind+2,mid+1,tr,max(mid+1,l),r,st));

}

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

        if(k%7==0)
            k=k/7;

            int cm=0;
            int j=1;
            ll pt=1;
            unordered_set<int> us;
            while(true){
                cm=(cm+pt)%k;
                if(cm==0)
                    break;
                else if(us.count(cm)){
                    j=-1;
                    break;
                }
                j++;
                us.insert(cm);
                pt=(pt*10)%k;
            }
            cout<<j<<endl;


}


Measured memory_bytes: 42696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define repr1(i, n) for (int i = n; i >= 1; i--)
#define all(v) v.begin(), v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  for (ll i = 1; i <= n; i++) {
    if (i % 3 != 0 && i % 5 != 0)
      sum += i;
  }
  cout << sum << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  ll n;
  cin >> n;
  int ans = 1e9 + 7;
  rep(i, 1, sqrt(n) + 1) {
    if (n % i)
      continue;
    ll a = n / i;
    chmin(ans, (int)max(to_string(i).size(), to_string(a).size()));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
# dp[i][j]=(i番目まで使って最後の高さがjであるようなものの美しさの最大値)
# dp[i][j]=max(dp[i-1][k])+a[i](h[i]==j,0<=k<j),dp[i-1][j](otherwise)

def segfunc(x,y):
    return max(x,y)


def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res


N=int(input())
h=list(map(int,input().split()))
a=list(map(int,input().split()))
n=N+1
#####単位元######
ide_ele = 0 #変える
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num
dp=[0]*n
init(dp)
for i in range(N):
    update(h[i],query(0,h[i])+a[i])
print(query(0,n))

Measured memory_bytes: 123728
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N;
int A[100000];
int main() {
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i];
	}

	bool ok = true;
	if (A[N - 1] != 2) {
		ok = false;
	}

	LL L = 2,R = 2;
	REM(i, 0, N - 1) {
		L = ((L - 1) / A[i] + 1) * A[i];
		R = (R + A[i + 1] - 1) / A[i] * A[i];
		if (L > R) ok = false;
	}

	if (ok) {
		cout << L << ' ' << R + A[0] - 1 << endl;
	} else {
		cout << -1 << endl;
	}


	return 0;
}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
 
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
 
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int bitsNum(int bits)
{
	bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
	bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
	bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
	bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
	return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
}
 
int main() {
 
	int N;
	int F[123];
	int P[123][16];
 
	scanf("%d", &N);
 
	rep(i, N) {
		F[i] = 0;
		rep(j, 10) {
			int t;
			scanf("%d", &t);
			F[i] <<= 1;
			F[i] += t;
		}
	}
 
	rep(i, N) {
		rep(j, 11) {
			scanf("%d", &P[i][j]);
		}
	}
 
	int ans = -2147483648;
	rep(i, 1 << 10) {
		if (!i) continue;
		int t = 0;
		rep(j, N) {
			t += P[j][bitsNum(F[j] & i)];
		}
		ans = max(ans, t);
	}
 
	printf("%d", ans);
 
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        /*var xyzk = Input.ar;
        var a = Input.arL.OrderBy(v=>v).ToArray();
        var b = Input.arL.OrderBy(v=>v).ToArray();
        var c = Input.arL.OrderBy(v=>v).ToArray();
        var res = new long[xyzk[3]];
        var dic = Calculation.Factorize(xyzk[3]);*/

        var num = Input.numL;
        var ae = Enumerable.Repeat(0, 5).Select(v => Input.numL).ToArray();
        WriteLine(4 + (num + ae.Min() - 1) / ae.Min());
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13396
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-8;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;
char s[maxn];
int sum[maxn];
int vis[3000][2];
void solve(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	ll ans=0;
	vis[0][0]=1;
	int sta=0;
	rep1(i,n){
		int x=s[i]-'0';
		sum[i]=(sum[i-1]*10+x)%2019;
		rep(j,2019)
			vis[j*10%2019][sta^1]=vis[j][sta];
		sta^=1;
		ans+=1ll*vis[sum[i]][sta];
		vis[sum[i]][sta]++;
	}
	ac;
}
int main(){
    //IOS;
    //freopen("fenwick.in","r",stdin);
    //freopen("fenwick.out","w",stdout);
    solve();
    
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    return 0;
}

Measured memory_bytes: 4248
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

lint dp[3][3001][3001];

int main(void){
    int N,S;
    cin >> N >> S;
    int A[N];
    rep(i,N) cin >> A[i];
    dp[0][0][0]=1;
    rep(i,N) rep(j,3001){
        dp[0][i+1][j]=(dp[0][i+1][j]+dp[0][i][j])%MOD;
        dp[1][i+1][j]=(dp[1][i+1][j]+dp[0][i][j]+dp[1][i][j])%MOD;
        dp[2][i+1][j]=(dp[2][i+1][j]+dp[2][i][j]+dp[1][i][j]+dp[0][i][j])%MOD;
        if(j+A[i]<=S){
            dp[1][i+1][j+A[i]]=(dp[1][i+1][j+A[i]]+dp[0][i][j]+dp[1][i][j])%MOD;
            dp[2][i+1][j+A[i]]=(dp[2][i+1][j+A[i]]+dp[1][i][j]+dp[0][i][j])%MOD;
        }
    }
    cout << dp[2][N][S] << endl;
}

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

const ll MOD = 1000000007;
const ll MAX = 100100;
const double PI = 3.1415926;

#define vll vector<ll>
#define max_heap priority_queue<int>
#define min_heap priority_queue<int , vector<int>, greater<int> >
#define pb push_back
#define all(container) container.begin(), container.end()
// #define traverse( container, it) for( typeof(container.begin()) it = container.begin(); it!=container.end(); it++)
ll n;
ll v[MAX];
ll dp[MAX];

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	cin >> n;
	ll x;
	memset(dp,0,sizeof(dp));
	for (int i = 0; i < n; i++)
		cin >> v[i];
	
	dp[0] = 0;
	dp[1] = abs(v[1] - v[0]);

	for(int i = 2; i < n; i++)
		dp[i] = min(dp[i - 2] + abs(v[i] - v[i - 2]), dp[i - 1] + abs(v[i] - v[i - 1]));

	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
const int mn=5e3+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
const ll mod=1e9+7;
ll dp[mn][mn],p1[mn][mn],p2[mn][mn];
int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);
    int n,a[2];
    cin>>n>>a[0]>>a[1];
    if(a[0]>a[1])swap(a[0],a[1]);
    dp[0][0]=p1[0][0]=p2[0][0]=1;
    ll ans=1;
    for(int i=1;i<=n;i++){
        ans*=2,ans%=mod;
        for(int j=0;j<=min(i,a[1]-1);j++){
            if(j==1){
                for(int k=0;k<=i;k++){
                    dp[i][j]+=(i>=2?p1[i-2][k]:0)-(i>=a[0]+1?p1[i-a[0]-1][k]:0);
                }
                dp[i][j]%=mod;
            }
            dp[i][j]+=(i>=a[0]+1?p2[i-a[0]-1][i-j]:0);
            dp[i][j]+=j?dp[i-1][j-1]:0;
            dp[i][j]%=mod;
            p1[i][j]=(p1[i-1][j]+dp[i][j])%mod;
            p2[i][i-j]=(p2[i-1][i-j]+dp[i][j])%mod;
        }
    }
    for(int i=0;i<=n;i++){
        int na=n-i;
        if(na<a[0]){
            for(int j=0;j<=i;j++)ans-=dp[i][j],ans%=mod;
        }
        else{
            for(int j=0;j+na<a[1];j++)ans-=dp[i][j],ans%=mod;
        }
    }
    if(ans<0)ans+=mod;
    printf("%lld",ans);
}

Measured memory_bytes: 353648
x_1,y_1,x_2,y_2 = gets.chomp.split(' ').map(&:to_i)
orth_v_x = y_1 - y_2
orth_v_y = x_2 - x_1
x_3 = x_2 + orth_v_x
y_3 = y_2 + orth_v_y
x_4 = x_1 + orth_v_x
y_4 = y_1 + orth_v_y
puts [x_3,y_3,x_4,y_4].join(' ')

Measured memory_bytes: 14348
#include<iostream>
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
   int n,l;
   cin>>n;
   vector<int>v;
   int a[n];
   for(int i=0;i<n;i++){
    cin>>a[i];
   }
   int d=a[0];
   int c=0;
   for(int i=0;i<n;i++){
      if(a[i]<=d){
        c++;
        v.push_back(a[i]);
        d=a[i];
      }
    }
     cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 5024
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s = to_string(n);
    int c = 0;
    rep(i,s.length()){
        c += s[i]-'0';
    }
    if (n%c == 0) PRINT("Yes");
    else PRINT("No");
}

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

A, B, M = map(int, input().split())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
xycs = [tuple(map(int, input().split())) for _ in range(M)]

ans = min(As) + min(Bs)
for x, y, c in xycs:
    x, y = x-1, y-1
    cost = As[x] + Bs[y] - c
#    print((x, y, c), cost)
    ans = min(ans, cost)

print(ans)


Measured memory_bytes: 29508
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,ll>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n, k;
  cin>>n>>k;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  ll ans = 1LL<<60;
  for (int bit = 1; bit < (1<<n); ++bit) {
    if (!(bit & (1<<0))) continue;
    if (__builtin_popcount(bit) < k) continue; //フラグ数がk未満
    ll cost = 0;
    bool ok = true;
    P preb = P(0,a[0]); //一つ前の色が見える建物
    for (int i = 1; i < n; ++i) {
      ll prehigh = preb.second;
      if (bit & (1<<i)) {
        if (preb.second >= a[i]) {
          cost += prehigh + 1 - a[i];
          preb = P(i, prehigh + 1);
        }
        else preb = P(i, a[i]);
      }
      else if (!(bit & (1<<i)) && a[i] > prehigh) {
        ok = false; break;
      }
    }
    if (ok) chmin(ans, cost);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#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()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    cout << 0 << endl;
    return;
  }
  cout << min(a * b, min(b * c, c * a)) << endl;
}

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

Measured memory_bytes: 3636
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
pq que;

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

  cin >> n >> m;
  rep(i, n) cin >> a, que.push(a);
  while (m--) {
    ll val = que.top();
    que.pop();
    val /= 2;
    que.push(val);
  }
  while (!que.empty()) {
    ans += que.top();
    que.pop();
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 4288
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cinf(vl,n) for(int i=0;i<n;i++) {ll a;cin>>a;vl.pb(a);} 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	vector<ll> vl;
	cin>>n;
	cinf(vl,n);
	vector<ll> an = vl;
	sort(all(an));
	for(int i=0;i<n;i++)
	{
		if(vl[i] != an[n-1])
		{
			cout<<an[n-1]<<endl;
		}
		else
		{
			cout<<an[n-2]<<endl;
		}
	}
	return 0;
}

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

int main(){
   int n;cin>>n;
   int m[n+3];
   for(int i=1;i<=n;i++) cin>>m[i];
   int cnt=0;
   int i=1;
   while(i<n){
       int j,k;
       for(j=i;j<n && m[j]<=m[j+1];j++);
       for(k=i;k<n && m[k]>=m[k+1];k++);
       //printf("%d %d\n",j,k);
       i=max(j,k)+1;
       //cout << i<<endl;
       if(i!=n+1)cnt++;//i=n+1の時，大小の入れ替わりではなく，端にきたから止まったのでバーは入れない
   }
   cout << cnt+1 << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const double EPS=1e-8;
const double PI=acos(-1);

struct point{
	double x,y;
	point():x(0),y(0){}
	point(double x,double y):x(x),y(y){}
	point operator+(const point &a)const{ return point(x+a.x,y+a.y); }
	point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
	bool operator< (const point &a)const{ return x+EPS<a.x || (abs(x-a.x)<EPS && y+EPS<a.y); }
};

double cross(const point &a,const point &b){ return a.x*b.y-a.y*b.x; }

double abs(const point &a){ return sqrt(a.x*a.x+a.y*a.y); }

typedef vector<point> polygon;

enum{CCW=1,CW=-1,ON=0};
int ccw(const point &a,const point &b,const point &c){
	double rdir=cross(b-a,c-a);
	if(rdir> EPS) return CCW;
	if(rdir<-EPS) return CW;
	return ON;
}

polygon convex_hull(vector<point> &P){
	int n=P.size();
	polygon CH;
	if(n<=1){
		CH.insert(CH.end(),P.begin(),P.end());
		return CH;
	}
	sort(P.begin(),P.end());

	rep(_,2){
		int m=0;
		vector<point> half(n);
		rep(i,n){
			half[m++]=P[i];
			while(m>=3 && ccw(half[m-3],half[m-2],half[m-1])!=CCW){
				half[m-2]=half[m-1];
				m--;
			}
		}
		CH.insert(CH.end(),half.begin(),half.begin()+m-1);
		reverse(P.begin(),P.end());
	}

	return CH;
}

int main(){
	int n; scanf("%d",&n);

	polygon G={point(0,0)};
	rep(i,n){
		point p; scanf("%lf%lf",&p.x,&p.y);

		vector<point> H=G;
		for(point q:G) H.emplace_back(q+p);
		G=convex_hull(H);
	}

	double ans=0;
	for(point p:G) ans=max(ans,abs(p));
	printf("%.10f\n",ans);

	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
int a=0,b=0;
scanf("%d %d",&a,&b);
if (a<b)
{printf("a < b\n");}
else if (a>b)
{printf("a > b\n");}
else 
{printf("a == b\n");}
return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int a, b, c;
    cin >> a >> b >> c;
    
    if (a == b) 
        if (a != c) {
            cout << "Yes" << endl;
            return 0;
    }
    if (a == c) 
        if (a != b) {
            cout << "Yes" << endl;
            return 0;
    }
    if (c == b) 
        if (a != c) {
            cout << "Yes" << endl;
            return 0;
    }


    cout << "No" << endl;
    
    //cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
int main() {
int a[10];
int b;
for(int i=0;i<10;i++){
cin>>b;
a[i]=b;
}
sort(a,a+10,greater<int>());
cout<<a[0]<<endl;
cout<<a[1]<<endl;
cout<<a[2]<<endl;
return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
 
struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}


signed main(){
    string s;cin>>s;
    int a=0;
    for(auto &c:s){
        a=(a+(c-'0'))%9;
    }
    if(a==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3752
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<numeric>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    rep(i, n) cin >> x[i] >> y[i];
    vector<int> town;
    rep(i, n) town.push_back(i);
    vector<double> ans;
    double sum = 0.0;
    int num = 0;
    do {
        double tmp_dist = 0.0;
        rep(i, n-1) {
            tmp_dist += sqrtl((x[town[i]] - x[town[i+1]]) * (x[town[i]] - x[town[i+1]]) + (y[town[i]] - y[town[i+1]]) * (y[town[i]] - y[town[i+1]]) );
        }
        sum += tmp_dist;
        ++num;
    } while( next_permutation(town.begin(), town.end()));
    printf("%6lf\n", sum / (double)num );
    return 0;
}

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

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

    string S;
    cin >> S;

    vector<ll> ruimod(200001);
    vector<ll> Ti(S.size());
    vector<ll> mod_list(2019,0);

    ruimod[0] = 1;
    rep(i,200000){
        ruimod[i+1] = ruimod[i] * 10 % 2019;
    }

    Ti[S.size()-1] = S[S.size()-1] - '0';
    mod_list[Ti[S.size()-1]]++;
    mod_list[0]++;
    rep(i,S.size()-1){
        Ti[S.size()-i-2] = (Ti[S.size()-i-1] + ruimod[i+1] * (S[(S.size()-i-2)] - '0')) % 2019;
        // cout << "i=" << S.size()-i-2 << ":" << Ti[S.size()-i-2] << "\n";
        mod_list[Ti[S.size()-i-2]]++;
    }

    ll result = 0;
    rep(i,2019){
        // if (mod_list[i] >= 2) cout << "i:" << i << " mod_list:" << mod_list[i] << "\n";
        if (mod_list[i] >= 2) result += mod_list[i] * (mod_list[i] - 1) / 2;
    }

    cout << result << "\n";
}

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

int main() {
  int N;
  cin >> N;
  vector<int>vec(100000,0);
  for(int i=1; i<=99; ++i){
    for(int j=1; j<=99; ++j){
      for(int k=1; k<=99; ++k){
        vec[i*i + j*j + k*k + i*j + j*k + k*i]++;
      }
    }
  }
  for(int i=1; i<=N; i++){
    cout << vec[i] << endl;
  }
}


Measured memory_bytes: 3764
import sys
sys.setrecursionlimit(10**6)
def main():
    n=int(input())
    color=list(map(int,input().split()))
    nodes=[[]for i in range(n)]
    cut=[[0]for i in range(n+1)]
    ans=[0]*(n+1)
    for i in range(n-1):
        a,b=map(int,input().split())
        nodes[a-1].append(b-1)
        nodes[b-1].append(a-1)
    def num(p,parent):
        s=0
        for child in nodes[p]:
            if child==parent:
                continue
            cut[color[p]].append(0)
            nc=num(child,p)
            group=nc-cut[color[p]].pop()
            ans[color[p]]+=group*(group+1)//2
            s+=nc
        s+=1
        cut[color[p]][-1]+=s
        return s
    num(0,-1)
    for a,c in zip(ans[1:],cut[1:]):
        group=n-c[0]
        c=group*(group+1)//2
        print(n*(n+1)//2-c-a)
main()

Measured memory_bytes: 313376
import java.util.Scanner;
public class Main {
	//static int N;
	static String s;
	static int min=1000;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		s=sc.next();
		for(int i=0;i<s.length()-2;i++) {
			min=Math.min(min,Math.abs(753-Integer.parseInt(s.substring(i, i+3))));
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


template <class Monoid>
class SegmentTree
{
public:
  using Func = function<Monoid(Monoid, Monoid)>;
  const Func F;
  const Monoid M1;
  int sz;
  vector<Monoid> seg;

  SegmentTree(int n,const Func fu, const Monoid &m1): F(fu) , M1(m1) {init(n);}
  void init(int n)
  {
      sz= 1;
      while (sz < n) sz *= 2;
      seg.assign(sz * 2, M1);
  }
  void update(int k,const Monoid &x)
  {
    k+=sz;
    seg[k]=x;
    while(k>>=1)
    {
      seg[k]=F(seg[k*2],seg[k*2+1]);
    }
  }
  void add(int k,const Monoid &x){
    update(k,x+seg[k+sz]);
  }
  Monoid query(int l,int r)
  {
    Monoid L=M1,R=M1;
    l+=sz;r+=sz;
    for(;l<r;l>>=1,r>>=1)
    {
      if(l&1)L=F(L,seg[l++]);
      if(r&1)R=F(seg[--r],R);
    }
    return F(L,R);
  }
};
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll q;cin>>q;
  vector<ll>query,ua,ub;
  vector<ll>x;
  rep(i,q){
    ll f;cin>>f;
    if(f==1){
      ll a,b;
      cin>>a>>b;
      ua.push_back(a);
      ub.push_back(b);
      x.push_back(a);
    }
    else query.push_back(ua.size());
  }
  sort(all(x));
  x.erase(unique(all(x)),x.end());
  map<ll,ll>ma,mai;
  ll id=0;
  for(auto tx:x){
    ma[tx]=id++;
  }
  SegmentTree<ll> st(2e5,[](ll a,ll b){return a+b;},0);
  auto st2=st;
  ll pre=0;
  set<ll>xx;
  ll sb=0;
  for(auto tq:query){
    repi(i,pre,tq){
      st.add(ma[ua[i]],ua[i]);
      st2.add(ma[ua[i]],1);
      sb+=ub[i];
    }
    pre=tq;
    ll ng=-1,ok=2e5;
    auto check=[&](ll num){
      return st2.query(0,num+1)>=(tq+1)/2;
    };
    while(ok-ng>1){
      ll nn=(ok+ng)/2;
      if(check(nn))ok=nn;
      else ng=nn;
    }
    ll cen=x[ok];
    cout<<cen<<" ";
    ll res=0;
    res+=-st.query(0,ma[cen])+st.query(ma[cen],2e5);
    res+=cen*st2.query(0,ma[cen])-cen*st2.query(ma[cen],2e5);
    cout<<res+sb<<endl;
  }


  return 0;

}


Measured memory_bytes: 20220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  
  ll x = n / (a + b);
  ll y = n % (a + b);
  ll z = min(a, y);
  
  cout << x * a + z << endl;
} 

Measured memory_bytes: 3636
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete



main = do
    n <- getInt
    unless (n==0) $ do
        ds <- map (apply2 (,)) <$> replicateM n getIntegers
        let dlcm = foldl1 lcm $ map snd ds
        let ts = map (\(d,v) -> d * dlcm `div` v) ds
        let nlcm = foldl1 lcm  ts
        mapM_ print $ map (div nlcm) ts
        main


Measured memory_bytes: 4252
#include<stdio.h>
#define N 100
 
int main(void){
  int i,j,tmp,n,count=0,flag=1,data[N];
 
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&data[i]);
 
  while(flag){
    flag=0;
    for(j=n-1;j>=1;j--){
      if(data[j]<data[j-1]){
        tmp=data[j];
        data[j]=data[j-1];
        data[j-1]=tmp;
        count++;
        flag=1;
      }
    }
  }
 
  for(i=0;i<n;i++){
    printf("%d",data[i]);
    if(i!=n-1) printf(" ");
  }
 
  printf("\n");
  printf("%d\n",count);
  return 0;
}

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

#define F first
#define S second
#define prev azaza

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 100005;

int main()
{
    //ifstream cin("input.txt");
    int a, n;
    cin >> n;
    int k = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        if (a % 2 == 1) k++;
    }
    if (n == 1)
    {
        cout << "YES";
        return 0;
    }
    if (k % 2 == 1)
    {
        cout << "NO";
        return 0;
    }
    cout << "YES";
    return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 5124;
int par[N];
VI edges[N];

PI dfs(int n, int v) {
  int tot = 0;
  bool some = false;
  REP(i, 0, edges[v].size()) {
    int w = edges[v][i];
    PI res = dfs(n, w);
    if (res.second) {
      some = true;
    }
    tot += res.first;
  }
  return PI(tot + (some ? 1 : 0), some ? 0 : 1);
}

int calc(int n) {
  return dfs(n, 0).first;
}


int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  par[0] = -1;
  REP(i, 0, n) {
    int pp;
    cin >> pp;
    par[i + 1] = pp;
    edges[pp].push_back(i + 1);
    cout << calc(i + 2) << "\n";
  }
}

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

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

    for (int i = 0; i < t.size(); ++i) {
    if (t[i] >= 'a' && t[i] <= 'z' && isalpha(t[i]) && islower(t[i])) ;
    else cout << "No" << endl; 
    }
    t.pop_back();
    if (s.size() >= 1 && s.size() <= 10 && s == t) cout << "Yes" << endl;
    else cout << "No" << endl; 
}

Measured memory_bytes: 3632
program aaa
implicit none

integer :: d

read*, d

if(d==25) then
write(*,*) 'Christmas'
else if (d==24) then
write(*,*) 'Christmas Eve'
else if (d==23) then
write(*,*) 'Christmas Eve Eve'
else if (d==22) then
write(*,*) 'Christmas Eve Eve Eve'
end if

end program

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 1100000;
int a[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    int ans = 1;
    for (int i = 1; i < n; i++){
        ans = ans * __gcd(i, a[i + 1]) % mod;
    }
    cout << ans * a[1] % mod;
}


Measured memory_bytes: 1024
import copy
def make_divisors(n):
  divisors = []
  for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n // i)

  # divisors.sort()
  return divisors


n = int(input())

box = make_divisors(n-1)
ans = len(box)-1
boxn = make_divisors(n)
for i in range(1,len(boxn)):
    k = boxn[i]
    nn = copy.deepcopy(n)
    while nn % k == 0 and nn >= k:
        nn = nn // k

    if nn % k == 1:
        ans += 1

print(ans)


Measured memory_bytes: 3736
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
using namespace std;
typedef long long ll;
#define MAX 2000000
#define INFTY 9000000000

int main(){
  ll N,K,t,d,X[MAX],Y[MAX];
  cin>>N>>K;
  vector<ll> V[MAX];
  for(ll i=0;i<N;i++){
    cin>>t>>d;
    V[t].push_back(d);
  }
  for(ll i=1;i<=N;i++){
    sort(V[i].begin(),V[i].end(),greater<ll>());
  }
  ll countX=0,countY=0;
  for(ll i=1;i<=N;i++){
    for(ll j=0;j<V[i].size();j++){
      if(j!=0) X[countX++]=V[i][j];
      else Y[countY++]=V[i][j];
    }
  }
  sort(X,X+countX,greater<ll>());
  sort(Y,Y+countY,greater<ll>());
  ll sumX[MAX],sumY[MAX];
  sumX[0]=0; sumY[0]=0;
  for(ll i=0;i<countX;i++){
    sumX[i+1]=sumX[i]+X[i];
  }
  for(ll i=0;i<countY;i++){
    sumY[i+1]=sumY[i]+Y[i];
  }
  ll ans=0;
  for(ll i=1;i<=K;i++){
    if(i>countY) break;
    else ans=max(ans,sumY[i]+sumX[K-i]+i*i);
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 60544
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin >> n;
   vector<int> a(n);
   for(int i = 0;i<n;i++){
       cin >> a.at(i);
   }

   int minj = 0;
   int cnt = 0;
   for(int i = 0; i < n; i++){
       minj = i;
       for(int j = i; j < n; j++){
           if(a.at(j) < a.at(minj)){
               minj = j;
               
           }
       }
       if(a.at(i) != a.at(minj)){
           swap(a.at(i),a.at(minj));
           cnt++;
       }
   }

   for(int i = 0;i < n;i++){
       if(i > 0) cout << " ";
       cout << a.at(i);
   }

   cout << endl;
   cout << cnt << endl;
}


Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var firstLine = Console.ReadLine().Split(' ').Select(value => long.Parse(value)).ToList();
			var n = firstLine[0];
			var t = firstLine[1];

			var times = Console.ReadLine().Split(' ').Select(value => long.Parse(value)).ToList();

			long total = 0;

			for(var i = 0; i < times.Count - 1; i++)
			{
				var diff = times[i + 1] - times[i];
				if (diff < t)
				{
					total += diff;
				}
				else
				{
					total += t;
				}
			}

			total += t;

			Console.WriteLine(total);
		}
	}
}


Measured memory_bytes: 29088
#include <stdio.h>

int main (){
	
	int a,b,c,d;
	scanf ("%d %d %d", &a, &b, &c);
	d = a+b+c;
	if (d >= 22){
		printf ("bust");
	}
	else {
		printf ("win");
	}
	return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
const int mod=1e9+7;
const int maxn=100+10;
const int maxk=1e5+10;

template<typename T> void read(T &x){
	T f=1;x=0;
	char c=getchar();
	while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	x*=f;
}
ll n,k;
ll a[maxn];
ll f[maxn][maxk];
ll pre_sum[maxn];
ll pre_ans[maxn][maxk];
int main(){
	read(n);read(k);
	for(re int i=1;i<=n;i++){
		read(a[i]);
		pre_sum[i]+=pre_sum[i-1]+a[i];
	} 
	f[0][0]=1;
	for(re int i=0;i<=k;i++){
		pre_ans[0][i]=1;
	}
	for(re int i=0;i<=n;i++) f[i][0]=pre_ans[i][0]=1;
	/*
	for(re int i=1;i<=n;i++){
		for(re int j=0;j<=k && j<=pre_sum[i];j++){
			for(re int t=0;t<=a[i];t++){
				if(j-t>=0) f[i][j]=(f[i][j]%mod+f[i-1][j-t]%mod)%mod;
			}
		}
	}
	*/	
	for(re ll i=1;i<=n;i++){
		for(re ll j=0;j<=k;j++){
			if(a[i]>=j) f[i][j]=(pre_ans[i-1][j])%mod;
			else f[i][j]=(f[i][j]+pre_ans[i-1][j]-pre_ans[i-1][j-a[i]-1])%mod;
			if(j>0) pre_ans[i][j]+=f[i][j]+pre_ans[i][j-1];
			else pre_ans[i][j]=f[i][j];
		}
	}
	//cout<<pre_ans[n][k]<<endl;
	cout<<f[n][k]<<endl;
	return 0;
}


Measured memory_bytes: 162048