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

int main() {
	
	int m;
	cin >> m;
	cout << 48 - m << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;
int maxi,n,i,a[100005];
int dps[100005],dpd[100005];
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    dps[2]=a[1];
    dpd[n-1]=a[n];

    for(i=3;i<=n;i++)
        dps[i]=__gcd(dps[i-1], a[i-1]);

    for(i=n-2;i>=1;i--)
        dpd[i]=__gcd(dpd[i+1], a[i+1]);

    maxi=max(dpd[1], dps[n]);

    for(i=2;i<=n-1;i++)
        maxi=max(maxi, __gcd(dps[i], dpd[i]));

    cout<<maxi;
    return 0;
}


Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(10**6)
MOD=10**9+7
def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv

def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD

def dfs(v,p,dep):
    global res
    c=0
    for nv in G[v]:
        if nv==p:
            continue
        dfs(nv,v,dep+1)
        c+=1
    if dep==0:
        res=((res*COM(K-1,c)%MOD)*fac[c])%MOD
    else:
        res=((res*COM(K-2,c)%MOD)*fac[c])%MOD
    
N,K=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
fac,finv,inv=facinv(max(K,N))
res=K
dfs(0,-1,0)
print(res%MOD)

Measured memory_bytes: 101556
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define FOR(i, n) for (int(i) = 0; (i) < n; (i)++)
#define PI (3.141592653589)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long ll;
#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who cannot acknowledge themselves, will invariably fail

    int n;
    cin >> n;
    string arr[n];
    for(int i = 0;i < n;i++)
    {
        string t;
        cin >> t;
        sort(t.begin(), t.end());
        arr[i] = t;
    }
    sort(arr, arr + n);
    long long curr = 1, sol = 0ll;
    for(int i = 1;i < n;i++)
    {
        if(arr[i] == arr[i-1])
        {
            curr++;
        }
        else
        {
            curr = 1;
        }
        sol += curr - 1;
    }
    cout << sol;
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  ll ans = -1;
  for(int i = 1; i < 500000; ++i) {
    int a = i * 1.08;
    if(a == n) ans = i;
  }
  if(ans == -1) cout << ":(" << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int saiki(int ,int);
int main(){
  int i,a,x,y,z;
  scanf("%d %d",&x,&y);
  a=saiki(x,y);
  printf("%d\n",a);
  return 0;
}
int saiki(int x,int y){
  int a;
  if(x>y){
    if((a=x%y)==0)
      return y;
    a=saiki(y,a);
    return;
  }
  if(x<y){
    if((a=y%x)==0)
      return x;
    a=saiki(x,a);
    return;
  }
}
      
    



Measured memory_bytes: 2144
#include <iostream>
using namespace std;
long long int mod (long long int x)
{
    return (x%1000000007 + 1000000007)%1000000007;
}
long long int powmodu(long long int x, long long int y)
{
    if(y==0)
    {
        return 1;
    }
    if(y==1)
    {
        return mod(x);
    }
    long long int ansi = mod(powmodu(x,y/2));
    if(y%2==0)
    {
        return mod((mod(ansi)*mod(ansi)));
    }
    else
    {
        return mod(mod(mod(ansi)*mod(ansi))*mod(x));
    }
}

int main()
{
    long long int n;
    cin>>n;
    long long int ans = mod(mod(powmodu(10LL,n))+ mod(powmodu(8LL,n))) - mod(mod(powmodu(9LL,n)) + mod(powmodu(9LL,n)));
    ans = mod(ans);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define REPA(x, v) for(auto&& x:v)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(v.rbegin(),v.rend())
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int K;
    cin >> K;
    vector<ll> A(K);
    REP(i,K) cin >> A[i];
    reverse(ALL(A));

    if(A[0]!=2){
        pr(-1);return 0;
    }

    ll minn = 2, maxn = 2;
    REP(i, K){
        ll mink = minn / A[i] + ((minn%A[i])==0?0:1);
        ll maxk = maxn / A[i];

        minn = mink * A[i];
        maxn = maxk * A[i] + (A[i]-1);

        if(minn > maxn){
            pr(-1);return 0;
        }
    }

    pr(minn, maxn);
}

Measured memory_bytes: 4036
N, t = map(int, raw_input().split())
n = map(int, raw_input().split())
total = 0
next = t
for i in range(N-1):
	if(next < n[i+1]):
		total += t
		next = n[i+1]+t
	else:
		total += n[i+1]-n[i]
		next = n[i+1]+t
total += t
print(total)

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


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

int main(){
    int l, r;
    cin >> l >> r;
    int ans = 2019;
    for(int i = l; i < r; i++){
        for(int j = i + 1; j < r + 1; j++){
            ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
            if(ans == 0){
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int K,S;
int main(){
  cin >> K >> S;
  int ans = 0;
  for(int i=0;i<=K;i++){
	for(int j=0;j<=K;j++){
      if(0<=S-i-j && S-i-j<=K) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N,M; cin >> N >> M;
	VL x(N), y(M);
	REP(i, N) cin >> x[i];
	REP(i, M) cin >> y[i];
	sort(ALL(x));
	sort(ALL(y));
	ll p = 0, q = 0;
	REP(i, N) (p += ((i + 1)*x[i]) % HMOD) %= HMOD;
	REP(i, N) (p -= ((N - i)*x[i]) % HMOD) %= HMOD;
	REP(i, M) (q += ((i + 1)*y[i]) % HMOD) %= HMOD;
	REP(i, M) (q -= ((M - i)*y[i]) % HMOD) %= HMOD;
	cout << (p*q) % HMOD << endl;
	return 0;
}



Measured memory_bytes: 1792
k,n=map(int,input().split())
A = list(map(int, input().split()))
mw = 0
for i in range(n):
  if i == 0:
    mw = max(mw, A[0]+(k-A[-1]))
  else:
    mw = max(mw, A[i]-A[i-1])
print(k-mw)

Measured memory_bytes: 26420
import sys
sys.setrecursionlimit(2147483647)



n=int(input())
if n==1:
    print(0)
    exit()

import math
def isPrime(num):
    if num < 2: return False
    elif num == 2: return True
    elif num % 2 == 0: return False
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False
    return True

if isPrime(n):
    print(1)
    exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

sisu=(factorization(n))
#print(sisu)
cnt=0
for item in sisu:
    i=1
    tmp=item[1]
    while tmp>=i:
        tmp-=i
        cnt+=1
        i+=1

print(cnt)




Measured memory_bytes: 64148
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		long K = sc.nextLong();
		
		System.out.println(K % 2 == 0 ? A - B : B - A);
	}
}


Measured memory_bytes: 23764
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static void swap(ref long x, ref long y)
        {
            var tmp = x;
            x = y;
            y = tmp;
        }


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var input = Reads();
            var a = input[0];
            var b = input[1];
            var c = input[2];
            if (c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");


            

        Console.Out.Flush();
        }
    }
}

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

int main() {
  long long N,ans;
  cin >> N;
  vector<long long> A1(N),A2(N);
  for (int i=0; i<N; i++) {
    cin >> A1[i];
  }
  
  ans += A1[0];
  
  for (int i=0; i<N; i++) {
    cin >> A2[i];
    ans += A2[i];
  }
  
  long long term = ans;
  
  for (int i=1; i<N; i++) {
    term += A1[i];
    term -= A2[i-1];
    ans = max(ans,term);
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;

map<string,int> s;
map<string,int>::iterator iter;
int main()
{
    int n,m;
    string c;
    scanf("%d",&n);
    while(n--)
    {
        cin>>c;
        s[c]+=1;
    }
    scanf("%d",&m);
    while(m--)
    {
        cin>>c;
        s[c]-=1;
    }
    int maxn=0;
    for (iter=s.begin();iter!=s.end();iter++)
        if (iter->second>maxn) maxn=iter->second;
    printf("%d\n",maxn);
    return 0;
}


Measured memory_bytes: 256
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[500005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=500005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }

// bool sorter(lld a, lld b)
// {
//     vector<lld> v2;
//     vector<lld> w;
//     // cout<<"A == " <<a<<"  B== "<<b;
//     while(a>=1)
//     {
//         v2.pb(a%10);
//         a/=10;
//     }
//     while(b>=1)
//     {
//         w.pb(b%10);
//         b/=10;
//     }   
       
//     reverse(all(v2));
//     reverse(all(w));
//     lld l1 = v2.size();
//     lld l2 = w.size();
//     lld  l = (l1*l2)/__gcd(l1,l2);
//     // cout<<l1<< " "<<l2<< " "<<l<< " ";
//     for(int i=0;i<l;i++)
//     {
//         if(v2[i%l1]!=w[i%l2])
//         {
//             // cout<< "   "<< (v2[i%l1] > w[i%l2])<<"\n";
//             return v2[i%l1] > w[i%l2];
//         }
//     }
//     // printf("false\n");
//     return false;
// }


lld p1=1e8 + 7,p2=998244353;
lld l,r,mid,ans;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;
lld ss=1;


void solve()
{
    cin>>n;
    x = n/200;
    cout<<10-x;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    // cin>>t;
    // cout<<t;
     // getfac(p1);
    //check the value by which modulo is to be taken
    // lld ans=0;
    // precompute();
    for(int i=0;i<t;i++)
    {
        // cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3684
# coding: utf-8
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces


def main():
    x = ni()
    memo = [pow(i,5) for i in range(-125,125)]
    xmod10 = x%10
    for a in range(-125, 125):
        for b in range(-125, 125):
            if (a-b)%10 == xmod10:
                if memo[a+125] - memo[b+125] == x:
                    print(a,b)
                    return
    print("Erorr")
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 64440
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
using namespace std;


int main() {
	int n, k;
	cin >> n >> k;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	map<int, long double> values;
	
	for (auto num : nums) {
		if (values.find(num) != values.end()) {
			continue;
		}
		long double sum = 0;
		long double final = 1.0 / num;
		for (int i = 1; i <= num; i++) {
			sum += (final * i);
		}
		values[num] = sum;
	}

	long double res = 0;
	long double current = 0;

	for (int i = 0; i < n; i++) {
		current += values[nums[i]];
		if (i - k + 1 >= 0) {
			res = max(res, current);
			current -= values[nums[i - k + 1]];
		}
	}

	cout << fixed << setprecision(10);
	cout << res << endl;
}


Measured memory_bytes: 1152
n = int(input())
l = [int(input()) for  i in range(n)]

l = sorted(l)
count = 1
ans = 0
for i in range(1,n):
  if l[i]==l[i-1]:
    count = count + 1
  else:
    if count%2 ==0:
      ans = ans +0
      count = 1
    else:
      ans = ans + 1
      count = 1
      
if count%2 ==0:
  ans = ans +0
else:
  ans = ans + 1
print(ans)

Measured memory_bytes: 8280
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;



int main(void) {
	ll n, k, ans = 0, mi = 1000000000000;
	cin >> n >> k;
	vector<ll>a(n);
	for (int i = 0;i < n;i++)cin >> a[i];
	for (int l = 0;l <= n - k;l++) {
		int r = l + k - 1;
		ans = abs(a[r]) + abs(a[r] - a[l]);
		mi = min(mi, ans);
		ans = abs(a[l]) + abs(a[r] - a[l]);
		mi = min(mi, ans);
	}
	cout << mi << endl;
	return 0;
}

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

int main(){
	int N;
	int num=1;
	int broken=0;
	cin >> N;
	for(int i=0;i<N;i++){
		int a;
		cin >> a;
		if(a==num){
			num++;
		}else{
			broken++;
		}
	}
	if(broken==N){
		cout << -1 << endl;
	}else{
		cout << broken << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import heapq

V, E, r = map(int, input().split())

g = [[] for _ in range(V)]
for i in range(E):
    s, t, d = map(int, input().split())
    g[s].append((t, d))

dis = [float("inf") for _ in range(V)]
dis[r] = 0

pq = [(0, r)]
while pq:
    d, node = heapq.heappop(pq)
    if d > dis[node]: continue

    for nxt, cost in g[node]:
        if d + cost < dis[nxt]:
            dis[nxt] = d + cost
            heapq.heappush(pq, (dis[nxt], nxt))

for d in dis:
    if d == float("inf"):
        print("INF")
    else:
        print(d)



Measured memory_bytes: 91592
#include <bits/stdc++.h>
int ds(int n) {
  int s = 0;
  while(n) s+=n%10, n/=10;
  return s;
}

int main()
{
  int n; scanf("%d", &n);
  puts(n % ds(n) == 0 ? "Yes" : "No");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N+1000];

        for (int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }

        int[] dp = new int[N+1000];
        for (int i = 0; i <dp.length ; i++) {
            dp[i] = Integer.MAX_VALUE;
        }
        dp[1] = 0;
        for (int i = 1; i <= N ; i++) {
            dp[i+1] =Math.min(dp[i+1], dp[i] +Math.abs(arr[i-1]-arr[i]));
            dp[i+2] =Math.min(dp[i+2], dp[i] +Math.abs(arr[i-1]-arr[i+1]));
        }
        System.out.println(dp[N]);
    }
}


Measured memory_bytes: 50096
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(X) if(X)
int main() {
	int n, sum;
	cin >> n;
	vector<int> b, a;
	b.resize(n - 1);
	for(int i = 0; i < n - 1; i++) cin >> b[i];
	sum = b[0];
	for(int i = 1, j = 0, cont = 0; i < n - 1; i++) {
		DEBUG(0) cout << i << ": " << b[i] << " " << b[i-1] << " " << min(b[i], b[i - 1]) << endl;
		sum += min(b[i], b[i - 1]);
	}
	cout << sum + b[n-2] << endl;
	return 0;
}

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

int digit_sum (int num) {
    int ans = 0;
    while (num > 0) {
        ans += num % 10;
        num = num / 10;
    }
    return ans;
}

int main() {
    int N;
    cin >> N;
    
    int minv = 1e7;
    for (int A = 1; A < N; A ++) {
        int B = N - A;
        minv = min(minv, digit_sum(A) + digit_sum(B));
    }
    
    cout << minv;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std ;
int main(){
  int n,b,f,r,v;
  int count[5][4][11]={0};
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>b>>f>>r>>v;
    count[b][f][r]+=v;
  }
  for(int i=1;i<5;i++){
    for(int j=1;j<4;j++){
      for(int k=1;k<11;k++){
	cout<<" "<<count[i][j][k];
      }
      cout<<endl;
    }
    if(i==4)break;
    cout<<"####################"<<endl;
   
  }
 return 0;
}

Measured memory_bytes: 3056
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
import numpy as np
#decimal.getcontext().prec = 10

H, W = MAP()
N = INT()
a = LIST()

A = []
for i in range(N):
	A += [i+1]*a[i]

ans = []
for i in range(H):
	ans.append(A[i*W:(i+1)*W])

for i in range(H):
	if i%2:
		ans[i] = ans[i][::-1]

for i in range(H):
	print(*ans[i])


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

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

int main() {
  int k;
  cin >> k;
  ll ans = 1, add = 1;
  for (int i = 0; i < k; ++i) {
    cout << ans << endl;
    if (sum(ans + add) * (ans + add * 10) < sum(ans + add * 10) * (ans + add))
      add *= 10;
    ans += add;
  }
}


Measured memory_bytes: 3624
/*
https://beta.atcoder.jp/contests/abc084/tasks
*/
#include<iostream>
#include<string>
#include<vector>
#include<algorithm> //find
#include<locale> //isdgit
#include<sstream> //istringstream
using namespace std;

vector<string> split(const string str, char delimiter){
  istringstream stream(str);
  string s;
  vector<string> a;
  while(getline(stream,s,delimiter)){
    a.push_back(s);
  }
  return a;
}

bool check(int loop,string str){
  if(loop!=str.size()) return false;

  for(int i=0;i<loop;i++){
    if(!isdigit(str[i])) return false;
  }
  return true;
}

int main(){
  int n,m;
  string s;
  cin>>n>>m>>s;
  auto result =find(s.begin(),s.end(),'-');
  if(result==s.end()){
    cout<<"No"<<"\n";
  }else{
    vector<string> vec=split(s,'-');
    bool A=check(n,vec[0]);
    bool B=check(m,vec[1]);
    cout<< (A&&B?"Yes":"No")<<"\n";
  }
}


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

int main()
{
    int N;
    cin >> N;
    int Xi;
    vector<int> X(N);
    for(int i=0;i<N;i++){
        cin >> Xi;
        X[i] = Xi;
    }
    auto X2 = X;
    sort(X2.begin(), X2.end());
    for(int i=0;i<N;i++){
        if(X[i] <= X2[(N-1)/2]) cout<<X2[(N)/2]<<endl;
        else                    cout<<X2[(N-1)/2]<<endl;
    }

    return 0;
}

Measured memory_bytes: 3840
import numpy as np

MOD = 10**9 + 7
N, K = map(int, input().split())
Alist = list(map(int, input().split()))

l = 0
r = 0
for i in range(N):
    for j in range(N):
        if Alist[i] > Alist[j]:
            if i < j:
                r += 1
            if i > j:
                l += 1

Kl = int((K * (K - 1) // 2) % MOD)
Kr = int((K * (K + 1) // 2) % MOD)
ans = (l * Kl + r * Kr) % MOD

print(ans)

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

using namespace std;

void output(vector<int> arr) {
    for (int i = 0; i < arr.size() - 1; i++) {
        cout << arr[i] << " ";
    }
    cout << arr[arr.size() - 1] << endl;
}

void step(vector<int>& arr, int step) {
    int i = step, pick = arr[step + 1];
    while (0 <= i && arr[i] > pick) {
        arr[i + 1] = arr[i];
        i--;
    }
    arr[i + 1] = pick;
}

void insertionSort(vector<int>& arr) {
    for (int i = 0; i < arr.size(); i++) {
        output(arr);
        step(arr, i);
    }
}

int main() {
    vector<int> arr;
    int size;
    cin >> size;
    for (int i = 0; i < size; i++) {
        int input;
        cin >> input;
        arr.push_back(input);
    }
    insertionSort(arr);
    return 0;
}



Measured memory_bytes: 3108
#include <iostream>
using namespace std;
int main(void){
    long long n;
    cin >> n;
    if(n%2==1)
        cout << 0 << endl;
    else{
        long long ans = 0;
        n/=2;
        long long p = 5;
        while(n>=p){
            ans+=n/p;
            p*=5;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 1e6+5 ;

int n ,a[N] ,b[N] ;
vector<int> xorA ,xorB ;

int nn ,mm ,pat[N], str[N];

int F[N];

int getNextLen(int len, int c){
  while(len && c != pat[len])
    len = F[len-1];
  if(c == pat[len]) ++len;
  return len;
}

void computeF(){
  for(int i = 1 ; i<nn ; ++i)
    F[i] = getNextLen(F[i-1], pat[i]);
}

vector<int> search(){
  int len = 0;
  vector<int> res;
  for(int i = 0 ; i<mm ; ++i){
    len = getNextLen(len, str[i]);
    if(len==nn){
        res.push_back(i-len+1);
    }
  }
  return res;
}


int main(){
    memset(pat,-1,sizeof pat);
    memset(str,-1,sizeof str);
    scanf("%d",&n);
    for(int i=0;i<n;++i) scanf("%d",a+i);
    for(int i=0;i<n;++i) scanf("%d",b+i);
    for(int i=0;i<n;++i){
        xorA.push_back(a[i]^a[(i+1)%n]);
        xorB.push_back(b[i]^b[(i+1)%n]);
    }
    for(int i=n;i<n+n+n;++i) xorA.push_back(xorA[i-n]);

    for(int i=0;i<xorA.size();++i) str[i] = xorA[i] ;
    for(int i=0;i<xorB.size();++i) pat[i] = xorB[i] ;
    mm = xorA.size() ;
    nn = xorB.size() ;
    computeF() ;
    auto v = search() ;

    for(auto go:v){
        if(go>=n) break ;
        int x = a[go]^b[0] ;
        printf("%d %d\n",go,x);
    }
    return 0;
}


Measured memory_bytes: 28900
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int maxn=1e5+7;
int a[maxn];
int main()
{

  int n,ans=0;
  cin>>n;
  rep(i,0,n) scanf("%d",&a[i]);
  sort(a,a+n);
  int cnt=1;
  rep(i,1,n)
  {
     // cout<<a[i]<<endl;
     if(a[i]==a[i-1]) cnt++;
     else
     {
       if(cnt%2==1) ans++;
       cnt=1;
     }
  //   de(cnt);
  }
  if(cnt%2==1) ans++;
  cout<<ans;
  return 0;
}


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

const int MAX_N = 300;
int N;
vector<int> a;
double dp[MAX_N + 1][MAX_N + 1][MAX_N + 1];
bool flag[MAX_N + 1][MAX_N + 1][MAX_N + 1];


// dp[c1][c2][c3] := 1個の皿がc1枚,2個の皿がc2枚, 3個の皿がc3枚ある時
// の全て食べるまでの操作回数の期待値
// dp[c1][c2][c3] = 1 + dp[c1-1][c2][c3] * (1この皿が選ばれる確率)
// + dp[c1+1][c2-1][c3] * (2kono) + dp[c1][c2+1][c3-1] *( 3kono) + dp[c1][c2][c3] * (残り)
    
double F(int c1, int c2, int c3){
    if(flag[c1][c2][c3]) return dp[c1][c2][c3];
    flag[c1][c2][c3] = 1;
    double s = 1;
    if(c1 > 0) s += F(c1-1,c2,c3) * c1 / N;
    if(c2 > 0) s += F(c1+1, c2 - 1,c3) * c2 / N;
    if(c3 > 0) s += F(c1, c2 + 1, c3 - 1) * c3 / N;
    s *= 1/ (1 - (double)(N - (c1 + c2 + c3)) / N);
    return dp[c1][c2][c3] = s; 
}

int main(){
    cin >> N;
    a.resize(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    int c1 = 0, c2 = 0, c3 = 0;
    for(int i= 0 ; i < N; i++){
        if(a[i] == 1) c1++;
        if(a[i] == 2) c2++;
        if(a[i] == 3) c3++;
    }
    dp[0][0][0] = 0, flag[0][0][0] = 1;
    cout << fixed << setprecision(10) <<  F(c1, c2, c3) << endl;
}

Measured memory_bytes: 239872
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string a,b,c;
    cin>>n;
    cin>>a>>b>>c;
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]==b[i] && b[i]==c[i])
            continue;
        if(a[i]==b[i] || b[i]==c[i] || a[i]==c[i])
            ans++;
        else
            ans+=2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

void solve() {
  int n, m, x, y;
  VI X, Y;
  cin >> n >> m>> x >> y;
  X.push_back(x);
  Y.push_back(y);
  REP(i, n) {
    int a;
    cin >> a;
    X.push_back(a);
  }
  REP(i, m) {
    int a;
    cin >> a;
    Y.push_back(a);
  }
  sort(ALL(X), greater<int>());
  sort(ALL(Y));
  if (X[0] < Y[0]) cout << "No War" << endl;
  else cout << "War" << endl;

}

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


Measured memory_bytes: 256
#include <cstdio>

int main(){
    int n;
    scanf("%d",&n);
    int p[n];
    for (int i = 0; i < n; i++){
        scanf("%d",&p[i]);
    }
    int count=0;
    for (int i = 1; i < n-1; i++){
        if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1])) count++;
    }
    printf("%d",count);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, count=0;
  cin >> N;
  vector<int> button(N);
  
  for(int i=0; i<N; i++)
    cin >> button.at(i);
    
  int a=1;
  for(int i=0; i<N; i++){
    
    count++;
    
    if(button.at(a-1) == 2){
      cout << count << endl;
      break;
    }
    
    a=button.at(a-1);
  }
  
  if(button.at(a-1) != 2)
    cout << -1 << endl;
        
}

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

void solve(long long D, long long N) {
  long long itmp = 0;
  switch (D) {

  case 0:
    itmp = 1;
    break;
  case 1:
    itmp = 100;
    break;
  case 2:
    itmp = 10000;
    break;
  default:
    break;
  }
  // cerr << itmp << endl;

  if (N == 100)
    N++;

  cout << N * itmp << endl;
}

int main() {
  long long D;
  scanf("%lld", &D);
  long long N;
  scanf("%lld", &N);
  solve(D, N);
  return 0;
}


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

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int n = sc.nextInt();
			int p = sc.nextInt();

			if ((n | p) == 0) {
				break;
			}

			int[] x = new int[n];

			int ended = n ;
			int center = p;

			int i = 0;
			for (;; i++) {
				if (i == n) {
					i = 0;
				}

				if (center != 0) {
					center--;
					if (x[i] == 0) {
						ended--;
					}
					x[i]++;
				} else {
					if (x[i] != 0) {
						ended++;
					}
					center += x[i];
					x[i] = 0;
				}
				
				if(center == 0 && ended == n-1){
					System.out.println(i);
					break;
				}

			}
		}

	}

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String[] temp = sc.nextLine().split(",");
			double BMI = Double.parseDouble(temp[1]) / Math.pow(Double.parseDouble(temp[2]), 2);
			if(BMI >= 25) System.out.println(temp[0]);
		}
	}
}

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

int main() {
  int n,a,k=1;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a==k){
      k++;
    }
//    printf("%d,%d,%d\n",i,a,k);
  }
  if(k==1){
    cout<<-1<<endl;
  }
  else{
    cout<<n-k+1<<endl;  
  }
}

Measured memory_bytes: 256
package main

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

func main() {
	ReadLineInt()
	Input := ReadLineInt()
	Result := 999999999

	for _, v := range Input {
		LResult := 0
		for {
			if v%2 == 0 {
				v /= 2
				LResult++
			} else {
				break
			}
		}
		Result = Min(Result, LResult)
	}

	fmt.Println(Result)
}

/////////////////////////////////////////

func fln(format string, elements ...interface{}) {
	fmt.Printf(format+"\n", elements...)
}

var BufReader = bufio.NewReaderSize(os.Stdin, 1e6)

func ReadLine() string {
	a, _, _ := BufReader.ReadLine()
	return string(a)
}

func ReadLineInt() (result []int) {
	in := strings.Split(ReadLine(), " ")
	result = make([]int, 0, 2)
	for _, v := range in {
		t, _ := strconv.Atoi(v)
		result = append(result, t)
	}
	return
}

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


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C;
    cin >> A >> B >> C;
    ll ans = 3 * std::max({A, B, C}) - (A + B + C);
    if (ans % 2 == 1)
        ans += 3;
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

const int maxi = 1e6+10;
string s;
vector<int> v[maxi];
ll n;
ll a[maxi];

int main () {
  cin >> n;
  ll p = sqrt(n);
  p++;
  while(true) {
    // cout << p << endl;
    if(n%p == 0) {
      // cout << p << endl;
      cout << p + n/p - 2<< endl;
      return 0;
    }
    p--;
  }
}


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

#define pr_double(x) cout << fixed << setprecision(10)<< x;

double dp[3001][3001];
double solve(vector<double>& ar,int i,int x){

    if(x==0){
        return 1;
    }
    else if(i==0){
      return 0;
    }

    if(dp[i][x] > -0.9){
        return dp[i][x];
    }

    return dp[i][x]=ar[i]* solve(ar,i-1,x-1)+(1-ar[i])*solve(ar,i-1,x);
}



int main(){

   int n;
   cin>>n;
   memset(dp,-1,sizeof dp);
   vector<double> ar(n+1);

   for(int i=1;i<n+1;i++){
       cin>>ar[i];
   }
   pr_double(solve(ar,n,(n+1)/2));

}

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

using namespace std;

int a[100100];

int main(){
	int n, x;
	cin >> n >> x;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		a[i] = abs(x - a[i]);
	}
	int ans = a[0];
	for(int i = 1; i < n; i++) ans = __gcd(ans, a[i]);
	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 32);
double EPS = 1e-4;

ll MOD = 1000000007;

ll isPrime(ll x) {
  for (ll i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}

ll inverse(ll x) {
  pii a = make_pair(1, 0);
  pii b = make_pair(0, 1);

  while (true) {
    ll u = a.first * MOD + a.second * x;
    ll v = b.first * MOD + b.second * x;

    if (v == 1) {
      return (b.second + MOD) % MOD;
    }

    pii new_a = b;
    pii new_b = make_pair(a.first - b.first * (u / v), a.second - b.second * (u / v));

    a = new_a;
    b = new_b;
  }
}

ll combination(ll x, ll y) {
  ll ret = 1;
  for (ll i = 0; i < y; i++) {
    ret = ret * (x - i) % MOD;
  }
  for (ll i = 0; i < y; i++) {
    ret = ret * inverse(i + 1) % MOD;
  }
  return ret;
}

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

  unordered_map<ll, ll> m;
  {
    ll i = 2;
    ll x = M;
    while (true) {
      if (x == 1) {
        break;
      }

      if (isPrime(x)) {
        m[x] += 1;
        break;
      }

      if (x % i == 0) {
        m[i] += 1;
        x /= i;
        continue;
      }

      i++;

      while (!isPrime(i)) {
        i++;
      }
    }
  }

  ll ans = 1;
  for (auto i: m) {
    ans = ans * combination(N + i.second - 1, N - 1) % MOD;
  }

  cout << ans << endl;
}

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

int main(void){
  vector<string> s(3);
  for(int i=0;i<3;i++) cin >> s[i];
  cout << s[0][0] << s[1][1] << s[2][2] << endl;
  
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        a: i64, b: i64, c: i64, n: i64,
    }

    let mut res = 0;
    for r in 0.. {
        if r * a > n {
            break;
        }
        for g in 0.. {
            if r * a + g * b > n {
                break;
            }
            let x = n - r * a - g * b;
            if x % c == 0 {
                res += 1;
            }
        }
    }
    println!("{}", res);
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pi 2*acos(0.0)
#define MOD 1000000007
#define N 100001
#define SZ 100000
int main()
{
    ll n,ans=0,i,temp=1;
    map<ll,int>mp;
    cin>>n;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            temp=i;
            while(n%temp==0)
            {
                ans++;
                n/=temp;
                temp*=i;
            }
        }
        if(n%i==0)
        {
            while(n%i==0)
            {
                n/=i;
            }
        }
    }
    if(n>1)
        ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3612
a, b, c = map(int,input().split())
if a == max(a,b,c):
  print(int(str(a)+str(b))+c)
elif b == max(a,b,c):
  print(int(str(b)+str(c))+a)
else:
  print(int(str(c)+str(a))+b)

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

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

  cout<<count<<endl;

return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main(void){
    long long int i,j,n,m;
    long long int tate=0,yoko=0;
    cin>>n>>m;
    long long int x[n],y[m];
    
    for(i=0;i<n;i++){
        cin>>x[i];
    }
    for(i=0;i<m;i++){
        cin>>y[i];
    }
    sort(x,x+n);
    sort(y,y+m);
    
    
    for(i=0;i<n;i++){
        tate+=x[i]*(-n+1+2*i);
        tate=tate%1000000007;
    }
    for(i=0;i<m;i++){
        yoko+=y[i]*(-m+1+2*i);
        yoko=yoko%1000000007;
    }
    
    cout<<(tate*yoko)%1000000007;
}

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

using namespace std;

int main()
{
  uint64_t n, x;
  cin >> n >> x;
  vector<uint64_t> v;
  for (auto i = 0; i < n; i++) {
    uint64_t a;
    cin >> a;
    v.push_back(a);
  }
  sort(begin(v), end(v));
  uint64_t child = 0;
  for (auto i = 0; i < n; i++) {
    child++;
    if (v[i] <= x) {
      x -= v[i];
      if (x == 0) break;
    } else {
      break;
    }
  }
  if (x > 0 && child > 0) child--;
  cout << child << endl;
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    long long a[N];
    for(int i=0; i<N; i++){
        cin >> a[i];
    }

    long long ans = 0;
    for(int i=0; i<N; i++){
        int r = 0;

        while(r == 0){
            r = a[i] % 2;
            if(r==0){
                ans += 1;
                a[i] = a[i]/2;
            }
        }
    }

    cout << ans << endl;
    return 0;

}

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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            double n = double.Parse(input[0]+input[1]);
            
            double n1 = Math.Sqrt(n);
            double n2 = Math.Round(n1);
            
            if(n1 - n2 == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n;
int x,y;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int a;
		scanf("%d",&a);
		if(a&1)x++;
		else y++;
	}
	if(x&1)cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return 0;
}

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


bool is_prime(int n)
{
	for(int i=2;i*i<n+1;i++){
		if(n%i==0)
			return false;
	}
	return n != 1;
}

int main()
{
	int n;
	while(cin >> n){
		int	tmp = n-1;
		while(1){
			if(is_prime(tmp)){
				cout << tmp << " ";
				break;
			}
			tmp--;
		}
		tmp = n+1;
		while(1){
			if(is_prime(tmp)){
				cout << tmp << endl;
				break;
			}
			tmp++;
		}
	}
	return 0;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for(int i = a; i <= b; i++){
        int i1 = i % 10;
        int i5 = i / 10000;
        if(i1 != i5)continue;
        int i2 = i % 100 / 10;
        int i4 = i % 10000 / 1000;
        if(i2 != i4)continue;
        ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int N = 1e5+100;

int dp[N];
int n,k;
int h[N];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>k;
    for(int i = 1; i<=n; i++) cin>>h[i];
    
    memset(dp,0x3f,sizeof dp);
    
    dp[1] = 0;
    for(int i = 2; i<=n; i++){
        for(int j = 1; j<=k; j++){
            if(i-j<1) break;
            dp[i] = min(dp[i],dp[i-j] + abs(h[i]-h[i-j]));
        }
    }
    
    cout<<dp[n];
    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int max(int p, int q) {
	if( q > p ) return q;
	return p;
}

int main(void){
	while (1){
		int w[2];
		cin >> w[0] >> w[1];
		if( w[0] == 0 && w[1] == 0 ) break;
		int h[2][21];
		for(int i = 0; i < 21 * 2; i++)
			h[ i / 21 ][ i % 21 ] = 0;
		for(int j = 0; j < 2; j++)
			for(int i = 0; i < w[j]; i++) {
				int tmp;
				cin >> tmp;
				h[j][tmp] ++;
			}
		int ans = 0;
		for(int i = 1; i < 21; i++)
			ans += max( h[0][i], h[1][i] ) * i;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int n, kq, dem[1000];

int main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        dem[i] = 0;
        for (int j = 1; j <= i; j++){
            if (i%j == 0) dem[i]++;
        }
    }
    kq = 0;
    for (int i = 1; i <= n; i++){
        if (dem[i] == 8 && i%2 == 1) kq++;
    }
    cout << kq;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int i,j,k,n,m,x,y,t,a[200010];long long ans;
int main(){
	scanf("%d",&n);
	for (i=1;i<=n;i++)scanf("%d",&a[i]);
	if (a[1]){printf("-1\n");return 0;}
	else{
		for (i=2;i<=n;i++)if (a[i]-a[i-1]>1){printf("-1\n");return 0;}
	}
	a[n+1]=1013687232;for (i=2;i<=n+1;i++)if (a[i]-a[i-1]!=1)ans+=a[i-1];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);

(function main() {
  const A = readInt();
  const B = readInt();
  const H = readInt();
  const M = readInt();

  const hx = A * Math.sin((H + M/60) / 12 * Math.PI * 2);
  const hy = A * Math.cos((H + M/60) / 12 * Math.PI * 2);

  const mx = B * Math.sin(M / 60 * Math.PI * 2);
  const my = B * Math.cos(M / 60 * Math.PI * 2);

  console.log(Math.sqrt((hx - mx) ** 2 + (hy - my) ** 2));
})();


Measured memory_bytes: 29712