akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int M, N;
double col[3][20];
double calc(int idx, int rest, VI& vi){
  if(rest == 0) return 0;
  if(idx == M) return -1e+10;

  double ans = 0.;
  REP(i,SZ(vi)) REP(j,3)
	ans += (col[j][vi[i]] - col[j][idx])*(col[j][vi[i]] - col[j][idx]);
  vi.PB(idx);
  ans += calc(idx+1, rest-1, vi);
  vi.pop_back();

  ans = max(ans, calc(idx+1, rest, vi));
  return ans;
}

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

  cin >> M >> N;
  REP(i,M) REP(j,3)	
	cin >> col[j][i];

  VI v;
  cout << fixed << setprecision(6) << calc(0,N,v) << endl;
  return 0;
}

Measured memory_bytes: 1316
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  if((a+b)%2==0){
    cout<< (b-a)/2<<endl;
  }
  else{
    ll hidaria = a-1;
    ll migia   = n-a;
    ll hidarib = b-1;
    ll migib   = n-b;
    if(hidaria < migib){
      cout << hidaria + (b-a) - (b-a)/2 << endl;
    }
    else{
      cout << migib +   (b-a) - (b-a)/2 << endl;
    }
  }//41else end
}

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

#define int long long
#define ll long long
#define vll vector<int>
#define mset(a) memset(a,0,sizeof(a))
#define pb push_back
#define range(c) c.begin() , c.end()
#define forn(i,n) for(ll i=0; i<(int)n; ++i)
#define for1(i,n) for(ll i=1; i<(int)n; ++i)
#define endl '\n'
#define MOD 1000000007
#define pii pair<int,int>
#define test ll t;cin>>t;while(t--)
using namespace std;

vector<bool> sieve(ll n){
    vector<bool>prime(n+1,true);
    prime[0]=prime[1]=false;
    for(ll i=2; i<=n; ++i){
        if(prime[i]&&(i*i)<=n)
        for(ll j=i*i; j<=n; j+=i)prime[j]=false;
    }
    return prime;
}

ll power(ll a, ll b, ll m = MOD) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

//////////////////////////////////////////////////////////////
map<int,int>mp;

int fun(int s, vll g[]) {
    int mx = 0;
    for(auto it:g[s]) {
        if(mp.find(it) == mp.end())
        mp[it] = fun(it,g) + 1;

        mx = max(mx,mp[it]);
    }

    return mx;
}

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

    

    int n,m;
    cin>>n>>m;
    vll g[n];
    forn(i,m){
        int u,v;
        cin>>u>>v;
        u-=1;
        v-=1;
        g[u].pb(v);
    }

    mp.clear();

    forn(i,n) {
        if(mp.find(i) == mp.end())
        mp[i] = fun(i,g)+1;
    }

    int res=0;
    for(auto it:mp) {
        res = max(res,it.second);
    }

    cout<<res-1<<endl;

    return 0;
}


Measured memory_bytes: 16128
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        long inpt = long.Parse(Reader.ReadLine());
        if(inpt %2!=0) {
            inpt = inpt * 2;
        }
        Console.WriteLine(inpt);
    
    }


    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



999999999





";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin>>a;
  string s;
  s.size()==a;
  cin>>s;
  int count=0;
  for(int i =0;i<a-2;i++){
    if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C'){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    string s,k;
    cin>>s>>k;
    VREV(s);
    if(s==k)
    {
        cout<<"YES"<<NL;
    }
    else
    {
        cout<<"NO"<<NL;
    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

int main() {
  ll a;
  cin >> a;

  ll ans = 0;

  if (a >= 500) {
    ans = ans + (a / 500) * 1000;

    if (a % 500 >= 5) {
      ans = ans + (a % 500 / 5) * 5;
    }
  } else {
    if (a >= 5) {
      ans = ans + (a / 5) * 5;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int>a(m+1);
  vector<int>l(m),r(m);
  for(int i=0;i<m;i++){
    cin>>l[i]>>r[i];
  }
  sort(l.begin(),l.end());
  sort(r.begin(),r.end());
  if(r[0]>=l[m-1])cout<<r[0]-l[m-1]+1;
  else cout<<0;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int main()
{
  int x = 0;
  int data1[3000],data2[3000];
  
  while(1)
    {
      cin >> data1[x] >> data2[x];
      
      if(data1[x] == 0 && data2[x] == 0)
	{
	  break;
	}
      x++;
    }
    
  for(int k = 0;k < x;k++)
    {
      if(data1[k] > data2[k])
	{
	  cout << data2[k] << " " << data1[k] << endl;
	}
      else
	{
	  cout << data1[k] << " " << data2[k] << endl;
	}
	
    }
  return 0;
}



Measured memory_bytes: 3072
N=int(input())
sn=N//7
if N%4==0 or N%7==0:
  print('Yes')
else:
  count=0
  for i in range(sn+1):
    if (N-i*7)%4==0:
      count+=1
  if count!=0:
    print('Yes')
  else:
    print('No')
    

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)
 
bool hasCircle;
 
bool add_edge(string a,string b,set<int> graph[30]){
    bool flag = true;
    rep( i , min(a.size(),b.size()) ){
        if(a[i]!=b[i]){
            graph[ b[i]-'a' ].insert( a[i]-'a' );
//            cout<<b[i]<<">"<<a[i]<<endl;
            flag=false;
            break;
        }
    }
    if(flag){
        if(a.size()>b.size()){
            return false;
        }
    }
    return true;
}
 
 
void dfs(int pos,bool used[30],set<int> graph[30]){
    if( used[pos] ){    //??¢????????????????????????
//        cout<<pos<<endl;
        hasCircle=true; //????????°???true???????????????
        return ;
    }
    
    used[pos]=true;
    for(auto &to:graph[pos]){
        dfs(to,used,graph);
    }
    used[pos]=false;
}
 
 
int main(){
    int n;
    while(cin>>n&&n){
        vector<string> s(n);
        rep(i,n){
            cin>>s[i];
        }
        
        set<int> graph[30];
        
        rep(i,n){
            for(int j=i+1;j<n;j++){
                if( add_edge(s[i],s[j],graph) == false ){
                    cout<<"no"<<endl;
                    goto next;
                }
            }
        }
        
//        rep(i,26){
//            for(auto &elm:graph[i]){
//                cout<<i<<"->"<<elm<<endl;
//            }
//        }
        
        
        hasCircle = false;
        rep(i,26){
            bool used[30];
            rep(j,30)used[j]=false;
            dfs(i,used,graph);
            if(hasCircle)break;
        }
        if( hasCircle )cout<<"no"<<endl;
        else cout<<"yes"<<endl;
        
        next:;
    }
    
}

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

#define pb push_back
#define S second
#define F first
#define sz size()
#define eps 0.000001
#define oo 2000000007
#define endl '\n'
#define bg begin()
#define nd end()
#define up upper_bound
#define lw lower_bound
#define debug(x) #x << " = " << x << "; "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

struct SegmentTree {
    vector<ll> st;
    int n, neutro = 0;

    SegmentTree(vector<ll> &arr) {
        n = arr.size();
        st.assign(n << 2, 0);
        build(1, 0, n - 1, arr);
    }

    ll query(int i, int j) { return query(1, 0, n - 1, i, j); }
    void update(int i, int j, ll val) { update(1, 0, n - 1, i, j, val); }

    int left (int p) { return p << 1; }
    int right (int p) { return (p << 1) | 1; }

    void build(int p, int L, int R, vector<ll> &arr) {
        if (L == R) st[p] = arr[L];
        else {
            int m = (L+R)/2, l = left(p), r = right(p);
            build(l, L, m, arr);
            build(r, m+1, R, arr);
            st[p] = max(st[l], st[r]);
        }
    }
    ll query(int p, int L, int R, int i, int j) {
        if (i > R || j < L) return neutro;
        if (i <= L && j >= R) return st[p];
        int m = (L+R)/2, l = left(p), r = right(p);
        ll _l = query(l, L, m, i, j);
        ll _r = query(r, m+1, R, i, j);
        return max(_l, _r);
    }

    void update(int p, int L, int R, int i, int j, ll val) {
        if (i > R || j < L) return;
        if (i <= L && j >= R) st[p] = val;
        else {
            int m = (L+R)/2, l = left(p), r = right(p);
            update(l, L, m, i, j, val);
            update(r, m+1, R, i, j, val);
            st[p] = max(st[l], st[r]);
        }
    }
};


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, x, y;
	cin >> n;
	pair<int, pii> arr[n];
	vector<ll> dp(n);
	for(int i = 0; i < n; i++){
		cin >> x;
		arr[i] = {x, {i, 0}};
		dp[i] = 0;
	}
	for(int i = 0; i < n; i++){
		cin >> y;
		arr[i].S.S = y;
	}
	sort(arr, arr + n);
	SegmentTree seg(dp);
	for(int i = 0; i < n; i++){
		ll mx = seg.query(0, arr[i].S.F);
		seg.update(arr[i].S.F, arr[i].S.F, mx + arr[i].S.S);
	}
	ll ans = seg.query(0, n - 1);
	cout << ans << endl;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<ll>> g(200005);
vector<ll> ans;
void dfs(ll v, ll p = -1){
    for(ll u : g.at(v)){
        if(u == p)
            continue;
        ans.at(u) += ans.at(v);
        dfs(u, v);
    }
}
int main(){
    ll n, q;
    cin >> n >> q;
    for(ll i = 0; i < n - 1; i++){
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        g.at(a).push_back(b);
        g.at(b).push_back(a);
    }
    ans.resize(n);
    for(ll i = 0; i < q; i++){
        ll p, x;
        cin >> p >> x;
        p--;
        ans.at(p) += x;
    }
    dfs(0);
    for(ll i = 0; i < n; i++)
        cout << ans.at(i) << " ";
    return 0;
}

Measured memory_bytes: 25072
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace C
{
    class Program
    {
        static List<Tuple<int, int, int, int>> seisu;
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] strs = line.Split(' ');
            int N = int.Parse(strs[0]);
            int M = int.Parse(strs[1]);
            int Q = int.Parse(strs[2]);
            seisu = new List<Tuple<int, int, int, int>>();
            for(int i = 0; i < Q; i++)
            {
                line = Console.ReadLine();
                strs = line.Split(' ');
                seisu.Add(new Tuple<int, int, int, int>(int.Parse(strs[0])-1, int.Parse(strs[1]) - 1, int.Parse(strs[2]), int.Parse(strs[3])));
            }

            int MAXSCORE = 0;
            MAXSCORE = GetMAXSCORE(new int[N], 0, M);

            Console.WriteLine(MAXSCORE);
        }

        static int GetMAXSCORE(int[] N, int next, int M)
        {
            int min = 0;
            if (next > 0) min = N[next - 1];
            int MAX = 0;
            for(int i = min; i < M; i++)
            {
                N[next] = i;
                int score;
                if (next == N.Length-1)
                {
                    score = 0;
                    foreach (var data in seisu)
                    {
                        if (N[data.Item2] - N[data.Item1] == data.Item3)
                        {
                            score += data.Item4;
                        }
                    }
                }
                else
                {
                    score = GetMAXSCORE(N, next + 1, M);
                }
                if (MAX < score) MAX = score;
            }
            return MAX;
        }
    }
}


Measured memory_bytes: 27848
package main

import (
	"fmt"
)

func main() {

	var n int
	var a []int

	fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		var x int
		fmt.Scanf("%d", &x)
		a = append(a, x)
	}

	min := 999
	max := -999

	for _, t := range a {
		if t < min {
			min = t
		}
		if t > max {
			max = t
		}
	}

	mincost := 9223372036854775807
	for t := min; t <= max; t++ {
		cost := 0
		for _, u := range a {
			cost += (u - t) * (u - t)
		}
		if cost < mincost {
			mincost = cost
		}
	}

	fmt.Println(mincost)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD=1e9+7;

//const int MOD=998244353;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    
    int oct=0;
    for(int i=0; i<n; i++){
        int x;
        cin>>x;
        oct+=(x%2);
    }
    cout<<(oct%2?"NO":"YES");
    
    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 repx(i,x,n) for(int i=(x);i<(n);i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main(){
    
    int n;
    cin >> n;
    vi p(n+2),index(n+1);
    p[0] = n+1;
    p[n+1] = n+1;
    index[0] = 0;
    repx(i,1,n+1){
        cin >> p[i];
        index[p[i]] = i;
    }

    int l2,l1,r1,r2;
    ll ans=0;
    
    //ver1
    // int a;
    // for (int i = n; i > 0; i--)
    // {
    //     a = 1;
    //     while(p[index[i]-a] < p[index[i]]) a++;
    //     l1 = a;
    //     // cout << "l1=" << l1;
    //     if(index[i]-a == 0) l2 = a;
    //     else
    //     {
    //         a++;
    //         while(p[index[i]-a] < p[index[i]]) a++;
    //         l2 = a;
    //     }
    //     // cout << "  l2=" << l2;

    //     a = 1;
    //     while(p[index[i]+a] < p[index[i]]) a++;
    //     r1 = a;
    //     // cout << "  r1=" << r1;
    //     if(index[i]+a == n+1) r2 = a;
    //     else
    //     {
    //         a++;
    //         while(p[index[i]+a] < p[index[i]]) a++;
    //         r2 = a;
    //     }
    //     // cout << "  r2=" << r2 << endl;

    //     ans += i * ((ll)(l2-l1)*r1 + (ll)(r2-r1)*l1);

    //     // cout << i << " " << ans << endl;
    // }


    //ver2
    set<int> index_set;
    index_set.insert(0);
    index_set.insert(n+1);
        
    for (int i=n;i>0;i--){
        index_set.insert(index[i]);
        auto it_b = index_set.find(index[i]);
        auto it = it_b;
        
        it--;
        l1 = index[i] - *it;
        if(*it == 0){
            l2 = l1;
        }else{
            it--;
            l2 = index[i] - *it;
        }

        it = it_b;
        it++;
        r1 = *it - index[i];
        if(*it == n+1){
            r2 = r1;
        }else{
            it++;
            r2 = *it - index[i];
        }

        ans += i * ((ll)(l2-l1)*r1 + (ll)(r2-r1)*l1);
    }

    
    cout << ans << endl;

    return 0;
}


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

struct Coor {
    long long x, y;
};

int main()
{
    int n, k;
    long long min = 4000000000000000000;
    Coor points[50]{};
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++)
    {
        scanf("%lld%lld", &points[i].x, &points[i].y);
    } 
    std::sort(points, points + n, [](const Coor& a, const Coor& b){ return a.x < b.x; });
    for (int left = 0; left + k <= n; left++)
    {
        for (int right = left + k; right <= n; right++)
        {
            int tmp_points[50]{};
            for (int i = left; i < right; i++) tmp_points[i] = i;
            std::sort(tmp_points + left, tmp_points + right,
                [&](const int& a, const int& b){ return points[a].y < points[b].y; }
            );
            for (int bottom_i = left; bottom_i <= right - k; bottom_i++)
            {
                long long tmp_min = points[tmp_points[bottom_i + k - 1]].y - points[tmp_points[bottom_i]].y;
                long long x_min = 2000000000000, x_max = -2000000000000;
                for (int j = left; j < right; j++)
                {
                    if (points[j].y < points[tmp_points[bottom_i]].y || points[j].y > points[tmp_points[bottom_i + k - 1]].y) continue;
                    x_min = std::min(x_min, points[j].x);
                    x_max = std::max(x_max, points[j].x);
                }
                tmp_min *= x_max - x_min;
                min = std::min(tmp_min, min);
            }
        }
    }
    printf("%lld\n", min);
}

Measured memory_bytes: 256
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_6-D: Minimum Cost Sort

#include <algorithm>
#include <cstdio>

using uint = unsigned int;

static void make_indices(const uint as[], const uint n, uint indices[])
{
  uint bs[n];
  std::copy(as, as+n, bs);
  std::sort(bs, bs+n);
  for (auto i = 0u; i < n; ++i) {
    indices[bs[i]] = i;
  }
}

static const uint MAX_VALUE = 10000;

static uint minimum_cost_sort(const uint as[], const uint n)
{
  auto cost = 0u;

  uint indices[MAX_VALUE+1];
  make_indices(as, n, indices);

  bool visited[n];
  std::fill(visited, visited+n, false);

  auto min = *std::min_element(as, as+n);

  for (auto i = 0u; i < n; ++i) {
    if (visited[i]) continue;
    auto c_n = 0u, c_min = MAX_VALUE, c_sum = 0u;
    auto j = i;
    while (!visited[j]) {
      visited[j] = true;
      auto a = as[j];
      ++c_n;
      c_min = std::min(c_min, a);
      c_sum += a;
      j = indices[a];
    }
    cost += std::min(c_sum + (c_n-2) * c_min,
                     c_sum + (c_n+1) * min + c_min);
  }
  return cost;
}

int main()
{
  uint n;
  std::scanf("%u", &n);
  uint as[n];
  for (auto i = 0u; i < n; ++i) {
    std::scanf("%u", &as[i]);
  }

  auto cost = minimum_cost_sort(as, n);
  std::printf("%u\n", cost);
}

// eof

Measured memory_bytes: 2824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n;
ll v[25],c[25],d[25];
ll ans;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    for(int i=0;i<n;i++){
        cin>>c[i];
        d[i]=v[i]-c[i];
    }
    sort(d,d+n);
    for(int i=0;i<n;i++){
        if(d[i]>0){
            ans+=d[i];
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3604
#include <stdio.h>

int main(void){
   
   int a, b, c, min;

   scanf("%d %d %d", &a, &b, &c);
   
   if(a < 1 || 10000 < a || b < 1 || 10000 < b || c < 1 || 10000 < c){
     return 1;
   }
   
   min = 0;
   
   min = a+b;
   
     if(a+c < min){
       min = a+c;
     }
     if(b+c < min){
       min = b+c;
     }
     
   printf("%d\n", min);
   
   return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c; cin >> a >> b >> c;
    bool ok = true;
    if(a==b && b!=c){ok = false;}
    if(b==c && c!=a){ok = false;}
    if(c==a && a!=b){ok = false;}
    if(!ok){cout << "Yes" << endl;}
    else cout << "No" << endl;
    return 0;
}

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

typedef long long ll;
const int MAXN = 100010;

inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x*10)+(ch^48);
	return x * f;
}

int n, a[MAXN];
bool h;
ll sum, ans;

int main() {
	n = read();
	for(int i = 1; i <= n; i++) a[i] = read();

	for(int i = 1; i <= n; i++) {
		if(a[i]) {
			if(!h) h = true, sum = a[i];
			else sum += a[i];
		}
		else {
			if(h) {
				ans += sum>>1;
				h = false;
			}
		}
	}
	if(h) ans += sum>>1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

int main () {
	ios::sync_with_stdio(0), cin.tie(0);
 	ll n, d;
 	cin >> n >> d;
 	d *= d;
 	ll ans = 0;
 	while (n --) {
 		ll x, y;
 		cin >> x >> y;
 		if (x * x + y * y <= d) ans ++;
	 }
	 cout << ans;
}

Measured memory_bytes: 3648
use std::io::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
 
fn main() {
    grouping_2();
}

fn grouping_2() {
    let n: i64 = read();
    println!("{}", n / 3);
}

Measured memory_bytes: 4352
#include<iostream>
#include <cstdlib>
#include<list>
#include<string>
#include<stack>
using namespace std;
int main() {
	int a, b, c, aa, bb, cc, cnt = 0; cin >> a >> b >> c;
	while (1) {
		
		if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
			cout << cnt; return 0;
		}if (a == b, b == c) {
			cout << "-1"; return 0;
		}
		aa = a / 2;
		bb = b / 2; cc = c / 2;
		a = bb + cc; b = aa + cc; c = aa + bb;
		cnt++;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int dy8[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dx8[] = {0, 1, 0, -1, 1, 1, -1, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{

    ll A,B,V,W; cin >> A >> V >> B >> W;
    ll T; cin>> T;

    if(A==B){
        cout << "YES" << endl;
        return 0;
    }else if(V<=W){
        cout << "NO" << endl;
        return 0;
    }else{
        ll res;
        if(A>=0 and B<=0){
            res = A-B;
        }else if(A<=0 and B>=0){
            res = B-A;
        }else{
            if(A>B) res = A-B;
            else res = B-A;
        }
        if(res<=T*(V-W)){
            cout << "YES" << endl;
            return 0;
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3628
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn count(a: i64, b: i64, m: i64) -> i64 {
    if a == b {
        if a % m == 0 {
            return 1;
        } else {
            return 0;
        }
    }
    let end_a = ((a - 1) / m) * m + 1;
    let start_b = (b / m) * m;
    if end_a > start_b {
        debug!(a, b, m);
        return 0;
    }
    let ret = (start_b - end_a) / m + 1;
    debug!(a, b, m, ret);
    ret
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}

fn main() {
    let v = read_vec::<i64>();
    let (a, b, c, d) = (v[0], v[1], v[2], v[3]);
    let ans = b - a + 1 - count(a, b, c) - count(a, b, d) + count(a, b, c * d / gcd(c, d));
    println!("{:?}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

class DisjointSet{
public:
  vector<int> rank, p, sz;

  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size, 0);
    p.resize(size, 0);
    sz.resize(size, 0);
    rep(i, size) makeSet(i);
  }

  void makeSet(int x){
    p[x] = x;
    rank[x] = 0;
    sz[x] = 1;
  }

  bool same(int x, int y){
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y){
    link(findSet(x), findSet(y));
  }

  void link(int x, int y){
    if(rank[x] > rank[y]){
      p[y] = x;
      sz[x] += sz[y];
    }
    else{
      p[x] = y;
      sz[y] += sz[x];
      if(rank[x] == rank[y]){
        rank[y]++;
      }
    }
  }

  int findSet(int x){
    if(x != p[x]){
      p[x] = findSet(p[x]);
    }
    return p[x];
  }

  int getSize(int x){
    return sz[findSet(x)];
  }
};


int main(){
  int n, m; cin >> n >> m;
  vector<int> a(m), b(m);
  rep(i, m){
    int s, t; cin >> s >> t;
    a[i] = s - 1;
    b[i] = t - 1;
  }
  DisjointSet ds = DisjointSet(n);
  vector<ll> ans(m+1);
  ans[m] = ((ll)n * (n - 1)) / 2;
  for(int i = m - 1; i >= 0; i--){
    int x = a[i], y = b[i];
    if(ds.same(x, y)){
      ans[i] = ans[i + 1];
      continue;
    }
    ll sizex = ds.getSize(x), sizey = ds.getSize(y);
    //cout << x << " " << y << " : ";
    //cout << sizex << " " << sizey << endl;
    ds.unite(x, y);
    ans[i] = max(ans[i + 1] - sizex * sizey, 0LL);
  }
  rep(i, m){
    cout << ans[i+1] << endl;
  }
  return 0;
}


Measured memory_bytes: 5864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  int Q;
  cin >> Q;
  ll b = 0;
  priority_queue<ll> q;
  priority_queue<ll, vector<ll>, greater<ll>> p;
  ll s = 0, t = 0;
  while (Q--) {
    int type;
    cin >> type;
    if (type == 1) {
      ll x, y;
      cin >> x >> y;
      b += y;
      if (q.empty()) {
        q.push(x);
        t += x;
        continue;
      }

      if (SZ(p) == SZ(q)) {
        // qに追加したい
        ll z = p.top();
        if (x <= z) {
          q.push(x);
          t += x;
        } else {
          q.push(z);
          p.pop();
          p.push(x);
          s += x - z;
          t += z;
        }
      } else {
        // pに追加したい
        ll z = q.top();
        if (x >= z) {
          p.push(x);
          s += x;
        } else {
          p.push(z);
          q.pop();
          q.push(x);
          s += z;
          t += x - z;
        }
      }
    } else {
      cout << q.top() << " " << s - t + b + (SZ(p) != SZ(q) ? q.top() : 0)
           << endl;
    }
  }
}

Measured memory_bytes: 3828
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, k) = (v[0], v[1]);
    let mut ans = 0;
    let mut min_sum = 0;
    let mut max_sum = 0;
    for i in 1..n + 1 {
        min_sum += i - 1;
        max_sum += n + 1 - i;
        if i >= k {
            ans += max_sum - min_sum + 1;
            if n < 10 {
                debug!(k, ans, min_sum, max_sum);
            }
            ans %= 1000_000_000 + 7;
        }
    }
    ans += 1;
    ans %= 1000_000_000 + 7;
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2136
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define debug(s, param) std::cerr << s << param << std::endl;

using namespace std;
using ll = long long;

int main() {
  ll d, t, s;
  cin >> d >> t >> s;
  if (t * s >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    rep(i, m) cin >> x.at(i);

    sort(x.begin(), x.end());
    vector<int> diff(m - 1);
    rep(i, m-1) diff[i] = x[i + 1] - x[i];

    sort(diff.begin(), diff.end());
    ll ans = 0LL;
    rep(i, m - 1 - (n - 1)) ans += diff[i];

    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
public class Main {

    public static void main (String[] args) throws java.lang.Exception
{
    BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));
    int N = Integer.parseInt(inp.readLine());
    boolean res = true; 
    for(int i= 1 ; i<=9 ; i++){
        for(int j=i ; j<=9 ; j++){
         if((i*j) == N) {
             res = false;
            System.out.println("Yes");
            break; 
         }
            
         }
         if(res == false) break;
        }
        if(res == true){
            System.out.println("No");
        }
        
   }
   

    
}


Measured memory_bytes: 23124
primes = [0, 0] + [1] * 999999
for i in range(2, 1000):
    if primes[i]:
        for j in range(i*i, 1000000, i):
            primes[j] = 0

while True:
    try:
        n = int(input())
    except:
        break
    ans = 0
    while n > 0:
        ans += primes[n]
        n -= 1
    print(ans)



Measured memory_bytes: 20964
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;string S;cin>>N>>S;
	long num[26]={0};long count=1;
    int a;const long M=1000000007;
	for(int i=0;i<N;i++){
        a=(int)S.at(i);
		num[a%26]++;
	}for(int j=0;j<26;j++){
		count=(count*(num[j]+1))%M;
	}cout<<count-1<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define MOD 1000000007
#define pb push_back
#define mp make_pair
typedef int Int;
typedef pair<Int,Int> pii;
typedef vector<Int> vi;
typedef vector<pii> vii;

int main()
{
	Int N,A[100010],count=0;
	cin>>N;
	for(Int i=1;i<=N;i++)
	{
		cin>>A[i];
	}
	for(Int i=1;i<=N;i++)
	{
		if(A[A[i]]==i&&i<A[i])
			count++;
	}
	cout<<count;


	return 0;
}

Measured memory_bytes: 640
#include <stdio.h> 
    
   int main(void) { 
    
     int i, n; 
     int sum = 0; 
    
     scanf("%d", &n); 
    
    for (i = 1; i <= n; i++) { 
      sum += i; 
    } 
   
    printf("%d\n", sum); 
   
    return 0; 
  } 
  


Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
//#include<cstdio>
//#include<algorithm>
//#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N, M;
vector<int> E[100001];
vector<ll> S1[100001], S2[100001];
int dame[100001];
bool memo[100001];

ll dfs(int v, int prev) {
	if (memo[v]) {
		int ES = E[v].size();
		ll ret = 1;
		if (prev) {
			int k = lower_bound(E[v].begin(), E[v].end(), prev) - E[v].begin();
			ret = S1[v][k] * S2[v][k + 2] % M;
		}
		else ret = S1[v][ES];
		if (dame[v] && dame[v] != prev) {
			int tmp = dfs(dame[v], v);
			int k = lower_bound(E[v].begin(), E[v].end(), dame[v]) - E[v].begin();
			for (int i = k + 1; i <= ES; i++) {
				S1[v][i] = S1[v][i] * tmp % M;
			}
			for (int i = k + 1; i > 0; i--) {
				S2[v][i] = S2[v][i] * tmp % M;
			}
			ret *= tmp;
			dame[v] = 0;
		}
		return (ret + 1) % M;
	}
	memo[v] = true;
	dame[v] = prev;
	ll ret = 1;
	int k = 1;
	for (int i : E[v]) {
		int tmp = 1;
		if (i != prev) {
			tmp = dfs(i, v);
			ret = ret * tmp % M;
		}
		S1[v][k] = ret;
		S2[v][k++] = tmp;
	}
	for (int i = k - 1; i > 0; i--) {
		S2[v][i] = (S2[v][i] * S2[v][i + 1]) % M;
	}
	return ret + 1;
}

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


	cin >> N >> M;

	int k = 2;
	rep1(i, N - 1) {
		int x, y;
		cin >> x >> y;

		E[x].pb(y);
		E[y].pb(x);
	}
	rep1(i, N) {
		int k = E[i].size();
		S1[i].resize(k + 2);
		S2[i].resize(k + 2);
		S1[i][0] = 1;
		S2[i][0] = 1;
		S1[i][k + 1] = 1;
		S2[i][k + 1] = 1;
		sort(E[i].begin(), E[i].end());
	}

	rep1(j, N) {
		ll kotae = (dfs(j, 0) - 1 + M) % M;
		co(kotae);
	}

	Would you please return 0;
}

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

const int MAX = 7368792;
bool use[MAX];

int main() {
    ll m, n;
    while (cin >> m >> n) {
        if ( ! m) break;
        fill_n(use, MAX, false);

        for (int i=0; i<n; ++i) {
            while (use[m]) m ++;
            for (int k=m; k<MAX; k+=m) {
                use[k] = true;
            }
        }
        while (use[m]) m ++;
        cout << m << endl;
    }   
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<string> word(N);
    for (int i = 0; i < N; i++){
        cin >> word.at(i);
    }
    int count = 0;
    for (int i = 0; i < N - 1; i++){
        int len = word.at(i).size();
        if (word.at(i).at(len - 1) == word.at(i + 1).at(0)){
            count++;
        }
    }
    for (int i = 0; i < N; i++){
        for (int j = 0; j < i; j++){
            if (word.at(i) == word.at(j)){
                count--;
            }
        }
    }
    if (count == N - 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

int main(){
    int a,b;
    cin >> a >> b;
    int x = min(a,b);
  	int z = max(a,b);
    string y = "";
    rep(i,z){
      	cout << (int)x;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, k;
    cin >> n >> m >> k;
    vector<set<int>> fri(n), block(n);
    union_find uf(n);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        --a; --b;
        fri[a].insert(b);
        fri[b].insert(a);
        uf.unite(a, b);
    }
    rep(i,k){
        int c, d;
        cin >> c >> d;
        --c; --d;
        block[c].insert(d);
        block[d].insert(c);
    }
    rep(i,n){
        int ans = uf.show_size(i) - 1;
        for(auto f : fri[i]){
            if(uf.same(i, f)) --ans;
        }
        for(auto b : block[i]){
            if(uf.same(i, b)) --ans;
        }
        cout << ans << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 33012
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
int main() {
    LL n, k;
    cin >> n >> k;
    if (k == 0) {
        cout << n*n << endl;
        return 0;
    }
    LL ret = 0;
    for (LL b = k+1; b <= n; b++) {
        ret += (b-k) * (n / b);
        ret += max(0LL, n%b-k+1);
    }
    cout << ret << endl;
    return 0;
}

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

int main(){
	string s;
	cin>>s;
	int cnt0=0;
	int cnt1=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0')cnt0++;
		if(s[i]=='1')cnt1++;
	}
	cout<<min(cnt0,cnt1)*2<<endl;

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define pf push_front
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}
set<ll> s;

int main(){
    ll x,y,z; cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z;
    return 0;
}


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

const int N = 9, MASK = 1 << N;

int dp[MASK][N];
int a[N];
int l[N];
int n;
int m = 3;
const int inf = 1e9;

int get_sum(int mask){
    int sum = 0;
    
    for(int i = 0 ; i < n ; i++){
        int e = mask & (1 << i);
        
        if(e){
            sum += l[i];
        }
    }    
    
    return sum;
}

int solve(int mask, int i){
    if(i == m){
        return 0;
    }
    
    if(mask == (1 << n) - 1){
        return inf;
    }    
    
    int &ans = dp[mask][i];
    
    if(ans != -1){
        return ans;
    }
    
    ans = inf;
    
    for(int j = 1 ; j < (1 << n) ; j++){
        if((mask & j) == 0){
            int v = get_sum(j);
            int el = __builtin_popcount(j);
            
           // cout << "my cost is " << abs(v - a[i]) + (el - 1) * 10 << " to build " << a[i] << " with " << el << " bamboos" << endl;
            ans = min(ans, solve(mask | j, i + 1) + abs(v - a[i]) + (el - 1) * 10);
        }
    }
    
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    memset(dp, -1, sizeof dp);
	
	cin >> n;
	
	for(int i = 0 ; i < m ; i++){
	    cin >> a[i];
	}
	
	for(int i = 0 ; i < n ; i++){
	    cin >> l[i];
	}
	
	cout << solve(0, 0) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    lint a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;

    lint dif = abs(a - b);

    if((v - w) * t >= dif){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    cout << flush;

    return 0;
}

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

int main(){
    int k;
    string s;
    cin>>k>>s;
    if(s.size() <= k){
        cout<<s<<endl;
    }
    else{
        for(int i=0; i<k; i++){
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
    return 0;
}


Measured memory_bytes: 3628
using System;


namespace ConsoleApplication35
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            int a = int.Parse(ss[0]);
            int b = int.Parse(ss[1]);
            int c = int.Parse(ss[2]);
            if (a < b && b < c)
            {
                Console.WriteLine("Yes");
            }
            else 
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main(void){

  int N;
  int X[101];
  scanf("%d",&N);
  
  int i;
  for(i=0;i<N;i++){
    scanf("%d",&X[i]);
  }
  
  int ans = 100*100*100;
  int p;
  for(p=1;p<=100;p++){
    int sum=0;
    for(i=0;i<N;i++){
      sum = sum + pow(X[i]-p,2);
    }
    if(ans>sum) ans = sum;
  }
  
  printf("%d",ans);
  
  return 0;
}

Measured memory_bytes: 1728
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
typedef long long ll;
using namespace std;
#define mod 1000000007


int main(){
    string s;cin >> s;
    for(int i=0;i<s.size();i+=2){
        cout << s[i];
    }
    cout << endl;
    return 0;
}


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

int main(){
  int N, K;
  vector<int> v;
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  
  int ans = 0;
  sort(v.begin(), v.end());
  for(int i = 0; i < K; i++){
    ans += v[i];
  }
  cout << ans << endl;
  
 
}

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

int main()
    {
    int n;
    cin>>n;
    long long a[n],b[n],c[n];
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
    long long tracka[n],trackb[n],trackc[n];
    tracka[0]=a[0];
    trackb[0]=b[0];
    trackc[0]=c[0];
    for(int i=1;i<n;i++)
    {
        tracka[i]=a[i]+max(trackb[i-1],trackc[i-1]);
        trackb[i]=b[i]+max(tracka[i-1],trackc[i-1]);
        trackc[i]=c[i]+max(tracka[i-1],trackb[i-1]);
    }
    cout<<max(max(tracka[n-1],trackb[n-1]),trackc[n-1]);
    return(0);
    }


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

int main() {

  int N;
  cin >> N;

  vector<int64_t> Lucas(N+1);

  for (int i = 0; i <= N; i++)
  {
    if(i==0) Lucas.at(i) = 2;
    else if(i==1) Lucas.at(i) = 1;
    else Lucas.at(i) = Lucas.at(i-2) + Lucas.at(i-1);
  }
  
  cout << Lucas.at(N) << endl;

  return 0;
}

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

N = int(input())
A = [int(i) for i in input().split()]
MOD = 10**9 + 7

def gcd(n, m):
    if m == 0:
        return n
    while m != 0:
        n, m = m, n % m
    return n

def lcm(n, m):
    return n * m // gcd(n, m)

L = 1
for a in A:
    L = lcm(L, a)

ans = 0
for i, a in enumerate(A):
    ans += L // a
    if i == N // 2:
        ans %= MOD

print(ans % MOD)


Measured memory_bytes: 3828