akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.NoSuchElementException;

public class Main {
	int N;

	public BigInteger gcd(BigInteger x,BigInteger y){
		return y.compareTo(BigInteger.ZERO) == 0 ? x : gcd(y,x.mod(y));
	}

	public BigInteger lcm(BigInteger x,BigInteger y){
		return x.multiply(y).divide(gcd(x,y));
	}

	public void solve() {
		N = nextInt();

		BigInteger ans = BigInteger.ONE;
		for(int i = 0;i < N;i++){
			ans = lcm(ans,new BigInteger(next()));
		}

		out.println(ans.toString());
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

Measured memory_bytes: 21716
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt; scanf("%d", &kkt);

	while (kkt--) {
		ll N; scanf("%lld", &N);
		string s = to_string(N);
		ll res = 0;
		while (s.size() > 1) {
			ll tmp = 0;
			for (int i = 0; i < (ll)s.size() - 1; i++) {
				ll a = stoll(s.substr(0, i + 1));
				ll b = stoll(s.substr(i + 1, s.size()));
				chmax(tmp, a * b);
			}
			res++;
			s = to_string(tmp);
		}
		cout << res << "\n";
	}
	return 0;

}


Measured memory_bytes: 3364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   ll n, a=-1, brojac=0, i;
   cin >> n;
   ll niz[n];
   for(i=0;i<n;i++)cin>>niz[i];
   ll x = niz[0];
   for(i=1;i<n;i++)
   {
      if(x == niz[i])
      {
         niz[i] = a;
         brojac++;
         a--;
      }
      x = niz[i];
   }
   cout << brojac << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
class Program
{
 static void Main(string[] args)
 {
  string[] sInp = Console.ReadLine().Trim().Split(' ');
  int iN = int.Parse(sInp[0]);
  int iL = int.Parse(sInp[1]);
  List<string> lstInp = new List<string>();
  for (int i = 0; i < iN; i++) { lstInp.Add(Console.ReadLine().Trim()); }
  lstInp.Sort();
  StringBuilder sOut = new StringBuilder();
  for (int i = 0; i < iN; i++) { sOut.Append(lstInp[i]); }
  Console.WriteLine("{0}", sOut.ToString());
 }
}


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

		public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			int N = sc.nextInt();
			// スペース区切りの整数の入力
			int M = sc.nextInt();
			int L =0;
			int R =0;
			int Lmax=0;
			int Rmin=N;
			for (int i = 0; i<M ; i++){
				L=sc.nextInt();
				R=sc.nextInt();
				if(Lmax<=L){
					Lmax = L;
				}
				if(Rmin>=R){
					Rmin = R;
				}
			}
			if(Rmin-Lmax>=0){
				System.out.println(Rmin-Lmax+1);
			}else{
				System.out.println(0);
			}
				
		}

	}

Measured memory_bytes: 61380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main(){
    int n;
    cin >> n;
    if(n==1){
        cout << "Hello World" << endl;
    }else{
        int a, b;
        cin >> a >> b;
        cout << a+b << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  3005

ll n;
ll a[N];
ll dp[N][N][2];


ll solve(ll st, ll en, bool player){
	if(dp[st][en][player]!=-1)return dp[st][en][player];
	if(st==en){
		if(player)return dp[st][en][player]=-a[st];
		else return dp[st][en][player]=a[st];
	}
	ll a1 = solve(st+1,en,1-player);
	ll a2 = solve(st, en-1, 1-player);
	if(player){
		return dp[st][en][player]=min(a1-a[st],a2-a[en]);
	}
	else{
		return dp[st][en][player]=max(a1+a[st],a2+a[en]);
	}
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	rep(i,0,N)rep(j,0,N)dp[i][j][0]=dp[i][j][1]=-1;
	while(TESTS--)
	{
			cin>>n;
			rep(i,0,n)cin>>a[i];
			cout<<solve(0,n-1,0)<<endl;
	}	
	return 0;
}

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



/*int main() {
    
    int n; cin >> n;
    string s = "";
    while(n != 0){
        if(n%(-2) != 0){
            n--;
            s += '1';
        }else s += '0';
        n /= -2;
    }
    if( s.size() == 0 ){
        cout << "0" << endl;
        return 0;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
    cout<<s[1];
    
    return 0;
}*/





int main(){


    int n;
    cin>>n;
    int ans[10000];
    int i=0;
    
    if(n==0){
        cout<<0;
        return 0;
    }
    
while(n!=1){
        if(n%2==0){
            n=n/(-2);
            ans[i]=0;
            
           // cout<<n<<ans[i]<<endl;
            i++;
            
        }else{
            n=(n-1)/(-2);
       
            ans[i]=1;
          //  cout<<n<<ans[i]<<endl;
            i++;
                      }
    ans[i]=1;
        }
    
    while(i>=0){
        cout<<ans[i];
        i--;
        
    }

return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        for(;;){
                int h,w;
                scanf("%d %d",&h,&w);
                if(h){
                        for(int t=0;t<h;t++){
                                for(int y=0;y<w;y++){
                                        if((t+y)%2) printf(".");
                                        else if((t+y)%2==0) printf("#");
                                }
                            printf("\n");
                        }
                        printf("\n");
                }
                else break;
        }
        return 0;
}

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

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

int main(){
  int G[10000];
  int N,i,j,c=0,judge=0;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&G[i]);
  }
  for(i=0;i<N;i++){
    for(j=2; j<=(int)sqrt(G[i]);j++){
      if(G[i]%j==0){
	judge=1;
	break;
      }
    }
    if(judge==0){
      c++;
    }
    judge=0;
  }
  printf("%d\n",c);
  return 0;
}



Measured memory_bytes: 2052
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 205000;

int n, k;
int p[MAXN];
int f[MAXN];
int ans;
bool same = false;

int numlog[MAXN];
int mn[20][MAXN], mx[20][MAXN];

int getMax(int l, int r) {
  int len = numlog[r - l + 1];
  return max(mx[len][l], mx[len][r - (1 << len) + 1]);
}

int getMin(int l, int r) {
  int len = numlog[r - l + 1];
  return min(mn[len][l], mn[len][r - (1 << len) + 1]);
}

vector< pair<int, int> > v;

int main() {

  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }

  for (int i = n - 1; i >= 0; i--) {
    f[i] = 1;
    if (i + 1 < n && p[i] < p[i + 1]) {
      f[i] = 1 + f[i + 1];
    }
  }

  numlog[1] = 0;
  for (int i = 2; i <= n; i++) {
    numlog[i] = numlog[i / 2] + 1;
  }
  for (int i = 0; i < 20; i++) {
    int len = 1 << i;
    for (int j = 0; j < n; j++) {
      if (i == 0) {
        mn[i][j] = p[j];
        mx[i][j] = p[j];
      } else {
        mn[i][j] = min(mn[i - 1][j], mn[i - 1][j + len / 2]);
        mx[i][j] = max(mx[i - 1][j], mx[i - 1][j + len / 2]);
      }
    }
  }

  ans = 0;
  // cerr << "max " << getMax(2, 3) << endl;

  for (int i = 0; i + k - 1 < n; i++) {
    if (f[i] >= k) {
      if (!same) {
        ans++;
        same = true;
      }
      continue;
    }
    int l = 0, r = k - 1;
    while (l < r) {
      // cerr << i << " " << l << " " << r << endl;
      int mid = (l + r + 1) / 2;
      bool ok = true;
      if (mid > 0) {
        if (f[i] < mid || i + k >= n || f[i + k] < mid) {
          ok = false;
        }
        if (p[i + mid - 1] > getMin(i + mid, i + k - 1) || getMax(i + mid, i + k - 1) > p[i + k]) {
          ok = false;
        }
      }
      if (ok) { 
        l = mid;
      } else {
        r = mid - 1;
      }
    }
    // cerr << i << " " << l << endl;
    v.push_back({i, -1});
    v.push_back({i + l, 1});
  }

  int cnt = 0;
  sort(all(v));
  for (int i = 0; i < sz(v); i++) {
    if (v[i].second == -1) {
      if (cnt == 0) {
        ans++;
      }
      cnt++;
    } else {
      cnt--;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
bool sortDescByFirst(const pair<int,int>&a, const pair<int,int>&b){
    return a.first>=b.first;
}
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int a,b,c,d;
    while(cin>>a>>b>>c>>d){
        cout<<(a-c)*(b-d)<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int s = 0;
    int cnt = 0;

    for (int i=0; i<n; i++) {
      int h = sc.nextInt();
      if (h>=s) {
        cnt++;
        s = h;
      }
    }
    
    System.out.println(cnt);
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int N;
    cin >> N;
    ll a,b;
    cin >> a >> b;
    rep(i,N-1){
        ll x,y;
        cin >> x >> y;
        ll n=max((a-1)/x+1,(b-1)/y+1);
        a=n*x;
        b=n*y;
    }
    cout << a+b << endl;    


}

/*



 */



Measured memory_bytes: 256
N,M = map(int,input().split())
from collections import defaultdict
d = defaultdict(lambda:[])
l = []
for i in range(M):
    P,Y = map(int,input().split())
    d[P].append(Y)
    l.append((P,Y))
dd = defaultdict(lambda:{})
for P in d:
    d[P].sort()
    for i in range(len(d[P])):
        dd[P][d[P][i]] = i+1
for i in range(M):
    P,Y = l[i]
    id1 = '0'*(6-len(str(P)))+str(P)
    n = dd[P][Y]
    id2 = '0'*(6-len(str(n)))+str(n)
    print(id1+id2)

Measured memory_bytes: 71356
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

 

int main() {
	int N; cin >> N;
	int out = 0;
	for (int i = 1; i <= N; i++) {
		if (i < 105 || i % 2 == 0)continue;
		int cnt = 0;
		for (int j = 1; j <= i; j++) {
			if (i%j == 0)cnt++;
		}
		if (cnt == 8)out++;

	}
	print(out);
	return 0;
}

Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (h, w, k) = readLine()!!.split(" ").map { it.toInt() }
    val ans = Array(h) { IntArray(w) {0} }
    val ss = Array(h) { readLine()!!.toCharArray() }

    var num = 1
    var shouldCopyLater = 0
    ss.forEachIndexed { hIdx, row ->
        var found = false

        row.forEachIndexed { wIdx, s ->
            if (s == '.') {
                ans[hIdx][wIdx] = num
            }
            else if (s == '#' && !found) {
                found = true
                ans[hIdx][wIdx] = num
            }
            else if (s == '#' && found) {
                ans[hIdx][wIdx] = ++num
            }
        }

        if (found) {
            num++

            if (shouldCopyLater > 0) {
                for (i in 1..shouldCopyLater) {
                    ans[hIdx-i] = ans[hIdx]
                }
            }
            shouldCopyLater = 0

        } else {
            shouldCopyLater++
        }
    }

    if (shouldCopyLater > 0) {
        for (i in 1..shouldCopyLater) {
            ans[h-i] = ans[h-shouldCopyLater-1]
        }
    }

    ans.forEach {
        println(it.joinToString(separator = " "))
    }
}

Measured memory_bytes: 40276
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG
#define ll long long
#define rep(i,n) for (ll i = 0; i < n; i++)
#define vl vector<ll>
#define vpl vector<pair<ll,ll>>
#define vvl vector<vector<ll>> //a(縦行,vector<ll>(横列));
#include<algorithm>//__gcd(a,b)
#include <iostream>
#include <vector>
#include <cstdlib>
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 long long INF = 1LL << 60;

int main(){
  ll n,m;cin>>n>>m; 
  vl a(n);rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  vl b(m),c(m);
  vpl P(m);


  rep(i,m){
      cin>>b[i]>>c[i];
      P[i]=make_pair(c[i],b[i]);
  }
  sort(P.begin(),P.end());
  reverse(P.begin(),P.end());

  ll d=0;
  bool Br=0;
  for(ll i=0;i<m;i++){
      for(ll j=0;j<P[i].second;j++){
          if(P[i].first>a[d]){
              a[d]=P[i].first;
              d++;
          }
          else{break;Br=1;}
      }
      if(Br){break;}
  }

ll sum=0;
rep(i,n){sum+=a[i];}

cout<<sum<<endl;
}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

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

  vector<int> v(n);
  rep(i, n) scanf("%d", &v[i]);

  sort(v.begin(), v.end());

  double ans = (v[0] + v[1]) / 2.0;
  for(int i = 2; i < n; ++i) {
    ans = (ans + v[i]) / 2.0;
  }
  printf("%.5f\n", ans);
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)

int main() {
	int sum = 0;

	for_(i,0,4) {
		int a; cin >> a;
		sum += a;
	}
	
	int M = sum / 60;
	sum %= 60;
	
	cout << M << endl << sum << endl;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<long long> vll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int a, b, c;
  cin >> a >> b;
  c=b;
  for(ll i=1;i<a;i++)
  {
      c*=b-1;
  }
  cout<<c<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import itertools


N, M = [int(str) for str in input().strip().split()]
ab = [[int(str) - 1 for str in input().strip().split()] for _ in range(M)]


def solve():
    G = [[False] * N for _ in range(N)]
    for a, b in ab:
        G[a][b] = True
        G[b][a] = True
    ans = 0
    for p in itertools.permutations(range(1, N), N - 1):
        pp = [0] + list(p)
        ans += all([G[pp[i]][pp[i + 1]] for i in range(N - 1)])
    print(ans)

solve()


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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int N;

  int a[300005]={ };
  int b[300005]={ };
  
  string s;

  cin>>N;

  cin>>s;

  a[0]=0;
  
  for(int i=1;i<=N;i++){

    a[i]+=a[i-1];

    if(s[i-1]=='E'){
      a[i]+=1;
    }
    
  }

  b[N+1]=0;
  
  for(int i=N;i>=1;i--){
    
    b[i]+=b[i+1];
    
    if(s[i-1]=='W'){
      b[i]+=1;
    }
    
  }

  int maxx=0;
  
  for(int i=1;i<=N;i++){

    maxx=max(maxx,a[i]+b[i]);
    
  }

  cout<<N-maxx<<endl;
  
  return 0;

}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    ll A[N], B[N], s[N];
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) s[i] = A[i]-B[i];
    sort(s, s+N, greater<ll>());
    ll sum1 = 0, sum2 = 0;
    int point = N;
    rep(i, N){
        if(s[i] < 0){
            point = i;
            break;
        }
    }
    rep2(i, point, N-1){
        sum2 -= s[i];
    }
    int ans;
    rep(i, point+1){
        if(sum1 >= sum2){
            ans = N-point + i;
            break;
        }
        elif(i == point) ans = -1;
        sum1 += s[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#pragma GCC optimize "Ofast"
#pragma GCC optimize "unroll-loops"
#pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native"
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define init(a, b) memset(a, b, sizeof(a))
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef unordered_map<int,int> uoii;
typedef unordered_map<string,int> uosi;

#define MOD = 1e9+7;

/******* Debugging Class Template *******/
#define DEBUG

#ifdef DEBUG

    #define de(args...)     (Debugger()) , args

    class Debugger
    {
        public:
        Debugger(const std::string& _separator = " - ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std:cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std:cerr << endl;}

        private:
        bool first;
        std::string separator;
    };

#else
    #define debug(args...)                  // Just strip off all debug tokens
#endif





int32_t main()
{
    IOS
    
    int n;
    cin>>n;
    vi h(n+1);
    int inf=1000*1000*1000;
    for(int i=1;i<n+1;i++) cin>>h[i];
    vi dp(n+1,inf);
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(h[2-1]-h[2]);
    for(int i=3;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i-2]-h[i]));
    }
    cout<<dp[n];
    return 0;
}


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

int main(){
    using namespace std;
    size_t N;
    cin >> N;
    unordered_map<unsigned long, size_t> mp;
    for(unsigned long i = 0, a; i < N; ++i){
        cin >> a;
        ++mp[a];
    }
    if(mp.size() > 3)return 0 & puts("No");
    if(mp.size() == 1)return 0 & puts(mp[0] == N ? "Yes" : "No");
    if(mp.size() == 2)return 0 & puts(mp[0] * 3 == N ? "Yes" : "No");
    if(mp.size() == 3){
        vector<unsigned long> a;
        for(const auto& i : mp){
            if(i.second * 3 != N)return 0 & puts("No");
            a.push_back(i.first);
        }
        puts((a[0] ^ a[1]) == a[2] ? "Yes" : "No");
    }
    return 0;
}

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

//http://hos.ac/slides/20140319_bit.pdf
template<class T, int MAX_N>
struct FenwickTree { //0-indexed
    int N;
    T data[MAX_N];
    void init(int n) {
        N = n;
        memset(data, 0, sizeof(data));
    }
    T sum(int j) { //[0, j)
        T ret = 0;
        for(int x = j - 1; x >= 0; x = (x & (x + 1)) - 1)
          ret += data[x];
        return ret;
    }
    void add(int j, T w) { // 0 <= j < N
        for(int x = j; x < N; x |= x + 1)
          data[x] += w;
    }
};

//Range Minimum Query
template<class T, int MAX_N>
struct SegmentTree {
    int n;
    T data[MAX_N * 2 - 1];
    const T INF = (1LL << 31) - 1LL;//rewrite
    void init(int n_) {
        n = 1;
        while(n < n_) n *= 2;
        fill_n(data, 2 * n - 1, INF);
    }
    void update(int k, T a) {//0-indexed
        k += n - 1;
        data[k] = a;
        while(k > 0) {
            k = (k - 1) >> 1;
            data[k] = min(data[k * 2 + 1], data[k * 2 + 2]); 
        }
    }
    T __query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b) return data[k];
        else {
            T val_l = __query(a, b, k * 2 + 1, l, (l + r) >> 1);
            T val_r = __query(a, b, k * 2 + 2, (l + r) >> 1, r);
            return min(val_l, val_r);
        }
    }
    T query(int a, int b) { //[a, b)
        return __query(a, b, 0, 0, n);
    }
};

FenwickTree<long long, 1 << 17> fewt;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N, Q; cin >> N >> Q;
    fewt.init(N);
    for(int i = 0; i < Q; ++i) {
        int com, x, y;
        cin >> com >> x >> y;
        --x;
        if(com == 0) fewt.add(x, static_cast<long long>(y));
        else {
            long long r = fewt.sum(y);
            long long l = fewt.sum(x);
            cout << r - l << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 4200
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int ax, ay, bx, by, cx, cy;
ld a, b, c;

/*********************************************/
ld TSP(ld a, ld b, ld c) { // Semi-Perimeter
	return (a + b + c) / 2;
}

ld TA(ld a, ld b, ld c) { // Area
	ld p = TSP(a, b, c);
	return sqrtl(p * (p - a) * (p - b) * (p - c));
}

ld TIR(ld a, ld b, ld c) { // Incircle Radius
	return TA(a, b, c) / TSP(a, b, c);
}
/*********************************************/
int main() {
	cin >> ax >> ay >> bx >> by >> cx >> cy;
	a = hypotl(ax - bx, ay - by);
	b = hypotl(ax - cx, ay - cy);
	c = hypotl(cx - bx, cy - by);
	ld r = TIR(a, b, c);
	ld mx = max(a, max(b, c));
	cout << fixed << setprecision(20) << mx * r / (2 * r + mx);
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int d = Integer.parseInt(str[1]);
    int[][] p = new int[n][d];
    for(int i=0; i<n; i++) {
      str = in.readLine().split(" ");
      for(int j=0; j<d; j++) {
        p[i][j] = Integer.parseInt(str[j]);
      }
    }
    int count = 0;
    for(int i=0; i<n; ++i) {
      for(int j=i+1; j<n; ++j) {
        if(f(p[i],p[j],d))
          ++count;
      }
    }
    System.out.println(count);
  }
  
  private static boolean f(int[] p,int[] p2,int n) {
    int sum = 0;
    for(int i=0; i<n; ++i) 
      sum += (p[i]-p2[i]) * (p[i]-p2[i]);
    return Math.abs(Math.pow((int)Math.sqrt(sum),2)-sum)<0.001;
  }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a,b) for(int i=int(a);i>int(b);--i)
using namespace std;
using ll = long long;

int main()
{
  string s[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"},t;
  cin >> t;
  rep(i,7) if(s[i]==t) cout << 7-i << "\n";
}


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

// one-based numbering
struct UnionFind {
    vector<int> data;
    // i: (data[i] < 0) -> group size, (data[i] > 0) -> parent;
    UnionFind(int n) {
        data.resize(n+1, -1);
    }
    int find(int x) {
        if(data[x] < 0) return x;
        else return data[x] = find(data[x]);
    }
    int size(int x) {
        return -data[find(x)];
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    bool same(int x, int y) {
        x = find(x); y = find(y);
        return x == y;
    }
};

bool V[9100000][2];

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

    int N, M; cin >> N >> M;
    vector<long long> A(N), B(N), C(N), D(M), E(M), F(M);
    vector<long long> X, Y;

    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i] >> C[i];
        X.emplace_back(A[i]);
        X.emplace_back(B[i]);
        Y.emplace_back(C[i]);
    }
    for (int i = 0; i < M; i++) {
        cin >> D[i] >> E[i] >> F[i];
        X.emplace_back(D[i]);
        Y.emplace_back(E[i]);
        Y.emplace_back(F[i]);
    }

    sort(X.begin(), X.end());
    X.erase(unique(X.begin(), X.end()), X.end());
    sort(Y.begin(), Y.end());
    Y.erase(unique(Y.begin(), Y.end()), Y.end());

    int Xs = X.size(), Ys = Y.size();
    auto encode = [&](int i, int j) { return i * (Ys+2) + j + 1; }; 

    for (int i = 0; i < N; i++) {
        int a = A[i], b = B[i], c = C[i];
        int xl = lower_bound(X.begin(), X.end(), a) - X.begin();
        int xr = lower_bound(X.begin(), X.end(), b) - X.begin();
        int y = lower_bound(Y.begin(), Y.end(), c) - Y.begin();
        for (int x = xl+1; x <= xr; x++) {
            V[encode(x, y)][0] = true;
        }
    }
    for (int i = 0; i < M; i++) {
        int d = D[i], e = E[i], f = F[i];
        int x = lower_bound(X.begin(), X.end(), d) - X.begin();
        int yl = lower_bound(Y.begin(), Y.end(), e) - Y.begin();
        int yr = lower_bound(Y.begin(), Y.end(), f) - Y.begin();
        for (int y = yl+1; y <= yr; y++) {
            V[encode(x, y)][1] = true;
        }
    }

    UnionFind uf((Xs+2)*(Ys+2));

    for (int i = 0; i <= Xs; i++) {
        for (int j = 0; j <= Ys; j++) {
            int cur = encode(i, j);
            int s = encode(i+1, j);
            int t = encode(i, j+1);
            if (!V[cur][0]) uf.unite(cur, t);
            if (!V[cur][1]) uf.unite(cur, s);
        }
    }

    int xz = lower_bound(X.begin(), X.end(), 0LL) - X.begin();
    int yz = lower_bound(Y.begin(), Y.end(), 0LL) - Y.begin();
    int Z = encode(xz, yz);

    long long ans = 0;
    for (int i = 0; i <= Xs; i++) {
        for (int j = 0; j <= Ys; j++) {
            int cur = encode(i, j);
            if (!uf.same(cur, Z)) continue;
            if (i == 0 || j == 0 || i == Xs || j == Ys) {
                cout << "INF\n";
                return 0;
            }
            ans += (X[i] - X[i-1]) * (Y[j] - Y[j-1]);
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 56236
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int T = 1;
            while (T-- > 0)
            {
                solveOne(in, out);
            }
        }

        private void solveOne(Scanner in, PrintWriter out)
        {
            int D = in.nextInt(), T = in.nextInt(), S = in.nextInt();
            if ((double) D / S <= T)
            {
                out.print("Yes");
            } else
            {
                out.print("No");
            }
        }

    }
}



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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
#define check cout<<"?\n";
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    int n; cin >> n;
    vector<ld> v(n);
    ld ans = 0;
    for(int i = 0; i < n; ++i){
        cin >> v[i];
        ans += (1/v[i]);
    }
    cout << fixed << setprecision(15);
    return cout << 1/ans << '\n', 0;
}

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

int N,A[200000+10],B[200000+10];

signed main(){
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A[i];
    B[i]=A[i];
  }
  sort(A,A+N);
  for(int i=0;i<N;i++){
    if(B[i]==A[N-1]) cout << A[N-2] << endl;
    else cout << A[N-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 4736
import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int h = Integer.parseInt(sc.next());
            int w = Integer.parseInt(sc.next());
            int[][] list = new int[h][w];
            int[][] list2 = new int[h][w];
            int bcounter = 0;
            int counter = 1;
            
            for(int i=0; i<h; i++){
            	String a = sc.next();
            	for(int j=0; j<w; j++){
            		list2[i][j] = h*w+1;
            		if(a.substring(j,j+1).equals("#")){
            			list[i][j] = 1;
            			bcounter++;
            		}else{
            			list[i][j] = 0;	
            		}
            	}
            }
            list2[0][0] = 1;
            while(counter != 0){
            	counter = 0;
            	for(int i=0; i<h; i++){
                	for(int j=0; j<w; j++){
                		if(list[i][j] == 0){
                			int a = 1 + Math.min(Math.min(list2[Math.max(0, i-1)][j], list2[Math.min(h-1, i+1)][j]), Math.min(list2[i][Math.max(0, j-1)], list2[i][Math.min(w-1, j+1)]));
                			if(list2[i][j] > a){
                				counter++;
                				list2[i][j] = a;
                			}
                		}
                	}
                }
            }
            
            //出力
            System.out.println(Math.max(-1, h*w - list2[h-1][w-1] - bcounter));
            sc.close();
        }
    }

Measured memory_bytes: 23764
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		int[] tr=new int[N];
		for(int i=0; i<N; i++) {
			tr[i]=sc.nextInt();
		}
		Arrays.sort(tr);
		int max=Integer.MAX_VALUE;

		for(int i=0; i<=N-K; i++) {
			max=Math.min(max, tr[K-1+i]-tr[i]);
		}
		System.out.println(max);
	}
}

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

ll gcd(ll a, ll b) {
  if (a < b)
    gcd(b, a);
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

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

  ll x, y;
  cin >> x >> y;
  cout << gcd(x, y) << endl;
}



Measured memory_bytes: 3168
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [0] * N
    for a in A:
        B[a-1] += 1
    print("\n".join(map(str, B)))

    return 0

if __name__ == "__main__":
    solve()

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

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

    for (int x = 1; x <= count; x++) {
        long long  n;
        cin >> n;
        stringstream ss;
        ss << n;
        cout << "Case " << x << ":" << endl;
        for (int i = 0; i < 10; i++) {
            n *= n;
            n /= 100;
            int j = 0;
            int k = 1;
            int tmp = 0;
            while (j < 4) {
                tmp += (n % 10) * k;
                k *= 10;
                n /= 10;
                j++;
            }
            n =  tmp;
            cout << tmp << endl;
        }
    }

    return 0;
}

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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    n++;
    int digit = log10(n);
    int msd = n / (ll)pow(10, digit);
    cout << digit * 9 + msd - 1 << ln;
    return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int h,w;
	cin >>h >>w;
	vector<string> ba(h);
	rep(i, h) cin >>ba[i];
	
	vector<VL> ysm(h, VL(w));
	rep(i, h){
		rep(j, w){
			if(ba[i][j]=='#') ysm[i][j]=0;
			else if(j==0) ysm[i][j] =1;
			else ysm[i][j] = ysm[i][j-1]+1; 
		}
		repr(j, w-1,1){
			if(ysm[i][j]==0 || ysm[i][j-1]==0) continue;
			if(ysm[i][j] > ysm[i][j-1]) ysm[i][j-1]=ysm[i][j];
		}
	}
	//for(auto xl: ysm){for(auto x :xl) printf("%d, ",x); puts("");}
	vector<VL> xsm(h, VL(w));
	rep(i, w){
		rep(j, h){
			if(ba[j][i]=='#') xsm[j][i]=0;
			else if(j==0) xsm[j][i] =1;
			else xsm[j][i] = xsm[j-1][i]+1; 
		}
		repr(j, h-1,1){
			if(xsm[j][i]==0 || xsm[j-1][i]==0) continue;
			if(xsm[j][i] > xsm[j-1][i]) xsm[j-1][i]=xsm[j][i];
		}
	}

	ll ans = 0;
	rep(i,h) rep(j,w) if(ba[i][j]!='#'){
		ans = max(ans, ysm[i][j] + xsm[i][j] -1);
	}

	cout << ans <<"\n";
}


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

using namespace std;

typedef long long ll;
#define mems(p) memset(p,-1,sizeof(p))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"

const int mxN = 1e5;
const ll MOD = 1e9 + 7;

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

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

bool sorter(ll a, ll b) {
	return a > b;
}

int main() {
	fast();
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	sort(a.begin(),a.end(),sorter);
	ll comf = 0;
	comf += a[0];
	int toUse = n - 2;
	for (int i = 1; i < n; ++i) {
		if (toUse > 0) {
			comf += a[i] * min(2, toUse);
			toUse -= 2;
		} else {
			break;
		}
	}
	cout << comf << nl;
}

Measured memory_bytes: 4780
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from operator import itemgetter
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'



def main():
    S = input()
    if S == 'RSR':
        print(1)
    else:
        print(S.count('R'))







main()



Measured memory_bytes: 9888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}

int main(){
    ll k;cin>>k;
    if(k%2==0){
        cout<<-1<<endl;
        return 0;
    }

    ll ans=1,num=7;
    while(num%k!=0){
        num=(10*num+7)%k;
        ans++;
        if(ans>2*1e6){
            cout<<-1<<endl;
            return 0;
        }
    }

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

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

int main() {
	string ab = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", s;
	int n;
	cin >> n >> s;
	for(int i = 0; i < s.size(); i++) {
		s[i] = ab[int(s[i]-'A')+n];
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
lista = list(map(int, input().split()))
c = 0
for i in lista:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            c += 1
            break
if c == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 2940
#include <stdio.h>

int main()
{
    int i, n, debt = 100000;
    scanf("%d", &n);

    for(i = 0; i < n; i++)
    {
        debt += 0.05*debt;
        if(debt % 1000)
        {
            debt = debt - debt % 1000 + 1000;
        }
    }
    printf("%d\n", debt);
    return 0;
}



Measured memory_bytes: 2568
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll d; cin >> d;
    vector<ll> c(26);
    rep(i, 26){
        cin >> c[i];
    }
    vector<vector<ll>> vec(d, vector<ll>(26));
    rep(i, d){
        rep(j, 26){
            cin >> vec[i][j];
        }
    }

    /*
    vector<ll> t(d);
    rep(i, d){
        cin >> t[i];
        t[i]--;
    }
    */

    ll ans = 0;
    vector<ll> last(26);

    rep(i, d){

        ll max_value = -1;
        ll contest_type = -1;
        rep(j, 26){
            if(max_value < vec[i][j]){
                max_value = vec[i][j];
                contest_type = j;
            }
            /*
            if(t[i] == j){
                ans += vec[i][j];
                last[j] = 0;
            }else{
                last[j]++;
            }
            */
        }

        ans += max_value;

        rep(j, 26){
            if(j == contest_type){
                last[j] = 0;
            }else{
                last[j]++;
            }
        }

        rep(j, 26){
            ans -= c[j]*last[j];
        }

        cout << contest_type+1 << endl;
    }


}

Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{

    int n; cin >> n;
    vector<int> s(n);
    int total = 0;
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        total += s[i];
    }

    if (total % 10 == 0) { 
        sort(s.begin(), s.end());
        for (auto x : s) {
            if (x % 10) {
                total -= x;
                break;
            }
        }
    }

    if (total % 10 == 0) total = 0;
    cout << total << endl;

    return 0;
}



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

int main() {
  
  int N; cin >> N;
  
  vector<double> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  sort(vec.begin(), vec.end());
  
  double tmp = vec.front();
  
  for (int i = 1; i < N; i++) tmp = (tmp + vec[i]) / 2;
  
  cout << fixed << setprecision(10);
  
  cout << tmp << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
string s[N];
char ans[N];
int n,a,b,c;
void dfs(int id,int a,int b,int c){
    if(a<0 || b<0 || c<0) return;
    if(id==n){
        puts("Yes");
        for(int i=0;i<n;i++) cout<<ans[i]<<endl;
        exit(0);
    }
    else{
        if(s[id]=="AB"){
            ans[id]='A';
            dfs(id+1,a+1,b-1,c);
            ans[id]='B';
            dfs(id+1,a-1,b+1,c);
        }
        else if(s[id]=="AC"){
            ans[id]='A';
            dfs(id+1,a+1,b,c-1);
            ans[id]='C';
            dfs(id+1,a-1,b,c+1);
        }
        else if(s[id]=="BC"){
            ans[id]='B';
            dfs(id+1,a,b+1,c-1);
            ans[id]='C';
            dfs(id+1,a,b-1,c+1);
        }
    }
}
main()
{
    cin>>n>>a>>b>>c;
    for(int i=0;i<n;i++) cin>>s[i];
    dfs(0,a,b,c);
    puts("No");
    return 0;
}


Measured memory_bytes: 14644
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

int main(void){
  fast_io
  int n,k;cin>>n>>k;
  ll a[n];
  rep(i,n){
    cin>>a[i];
  }
  vector<ll> b;
  rep(i,n){
    ll sum = 0;
    rep(j,n){
      if(j<i) continue;
      sum += a[j];
      b.push_back(sum);
    }
  }




  ll ans = 0;
  REP(bit, 50){
    ans = ans<<1;
    ll count = 0;
    vector<ll> b2;
    rep(i,b.size()){
      if((b[i]>>bit)&1){
        count++;
        b2.push_back(b[i]);
      }
    }
    if(count >= k){
      b = b2;
      ans += 1;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6512