akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int a[maxn];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int b,e,t;
    int n;
    cin>>n;
    rep(i,1,n)cin>>a[i];
    int q;cin>>q;
    while(q--){
        int b,e,t;
        cin>>b>>e>>t;
        swap_ranges(a+b+1,a+e+1,a+t+1);
    }
    rep(i,1,n)cout<<a[i]<<(n==i?'\n':' ');
    


}
/* 
swapRange(b,e,t): For each integer kk (0≤k<(e−b)0≤k<(e−b), swap element (b+k)(b+k) and element (t+k)(t+k).
11
1 2 3 4 5 6 7 8 9 10 11
1
1 4 7
 */


Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <functional>
using namespace std;

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

int a[200010];
int b[200010];

int main() {

    int N, K;
    cin >> N >> K;
    rep(i, N) {
        cin >> a[i];
    }
    rep(i, N) {
        b[a[i]]++;
    }
    sort(b + 1, b + N + 1);

    int sum = 0;
    for (int i = 1; i <= N - K; i++) {
        sum += b[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 1792
<?php
fscanf(STDIN, "%d %d", $H, $W);


$list = array();
for ($i = 0; $i < $H; $i++) {   
  $list[$i]=str_split(trim(fgets(STDIN)));
}


$resultList = array();
for ($i = 0; $i < $H; $i++) { 
  for ($j = 0; $j < $W; $j++) {
    $resultList[$i][$j] = 0;
  }
}


function check ($H, $W, $list){
  for ($i = 0; $i < $H; $i++) { 
    for ($j = 0; $j < $W; $j++) {
      // 爆弾
      if( strcmp($list[$i][$j],"#") == 0 )
      {
        // 左
        if(isset($list[$i][$j-1])){
          if( strcmp($list[$i][$j-1],"#") == 0 ){
            continue;
          }
        }
        
        // 上
        if(isset($list[$i-1][$j])){
          if( strcmp($list[$i-1][$j],"#") == 0 ){
            continue;
          }
        }

        // 右
        if(isset($list[$i][$j+1])){
          if( strcmp($list[$i][$j+1],"#") == 0 ){
            continue;
          }
        }

        // 下
        if(isset($list[$i+1][$j])){
          if( strcmp($list[$i+1][$j],"#") == 0 ){
            continue;
          }
        }

        // ここまできたら隣接なしなので終了
        return "No";
      }
    }
  }
  return "Yes";
}


echo check($H, $W, $list);
// for ($i = 0; $i < $H; $i++) { 
//   for ($j = 0; $j < $W; $j++) {
    
//     if( strcmp($list[$i][$j],".") == 0 )
//     {
//       $list[$i][$j] = $resultList[$i][$j];
//     }
//   }
// }




// for ($i = 0; $i < $H; $i++) { 
//   for ($j = 0; $j < $W; $j++) {   
//     echo $list[$i][$j];
//   }
//   echo "\n";
// }
?>

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

int main() {
  int N; cin >> N;
  double sum = 0;
  rep(i,N) {
    int A; cin >> A;
    sum += 1.0/A;
  }
  double ans = 1/sum;
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//WA

int main(void){
	int N;
	cin>>N;
	if(N<1000){
		printf("ABC\n");
	}else{
		printf("ABD\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef vector<LL> VEC;
typedef vector<VEC> VVEC;
typedef  pair<LL,LL> P;


const LL INF=1<<30;
const LL MOD=1000000007;




int main(){
    string S;
    cin>>S;
    S[3]='8';
    cout<<S<<endl;
}



Measured memory_bytes: 256
//
// Created on 2020/07/29.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n,q;
    string s;
    cin>>n>>q;
    cin>>s;
    vector<int>g(n,0);
    for (int i = 1; i < n ; ++i) {
        if(s[i - 1] == 'A' && s[i] == 'C'){
            g[i] = g[i - 1] + 1;
        }else{
            g[i]= g[i - 1];
        }
    }
    for (int k = 0; k < q; ++k) {
        int l,r;
        cin>>l>>r;
        l--;r--;
        cout<<g[r] - g[l]<<endl;
    }

    return 0;
}


Measured memory_bytes: 3796
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001

typedef struct cell{
 int id;
 struct cell *right;
 struct cell *left;
}cell;


void preorder(cell *root){
cell *p=root;
printf(" %d",p->id);

if(p->left!=NULL){preorder(p->left);}
if(p->right!=NULL){preorder(p->right);}

return;
}

void inorder(cell *root){
cell *p=root;
if(p->left!=NULL){inorder(p->left);}
printf(" %d",p->id);
if(p->right!=NULL){inorder(p->right);}

return;
}


cell* makecell(int x){
cell *new=malloc(sizeof(cell));
new->id=x;
new->left=NULL;
new->right=NULL;

return new;
}

void insert(cell **p,cell *new){

cell *temp;

if((*p)==NULL){(*p)=new;return;}
else{

 if( (*p)->left==NULL && (*p)->right==NULL ){/*子なし*/
   if((*p)->id < new->id){
     (*p)->right=new;return;}
   else{
     (*p)->left=new;return;}
  }
  else if((*p)->left==NULL&&(*p)->right!=NULL){/*左なし右あり*/
   if( (*p)->id > new->id ){
     (*p)->left=new;return;}
   else{insert(&((*p)->right),new);}
  }
  else if((*p)->left!=NULL&&(*p)->right==NULL){/*左あり右なし*/
   if( (*p)->id < new->id){
     (*p)->right=new;return;}
   else{insert(&((*p)->left),new);}
  }
  else{/*どっちも子あり*/
   if((*p)->id < new->id){
     insert(&((*p)->right),new);
   }
   else{insert(&((*p)->left),new);}
 }
}

return;
}
     


int find(cell *root,int x){
cell *p=root;

while(p!=NULL){
 if(p->id==x){return 1;}
 else if(p->id <x){p=p->right;}
 else{p=p->left;}
}

return 2;
}







int main(){
int n,i,x,j,k;
char com[7];
cell *root=NULL;
cell *new;
int F[MAX]={0};

scanf("%d",&n);


for(i=0;i<n;i++){
 scanf("%s",com);

 switch(com[0]){
  case 'i':scanf("%d",&x);
           new=makecell(x);
           insert(&root,new);
           break;

  case 'p':inorder(root);
           printf("\n");
           preorder(root);
           printf("\n");
           break;

  case 'f':scanf("%d",&x);
           F[i]=find(root,x);

 }/*switch end*/

}/*for end*/


for(i=0;i<MAX;i++){
 if(F[i]==1){printf("yes\n");}
 else if(F[i]==2){printf("no\n");}
 


}

return 0;
}


Measured memory_bytes: 19348
n = int(input())
a = [[int(i), j] for j, i in enumerate(input().split())]
a.sort(reverse=1)
a.append([0, n-1])
ans = [0] * n

j = n-1
for i in range(n):
    j = min(j, a[i][1])
    ans[j] += (i+1) * (a[i][0] - a[i + 1][0])
print("\n".join(map(str, ans)))


Measured memory_bytes: 31440
import java.util.Scanner;

public class Main {

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

        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        if (c >= a && c <= b) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
fun main(args: Array<String>){

    val x = readLine()!!.toLong()


    for(a in 0..x){
        val a5 = a * a * a * a * a
        val b5 = a5 - x
        for(b in 0 until a){
            val ans = b * b * b * b * b
            if(ans == b5){
                println("$a $b")
                return
            }

            if(-ans == b5){
                println("$a -$b")
                return
            }


        }
    }

    println("ERROR $x")
}



Measured memory_bytes: 34424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    ll ans = 0;
    ll r = 0;
    rep(l, n) {
        while(r<n && a[r] - a[l] <= 2) r++;
        chmax(ans, r - l);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4064
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <tuple>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;
using ll = long long;

int main(void)
{
    int n;
    cin >> n;
    ll ans=0,max=0;
    for (int  i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if (max>a)
        {
            ans+=max-a;
        }
        if (a>max)
        {
            max=a;
        }
    }
    cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

template <typename T>
struct SegmentTree {
  using F = function<T(T, T)>;
  vector<T> v;
  F f;
  T e;
  int n;
  SegmentTree(int size, F f, T e) : f(f), e(e) {
    n = 1;
    while (n < size) n <<= 1;
    v.resize(n * 2, e);
  }
  void set(int k, T x) {
    v[k + n] = x;
  }
  void build() {
    for (int i = n - 1; i > 0; i--) {
      v[i] = f(v[i * 2 + 0], v[i * 2 + 1]);
    }
  }
  void update(int k, T x) {
    v[k += n] = x;
    while (k >>= 1) v[k] = f(v[k * 2 + 0], v[k * 2 + 1]);
  }
  T query(int a, int b) {
    T l = e, r = e;
    for (a += n, b += n; a < b; a >>= 1, b >>= 1) {
      if (a & 1) l = f(l, v[a++]);
      if (b & 1) r = f(v[--b], r);
    }
    return f(l, r);
  }
};

void solve() {
  int n;
  cin >> n;
  vi32 a(n);
  cin >> a;
  vi32 accl(n + 1), accr(n + 1);
  rep(i, n) accl[i + 1] = gcd(accl[i], a[i]);
  rrep(i, n) accr[i] = gcd(accr[i + 1], a[i]);
  int ans = 0;
  rep(i, n) {
    amax(ans, (int) gcd(accl[i], accr[i + 1]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    ll h, w;
    cin>>h>>w;
    string s[h];
    loop(i,0,h) cin>>s[i];

    ll dp[h][w];
    loop(i,0,h) loop(j,0,w) dp[i][j] = inf;
    if(s[0][0] == '#') dp[0][0] = 1;
    else dp[0][0] = 0;

    for(ll i=0; i<h; i++){
        for(ll j=0; j<w; j++){
            if(i == 0 && j == 0)continue;
            if(i-1 >= 0){
                if(s[i][j] == '.') dp[i][j] = min(dp[i][j], dp[i-1][j]);
                else {
                    dp[i][j] = min(dp[i][j], dp[i-1][j] + (s[i-1][j] == '.'));
                }
            }
            if(j-1 >= 0){
                if(s[i][j] == '.') dp[i][j] = min(dp[i][j], dp[i][j-1]);
                else {
                    dp[i][j] = min(dp[i][j], dp[i][j-1] + (s[i][j-1] == '.'));
                }
            }
        }
    }
    print(dp[h-1][w-1]);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
 
}


Measured memory_bytes: 384
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

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

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}

ll i,j,k,ii,jj,n,m,a,b,c,d,e,g,h,r,w,l;
ll num,ans;
ll x[500005],y[500005],z[500005];
bool dame,flag;
ll ok,ng;
string s,t;


int main(){
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x[i];
		a += x[i];
	}
	for(i=0;i<n;i++){
		cin >> y[i];
		b += y[i];
	}

	if(a < b){
		p(-1);
	}else{
		a = 0;
		b = 0;
		for(i=0;i<n;i++){
			if(x[i] < y[i]){
				a += y[i] - x[i];
				ans++;
			}else if(x[i] > y[i]){
				z[num] = x[i] - y[i];
				num++;
			}
		}
		sort(z,z+num);
		reverse(z,z+num);
		if(a <= 0){
				p(ans);
				return 0;
		}
		for(i=0;i<num;i++){
			if(a <= 0){
				p(ans);
				return 0;
			}
			a -= z[i];
			ans++;
			if(a <= 0){
				p(ans);
				return 0;
			}
		}
		p(-1);
		return 0;
	}

	return 0;
}

Measured memory_bytes: 33792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a,b,c,d;
ll gcd(ll x,ll y){
    return y==0?x:gcd(y,x%y);
}
int main(){
	cin>>a>>b>>c>>d;
	ll o=c/gcd(c,d)*d;
	ll d1=b/c-(a-1)/c,d2=b/d-(a-1)/d,d3=b/o-(a-1)/o;
	ll all=d1+d2-d3;
	cout<<(b-a+1)-all;
	
}

Measured memory_bytes: 256
N, K = list(map(int, input().split()))

t = 0
L = []
for i in range(1, N - 1):
  t += i
  for j in range(i + 1, N):
    L.append([i + 1, j + 1])

if K > t:
  print(-1)
  exit()

print(N - 1 + (t - K))
for i in range(1, N):
  print(1, i + 1)
for i in range(t - K):
  print(L[i][0], L[i][1])



Measured memory_bytes: 4120
n,*a=map(int,open(0).read().split())
ans=0
store=1
leaves=sum(a)
for i in range(n+1):
  if a[i]>store:
    ans=-1
    break
  node=min(store,leaves)
  ans+=node
  leaves-=a[i]
  store-=a[i]
  store*=2
print(ans)

Measured memory_bytes: 20148
from collections import defaultdict
from itertools import combinations

N = int(input())
d = defaultdict(int)
for _ in range(N):
    s = input()
    d[s[0]] += 1

ans = 0
for a, b, c in combinations(['M', 'A', 'R', 'C', 'H'], 3):
    ans += d[a] * d[b] * d[c]
print(ans)

Measured memory_bytes: 3316
#include "bits/stdc++.h"

using namespace std;

int main() {
    string n;
    cin >> n;
    if ((n[0] == n[1] && n[0] == n[2]) || (n[1] == n[2] && n[1] == n[3])) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3604
module IMap=Map.Make(Int64);;
let(++),(--),( **),(//),(%)=Int64.(add,sub,mul,div,rem)
in Scanf.(Array.(scanf" %d %Ld"@@fun n m->
	let a=make(n+1)0L in for i=1 to n do a.(i)<-scanf" %Ld"@@fun v->v++a.(i-1)done;
	IMap.(fold_left(fun u v->let r=v%m in add r(1L++try find r u with Not_found->0L)u)empty a
		|>bindings|>List.fold_left(fun u(_,c)->u++(c**(c--1L))//2L)0L
		|>Int64.to_string|>print_endline)))

Measured memory_bytes: 19456
from collections import deque
def readinput():
    n,m,k=list(map(int,input().split()))
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    return n,m,k,a,b

def main(n,m,k,a,b):
    qa=deque(a)
    qb=deque(b)
    count=0
    res=k
    while(len(qa)>0 and len(qb)>0):
        if qa[0] < qb[0]:
            res-=qa[0]
            qa.popleft()
        else:
            res-=qb[0]
            qb.popleft()
        if res<0:
            return count
        count+=1
    else:
        if len(qa)==0:
            while(len(qb)>0):
                res-=qb[0]
                qb.popleft()
                if res<0:
                    return count
                count+=1
            return count
        else:
            while(len(qa)>0):
                res-=qa[0]
                qa.popleft()
                if res<0:
                    return count
                count+=1
            return count

import sys
INFTY=sys.maxsize
def find(t,s):
    '''
    単調増加配列sからs[i]がtを超えない最大のiを返す
    '''
    ss=s[:]
    ss.append(INFTY)
    left=0
    right=len(ss)
    while(left<right):
        middle=(left+right)//2
        #print(left,middle,right,t,ss)
        if ss[middle]==t:
            #print(middle, ss)
            return middle
        if t<ss[middle]:
            right=middle
        else:
            left=middle+1
    else:
        return left-1

def main2(n,m,k,a,b):
    sa=[0]
    for i in range(1,n+1):
        sa.append(sa[i-1]+a[i-1])
    sb=[0]
    for i in range(1,m+1):
        sb.append(sb[i-1]+b[i-1])
    maxab=0
    nb=m+1
    for na in range(0,n+1):
        res=k-sa[na]
        if res>=0:
            nb=find(res,sb[:nb+1])
            #print(na,nb,sa,sb)
            maxab=max(maxab,na+nb)
    return maxab

from bisect import bisect_left, bisect_right
def find_le(a, x):
    'Find rightmost index less than or equal to x'
    i = bisect_right(a, x)
    if i:
        return i-1
    raise ValueError

def main3(n,m,k,a,b):
    sa=[0]
    for i in range(1,n+1):
        sa.append(sa[i-1]+a[i-1])
    sb=[0]
    for i in range(1,m+1):
        sb.append(sb[i-1]+b[i-1])
    maxab=0
    nb=m+1
    for na in range(0,n+1):
        res=k-sa[na]
        if res>=0:
            nb=find_le(sb,res)
            #print(na,nb,res,sa,sb)
            maxab=max(maxab,na+nb)
    return maxab

def main4(n,m,k,a,b):
    sa=[0]
    for i in range(1,n+1):
        sa.append(sa[i-1]+a[i-1])
    sb=[0]
    for i in range(1,m+1):
        sb.append(sb[i-1]+b[i-1])
    maxab=0
    nb=m
    for na in range(0,n+1):
        res=k-sa[na]
        while res<sb[nb] and nb>=0:
            nb-=1
        else:
            if nb>=0:
                maxab=max(maxab,na+nb)
        #print(na,nb)
    return maxab

def readinput2():
    m=2*10**5
    n=2*10**5
    a=[10**9]*n
    b=[10**9]*m
    k=1
    return n,m,k,a,b

if __name__=='__main__':
    n,m,k,a,b=readinput()
    ans=main3(n,m,k,a,b)
    print(ans)


Measured memory_bytes: 49540
num = int(input())
count = 0
for i in range(num):
    if (i + 1) % 15 == 0:
        pass
    elif (i + 1) % 3 == 0:
        pass
    elif (i + 1) % 5 == 0:
        pass
    else:
        count += i + 1
print(count)


Measured memory_bytes: 9136
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

int main()
{
    int X;
    cin >> X;
    for (ll i = -119; i <= 119; i++)
        for (ll j = i; j <= 119; j++) {
            if (j*j*j*j*j - i*i*i*i*i == X) {
                cout << j << " " << i << "\n";
                return 0;
            }
        }
    return 0;
}


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

#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define let const auto
#define USE_T template <typename T>
#define USE_Ti template <typename T = int>
#define USE_TU template <typename T, typename U>

USE_Ti using duo = std::pair<T, T>;
USE_Ti using vec = std::vector<T>;
using ll = long long;
// clang-format off
USE_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE_Ti inline T in(){T x;std::cin>>x;return x;}
USE_Ti inline vec<T> in(int n){vec<T> v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE_T inline void in(T*x,int n){rep(i,n)x[i]=in<T>();}
struct IoSetup {
  IoSetup(){
    using namespace std;
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<setprecision(10);
    cerr<<setprecision(10);
  }
} iosetup;
// clang-format on
// }}}
using namespace std;
const int inf = 1001001001;
const ll infll = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() {
  int N = in();
  auto V = in(2 * N);
  sort(ALL(V));
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += min(V[2 * i], V[2 * i + 1]);
  }
  cout << ans << endl;
  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

signed main(){
    int a,b,c;
    cin>>a>>b>>c;

    if(a>b)swap(a,b);
    if(a>c)swap(a,c);
    if(b>c)swap(b,c);

    if(a!=b)cout<<a<<endl;
    else cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main{
  public static void main(String[]  args){
    Scanner S = new Scanner(System.in);
    int N = S.nextInt();
    int A[] = new int[N];
    for ( int i = 0;i < N;i++){
      A[i] = S.nextInt();
    }
    int[] B = A;
    int wrong = 0;
    Arrays.sort(B);
    if( N % 2 == 1){
      for(int i = 0;i<(N-1)/2;i++){
        if(i == 0){
          if (B[i] != 0){
            wrong = 1;
          }
        }
        if(i != 0){
          if (B[2 * i -1] != 2 * i){
            wrong = 1;
          }
          if (B[2 * i] != 2 * i){
            wrong = 1;
          }
        } 
      }
      if (wrong ==0){
        int c = 1;
        for(int i=0;i<(N-1)/2;i++){
          c *= 2;
          while(c>=1000000007){
            c -= 1000000007;
          }
        }
        System.out.println(c);
      }
      if (wrong != 0){
        System.out.println(0);
      }
    }
    if (N%2 == 0){
      for(int i = 0;i<N/2;i++){
        if (B[2 * i ]  != 2 * i + 1){
          wrong = 1;
        }
        if (B[2 * i +1] != 2 * i + 1){
          wrong = 1;
        }
      }
      if (wrong ==0){
        int c = 1;
        for(int i=0;i<N/2;i++){
          c *= 2;
          while(c>=1000000007){
            c -= 1000000007;
          }
        }
        System.out.println(c);
      }
      if (wrong != 0){
        System.out.println(0);
      }
    }
  }
}


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,ans=INF; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll sum=accumulate(all(a),0LL);
    ll tmp=0,x=0;
    rep(i,n){
        sum -= a[i];
        tmp += a[i];
        ans = min(ans,abs(sum-tmp));
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 4768
{
  const main = (input: string): void | string | number => {
    const r = _reader(input)
    const [N, K] = r.nn()
    const [R, S, P] = r.nn()
    const T = r.s()
    const dp: number[] = []
    const t: number[] = T.split('').map(c => ({ r: P, s: R, p: S }[c]))

    const count = { r: 0, s: 0, p: 0 }

    for (let i = 0; i < N; i++) {
      const ts = T[i]
      const tn = t[i]

      if (i === 0) {
        dp[i] = tn
      } else if (i < K || ts !== T[i - K]) {
        dp[i] = +tn
      } else {
        if (dp[i - K] === 0) {
          dp[i] = tn
        } else {
          dp[i] = 0
        }

        count[ts] += 1
      }
    }

    return dp.reduce((a, b) => a + b, 0)
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
}


Measured memory_bytes: 17868
import copy
S=input()
ListS = list(S)
revListS = copy.deepcopy(ListS)
norm = 0
rev = 0
N = len(ListS)
for i in range(1,N):
  if ListS[i] == ListS[i-1]:
    ListS[i] = str(abs(int(ListS[i])-1))
    norm += 1
  if revListS[N-i-1] == revListS[N-i]:
    revListS[N-i-1] = str(abs(int(revListS[N-i-1])-1))
    rev += 1
res = min(norm,rev)
print(res)

Measured memory_bytes: 17364
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
const ll MAX=510000;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
    string S;
    cin>>S;
    ll s=0,t=0;
    for(ll i=0;i<S.size();i++){
        if(S[i]=='T'&&s==0) t++;
        else if(S[i]=='T'&&s!=0) s--;
        else if(S[i]=='S') s++;
    }
    cout<<s+t<<endl;
}



Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>
#include <stack>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

typedef long long llong;

int main() {
	float N, b;
	cin >> N >> b;

	cout << float(N/b) << endl;

	return 0;
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; ll A[int(2e5 + 5)];

int main(){
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N, greater<ll>());

  ll ans = A[0], rest = N - 2, now = 1;
  while (rest > 0){
    if (rest == 1) ans += A[now], rest--;
    else ans += A[now] * 2, rest -= 2;
    now++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5132
#include<iostream>
#include<math.h>
#include<algorithm>

using namespace std;

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


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::VecDeque;


fn main() {
  let n = read::<i64>();
  let mut ans = VecDeque::new();

  for i in 0..n {
    let a = read::<i64>();
    if i % 2 != n % 2 {
      ans.push_front(a);
    } else {
      ans.push_back(a);
    }
  }

  for i in ans {
    print!("{} ", i)
  }
}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll x;
    cin >> x;
    ll ans=0;
    ans+=1000*(x/500);
    x=x%500;
    ans+=5*(x/5);
    cout << ans << endl;
    
    return 0;
}











Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
  int i, count = 0, number_n, amount_ingredient, temp = 0;
  scanf("%d %d", &number_n, &amount_ingredient);
  int cost[number_n];
  for(i = 0; i < number_n; i++) {
    scanf("%d", &cost[i]);
    temp += cost[i];
  }
  qsort(cost, number_n, sizeof(int), asc);
  amount_ingredient -= temp;
  count += (number_n + amount_ingredient / cost[0]);
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES    
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define quickIO()   {cin.tie(0);    cout.sync_with_stdio(false);}
#define rep(i,n)    for(ll i=0; i<(ll)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define fcout cout << fixed << setprecision(10) 
const ll inf = 1e18;
const ll mod = 1e9 +7;
     
ld sqrtld(ld x){
    ld left = 0, right = x;
    rep(i, 100){
        ld mid = (left + right)/2;
        if (mid*mid <= x)   left =mid;
        else    right = mid;
    }
    return left;
}

ll gcd(ll a, ll b){
    if(b>a){
        ll c =b; b=a;   a=c;
    }
    ll d = a%b;
    if(d==0){
        return b;
    }else if(d==1){
        return 1;
    }else{
        gcd(b,d);
    }
}


ll cul(ll n){
    return (n-1)*n/2;
}


int main (){
    string s;
    cin >> s;
    string a;
    rep(i,s.size()){
        if(s[i] == '0'){
            a += '0';
        }else if(s[i] == '1'){
            a += '1';
        }else{
            if(a.size()!=0){
                a.pop_back();
            }
        }
    }

    cout << a << endl;
    return 0;
}



Measured memory_bytes: 256
def main():
    n = int(input())
    results = {"AC":0,"WA":0,"TLE":0,"RE":0}
    for i in range(n):
        r = input()
        results[r] += 1
    print("AC x " + str(results["AC"]))
    print("WA x " + str(results["WA"]))
    print("TLE x " + str(results["TLE"]))
    print("RE x " + str(results["RE"]))


if __name__ == '__main__':
    main()


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

char nextS(char ch) { return ch == '0'? '1' : '0';}

int main() 
{
    string s;
    cin >> s;
    
    char a = '0';
    char b = '1';
    int cntA = 0;
    int cntB = 0;
    rep(i,s.size()) {
        char ch = s[i];
        if (a != ch) cntA++;
        if (b != ch) cntB++;
        a = nextS(a);
        b = nextS(b);
    }

    int ans = min(cntA, cntB);
    cout << ans << endl;    
    return 0;

}


Measured memory_bytes: 512
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a,int b){return a*b/gcd(a,b);}
//priority_queue<int, vector<int>, greater<int> > que; //昇順

using namespace std;

const int mod=1e9+7;

int ans=0;

signed main(){
    SPEED;
    int a,b;
    cin >> a >> b;
    int num = 0;
    for(int i = b - a; i != 0;--i)
    {
        num += i;
    }
    cout << num - b << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	d, n := 0, 0
	fmt.Scan(&d, &n)

	ans := 1
	for i := 0; i < d; i++ {
		ans *= 100
	}
	if n==100{
		n++
	}
	fmt.Println(ans * n)
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    double f;
    int a,b,d,r;
    cin>>a>>b;
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    cout << d << " " << r << " ";
    printf("%f\n",f);
}


Measured memory_bytes: 3216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    static int c=0;
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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



    public static void main(String[] args)throws IOException {
        FastReader fr=new FastReader();
        int n=fr.nextInt();
        int arr[]=new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = fr.nextInt();
        }
        int sums[]=new int[n];
        sums[0]=0;
        sums[1]=Math.abs(arr[0]-arr[1]);
        for(int i=2;i<n;i++)
        {
            sums[i]=Math.min(sums[i-2]+Math.abs(arr[i-2]-arr[i]),sums[i-1]+Math.abs(arr[i-1]-arr[i]));

        }
//        System.out.println(Arrays.toString(sums));
        System.out.println(sums[n-1]);

    }




}


Measured memory_bytes: 42840
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b);
int lcm(int a, int b);

void solve_A(){
    
}

void solve_B(){
    int n;
    string s;
    cin >> s;

    n = s.length();
    REP(i,n) cout << "x";
}

void solve_C(){
    int n;
    cin >> n;

    /*
    int a[n];
    int* num;
    num = (int*)calloc(1000000010, sizeof(int));
    if(num == NULL) exit(1);

    int flag = 0;
    REP(i,n){
        cin >> a[i];
        num[a[i]] ++;
        if(num[a[i]] == 2){
            flag ++;
            break;
        }
    }

    if(flag == 0) cout << "YES";
    else cout << "NO";
    */

    int a[n];
    REP(i,n) cin >> a[i];

    bool flag = false;
    sort(a, a+n);
    REP(i,n-1){
        if(a[i] == a[i+1]) flag = true;
    }

    if(flag) cout << "NO";
    else cout << "YES";

    // free(num);
}

double Expect(int n){
    return (double) (n + 1) / 2;
}

void solve_D(){
    int n, k;
    cin >> n >> k;

    int p[n];
    double e[n];
    double sum = 0.0;
    REP(i,n){
        cin >> p[i];
        sum += Expect(p[i]);
        e[i] = sum;
    }

    double ans = 0;

    if(k != n){
        REP(i, n-k){
            if(ans <= e[i+k] - e[i]) ans = e[i+k] - e[i];
        }
    } else{
        ans = e[n-1];
    }
    
    printf("%.10f", ans);
}

int main(void){
    solve_B();
    return 0;
}

int gcd(int a, int b){
    if(a < b) swap(a, b);

    int r = a % b;
    while(r != 0){
        a = b;  b = r;  r = a % b;
    }
    return b;
}

int lcm(int a, int b){
    return a * b / gcd(a, b);
}

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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    vector<int> b(m);
    for(int i=0;i<m;i++){
        cin>>b.at(i);
    }
    vector<int> a(m);

    ll sum=0,co=0;
    for(int j=0;j<n;j++) {
        sum=0;
        for (int i = 0; i < m; i++) {
            cin >> a.at(i);
            sum += a.at(i)*b.at(i);
            if(i==(m-1)){
                sum += c;
            }
        }
        if(sum>0){
            co += 1;
        }
    }

    cout<<co<<endl;

}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define line_buf 512
#define ll long long int

void sort_func(int *origin, int left, int right, int *tmp){
    

	if(right - left > 1){

		int i, j, k, half = (left + right) / 2;
	
    	sort_func(origin, left, half, tmp);
		sort_func(origin, half, right, tmp);
	
    	for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}

		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(tmp[j] <= tmp[k] && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	
    }


}

void pre_sort(int *origin, int N){
	int *tmp = (int *)malloc(sizeof(int) * N);
	sort_func(origin, 0, N, tmp);
	free(tmp);
}

int main(){

    int i,j,k;
    int N,X,count;
    char line[line_buf];

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d",&N,&X);

    int *m = (int *)malloc(sizeof(int)*N);
    int sum = 0;

    for(i=0;i<N;i++){
        scanf("%d",&m[i]);
        sum += m[i];
    }

    pre_sort(m,N);

    int nokori = (X-sum);
    int min = m[0];

    if(nokori-min < 0)printf("%d",N);
    else printf("%d",N+nokori/m[0]);

}


Measured memory_bytes: 128
function main( input ) {
    const a = input.split(' ')[0];
    const b = input.split(' ')[1];
    const c = parseInt( a+b, 10 );
    const cc = Math.floor(Math.sqrt( c ));
    console.log( ( Math.pow(cc, 2) === c ) ? 'Yes' : 'No' );
}

main( require('fs').readFileSync('/dev/stdin', 'utf8') )

Measured memory_bytes: 29488
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            var a = consoleReader.Split.Int;
            return a.Sum() - N;
        }


        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

Measured memory_bytes: 13268