akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
#include<cstdint>
//#include<>
using namespace std;

typedef int64_t i64;typedef int32_t i32;
typedef int16_t i16;typedef int8_t i8;
typedef uint64_t ui64;typedef uint32_t ui32;
typedef uint16_t ui16;typedef uint8_t ui8;

typedef i32 int__;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define repeat_eq(i,j,k) for(int__ i=(j);i<=(k);i++)
#define all(v) begin(v),end(v)

const i32 INF=1<<30;//=10E10
int h;

void drop(vector< vector<int> > &vv ){
  rep(y,h-1){
    rep(x,5){
      while(vv[y][x]==-1){
	for(int yy=y;yy<h-1;yy++){
	  vv[yy][x]=vv[yy+1][x];
	}
	vv[h-1][x]=-3;
      }
    }
  }
};

int del( vector< vector<int> > &vv){
  int ans=0;
  rep(y,h){
    int seq=0,pre=-2;
    int i;
    for(i=0;i<5;i++){
      if(pre==vv[y][i])++seq;
      else{
	if(seq>=3)break;
	seq=1;
	if(vv[y][i]!=-1 && vv[y][i]!=-3)
	  pre=vv[y][i];
	else
	  pre=-2;
      }
    }
    if(seq>=3){
      rep(j,seq){
	vv[y][i-j-1]=-1;
      }
      ans+=seq*pre;
    }
  }
  return ans;
}

int main()
{
  while(true){
    cin>>h;
    if(h==0)break;

    vector< vector<int> > pazzle(h,vector<int>(5,-1));

    rep(i,h){
      rep(j,5)
	cin>>pazzle[h-i-1][j];
    }
    
    int ans=0;
    int scr=0;
    while( (scr=del(pazzle)) >0 ){
      ans+=scr;
      drop(pazzle);
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

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

    int ans = INF;

    for (int i = 0, j = k-1; j < n; i++, j++) {
        int tmp = INF;
        if (data[j] < 0) {
            tmp = -data[i];
        } else if (data[i] > 0) {
            tmp = data[j];
        } else if (data[j] == 0 || data[i] == 0) {
            tmp = max(-data[i], data[j]);
        } else {
            tmp = min(data[i] * -2 + data[j], -data[i] + data[j] * 2);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
    

    return 0;
}









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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

int main()
{
    ll n,sum = 0,tmp = 0;
    cin >> n;
    vll a(n),x(n);
    rep(i,n){
        cin >> a[i];
        sum += a[i];

        if(i % 2 == 1)tmp += a[i];
    }

    x[0] = sum - 2*tmp;
    cout << x[0] << " ";

    REP(i,1,n){
        x[i] = 2 * a[i-1] - x[i-1];
        cout << x[i] << " ";
    }
    cout << endl;
    
    return 0;
}

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



int main(){
  
  int64_t x;
  cin>>x;
  
  int year=0;
  int64_t sta=100;
  long double kak=1.01;
  while(true){
    year+=1;
    sta*=kak;
    if(sta>=x) break;
  }
  
  cout<<year<<endl;
}

Measured memory_bytes: 3608
n = int(input())
a = list(map(int, input().split()))

ans = 0
mod = 10**9+7
for i in range(60):
  cnt_zero = 0
  cnt_one = 0
  for j in range(n):
    if a[j] >> i & 1:
      cnt_one += 1
    else:
      cnt_zero += 1
  ans += 2**i*cnt_zero*cnt_one
  ans %= mod
print(ans)

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

#define FOR(n) for(int i=0;i<n;i++)
#define ll long long

ll mob=1000000007;

using namespace std;
int main()
{ int n;
 cin>>n;
 char a[51];int k=0;
 cin>>a;

 FOR(n-2)
 {if(a[i]=='A'&& a[i+1]=='B'&& a[i+2]=='C') k++;
   else continue;
 
 }
cout<<k;




return 0;
}



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

const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  ll ans = 0;
  rep(i,60){
      ll x = 0;
      rep(j,n) if(a[j]>>i&1) x++;
      ll now  = x * (n-x) % mod;
      rep(j,i) now = now*2%mod;
      ans += now;
      ans %= mod;
  }
    cout << ans << endl;
  return 0;
}


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

int main(){
	ll x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	vector<ll> p(a);
	vector<ll> q(b);
	vector<ll> r(c);
	rep(i,a) cin >> p[i];
	rep(i,b) cin >> q[i];
	rep(i,c) cin >> r[i];
	sort(p.begin(), p.end());
	sort(q.begin(), q.end());
	sort(r.begin(), r.end());
	reverse(p.begin(),p.end());
	reverse(q.begin(),q.end());
	reverse(r.begin(),r.end());
	vector<int> temp;
	rep(i,min(x,a)){
		temp.push_back(p[i]);
	}
	rep(i,min(y,b)){
		temp.push_back(q[i]);
	}
	rep(i,c){
		temp.push_back(r[i]);
	}
	sort(temp.begin(),temp.end());
	reverse(temp.begin(),temp.end());
	ll ans = 0;
	rep(i,x+y){
		ans += temp[i];
	}
	cout << ans << endl;
    return 0;
}



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

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

const int mod1 = 1e9 + 7, mod2 = 1e9 + 9;
const int MN = 250010;
const int P = 1e6 + 7;

int exp(int x, int n, int mod) {
    int ret = 1;
    while(n) {
        if(n & 1) ret = 1LL * ret * x % mod;
        x = 1LL * x * x % mod;
        n >>= 1;
    }
    return ret;
}
int inv(int x, int mod) {
    return exp(x, mod - 2, mod);
}
int po1[MN << 1], po2[MN << 1];

int N;
char S[MN];
int A[MN << 1];
map<pii, int> cnt;

int main() {
    po1[0] = 1;
    for(int i = 1; i < (MN << 1); i++) {
        po1[i] = 1LL * po1[i - 1] * P % mod1;
    }
    po2[0] = 1;
    for(int i = 1; i < (MN << 1); i++) {
        po2[i] = 1LL * po2[i - 1] * P % mod2;
    }

    scanf("%d", &N);

    scanf("\n");
    for(int i = 0; i < N; i++) {
        scanf("%c", &S[i]);
    }

    int pos = MN;
    for(int i = 0; i < N; i++) {
        if(S[i] == '+') A[pos]++;
        if(S[i] == '-') A[pos]--;
        if(S[i] == '<') pos--;
        if(S[i] == '>') pos++;
    }

    int hval1 = 0;
    int hval2 = 0;
    for(int i = 0; i < (MN << 1); i++) {
        hval1 += 1LL * (A[i] + mod1) % mod1 * po1[i] % mod1;
        hval1 %= mod1;
        hval2 += 1LL * (A[i] + mod2) % mod2 * po2[i] % mod2;
        hval2 %= mod2;
    }

    int a1 = 1, b1 = 0;
    int a2 = 1, b2 = 0;
    ll ans = 0;
    for(int i = N - 1; i >= 0; i--) {

        int p1 = 1LL * (mod1 - b1) * inv(a1, mod1) % mod1;
        int p2 = 1LL * (mod2 - b2) * inv(a2, mod2) % mod2;
        cnt[ {p1, p2} ]++;

        if(S[i] == '+') {
            b1 += po1[MN];
            b1 %= mod1;
            b2 += po2[MN];
            b2 %= mod2;
        }
        if(S[i] == '-') {
            b1 += mod1 - po1[MN];
            b1 %= mod1;
            b2 += mod2 - po2[MN];
            b2 %= mod2;
        }
        if(S[i] == '<') {
            a1 = 1LL * a1 * inv(P, mod1) % mod1;
            b1 = 1LL * b1 * inv(P, mod1) % mod1;
            a2 = 1LL * a2 * inv(P, mod2) % mod2;
            b2 = 1LL * b2 * inv(P, mod2) % mod2;
        }
        if(S[i] == '>') {
            a1 = 1LL * a1 * P % mod1;
            b1 = 1LL * b1 * P % mod1;
            a2 = 1LL * a2 * P % mod2;
            b2 = 1LL * b2 * P % mod2;
        }

        p1 = 1LL * (hval1 + mod1 - b1) * inv(a1, mod1) % mod1;
        p2 = 1LL * (hval2 + mod2 - b2) * inv(a2, mod2) % mod2;
        ans += cnt[ {p1, p2} ];
    }

    printf("%lld", ans);
}


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

        using namespace std;

        #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define FOR(i,a,b) for(int i = (a); i < (b); i++)
        #define rep(i,n) FOR(i,0,n)
        #define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
        #define ITER(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
        #define FILL(a,value) memset(a, value, sizeof(a))

        #define SZ(a) (int)a.size()
        #define ALL(a) a.begin(),a.end()
        #define PB push_back
        #define MP make_pair
        #define in insert
        #define er erase
        #define fs first
        #define sc second


        typedef long long LL;
        typedef vector<int> VI;

        typedef vector<bool> VB;
        typedef vector<LL> VL;
        typedef pair<int,int> PII;
        typedef pair<LL,LL> PLL;
        typedef vector<PII> VPI;
        typedef vector<VL>VVL;
        typedef vector<VI>VVI;
        typedef vector<string>VS;

        typedef vector<vector<PII>> VVPI;
        typedef vector<vector<PLL>> VVPL;



        const double PI = acos(-1.0);
        const int INF = 1000 * 1000 * 1000 + 7;
        const LL LINF = INF * (LL)INF;

        const int MAX = 305;

        const int MAS = 1e5 + 10 ;
        const int MOD = 1000 * 1000 * 1000 + 7;
        const double EPS = 1e-8;



        int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            //  freopen("skateboard.in","r",stdin);
            //  freopen("skateboard.out","w",stdout);
               string   k ;
               cin >> k ;
               int len =SZ(k);
               int d;
               cin >> d;
               vector<vector<int >> dp(d,vector<int> (2));

               dp[0][0] = 1;
               FOR(i,0,len)
                {
                   vector<vector<int >>new_dp(d,vector<int > (2));
                   rep(rem,d) {
                       for (bool ws : {false, true})
                       {
                           rep(digit,10)
                           {
                               if(digit > k[i] - '0' && !ws) {
                                   break;
                               }
                               new_dp[(rem + digit)%d][ws || (digit < k[i] - '0')] +=dp[rem][ws];
                               new_dp[(rem + digit)%d][ws || (digit < k[i] - '0')]%=MOD;
                           }
                       }

                   }
                   dp = new_dp;
               }
               int ans = (dp[0][0] + dp[0][1])%MOD;
               ans--;
               if(ans == -1 )
               {
                   ans = MOD-1;
               }
               cout << ans << endl;
        }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main(){
    ll a,b;
    cin >> a >> b;
    a--;
    ll now=1;
    int ed_a=0;
    int ed_b=0;
    vector<ll>bin_a(120,0);
    vector<ll>bin_b(120,0);
    while(now<=a){
        ll x=a-(now-1);
        ll p=x/(now*2);
        ll r=x%(now*2);
        if(r>now)r=now;
        bin_a[ed_a]=p*now+r;
        ed_a++;
        now*=2;
    }
    now=1;
    while(now<=b){
        ll x=b-(now-1);
        ll p=x/(now*2);
        ll r=x%(now*2);
        if(r>now)r=now;
        bin_b[ed_b]=p*now+r;
        ed_b++;
        now*=2;
    }
    rep(i,120) bin_b[i]+=bin_a[i];
    ll keta=1;
    ll ans=0;
    rep(i,ed_b){
        if(bin_b[i]%2==1) ans+=keta;
        keta*=2;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N;
    cin >> N;

    ll cn = 0;
    ll cn2 = 0;
    for(ll i = 0; i < N; i++){
        ll t; cin >> t;
        vec.push_back(t);
        if(t % 2 == 0 ){
            cn2++;
            if(t % 3 == 0 || t % 5 == 0){
                cn++;
                //cout << "APPROVED" << endl;
            }else{
                //cout << "DENIED" << endl;
            }
        }else{
            //cout << "DENIED" << endl;
        }
    }

    if(cn == cn2){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }

}


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

int main()
{
    int n;
    char c;
    set<char> s;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> c;
        s.insert(c);
    }
    if(s.size()==3) cout << "Three\n";
    else cout << "Four\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
	int a, 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: 2096
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 30;
const double eps = 1e-6;

string s, t;
int g[N][N];

int main()
{
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++)
    {
        int a = s[i] - 'a', b = t[i] - 'a';
        g[a][b] = 1;
    }

    bool flag = true;
    for(int i = 0; i < 26; i++)
    {
        int cnt = 0;
        for(int j = 0; j < 26; j++)
            if(g[i][j]) cnt++;
        if(cnt > 1) flag = false;

        cnt = 0;
        for(int j = 0; j < 26; j++)
            if(g[j][i]) cnt++;
        if(cnt > 1) flag = false;
    }

    if(flag) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 776
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		List<Rec> list = new ArrayList<Rec>();
		for (int h = 1; h <= 150; h++) {
			for (int w = h + 1; w <= 150; w++) {
				list.add(new Rec(h, w));
			}
		}
		Collections.sort(list);
		Scanner sc = new Scanner(System.in);
		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if (h == 0)
				break;
			int x = h * h + w * w;
			int i = list.indexOf(new Rec(h, w));
			Rec l = list.get(i+1);
			System.out.println(l.h + " " + l.w);
		}
	}
}

class Rec implements Comparable<Rec> {
	int h, w;
	int x;

	Rec(int h, int w) {
		this.h = h;
		this.w = w;
		x = h * h + w * w;
	}

	@Override
	public int compareTo(Rec o) {
		if (x == o.x) {
			if (h == o.h)
				return 0;
			else if (h > o.h)
				return 1;
			else
				return -1;
		} else if (x > o.x)
			return 1;
		else
			return -1;
//		return Integer.compare(x, o.x);
	}
	
	@Override
	public boolean equals(Object obj) {
		return ((Rec)obj).h == h && ((Rec)obj).w == w;
	}
}

Measured memory_bytes: 32880
using System;
using static System.Console;
using System.Collections.Generic;

namespace abc176
{
    class Program
    {
        static void Main()
        {
            var hwm = ReadLine().Split(' ');
            var h = int.Parse(hwm[0]);
            var w = int.Parse(hwm[1]);
            var m = int.Parse(hwm[2]);

            var hList = new int[h + 1];
            var wList = new int[w + 1];
            var set = new HashSet<long>();

            for (var i = 0; i < m; ++i)
            {
                var a = ReadLine().Split(' ');
                var ah = int.Parse(a[0]);
                var aw = int.Parse(a[1]);
                ++hList[ah];
                ++wList[aw];
                set.Add(ah * 1000000L + aw);
            }

            WriteLine(Count(h, w, hList, wList, set));
        }
        static int Count(int h, int w, int[] hList, int[] wList, HashSet<long> set)
        {
            var maxH = 0;
            for (var i = 1; i <= h; ++i)
            {
                maxH = Math.Max(maxH, hList[i]);
            }
            var maxW = 0;
            for (var i = 1; i <= w; ++i)
            {
                maxW = Math.Max(maxW, wList[i]);
            }
            var maxHList = new List<int>();
            for (var i = 0; i <= h; ++i)
            {
                if (hList[i] == maxH)
                {
                    maxHList.Add(i);
                }
            }
            var maxWList = new List<int>();
            for (var i = 0; i <= w; ++i)
            {
                if (wList[i] == maxW)
                {
                    maxWList.Add(i);
                }
            }

            foreach (var hi in maxHList)
            {
                foreach (var wi in maxWList)
                {
                    if (!set.Contains(hi * 1000000L + wi))
                    {
                        return maxH + maxW;
                    }
                }
            }
            return maxH + maxW - 1;
        }
    }
}


Measured memory_bytes: 56512
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    ll H, A;
    in >> H >> A;
    ll ans = (H + A - 1) / A;
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

char c;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> c;
	if(c >= 'A' && c <= 'Z') cout << "A" << endl;
	else cout << "a" << endl;
	
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int a;
  cin >> a;
  cout << 3 * a * a << endl;
}


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

int main(){
  int sx,sy,tx,ty,xcount=0,ycount=0;
  cin>>sx>>sy>>tx>>ty;
  for(int i=0;sx<tx;i++){
    xcount++;
    sx++;
    cout<<'R';
  }while(sy<ty){
    ycount++;
    sy++;
    cout<<'U';
  }for(int i=0;i<xcount;i++){
    cout<<'L';
  }for(int i=0;i<ycount;i++){
    cout<<'D';
  }cout<<'D';
  for(int i=0;i<=xcount;i++){
    cout<<'R';
  }for(int i=0;i<=ycount;i++){
    cout<<'U';
  }cout<<'L'<<'U';
  for(int i=0;i<=xcount;i++){
    cout<<'L';
  }for(int i=0;i<=ycount;i++){
    cout<<'D';
  }cout<<'R'<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 5e3 + 5;
const ll linf = 0x3f3f3f3f3f3f3f3f;

int p[MAXN], c[MAXN];

int main(void)
{
	int n,d;
	scanf("%d%d",&n,&d);
	for(int i=1; i<=n; ++i) scanf("%d",&p[i]);
	for(int i=1; i<=n; ++i) scanf("%d",&c[i]);
	
	ll ans = -linf;
	for(int i=1; i<=n; ++i)
		ans = max(ans, (ll)c[i]);
	
	static bool vis[MAXN];
	for(int k=1; k<=n; ++k) if(!vis[k])
	{
		int tmp = k;
		vector<int> a;
		while(!vis[tmp])
		{
			vis[tmp] = 1;
			a.push_back(c[tmp]);
			tmp = p[tmp];
		}
		
		ll sum = 0;
		for(int i=0; i<(int)a.size(); ++i)
			sum += a[i];
		
		for(int i=0; i<(int)a.size(); ++i)
		{
			ll now = 0;
			for(int j=1; j<=d && j<=(int)a.size(); ++j)
			{
				now += a[(i+j)%(int)a.size()];
				ll res = sum>0? (d-j)/(int)a.size() * sum: 0;
				
				ans = max(ans, now + res);
			}
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3316
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let it = stdin.lock().bytes().map(|c| c.unwrap() as char);
    let (fs, ft) = (|c: &char| c.is_whitespace(), |c: &char| !c.is_whitespace());
    let token = it.skip_while(fs).take_while(ft).collect::<String>();
    token.parse().ok().unwrap()
}
#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    f(std::io::BufWriter::new(out.lock()));
}
#[allow(unused_macros)]
macro_rules! debug {
    ($($var:expr),*) => { #[cfg(debug_assertions)] {
        $({ match &$var { v => eprint!("{}={:?} ", stringify!($var), v) } })*
        eprintln!();
    }};
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();
    let k: usize = input();

    let mut t = vec![0; 26];
    for &c in &s {
        let i = (c as u8 - b'a') as usize;
        t[i] += 1;
    }

    let mut u = vec![];
    for (i, _) in t.iter().enumerate().filter(|&(_, c)| *c > 0) {
        let c = char::from(b'a' + i as u8);
        for j in 0..s.len() {
            if s[j] != c {
                continue;
            }
            let mut p = 0;
            while j + p < s.len() && p < k {
                u.push(s[j..j + p + 1].iter().cloned().collect::<String>());
                p += 1;
            }
        }
        u.sort();
        u.dedup();
        if u.len() >= k {
            break;
        }
    }

    u.sort();
    debug!(u);
    println!("{}", u[k - 1]);
}


Measured memory_bytes: 6396
n = int(input())
point_f = (0, 0, 0)
for i in range(n):
  point = list(map(int, input().split()))
  diff = point[0] - point_f[0] - abs(point[1] + point[2] - point_f[1] - point_f[2])
  if (diff >= 0 and diff % 2 == 0):
    if i == n - 1:
      print("Yes")
    else:
      continue
  else:
    print("No")
    break


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

int main() {
  
  int A;
  int B;
  int K;
  int J;
  int num = 0;
  int a = 0;
  
  cin >> A >> B >> K;
  
  if(A <= B){
  for(int i = 1;i < A + 1;++i){
    if(A % i == 0 && B % i == 0){
      num++;
    }
  }
  }
  else{
  for(int i = 1;i < B + 1;++i){
    if(A % i == 0 && B % i == 0){
      num++;
    }
  }
  }
  
  vector<int> S(num);
  
  if(A <= B){
  for(int i = 1;i < A + 1;++i){
    if(A % i == 0 && B % i == 0){
          S[a] = i;
      a++;
    }
  }
  }
  else{
  for(int i = 1;i < B + 1;++i){
    if(A % i == 0 && B % i == 0){
          S[a] = i;
      a++;
    }
  }
  }
    
  reverse(S.begin(),S.end());
  
  cout << S[K - 1] << endl;
  
}



Measured memory_bytes: 256
import bisect
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A = sorted(A)
C = sorted(C)
ans = 0
for b in B:
  aind = bisect.bisect_left(A, b)
  bind = bisect.bisect_right(C, b)
  ans += aind*(N-bind)
print(ans)

Measured memory_bytes: 22592
n,m=map(int,input().split())

py=[]
#初期値が0の辞書

p2year = [[] for _ in range(n+1)]

for _ in range(m):
    p,y=map(int,input().split())
    py.append((p,y))
    p2year[p].append(y)

#初期値が0の辞書
from collections import defaultdict
py2index = defaultdict(lambda: 0) 

for item in range(n+1):
    p2year[item].sort()
    for index,temp in enumerate(p2year[item]):
        py2index[(item,temp)]=index+1

for item in py:
    pp=item[0]
    yy=item[1]
    result=str(pp).zfill(6)+str((py2index[(pp,yy)])).zfill(6)
    print(result)



Measured memory_bytes: 83232
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n; cin>>n;
	long long cnt=0;
	for(int i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0)
			cnt+=i;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int h, w, n;
    cin >> h >> w >> n;
    vector<vector<int> > v(h, vector<int>(w, -1));
    int tmp = 0;
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            char c;
            cin >> c;
            if(c == '#'){
                ++ tmp;
                v[y][x] = tmp;
            }
        }
    }
    
    for(int y=0; y<h; ++y){
        for(int x=1; x<w; ++x){
            if(v[y][x] == -1)
                v[y][x] = v[y][x-1];
        }
    }
    for(int y=0; y<h; ++y){
        for(int x=w-2; x>=0; --x){
            if(v[y][x] == -1)
                v[y][x] = v[y][x+1];
        }
    }
    for(int y=1; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(v[y][x] == -1)
                v[y][x] = v[y-1][x];
        }
    }
    for(int y=h-2; y>=0; --y){
        for(int x=0; x<w; ++x){
            if(v[y][x] == -1)
                v[y][x] = v[y+1][x];
        }
    }
    
    for(int y=0; y<h; ++y){
        cout << v[y][0];
        for(int x=1; x<w; ++x)
            cout << ' ' << v[y][x];
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
	using namespace std;
	#define mp make_pair
	#define ll long long
	#define pb push_back
	#define mp make_pair
	#define M LONG_LONG_MAX
	#define IM INT_MAX
	#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int32_t main()
    {
		IOS;
	    string s;
	    ll n,l,i,j;
	    cin>>n>>l;
	    ll a[n+1];
	    ll x=0,y=10000000,z;
	    for(i=1;i<=n;i++)
	    {
	        a[i]=l+i-1;
	        x+=a[i];
	        if(abs(a[i])<y)
	        {
	            y=abs(a[i]);
	            z=a[i];
	        }
	    }
	    cout<<x-z;
	}

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

int main(){
    int n, a;
    cin >> n;

    vector<int> p;
    for(int i = 0; i < n; i++){
        cin >> a;
        p.push_back(a);
    }

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

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

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()
    val A = na(N)
    val C = mutable.Map[Int, Int]().withDefaultValue(0)
    val S = mutable.Set[Int]()
    REP(N) { i =>
      C(A(i)) = C(A(i)) +  1
      S += A(i)
    }

    var ans = 0
    // 大きいほうからどんよくに
    REP_r(30, 1) { k =>
      val sum = 1 << k
      S.foreach { a =>
        val b = sum - a
        if (C(a) > 0 && C(b) > 0) {
          if (a == b) {
            val cnt = C(a) / 2
            ans += cnt
            C(a) = C(a) + cnt
          } else {
            val cnt = min(C(b), C(a))
            ans += cnt
            C(a) = C(a) - cnt
            C(b) = C(b) - cnt
          }
        }
      }
    }

    out.println(ans)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

Measured memory_bytes: 131172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin  >> n;
    ll ans = 0;
    REP(i,1,n+1)
    {
        if (i%3==0 || i%5==0)
        {
            continue;
        }
        else
        {
            ans += i;
        }
        
    }
    cout << ans << endl;
    
}




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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    int A, B, C, D; cin >> A >> B >> C >> D;

    int cnt = 0;
    int res = 0;

    REP(i, 101) {
        if(i == A) {
            cnt++;
        }

        if(i == C) {
            cnt++;
        }

        if(i == B || i == D) {
            cnt--;
        }

        if(cnt == 2) {
            res++;
        }
    }

    cout << res << endl;
}

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

using namespace std;

int main() {
	const double pi = 3.14159265359;
	double r, area, circumf;

	cin >> r;

	area = pi * r * r;
	circumf = 2 * pi * r;

	printf("%lf %lf", area, circumf);

	return 0;
}


Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define in1(n) cin>>n;
#define in2(n, k) cin>>n>>k;
#define in3(n, k, s) cin>>n>>k>>s;
#define scn(t) scanf("%d", &t)
#define scnld(t) scanf("%ld", &t)
#define scnlld(t) scanf("%lld", &t)
#define scnc(t) scanf("%c", &t)
#define scns(t) scanf("%s", t)
#define scnf(t) scanf("%f", &t)
#define scnlf(t) scanf("%lf", &t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define nloop(i, j, k, in) for (int i = j; i < k; i += in)
#define rloop(i, j, k, in) for (int i = j; i >= k; i -= in)
#define rep(i, j) nloop(i, 0, j, 1)
#define rrep(i, j) rloop(i, j, 0, 1)
#define inar(n, a) \
    rep(i, n)\
        cin>>a[i];
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert(B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define fast  \
    ios_base::sync_with_stdio(false);\
    cin.tie(NULL);
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
const double pi = acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

int main()
{
    fast
    string a, b;
    cin>>a>>b;
    rep(i, a.length())
    {
        if(a[i] != b[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}

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

int main()
{
    int n; cin>>n;
    vector<vector<int>> a(2, vector<int>(n));
    for(auto& v: a) for(int& e: v) cin>>e;

    int res=0;
    for(int i=0; i<n; ++i) {
        int x=0;
        for(int j=0; j<=i; ++j) x+=a[0][j];
        for(int j=i; j<n; ++j) x+=a[1][j];
        res=max(res, x);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <math.h>
#include <map>
#include <set>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll INF = 1000000000000000000LL;
using namespace std;

const int MOD = 1000000007;


int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    //setをalphabetの個数分作成
    set<int> st[26];
    REP(i,n)
    {
        int k = s[i] - 'a';
        st[k].insert(i);
    }
    //終端を設定しておく
    REP(d,26)
    {
        st[d].insert(n);
    }
    
    int Q;
    cin >> Q;
    
    REP(i,Q)
    {
        int q;
        cin >> q;
        if(q == 1)
        {
            int l;
            char c;
            cin >> l;
            --l;
            cin >> c;
            if(s[l] != c)
            {
                //元々の要素
                st[s[l] - 'a'].erase(l);
                st[c - 'a'].insert(l);
                s[l] = c;
            }
        }
        else
        {
            int l,r;
            cin >> l >> r;
            --l;--r;
            int res = 0;
            
            REP(d,26)
            {
                //int t = st[d].lower_bound(l) - st[d].begin();
                int t = *st[d].lower_bound(l);
                if(t <= r)++res;
            }
            cout << res << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 24196
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        char[] s = sc.nextLine().toCharArray();
        char[] t = sc.nextLine().toCharArray();
        for(int i = 0; i < s.length; i++) {
            if(s[i]==t[i]) {
                ++ans;
            }
        }
        System.out.println(ans);

    }
}

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

const ll MAX = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;
const double PI=3.1415926535897932;

ll N, K, L, ans=0, tmp=0;
vector<ll> cl1, cl2;
vector<vector<ll>> G1, G2;
string S;
map<pair<ll,ll>, ll> MP;

void bfs1(ll id) {
    queue<ll> Q;
    cl1[id] = tmp;
    Q.push(id);
    while(!Q.empty()) {
        ll u = Q.front();
        Q.pop();
        for(int i=0;i<G1[u].size();i++) {
            if(cl1[G1[u][i]]==-1) {                            
                cl1[G1[u][i]] = tmp;
                Q.push(G1[u][i]);
            }
        }
    }
}

void bfs2(ll id) {
    queue<ll> Q;
    cl2[id] = tmp;
    Q.push(id);
    while(!Q.empty()) {
        ll u = Q.front();
        Q.pop();
        for(int i=0;i<G2[u].size();i++) {
            if(cl2[G2[u][i]]==-1) {                            
                cl2[G2[u][i]] = tmp;
                Q.push(G2[u][i]);
            }
        }
    }
}

signed main(){
    cin >> N >> K >> L;
    G1.resize(N);
    G2.resize(N);
    cl1.resize(N,-1);
    cl2.resize(N,-1);
    for(int i=0;i<K;i++) {
        ll p, q;
        cin >> p >> q;
        p--;
        q--;
        G1[p].push_back(q);
        G1[q].push_back(p);
    }
    for(int i=0;i<L;i++) {
        ll p, q;
        cin >> p >> q;
        p--;
        q--;
        G2[p].push_back(q);
        G2[q].push_back(p);
    }
    vector<set<ll>> S1, S2;
    for(int i=0;i<N;i++) {
        if(cl1[i]==-1) {
            bfs1(i);
            tmp++;
        }
    }
    tmp=0;
    for(int i=0;i<N;i++) {
        if(cl2[i]==-1) {
            bfs2(i);
            tmp++;
        }
    }
    for(int i=0;i<N;i++) {
        MP[make_pair(cl1[i], cl2[i])]++;
    }
    for(int i=0;i<N;i++) {
        cout << MP[make_pair(cl1[i], cl2[i])] << endl;
    }
    return 0;
}

Measured memory_bytes: 32648
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1'000'000'007;
constexpr ll MOD2   = 998'244'353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int dp[100'005];

    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < n; ++i){
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[n - 1] << endl;

return 0;
}


Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,K;
    cin>>A>>B>>K;
    for(int i=0;i<K;i++){
        if(i==0||i%2==0){
            if(A%2!=0) A--;
            A=A/2;
            B+=A;
        }
        if(i%2!=0){
            if(B%2!=0) B--;
            B=B/2;
            A+=B;
        }
    }
    cout<<A<<" "<<B;
}


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

using namespace std;

int main(){
	int xm,n,ans=numeric_limits<int>::min();
	cin >> n;
	cin >> xm;
	for(int i=1;i<n;i++){
		int r;
		cin >> r;
		ans = max(ans,r-xm);
		xm = min(xm,r);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    ll n, k; cin >> n >> k;
    vector<vector<ll>> v(n);
    rep(i, n) {
        ll a, b; cin >> a >> b;
        vector<ll> tmp = {a, b};
        v[i] = tmp;
    }
    sort(ALL(v));
    ll cnt = 0;
    rep(i, n) {
        cnt += v[i][1];
        if (cnt >= k) { cout << v[i][0] << endl; return 0; }
    }
    return 0;
}

Measured memory_bytes: 5760
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int N, h[100000], ans[100000];

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

  ans[0] = 0;
  ans[1] = abs(h[1] - h[0]);
  for (int i = 2; i < N; i++) {
    ans[i] = min(ans[i-1] + abs(h[i-1]-h[i]), ans[i-2] + abs(h[i-2]-h[i]));
  }

  cout << ans[N-1] << endl;
}


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

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

    vector<int> v;
    for(int i = 0; i < 3;  i++) {
        int input;
        cin >> input;
        v.push_back(input);
    }
    iter_swap(v.begin() + 1, v.begin() + 2);
    iter_swap(v.begin() + 0, v.begin() + 1);
    for(auto u : v)
        cout << u << " ";
    cout << "\n";
    return 0;
}


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

using namespace std;

int dx[8] = {1,1,0,-1,-1,-1,0,1},dy[8] = {0,-1,-1,-1,0,1,1,1};
int h,w;
char field[51][51];

int check(int x,int y){
    int ans = 0;
    for(int i = 0;i < 8;i++){
        int nx = x+dx[i],ny = y+dy[i];
        if(nx < 0 || nx >= 51 || ny < 0 || ny >= 51 || field[ny][nx] != '#')continue;
        else ans++;
    }
    return ans;
}

int main(){
    cin >> h >> w;

    for(int i = 0;i < h;i++)
        for(int j = 0;j < w;j++)
            cin >> field[i][j];

    
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            if(field[i][j] == '.'){
                cout << check(j,i);
            }else cout << field[i][j];
        }
        cout << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
# 作れる数の最大は50 * 50 = 2500
# dp[i][j] = i枚使ってjを作れる場合の数

import sys
readline = sys.stdin.readline

N,A = map(int,readline().split())
X = list(map(int,readline().split()))

dp = [[0] * 2501 for i in range(N + 1)]
dp[0][0] = 1

for x in X:
  for i in range(len(dp) - 2, -1, -1):
    for j in range(len(dp[i]) - 1, -1, -1):
      if dp[i][j] == 0:
        continue
      dp[i + 1][j + x] += dp[i][j]
      
ans = 0
for i in range(1, len(dp)):
  for j in range(len(dp[i])):
    if j == i * A:
      ans += dp[i][j]
      
print(ans)

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


int combination(int n, int r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

int main(){
    int N, M;
    cin >> N >> M;//nC2+mC2
    cout << combination(N, 2) + combination(M, 2) << endl;

}



Measured memory_bytes: 256