akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
bool ok(string S) {
	REP(i,S.size()) if (S[i] < 'a' || S[i] > 'z') return false;
	return true;
}
 
int main() {
 
	string S,T; cin >> S >> T;
	vector < string > ans;
 
	REP(i,S.size() - T.size() + 1) {
		string St = S;
		for (int j = i; j < i + T.size(); j++) {
			if (St[j] == '?') {
				St[j] = T[j - i];
			} else if ( St[j] != T[j - i]) goto nxt;
		}
		REP(j,St.size()) if (St[j] == '?') St[j] = 'a';
		if (ok(St)) ans.push_back(St);
		nxt:;
	}
 
	if (ans.size() == 0) {
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
 
	sort(ans.begin(), ans.end());
	cout << ans[0] << endl;
 
	return 0;
}

Measured memory_bytes: 256
'use strict'

const main = (input) => {
    input = input.split('\n')
    const N = parseInt(input[0].split(' ')[0])
    const K = parseInt(input[0].split(' ')[1])
    const arr = input[1].split(' ').map(v => parseInt(v))
    let obj = {}
    for(let i = 0; i < arr.length; i++){
        if(obj[arr[i]] === undefined){
            obj[arr[i]] = 0
        }
        obj[arr[i]]++
    }
    let arr1 = []
    for(let key in obj){
        arr1.push([key, obj[key]])
    }
    arr1.sort((a, b) => a[1] - b[1])
    const arr1Length = arr1.length

    let sum = 0
    for(let i = 0; i < arr1Length - K; i++){
        sum += arr1[i][1]
    }
    console.log(sum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 72656
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  long N,K;
  cin>>N>>K; 
  vector<vector<int>> a(N, vector<int>(2));

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> a.at(i).at(j);
    }
  }
  sort(a.begin(),a.end());
  long to=0;
  for(int i=0;i<N;++i){
    to+=a.at(i).at(1);
    if(to>=K){
      cout<<a.at(i).at(0);
      break;
    }
  }
  
}



Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[])
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	printf("%s\n",(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)) ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

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

        int N = sc.nextInt();
        long C = sc.nextLong();
        long[] x = new long[N];
        int[] v = new int[N];
        for (int i = 0; i < N; ++i) {
            x[i] = sc.nextLong();
            v[i] = sc.nextInt();
        }

        System.out.println(solve(x, v, C));

        sc.close();
    }

    static long solve(long[] x, int[] v, long C) {
        return Math.max(solveFirstClockwise(x, v, C),
                solveFirstClockwise(reverse(Arrays.stream(x).map(xi -> C - xi).toArray()), reverse(v), C));
    }

    static long[] reverse(long[] a) {
        for (int i = 0, j = a.length - 1; i < j; ++i, --j) {
            long temp = a[i];
            a[i] = a[j];
            a[j] = temp;
        }

        return a;
    }

    static int[] reverse(int[] a) {
        for (int i = 0, j = a.length - 1; i < j; ++i, --j) {
            int temp = a[i];
            a[i] = a[j];
            a[j] = temp;
        }

        return a;
    }

    static long solveFirstClockwise(long[] x, int[] v, long C) {
        int N = x.length;

        PriorityQueue<Element> pq = new PriorityQueue<>((e1, e2) -> -Long.compare(e1.gain, e2.gain));
        long counterClockwiseEnergySum = 0;
        for (int i = N - 1; i >= 0; --i) {
            counterClockwiseEnergySum += v[i];
            long gain = counterClockwiseEnergySum - (C - x[i]);

            pq.offer(new Element(x[i], gain));
        }

        long result = Math.max(0, pq.peek().gain);
        long clockwiseEnergySum = 0;
        for (int i = 0; i < N; ++i) {
            clockwiseEnergySum += v[i];
            long balance = clockwiseEnergySum - x[i];

            while (!pq.isEmpty() && pq.peek().clockwiseDistance <= x[i]) {
                pq.poll();
            }
            if (!pq.isEmpty()) {
                balance += Math.max(0, pq.peek().gain - x[i]);
            }

            result = Math.max(result, balance);
        }

        return result;
    }
}

class Element {
    long clockwiseDistance;
    long gain;

    Element(long clockwiseDistance, long gain) {
        this.clockwiseDistance = clockwiseDistance;
        this.gain = gain;
    }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> V(N);
  int ac = 0, pe = 0;
  for (int i = 0; i < M; i++) {
    int p;
    string S;
    cin >> p >> S;
    if (V.at(--p) == -1) continue;
    if (S == "WA") V.at(p)++;
    else ac++, pe += V.at(p), V.at(p) = -1;
  }
  cout << ac << " " << pe << "\n";
}

Measured memory_bytes: 3680
void main()
{
    long n, a, b, c;
    rdVals(n, a, b, c);
    string[] s = n.rdCol!string;

    long[dchar] cnt;
    cnt['A'] = a, cnt['B'] = b, cnt['C'] = c;
    dchar no = 'X';

    dchar calc(long idx)
    {
        dchar x = s[idx][0], y = s[idx][1];
        if (!cnt[x] && !cnt[y]) return no;

        if (cnt[x] < cnt[y])
        {
            ++cnt[x], --cnt[y];
            return x;
        }
        if (cnt[x] > cnt[y])
        {
            --cnt[x], ++cnt[y];
            return y;
        }

        if (idx == n - 1)
        {
            ++cnt[x], --cnt[y];
            return x;
        }
        else
        {
            if (s[idx+1].canFind(x))
            {
                ++cnt[x], --cnt[y];
                return x;
            }
            else
            {
                --cnt[x], ++cnt[y];
                return y;
            }
        }
    }

    string list;
    foreach (i; 0 .. n)
    {
        dchar d = calc(i);
        if (d == no)
        {
            "No".writeln;
            return;
        }
        list ~= d;
    }

    "Yes".writeln;
    foreach (l; list)
    {
        l.writeln;
    }
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 6352
// Create your own template by modifying this file!
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#include <deque>
#include <stack>
#include <functional>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x;  }
void _R(int &x) { scanf("%d", &x);  }
void _R(int64_t &x) { scanf("%lld", &x);  }
void _R(double &x) { scanf("%lf", &x);  }
void _R(char &x) { scanf(" %c", &x);  }
void _R(char *x) { scanf("%s", x);  }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...);  }
template<class T> void _W(const T &x) { cout << x;  }
void _W(const int &x) { printf("%d", x);  }
void _W(const int64_t &x) { printf("%lld", x);  }
void _W(const double &x) { printf("%.16f", x);  }
void _W(const char &x) { putchar(x);  }
void _W(const char *x) { printf("%s", x);  }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' ');  }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...);  }
#ifdef DEBUG
 #define debug(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define debug(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;

void solve() {
    int N, X, T;
    R(N, X, T);
    W((N + X - 1) / X * T);
}

int main() {
#define MULTITEST 0
#if MULTITEST    
    CASET{
        solve();
    }
#else
    solve();
#endif
    return 0;
}



Measured memory_bytes: 3228
#include <stdio.h>
int main()
{
  int a[120];
  int m,n,sum=0,p,sum1=0,sum2=0,p1,p2,suma,sumb;
  scanf("%d",&m);
  for(n=0;n<m;n++)
  {
      scanf("%d",&a[n]);
      sum=sum+a[n];
  }
  p=sum/m;
  sum=0;
  for(n=0;n<m;n++)
    {
      sum=(a[n]-p)*(a[n]-p)+sum;
    }
    p1=p;p2=p;
    suma=sum;sumb=sum;
  while(1)
  {
      p1--;
    sum1=0;
    for(n=0;n<m;n++)
    {
      sum1=(a[n]-p1)*(a[n]-p1)+sum1;
    }
    if(suma>sum1)
        suma=sum1;
    else
        break;
  }
  while(1)
  {
        p2++;
    sum2=0;
    for(n=0;n<m;n++)
    {
      sum2=(a[n]-p2)*(a[n]-p2)+sum2;
    }
    if(sumb>sum2)
        sumb=sum2;
    else
        break;
  }
  if(suma<=sumb)
    printf("%d",suma);
  else
    printf("%d",sumb);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

string match[9] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
ll cost[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
string dp[10001];

void solve(long long N, long long M, vector<long long> A){
	rep(i, N+1) {
		if (i != 0 && dp[i].length() == 0) continue;
		for (auto x : A) {
			string s = dp[i] + match[x-1];
			if (i+cost[x-1] <= N && (dp[i+cost[x-1]].length() < s.length() 
			|| (dp[i+cost[x-1]].length() == s.length() && dp[i+cost[x-1]] < s))) dp[i+cost[x-1]] = s;
		}
	}
	// rep(i, N+1) {
	// 	cout << i << " " << dp[i] << endl;
	// }
	cout << dp[N] << endl;
}

int main(){	
	long long M;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<long long> A(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, M, A);
	return 0;
}



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

using namespace std;

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i =0;i<t;i++)
#define bs(a,x) binary_search(a.begin(),a.end(),x)
#define ll long long int
#define ul unsigned long int
#define ld long double
#define umpi unordered_map<int,int> 
#define umpl unordered_map<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mod 1000000007 
#define N 10000000
#define all(a) a.begin(),a.end()
#define point pair<ll,ll>

const int inf = 1000000007;
const ll linf = 1ll * inf * inf;
const ll MAXIMUM =1000005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll min(ll a, ll b){return a<b?a:b;}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int main()
{
	fio;
	ll n;cin>>n;
	ll k;cin>>k;
	vl h(n);
	f(n)cin>>h[i];
	vl dp(n+1,inf);
	dp[0]=0;
	f(n)
	{
		for(int j=i+1;j<=i+k;j++)
		{
			if(j<n)
			{
				dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
			}
		}
	}
	cout<<dp[n-1]<<"\n";
}

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define pb push_back
#define rep(i, l, n) for (int i = (l); i < n; i++)
#define rep_cs(i, l, n) for (int i = (l); i <= n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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

const int MOD = 1000000007;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

using Graph = vector<vector<int>>;
Graph G;
vector<bool> seen;
void dfs(const Graph &G, int v)
{
    seen[v] = true;

    for (auto next_v : G[v])
    {
        if (seen[next_v])
            continue;
        dfs(G, next_v);
    }
}

ll dp[110][110000] = {0};
vll w(200);
vll v(200);

int main()
{
    ll N, W;
    cin >> N >> W;
    rep(i, 0, N) cin >> w[i] >> v[i];
    rep(i, 0, N)
    {
        rep_cs(sum_weight, 0, W)
        {
            if (sum_weight - w[i] >= 0)
            {
                chmax(dp[i + 1][sum_weight], dp[i][sum_weight - w[i]] + v[i]);
            }
            chmax(dp[i + 1][sum_weight], dp[i][sum_weight]);
        }
    }
    cout << dp[N][W] << endl;
}

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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
	string sep = " ";
	if(v.size()) os << v[0];
	for(int i=1; i<v.size(); i++) os << sep << v[i];
	return os;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
	cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(20) << fixed;

	ll a;
	double b;
	cin >> a >> b;
	b*=100;
	ll c = a*(int)round(b);

	cout << c / 100 << endl;

	return 0;
}


Measured memory_bytes: 3756
<?php
class Dice{
    private $numbers;
    private $directions = [
        "E" => [1 => 3,3 => 6,4 => 1,6 => 4],
        "N" => [1 => 5,2 => 1,5 => 6,6 => 2],
        "S" => [1 => 2,2 => 6,5 => 1,6 => 5],
        "W" => [1 => 4,3 => 1,4 => 6,6 => 3]
    ];
    public function __construct($numbers){
        $this->numbers = $numbers;
    }
    public function roll($direction){
        $pos = $this->numbers;
        foreach($this->directions[$direction] as $before => $after){
            $this->numbers[$after] = $pos[$before];
        }
    }
    public function getNumberTop(){
        return $this->numbers[1];
    }
}
//=========================================
$numbers = explode(" ",getStdin());
$numbers = array_combine(range(1,6),$numbers);
$orders = str_split(getStdin());
$dice = new Dice($numbers);
foreach($orders as $direction){
    $dice->roll($direction);
}
echo $dice->getNumberTop()."\n";

function getStdin(){
    return trim(fgets(STDIN));
}

Measured memory_bytes: 15464
#include<bits/stdc++.h>
#define lli unsigned long long
#define rep0(i,j) for(int i=0; i<j; i++)
#define rep1(i,j) for(int i=1; i<=j; i++)
#define all(a) a.begin(), a.end()
using namespace std;

void dfs(lli ed, lli num, vector<map<lli,lli>>& vec){
    lli n=1;
    for(auto e: vec[num]){
        if(n == ed)n++;
        if(e.second != -1)continue;
        vec[num][e.first] = n;
        vec[e.first][num] = n;   
        dfs(n, e.first, vec);
        n++;
    }
}

int main(){
    lli h,w;
    cin >> h >> w;
    vector<vector<int>> tab(h, vector<int>(w, 0));
    deque<pair<pair<int,int>,pair<int,int>>> deq;
    rep0(i,h){
        cin >> tab[i][0];
        rep1(j,w-1){
            cin >> tab[i][j];
            if(tab[i][j-1] % 2 == 1){
                deq.push_back(make_pair(make_pair(i, j-1), make_pair(i, j)));
                tab[i][j-1]--;tab[i][j]++;
            }
        }
    }
    rep1(j, h-1){
        if(tab[j-1][w-1] % 2 == 1){
            deq.push_back(make_pair(make_pair(j-1, w-1), make_pair(j, w-1)));
            tab[j-1][w-1]--;tab[j][w-1]++;
        }
    }
    cout <<deq.size() << '\n';
    for(auto e:deq){
        cout << e.first.first+1 << ' ' << e.first.second+1 << ' ' << e.second.first+1 << ' ' << e.second.second+1 << '\n';
    }
}

Measured memory_bytes: 5120
N = int(input())
H = list(map(int,input().split()))
count = 0
max = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        count += 1
    else:
        if max < count:
            max = count
        count = 0
if max < count:
    max = count
print(max)


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int left = a+b;
    int right = c+d;
    string ans;
    if (left > right){
        ans = "Left";
    } else if (left == right) {
        ans = "Balanced";
    } else {
        ans = "Right";
    }
    cout << ans << endl;

    return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int32 cnt = 0;
    REP(i,3){
        if(s[i] == 'A')cnt++;
    }
    Yes(cnt == 1 || cnt == 2);
    return 0;
}

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

 string f(string s1, string s2){
    
     int n1 = s1.length(), n2 = s2.length();
     vector < vector <int> > dp(n1+1, vector <int> (n2+1,0));

     for(int i=1 ; i<=n1 ; i++){
       for(int j=1 ; j<=n2 ; j++){
           if(s1[i-1]==s2[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
           else dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
        }
     }

        string ans = "";
        
        int i=n1, j=n2;
        while(i){
           if(s1[i-1]==s2[j-1]) {ans+=s1[i-1]; i--; j--;}
           else{
             if(dp[i][j]==dp[i][j-1]) j--;
             else i--;
           }
        }

            reverse(ans.begin(),ans.end());
             
             return ans;
 }
 
  int32_t main() {
     string s,t;
     cin>>s>>t;
     cout<<f(s,t);
}


Measured memory_bytes: 70784
import java.util.Scanner;

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		boolean ans[] = new boolean[3+1];
		int a=sc.nextInt();
		for(int i=1; i<=3; i++) {
			if(a==i) {
				ans[i]=true;
				break;
			}
		}
		int b=sc.nextInt();
		for(int i=1; i<=3; i++) {
			if(b==i) {
				ans[i]=true;
				break;
			}
		}
		int j=-1;
		for(int i=1; i<=3; i++) {
			if(ans[i]==false) {
				j=i;
				break;
			}
		}
		System.out.println(j);
		sc.close();
	}
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define S second
using namespace std;
map<int, int> m;
signed main() {
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if (s == u)cout << a - 1 << " " << b << endl;
	else cout << a << " " << b - 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <fstream>
#include <cassert>
#include <unordered_map>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef long double ld;



int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int a, h;
	cin >> h >> a;
	cout << (h - 1) / a + 1;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define prints(x, y) cout<<(x)<<" "<<(y)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N;
  cin >> N;
  N %= 10;
  if(N==2 || N==4 || N==5 || N ==7 || N==9) print("hon");
  else if(N==0 || N==1 || N==6 || N==8) print("pon");
  else print("bon");
}


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

d = []
for i in range(N-1):
    d.append(A[i+1] - A[i])
d.append(A[0] + K - A[N-1])

max_d = max(d)

print(K - max_d)

Measured memory_bytes: 32328
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  Array.sort (Fun.flip compare) as_;
  Printf.printf "%d\n" @@
  ( + ) (as_.(0) + if n mod 2 = 1 then as_.((n - 1) / 2) else 0) @@
  ( * ) 2 @@
  Array.fold_left ( + ) 0 @@
  Array.sub as_ 1 ((n - 2) / 2)

Measured memory_bytes: 8296
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define long long int
using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, s;
    cin>>n;
    vector<int> h;
    rep(i, n){
        cin>>s;
        h.eb(s);
    }
    int key = 1;
    if(n==1){
        key == 1;   
    }
    else{
        /*
        for(int i=0 ; i<n-1; i++){
            if(h[i] - h[i+1] >= 2){
                cout<<"No"<<endl;
                key = 0;
                break;
            }
            else if(h[i] - h[i+1] == 1){
                h[i] = h[i]-1;
            }
        }
        for(int i=0 ; i<n-1; i++){
            if(h[i] - h[i+1] >= 1){
                cout<<"No"<<endl;
                key = 0;
                break;
            }
        }
        if(h[n-2] - h[n-1] >= 1 && key == 1){
            cout<<"No"<<endl;
            key = 0;
        }
        */
        for(int i=n-1 ; 0<i; i--){
            if(h[i-1] - h[i] >= 2){
                cout<<"No"<<endl;
                key = 0;
                break;
            }
            else if(h[i-1] - h[i] == 1){
                h[i-1] = h[i-1]-1;
            }
        }
        /*
        for(int i=n-1 ; 0<i; i--){
            if(h[i-1] - h[i] >= 1){
                cout<<"No"<<endl;
                key = 0;
                break;
            }
        }
        */
        if(h[0] - h[1] >= 1 && key == 1){
            cout<<"No"<<endl;
            key = 0;
        }
    }
    if(key==1){
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////
void solve(){
    ll n ;
    cin >> n ;
    ll ans = 0 ;
    vector < ll > pre(64,0);
    for( int i = 1 ; i < 64 ; i++){
        pre[i] = (i*(i+1)) / 2;
    }
    for( ll j = 2 ; j * j <= n ; j++){
        if( n % j == 0){
            int cnt = 0 ;
            while(n%j==0){
                cnt++;
                n/=j;
            }
            ll cur = 1 ;
            ll s = 0 ;
            while(s+cur <= cnt){
                s += cur ;
                cur++;
            }
            ans += cur-1;
            // calculate 1 + 2 + 3 + 4 .... = n(n+1)/2
        }
    }
    if(n!=1){
        ans++;
    }
    cout << ans ;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1 ;
    //cin >> t ;
    while(t--){
        solve( );
    }
}



Measured memory_bytes: 3656
N,K = map(int,input().split())
D  = {int(n) for n in input().split()}
for j in range(N,N*10):
    if N <= j:
        L = {int(result) for result in str(j)}
        if D.isdisjoint(L):
            D_love = j
            break    
print(D_love)



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

int LCM(int a, int b);

int main(){
	int N;
	cin >> N;
	long long int a[N], i;
	for(i=0; i<N; i++){
		cin >> a[i];
	}
	
	int sum=0;
	for(i=0; i<N; i++){
		sum += a[i];
	}
	
	cout << sum - N << endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
    int[] daynum = inta();
    if(daynum[1] == 1){
        WriteLine(rint()-1);
    }else{
        int[] num = inta();
        Array.Sort(num);
        Array.Reverse(num);
        while(num[1] >0){
            num[0] -= num[1];
            num[1] = 0;
            Array.Sort(num);
            Array.Reverse(num);
        }
        WriteLine(Max(num[0]-1,0));
    }
    
    
    }
    //各種読取
    static string rstr(){
        return ReadLine();
    }
    static int rint(){
        return int.Parse(ReadLine());
    }
    static string[] stra(){
        return ReadLine().Split(' ');
    }
    static int[] inta(){
        string[] read_str_array = ReadLine().Split(' ');
        int[] return_int_array = new int[read_str_array.Length];
        for(int countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
        }
        return return_int_array;
    }
    static int[,] inta2(int num_array,int in_array){
        int[,] int_array2 = new int[num_array,in_array];
        for(int i=0;i<num_array;i++){
            int[] temp_array = inta();
            for(int j=0;j<in_array;j++){
                int_array2[i,j] = temp_array[j];
            }
        }
        return int_array2;
    }
    // A/B小数点以下切上
    static int divideup(int divided,int divid){
        int temp_divide = divided/divid;
        if(divided % divid > 0){
            temp_divide++;
        }
        return temp_divide;
    }
}

Measured memory_bytes: 11476
#include<stdio.h>
int main(void) {
	int m, f, b;
	scanf("%d%d%d", &m, &f, &b);
	if (m + f >= b) {
		if (m >= b) {
			printf("0\n");
		}
		else {
			printf("%d\n",b-m);
		}
	}
	else {
		printf("NA\n");
	}
	return 0;
}


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

using namespace std;
int main() {
 	int n;
  	cin >> n;

  
    int cnt=0;
 
  	vector<int> arr(n,0);
    for(int i=0;i<n;i++) {
     	int temp; cin >> temp;
      arr[i] = temp;
      if((i+1)%2 == 1 && arr[i]%2 == 1) 
        cnt+=1;
    }
  
  	cout << cnt << endl;
}

Measured memory_bytes: 3572
s = input()
c = 0
if s[0] == 'A':
  c += 1
hoge = s[2:-1]
a = hoge.count('C')
if a == 1:
  c += 1
b = s.replace("A","")
d = b.replace('C','')
e = d.islower()
if e == True:
  c += 1
if c == 3:
  print('AC')
else:
  print('WA')

Measured memory_bytes: 3064
#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

#[allow(unused_macros)]
macro_rules! trace {
    ($var:expr) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    };
    ($($args:expr),*) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($($args),*), ($($args),*));
    };
}

const M: usize = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let h: usize = sc.cin();
    let w: usize = sc.cin();
    let mut fs = vec![vec![0; w+2]; h+2];
    for i in 0..h {
        let s: String = sc.cin();
        let cc: Vec<char> = s.chars().collect();
        for j in 0..w {
            if cc[j] == '#' { fs[i + 1][j + 1] = -1; }
        }
    }

    for i in 0..h {
        for j in 0..w {
            if fs[i+1][j+1] == -1 { continue }
            let mut count = 0;
            for x in 0..3 {
                for y in 0..3 {
                    if x == 1 && y == 1 { continue }
                    if fs[i + x][j + y] == -1 {
                        count += 1;
                    }
                }
            }
            fs[i + 1][j + 1] = count;
        }
    }

    for i in 0..h {
        for j in 0..w {
            let a = fs[i+1][j+1];
            if a == -1 {
                print!("#");
            } else {
                print!("{}", a);
            }
        }
        println!("");
    }
}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#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 rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N;
int main() {
  cin >> N;
  vector<int> d(N);
  rep (i, N) cin >> d[i];
  sort (d.begin(), d.end());
  int half = N/2;
  int ret = d[half] - d[half-1];
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 640
#include<cstdio>  
#include<cstring>  
#include<vector>  
#include<map>  
#include<algorithm>  
using namespace std;  
const int maxn=10000+10;  
const int maxm=100000+10;  
int n,m;  
struct node  
{  
    int x;
    bool operator <(const node& rhs)const  
    {  
        return x<rhs.x;  
    }  
};  
map<node,int> mp;//½«×Ö·û´®nodeÓ³Éä³É½Úµã±àºÅ  
struct Edge  
{  
    int  u,v;  
    bool flag;//±ê¼Ç¸Ã±ßÊÇ²»ÊÇÇÅ  
}e[maxm];  
vector<int> G[maxn];  
int pre[maxn],low[maxn];  
int dfs_clock;  
void tarjan(int u,int fa)  
{  
    low[u]=pre[u]=++dfs_clock;  
    for(int i=0;i<G[u].size();i++)  
    {  
        int v=G[u][i];  
        if(v==fa) continue;  
        if(!pre[v])  
        {  
            tarjan(v,u);  
            low[u]=min(low[u],low[v]);  
        }  
        else low[u] = min(low[u],pre[v]);  
    }  
}  
int main()  
{  
    int T; T=1; 
    while(T--)  
    {  
        int id=0;  
        scanf("%d%d",&n,&m);  
        mp.clear();  
        dfs_clock=0;  
        memset(pre,0,sizeof(pre));  
        for(int i=1;i<=n;i++) G[i].clear();  
        for(int i=0;i<m;i++)  
        {  
            e[i].flag=false;  
            scanf("%d%d",&e[i].u,&e[i].v);
            int x=e[i].u,y=e[i].v;
            G[x].push_back(y);  
            G[y].push_back(x);  
        }  
        tarjan(1,-1);  
        bool ok=true;//ÅÐ¶ÏÊÇ·ñÁ¬Í¨Í¼  
        for(int i=1;i<=n;i++)if(!pre[i])  
        {  
            ok=false;  
            break;  
        }  
        if(!ok) printf("0\n");  
        else  
        {  
            int ans=0;//¼ÆÊýÇÅ×ÜÊý  
            for(int i=0;i<m;i++)  
            {  
                int u=e[i].u, v=e[i].v;  
                if(low[u]>pre[v]||low[v]>pre[u]) e[i].flag=true,ans++;  
            }  
            printf("%d\n",ans); 
        }  
    }  
    return 0;  
}  

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		if(a == b) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
//
//  main.cpp
//  AOJ0118
//
//  Created by aki33524 on 2014/04/27.
//  Copyright (c) 2014年 aki33524. All rights reserved.
//

#include <iostream>
using namespace std;

int H, W;
char fields[100][101];
int dh[] = {0, 0, 1, -1};
int dw[] = {1, -1, 0, 0};

void dfs(int h, int w){
    char c = fields[h][w];
    fields[h][w] = '.';
    for(int i=0; i<4; i++){
        int nh = h + dh[i];
        int nw = w + dw[i];
        if(0<=nh && nh<H && 0<=nw && nw<W && fields[nh][nw] == c)
            dfs(nh, nw);
    }
}

int main(int argc, const char * argv[])
{
    while(cin >> H >> W, H|W){
        int ans = 0;
        for(int i=0; i<H; i++)
            cin >> fields[i];
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if(fields[i][j] != '.'){
                    dfs(i, j);
                    ans ++;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1636
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <stack>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int func(vector<int>& v) {
	stack<P> st;
	int n = v.size(), ret = 0;

	rep(i, n) {
		int len = 1, c = v[i];
		REP(j, i+1, n) {
			if(c == v[j]) {
				i++;
				len++;
				continue;
			} else break;
		}

		if(len >= 4) continue;
		else {
			if(st.size() == 0) {
				st.push(mp(c, len));
				ret += len;
			} else {
				P p = st.top();
				if(p.first == c) {
					if(p.second + len < 4) {
						st.top().second += len;
						ret += len;
					} else {
						st.pop();
						ret -= p.second;
					}
				} else {
					st.push(mp(c, len));
					ret += len;
				}
			}
		}

		// prints(st);
	}

	// int ret = 0;
	// while(st.size()) {
	// 	ret += st.top().second;
	// 	st.pop();
	// }
	return ret;
}

int main() {
	int n;
	while(cin >> n && n) {

		vector<int> v(n);
		rep(i, n) cin >> v[i];

		int ans = n + 1;
		rep(i, n) {
			int t = v[i];

			v[i] = 1;
			if(i == 0) {
				v[i] = v[i+1];
				ans = min(ans, func(v));
			} else if(i == n-1) {
				v[i] = v[i-1];
				ans = min(ans, func(v));
			} else {
				if(v[i+1] == v[i-1]) {
					v[i] = v[i+1];
					ans = min(ans, func(v));
				} else {
					v[i] = v[i-1];
					ans = min(ans, func(v));

					v[i] = v[i+1];
					ans = min(ans, func(v));
				}
			}

			v[i] = t;
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1304
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtcoderTemplateForCSharp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var a = new List<List<int>>();

            var input = Console.ReadLine()
                .Split(' ')
                .Select(int.Parse);

            var n = input.ElementAt(0);
            var m = input.ElementAt(1);

            for (int i = 0; i < n; i++)
            {
                a.Add(new List<int>());

                var input2 = Console.ReadLine()
                    .Split(' ')
                    .Skip(1)
                    .Select(int.Parse);

                a[i].AddRange(input2);
            }

            // 警告消去のための初期化
            IEnumerable<int> answerCollection = new List<int>();

            for (int i = 0; i < a.Count; i++)
            {
                if (i == 0)
                {
                    answerCollection = a[0];
                    continue;
                }
                else
                {
                    answerCollection = answerCollection.Intersect(a[i]);
                }
            }

            Console.WriteLine(answerCollection.Count());
        }
    }
}


Measured memory_bytes: 13408
N,K = map(int,input().split())
D = list()
Snuke = {x for x in range(1,N+1)}

for i in range(K):
    d = int(input())
    j = list(map(int,input().split()))
    D.append(j)    
    
for i in D:
    Snuke = Snuke.difference(set(i))


print(len(Snuke))

Measured memory_bytes: 9104
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;


ll attack(ll x) {
    if (x == 1) return 1;
    else {
      x = x/2;
      return 2 * attack(x) + 1;
    }
}
int main() {
  ll H; cin >> H;

  ll ans = attack(H);
  cout << ans << endl;
	return 0;
}



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

using namespace std;

template<typename T>void read(T&x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')
fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t);read(args...);}

typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define mp(x, y) make_pair(x, y)
#define pb(x) emplace_back(x)

const LL MOD = 1e9 + 7;

int n, k;
LL ans;

int main(){
	read(n, k);
	for(LL i = k; i <= n; i++)
		(ans += i * n - i * (i - 1) + 1) %= MOD;
	printf("%lld\n", ans + 1);
	return 0;
}

Measured memory_bytes: 3760
from collections import Counter
n = int(input())
s = input()
c = Counter(s)
ans = c['R']*c['G']*c['B']

for i in range(n):
    for j in range(i+1, n):
        x, y = s[i], s[j]
        if x == y:
            continue
        if n <= 2*j-i:
            continue
        z = s[2*j-i]
        if x != z and y != z:
            ans -= 1

print(ans)


Measured memory_bytes: 74560
"""
T:0
A:1
C:2
G:3
"""

N = int(input())

dp = [[[[0]*4 for b in range(4)] for a in range(4)] for i in range(N+1)]
dp[0][0][0][0] = 1

for i in range(N):
    for a in range(4):
        for b in range(4):
            for c in range(4):
                for d in range(4):
                    if b == 1 and c == 3 and d == 2: # AGC
                        continue
                    if b == 1 and c == 2 and d == 3: # ACG
                        continue
                    if b == 3 and c == 1 and d == 2: # GAC
                        continue
                    if N <= 3:
                        dp[i+1][b][c][d] = 1
                        continue
                    if a == 1 and b == 3 and d == 2: # AGXC
                        continue
                    if a == 1 and c == 3 and d == 2: # AXGC
                        continue
                    dp[i+1][b][c][d] += dp[i][a][b][c]
                    dp[i+1][b][c][d] %= ((10**9)+7)

ans = 0
for a in range(4):
    for b in range(4):
        for c in range(4):
            ans += dp[N][a][b][c]
            ans %= ((10**9)+7)

print(ans)

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

int main() {
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    ll ans = (n >> 1) * min({(q << 3), (h << 2), (s << 1), d}) + (n & 1) * min({(q << 2), (h << 1), (s << 0)});
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define PI 3.1415926535
int main(){
    double a,b,x;
	cin>>a>>b>>x;
	if(x/(a*a)>(b/2)){
	double h=x/(a*a);
	double k = atan(a/(2*b-2*h))*(double)(180/PI);
	k=90-k;
	printf("%.7lf",k);
	return 0;
}
 double m = atan(2*x/(a*b*b))*(double)(180/PI);
 	printf("%.7lf",90-m);
 	
	
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
roop = [1]
roop2 = set([1])
while True:
    next_i = a[roop[-1] - 1]
    if next_i in roop2:
        break
    else:
        roop.append(next_i)
        roop2 |= set([next_i])
temp = roop.index(next_i)
if k <= temp:
    print(roop[k])
else:
    period = len(roop) - temp
    temp2 = (k - temp) % period
    print(roop[temp + temp2])

Measured memory_bytes: 33340
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;
 
int N;
vector<int> v;

int calc(int x){
  long long p = 0LL;
  while(!(x&1)) x  /= 2, ++p;
  return p;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  long long res = 0;
  for(int i=0; i<N; ++i){
    int x;
    cin >> x;
    if(!(x&1))
      res += calc(x);
  }
  cout << res << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N, K;
    cin >> N >> K;
    int a[N];
    rep(i, N) cin >> a[i];
    int cnt = 0;
    int sum = 1;
    while(sum < N){
        sum += (K-1);
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
from random import randint
from time import time
start = time()
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline


def get_sat():
    sat = 0
    when = [-1] * 26
    for i in range(d):
        sat += s[i][t[i]]
        when[t[i]] = i
        for j in range(26):
            sat -= c[j] * (i - when[j])
    return sat


def get_sat_small(k, score):
    res = -100000000
    ind = -1
    for i in range(26):
        sat = score
        sat += s[k][i]
        for j in range(26):
            if i != j:
                sat -= c[j] * (i - when2[j])
        if res <= sat:
            res = sat
            ind = i
    when2[ind] = k
    t[k] = ind
    return res


d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [-1] * d
score = 0
when2 = [-1] * 26
for i in range(d):
    get_sat_small(i, score)
ans = get_sat()
while time() - start < 1.8:
    p, q = randint(0, d - 1), randint(0, 25)
    x = t[p]
    t[p] = q
    y = get_sat()
    if ans >= y:
        t[p] = x
    else:
        ans = y
for i in t:
    print(i + 1)


Measured memory_bytes: 80956
#include <iostream>

using namespace std;

main(){
	int a,b,c;
	
	cin >> a >> b >> c;
	
	int buf = a;
	a = b;
	b = buf;
	
	buf = a;
	a = c;
	c = buf;
	
	cout << a << " " << b  << " " << c;
	
}

Measured memory_bytes: 256
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
ll a[N];
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    for (ll i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    cout << a[n / 2] - a[n / 2 - 1];
    return 0;
}

Measured memory_bytes: 1024
s=list(input())
t=list(input())
score=[]
for i in range(len(s)-len(t)+1):
  point=0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      point+=1
  score.append(point)
cnt=0
w=max(score)
w_iti=score.index(w)
for i in range(len(t)):
  if s[w_iti+i] != t[i]:
    cnt += 1
print(cnt)

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;
template<typename T> using Graph = vector<vector<T>>;

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

    int T, N;
    cin >> T >> N;
    vi s(N), t(N);
    rep(i, N) cin >> s[i] >> t[i];

    // ?????????????????????????????????????????¨???
    int ans = 0;
    int r = 0;
    int len = 0;
    rep(l, N) {
        while (r < N && t[r] <= s[l] + T) {
            len += t[r] - s[r];
            r++;
        }
        int vim = 0;
        if (r < N) vim += max(0ll, (s[l] + T) - s[r]);
        ans = max(ans, len + vim);
        len -= t[l] - s[l];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4420