akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int count8bit(unsigned char v) {
    unsigned count = (v & 0x55) + ((v >> 1) & 0x55);
    count = (count & 0x33) + ((count >> 2) & 0x33);
    return (count & 0x0f) + ((count >> 4) & 0x0f);
}

int count16bit(unsigned short v) {
    unsigned short count = (v & 0x5555) + ((v >> 1) & 0x5555);
    count = (count & 0x3333) + ((count >> 2) & 0x3333);
    count = (count & 0x0f0f) + ((count >> 4) & 0x0f0f);
    return (count & 0x00ff) + ((count >> 8) & 0x00ff);
}

int count32bit(unsigned v) {
    unsigned count = (v & 0x55555555) + ((v >> 1) & 0x55555555);
    count = (count & 0x33333333) + ((count >> 2) & 0x33333333);
    count = (count & 0x0f0f0f0f) + ((count >> 4) & 0x0f0f0f0f);
    count = (count & 0x00ff00ff) + ((count >> 8) & 0x00ff00ff);
    return (count & 0x0000ffff) + ((count >> 16) & 0x0000ffff);
}


bool MSB8bit(unsigned char v, int &out) {
    if (v == 0) return false;
    v |= (v >> 1);
    v |= (v >> 2);
    v |= (v >> 4);
    out = count8bit(v) - 1;
}

bool MSB16bit(unsigned short v, int &out) {
   if (v == 0) return false;
    v |= (v >> 1);
    v |= (v >> 2);
    v |= (v >> 4);
    v |= (v >> 8);
    out = count16bit(v) - 1;
}

bool MSB32bit(unsigned v, int &out) {
   if (v == 0) return false;
    v |= (v >> 1);
    v |= (v >> 2);
    v |= (v >> 4);
    v |= (v >> 8);
    v |= (v >> 16);
    out = count32bit(v) - 1;
}


int main(void){
    int N;
    cin >> N;
    int ans;
    MSB8bit((unsigned char)N, ans);
    cout << (1 << ans) << endl;
    return 0;
}

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

int main() {
  string S;
  cin >> S;

  if(S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(2) != S.at(3)){
    cout << "Good" << endl;
  }
  else{
    cout << "Bad" << endl;
  }
}

Measured memory_bytes: 256
/*
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;
 
int main()
{
    int ans=0;
    string s;
    cin>>s;
    char x=s[0];
    for(char c:s) if(c!=x) x=c,ans++;
    cout<<ans<<endl;
 
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define emp emplace
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	int a, b, c; cin >> a >> b >> c;

	set<int> st;

	st.emp(a);
	st.emp(b);
	st.emp(c);

	cout << (st.size() == 2 ? "Yes\n" : "No\n");

	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N >> K;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	vector< int > dp(K + 1, 0);
	dp[0] = 0;
	rep(j, K + 1) {
		int tmp = 0;
		rep(i, N) {
			if (j - A[i] >= 0 && dp[j - A[i]] == 0)
				tmp = 1;
		}
		dp[j] = tmp;
	}
	cout << (dp[K] ? "First" : "Second") << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(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)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

 
const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
 
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; }


ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }

int main(){
  ll a,b; cin>>a>>b;
  
  ll C=GCD(a,b);
  ll ans=1;
  for(ll i=2; i*i<=C; i++){
    if(C%i==0){
      ans++;
      while(C%i==0) C/=i;
    }
  }
  if(C!=1)ans++;
  cout<<ans<<endl;
}

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

int32_t main()
{
 int l,r,d; cin>>l>>r>>d;
 int ct=0;
 ct+=(r/d-l/d);
 if(l>=d && l%d==0)ct++;
 
 cout<<ct;
}

Measured memory_bytes: 3632
#pragma region header
#include <bits/stdc++.h>
#define int ll
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define mp make_pair
#define rep1(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define rrep1(i, n) for (auto i = n - 1; i > static_cast<decltype(i)>(-1); i--)
#define rep2(i, a, b) for (auto i = (a); i < (b); i++)
#define rrep2(i, a, b) for (auto i = b - 1; i >= a; i--)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1) (__VA_ARGS__)
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep2, rrep1) (__VA_ARGS__)
#define each(i, a) for (auto &&i : (a))
using namespace std;

using ll = long long;

const int INF = 1e18;

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

#pragma endregion header

template<typename T>
struct edge {
  int to;
  T cost;
  edge(int to, T cost) : to(to), cost(cost) {}
};
template<typename T>
vector<T> dijkstra(vector<vector<edge<T>>> &g, int s, const T &INF) {
  vector<T> dist(g.size(), INF);
  using Pi = pair<T, int>;
  priority_queue<Pi, vector<Pi>, greater<Pi>> pq;
  dist[s] = 0;
  pq.emplace(0, s);
  while(!pq.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = pq.top();
    pq.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      pq.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

const int MAX = 1e15;

#pragma region main
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--;t--;
  vector<vector<edge<int>>> g(n), rg(n);
  rep(_, m) {
    int u, v, a, b;
    cin >> u >> v >> a >> b;
    u--;v--;
    g[u].emplace_back(v, a);
    g[v].emplace_back(u, a);
    rg[u].emplace_back(v, b);
    rg[v].emplace_back(u, b);
  }
  vector<int> dij = dijkstra(g, s, INF), rdij = dijkstra(rg, t, INF);
  rep(i, n) dij[i] += rdij[i];
  rrep(i, n - 1) amin(dij[i], dij[i + 1]);
  rep(i, n) cout << MAX - dij[i] << '\n';
}
#pragma endregion main


Measured memory_bytes: 21060
#include <iostream>
#include <string.h>

#define MAX 17

using namespace std;

int dp[MAX][MAX];

int main(void)
{
	int a,b,n;
	int i1,i2;
	int x,y;
	while(1){
		cin>>a>>b;
		if(a+b==0) break;
		cin>>n;

		memset(dp,0,sizeof(dp));
		for(i1=1;i1<=b;i1++){
			for(i2=1;i2<=a;i2++){ 
				if(i1==1 || i2==1) dp[i1][i2]=1;
			}
		}

		for(i1=0;i1<n;i1++){
			cin>>x>>y;
			if(x==1) {
				for(i2=y;i2<=b;i2++) dp[i2][1]=0;
			}
			else if(y==1) {
				for(i2=x;i2<=a;i2++) dp[1][i2]=0;
			} 
			else dp[y][x]=-1;
		}

		for(i1=2;i1<=b;i1++){
			for(i2=2;i2<=a;i2++){
				if(dp[i1][i2]==-1) dp[i1][i2]=0;
				else {
					dp[i1][i2]=dp[i1-1][i2]+dp[i1][i2-1];
				}
			}
		}

	/*for(i1=1;i1<=b;i1++){
			for(i2=1;i2<=a;i2++){
				cout<<dp[i1][i2]<<" ";
			}
			cout<<endl;
		}*/

		cout<<dp[b][a]<<endl;
	}
	return 0;
} 

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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);


int main(){
  faster();
  ll n;
  cin >> n;
  vvl c(11,vl(11,0));
  REP(i,1,n+1){
    string s = to_string(i);
    ll siz = s.size();
    int digb = s.at(0) - '0';
    int dige = s.at(siz-1) - '0';
    c[digb][dige]++;
  }
  ll ans = 0;
  rep(i,10)rep(j,10) ans += (c[i][j]*c[j][i]);
  cout << ans ;
}



























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str;
			int cnt[] = new int[26];
			int i;
			char c;
			for( i=0; i<26; i++ ){
				cnt[i] = 0;
			}
			while((str = br.readLine())!=null){
				for( i=0; i<str.length(); i++ ){
					c = str.charAt(i);
					if('A'<=c && c<='Z') cnt[c-'A']++;
					if('a'<=c && c<='z') cnt[c-'a']++;
				}
			}
			for( i=0; i<26; i++ ){
				c = (char)('a' + i);
				System.out.println( c + " : " + cnt[i] );
			}
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
}

Measured memory_bytes: 17032
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

a,b,c = myinput()

if (a*c)<=b:
    print(c)
    exit()
else:
    print(b//a)
    exit()

Measured memory_bytes: 38384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;


const int mod=1000000007;
//const int mod=998244353;





int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d;
    cin >> a>> b>> c>> d;
    k=c*d/__gcd(c,d);
    cout<< b-a+1-(b/c-(a-1)/c+b/d-(a-1)/d-b/k+(a-1)/k) <<'\n';

    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define sz(a) int((a).size())
#define fr(i,n) for(int i=0;i<n;i++) 
#define rf(i,n) for(int i=1;i<=n;i++) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define MAX INT_MAX 
#define f first
#define s second
using namespace std;
#define M 1000000007
ll dp[101][100001];
int main()
{
    int n,w;
    cin>>n>>w;
    std::vector<pair<int,int> > v(n);
     
    fr(i,n)
        cin>>v[i].f>>v[i].s;

    memset(dp,0,sizeof(dp));
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else
                if(v[i-1].f <= j)
                    dp[i][j] = max((ll)v[i-1].s + dp[i-1][j-v[i-1].f], dp[i-1][j]);
                else
                    dp[i][j]=dp[i-1][j];
        }
    } 
    ll ans = dp[n][w];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 82512
N = gets.chomp.to_i

arr = N.to_s.split('')

count = 0
l = arr.length
if l == 1
  count += N
end

if l > 1
  count += 9
end

if l == 3
  count += N - 99
end

if l > 3
  count += 900
end

if l == 5
  count += N - 9999
end

if l > 5
  count += 90000
end

print count


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
/*#include <boost/multiprecision/cpp_int.hpp> 
using boost::multiprecision::cpp_int;*/
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int              long long int
#define pb              push_back
#define mp12            make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pq1             priority_queue<int>
#define pqr1            priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


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

}
void file(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

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


int p[1000006];
vi prime;
//int mrp[1000000];
void seive(){
    for(int i=2;i<1000006;i++) {
        if(p[i]){
            prime.pb(i);
            for(int j=i*i;j<=1000006;j=j+i){
                p[j]=0;
            }
        }
    }

}
// int c;
double dp[3001][3001];
double solve(int i,int x,double a[]){
    if(x==0) return 1;
    if(i==0) return 0;

    if(dp[i][x]> -0.9) return dp[i][x];

    return dp[i][x]=(a[i]*solve(i-1,x-1,a))+((1-a[i])*solve(i-1,x,a));
}


int32_t main()
{
    // memset(prime,0,sizeof(prime));
    //memset(p,1,sizeof(p));   
    //seive();
   // file();
    fast();
    //int mo=1000000007;
   int n;
   cin>>n;
   double a[n+1];
   int c=0;
   memset(dp,-1,sizeof(dp));
   for(int i=1;i<=n;i++) cin>>a[i];
    int x=(n+1)/2;
    cout<<ps(solve(n,x,a),10);




    return 0;
    
    
}



Measured memory_bytes: 74388
/**
 *    author:  FromDihPout
 *    created: 2020-08-18
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    if (n > m) {
        swap(n, m);
    }
    
    if (n == 1 && m == 1) {
        cout << 1 << '\n';
    }
    else if (n == 1) {
        cout << m - 2 << '\n';
    }
    else if (n == 2) {
        cout << 0 << '\n';
    }
    else {
        cout << (long long) (n - 2) * (m - 2) << '\n';
    }
    return 0;
}

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

int main() {
    int X, Y;
    cin >> X >> Y;
    string ans = "No";
    rep(i, X + 1) {
        int j = X - i;
        if (i * 2 + j * 4 == Y) {
            ans = "Yes";
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
from collections import deque
from copy import copy,deepcopy
from itertools import permutations,combinations
from pprint import pprint

def myinput():
    return map(int,input().split())

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

x,y = myinput()

ans = []
na = copy(x)

while na<=y:
    ans.append(na)
    na = 2*na
# print(ans)

print(len(ans))

Measured memory_bytes: 38256
#include <stdio.h>

int main(){
    char s[100001];
    int keys[26];
    scanf("%s", s);
    for(int i = 0; i < 26; i++){
        keys[i] = 0;
    }

    for(int i = 0; s[i] != '\0'; i++){
        keys[s[i] - 'a']++;
    }

    for(int i = 0; i < 26; i++){
        if(keys[i] == 0){
            printf("%c\n", i + 'a');
            return 0;
        }
    }
    printf("None\n");
    return 0;
}

Measured memory_bytes: 256
def main():

    N = input()
    D = list(map(int,input().split()))
    M = max(D)
    countlist=[0] * (M + 1)
    ans=1

    for i in D:
        countlist[i]+=1

    if countlist[0]!=1 :
        ans = 0
    else :
        if D[0]!=0 :
            ans = 0
        else:
            for i in range(2,M+1):
                ans *= countlist[i-1]**countlist[i]

    print(ans%998244353) 

if __name__ == "__main__":
    main()

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

int main(){
        int input,h,m,s;
        cin >> input;
        s = input % 60;
        input = input / 60;
        m = input % 60;
        input = input / 60;
        h = input;
        cout << h << ":" << m << ":" << s << endl;
        return 0;
}

Measured memory_bytes: 1164
import Data.List
import Data.Array
import Data.Maybe
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt
 
solve :: Int -> [Int] -> Int
solve k = sum . drop k . sortBy (flip compare) . change . sort
 
change :: [Int] -> [Int]
change [] = []
change (x:xs) = go x 1 xs
    where go n c [] = [c]
          go n c (x:xs)
            | n == x = go n (c+1) xs
            | otherwise = c : go x 1 xs 
 
main :: IO ()
main = do
    [n, k] <- getInts
    ls <- getInts
    print (solve k ls)

Measured memory_bytes: 31100
N = int(input())
A = [int(x) for x in input().split()]

ngcount = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0:
            continue
        elif A[i] % 5 == 0:
            continue
        else:
            ngcount = ngcount + 1
            break
    else:
        continue
if ngcount == 0:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
string s;
ll res;
int n;
int main() {
  cin>>s;
  res=0;
  n = s.size();
  int m = n-1;
  for (int i = 0; i < (1<<m); ++i) {
    ll cur=0;
    for (int j = 0; j < n; ++j) {
      cur = cur*10LL+s[j]-'0';
      if (j<n-1 && (1<<j)&i) {
        res+=cur;
        cur=0;
      }
    }
    res += cur;
    cur=0;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws Exception{
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        int i = 0;
        int x = 0;
        ArrayList<Integer> array = new ArrayList<Integer>();
        while(true){
        	line = br.readLine();
        	x = Integer.parseInt(line);
        	if(x == 0){
        		break;
        	}
        	array.add(x);
        	i++;
        }
        int N = i;
        for(i = 0;i<N;i++){
        	System.out.println("Case "+(i+1)+": "+array.get(i));
        }

	}

}

Measured memory_bytes: 27940
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int n;
    cin >> n;

    if(n % 2 == 0){
        cout << n / 2 << endl;
    } else {
        cout << n / 2 + 1 << endl;
    }
}   

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int check(string s)
{
    int n = s.length();
    int ans = 0;
    for (int i=0; i<n; i++)
        ans += (s[i]-'0');
    return (ans % 9 == 0);
}
int main() {

    jaldi

    string s;
    cin>>s;
    int res = check(s);
    if(res) {
        cout<<"Yes"<<'\n';
    }
    else {
        cout<<"No"<<'\n';
    }

}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;
	vector<lli> s(n+1);
	s[0]=0;
	REP(i,0,n){
		lli a;
		cin>>a;
		s[i+1] = s[i] + a;
	}

	map<lli,lli> ss;
	REP(i,0,n+1)ss[s[i]]++;

	lli cnt=0;
	for(auto e:ss){
		cnt+= (e.second)*(e.second-1)/2;
	}
	cout<<cnt<<endl;

	return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main()
{
    int n,m;cin>>n>>m;
    VI suki(m);
    REP(i,n){
        int k;cin>>k;
        REP(j,k){
            int a;cin>>a;a--;
            suki[a]++;
        }
    }
    int result = 0;
    REP(i,m){
        if(suki[i] == n){
            result++;
        }
    }
    cout<<result<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

int main() {
  string s, t; cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<int>());

  if (t > s)p("Yes");
  else p("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<ll> a(n);
    REP(i,n) cin>>a[i];
    ll ans=0;
    while(true){
        bool f=true;
        REP(i,n) if(a[i]>=n) f=false;
        if(f) break;

        ll cnt=0;
        REP(i,n){
            cnt += max(0LL,a[i])/n;
        }
        REP(i,n){
            ll d = max(0LL,a[i])/n;
            a[i] = a[i] - d*n + (cnt-d);
        }
        ans+=cnt;
    }
    cout<<ans<<endl;
}


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


string S;


void input() {
    cin >> S;
}


int main() {
    input();
    int n = S.size();
    rep(i, n) cout << "x";
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int n, a;
    cin >> n;
    vector<int> input;
    for (int i=0; i<n; ++i) {
        cin >> a;
        input.push_back(a);
    }
    ll sum = 0;
    for (auto&e : input) {
        sum += e;
    }
    ll minDiff = LLONG_MAX;
    ll x = 0, y = sum;
    
    for (int i=0; i < input.size()-1; ++i) {
        x += input[i];
        y -= input[i];
        minDiff = min(minDiff, abs(x - y));
    }
    cout << minDiff << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<long long> vl;
typedef pair<long long, long long> pl;
typedef vector<vector<long long>> matrix;

#define F 						first
#define S 						second
#define PB 						push_back
#define MP 						make_pair
#define all(c) 					c.begin(), c.end()
#define f(i,a,b) 				for(ll i=a; i<b; i++)
#define rep(i,n) 				f(i,0,n)
#define tr(c,i) 				for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) 			(c.find(x) != c.end())	//for set and map
#define cpresent(c,x) 			(find(all(c),x) != c.end())	//for vectors
#define w(t)					ll t; cin>>t; while(t--)
#define epsilon 				1e-9
#define MOD						(ll)1e9

void doublade() {
	ios::sync_with_stdio(false); cin.tie(0); cout.precision(10);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

int main() {
	doublade();
	// w(t) {
		string s;
		cin >> s;
		ll r = 0, temp = 0;
		bool flag = false;
		rep(i, s.length()) {
			if(!flag && s[i]=='R') {
				flag = true;
			}else if(flag && s[i]=='S') {
				flag = false;
				r = max(r, temp);
				temp = 0;
			}
			if(s[i]=='R') temp++;
		}
		if(flag) r = max(r, temp);
		cout<<r<<"\n";
	// }
	return 0;
}

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

if n == 2:
  if a[0] >= a[1] and (a[0] - a[1]) % 2 == 0:
    print((a[0] - a[1]) // 2)
  else:
    print(-1)
else:
  num = 0
  for i in range(2, n):
    num ^= a[i]
  
  _and = (a[0] + a[1] - num)
  if  _and % 2 != 0 or a[0] < _and // 2 or (_and // 2) & num != 0:
    print(-1)
  else:
    _and //= 2
    
    max_2 = 1
    while max_2 <= num:
      max_2 *= 2
    
    a0 = _and
    while max_2 >= 1:
      if num & max_2 != 0 and a0 + max_2 <= a[0]:
        a0 += max_2
      max_2 //= 2
    
    if a0 != 0:
      print(a[0] - a0)
    else:
      print(-1)

Measured memory_bytes: 9116
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    H1, M1, H2, M2, K = [int(x) for x in input().split()]

    print(H2 * 60 + M2 - (H1 * 60 + M1) - K)

if __name__ == '__main__':
    main()


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

using namespace std;

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

typedef long long int ll;

bool oddDigit(int n)
{
    int count = 0;
	while(n > 0)
	{
	    count++; 
	    n = n / 10;
	}
	if(count&1)
	    return true;
	return false;
}

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

	int n;
	cin >> n;

    int ans = 0;
	while(n >= 1)
	{
		if(oddDigit(n))
		{
		    ans++;
		}
		n--;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn =1e5+10;
int cnt [maxn],ans,n;
int main ()
{
    cin>>n;
    for (int i=0;i <n;i++)
    {
        int a;
        cin>>a;
        cnt [a+1]++;
    }
    for (int i=1;i <maxn-1;i++)
    {
        ans=max (ans,cnt [i-1]+cnt [i]+cnt [i+1]);
    }
    cout <<ans<<endl;
}

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

    
int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll money = 1000;
    ll kabu = 0;
    //int flag = 0;
    vector<int> kyoku(n);
    rep(i,n-1){
        if(a[i]<a[i+1]) kyoku[i] = -1;
        else if(a[i]>a[i+1]) kyoku[i] = 1;
    }

    rep(i,n){
        if(kyoku[i]==-1){
            kabu += money / a[i];
            money %= a[i];
            //flag = 1;
        } else if(kyoku[i]==1){
            //flag = 0;
            money += kabu * a[i];
            kabu = 0;
        }
    }
    money += kabu * a[n-1];

    cout << money << endl;
    return 0;
}

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

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    string s;
    cin >> s;
    bool ans = true;
    for (int i = 0;i < s.size();i++){
        if (i % 2 == 0){
            if (s[i] != 'h') ans = false;
        }
        else{
            if(s[i] != 'i') ans = false;
        }
    }
    if (s.size() % 2 != 0) ans = false;

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    ai = [int(i) for i in input().split()]
    ai = [0] + ai + [0]

    z = sum([abs(y - x) for x, y in zip(ai, ai[1:])])
    for i in range(1, len(ai)-1):
        zz = z
        zz -= abs(ai[i-1] - ai[i])
        zz -= abs(ai[i] - ai[i+1])
        zz += abs(ai[i-1] - ai[i+1])
        print(zz)

if __name__ == '__main__':
    main()


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

int main(){
		int n;
	char s,t,b;
	while(cin>>n,n){
		double dp[16][9]={0.0};
		int floor[9][4]={
			{0,1,3,0},{1,2,4,0},{2,2,5,1},
			{0,4,6,3},{1,5,7,3},{2,5,8,4},
			{3,7,6,6},{4,8,7,6},{5,8,8,7}
		};
		cin>>s>>t>>b;
		dp[0][s-'A']=1;
		for(int i=0;i<9;i++)for(int j=0;j<4;j++)if(floor[i][j]==b-'A')floor[i][j]=i;
		for(int i=0;i<n;i++){
			for(int j=0;j<9;j++){
				for(int k=0;k<4;k++){
					dp[i+1][floor[j][k]]+=dp[i][j]/4;
				}
			}
		}
		printf("%.8lf\n",dp[n][t-'A']);
	}
	return 0;
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
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(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  ll h, a; cin >> h >> a;
  cout << (h + a - 1) / a << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
 
int main () {
int A, B;
cin >> A ;
cin >> B ;
if ( A == 1 && B == 2 ) {
  cout << 3 << endl;}
else if ( A == 1 && B == 3 ) {
  cout << 2 << endl;}
else if ( A == 3 && B == 2 ) {
  cout << 1 << endl;}
int k = B ;
int l = A ;
if ( k == 1 && l == 2 ) {
  cout << 3 << endl;}
else if ( k == 1 && l == 3 ) {
  cout << 2 << endl;}
else if ( k  == 3 && l == 2 ) {
  cout << 1 << endl;}  

  
  
return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static int gcd(int a,int b)
    {
        if(b==0)
        return a;
        return gcd(b,a%b);
    }
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        //String str[]=br.readLine().split(" ");
        //int n=Integer.parseInt(br.readLine());
        //int n=Integer.parseInt(str[0]);
        //int n=Integer.parseInt(str[1]);
        //String s=br.readLine();
        int n=Integer.parseInt(br.readLine());
        long sum=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                for(int k=1;k<=n;k++)
                {
                    int gcd1=gcd(Math.max(j,k),Math.min(j,k));
                    int gcd2=gcd(Math.max(i,gcd1),Math.min(i,gcd1));
                    sum=sum+gcd2;
                }
            }
        }
        pw.println(sum);
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 32968
#include <stdio.h>

int max(int a, int b){
    return (a > b) ? a : b;
}

int main(void){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int k;
    scanf("%d", &k);

    int m;
    for(int i = 0; i < k; i++){
        m = max(a, max(b, c));
        if (a == m) a *= 2;
        else if(b == m) b *= 2;
        else c *= 2;
    }
    printf("%d\n", a + b + c);
    
    return 0; 
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

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

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll MOD = 1'000'000'007;

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int a,b,c;
    int x,y,z;
    cin>>a>>b>>c>>x>>y;
    z=max(x,y);
    int res = 2001'000'000;
    rep(i, z+1){
        int num_a = max(0, x - i);
        int num_b = max(0, y - i);
        res = min(res, num_a * a + num_b * b + 2 * i * c);
    }
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e12;
using Graph = vector<vector<int>>;


signed main(){
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for( int i = 0; i < N; i++ ) cin >> H[i];

  vector<int> dp(N+10, INF);
  dp[0] = 0;
  for( int i = 0; i < N; i++ ){
    for( int j = 1; j <= K; j++ ){
      if( i+j >= N ) continue;
      dp[i+j] = min(dp[i+j], dp[i]+abs(H[i]-H[i+j]));
    }
  }
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 4824
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N,M = inpl()
aa = inpl()
ans = 0
modSUM = defaultdict(int)

tmp = 0
modSUM[0] += 1
for a in aa:
	tmp += a
	tmp %= M
	ans += modSUM[tmp]
	modSUM[tmp] += 1

print(ans)


Measured memory_bytes: 15452
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	string S;
	cin >> S;

	ll dp[4001][4001] = {};
	dp[0][0] = 1;

	int N = S.size();
	ll mod = 998244353;

	rep(i, N) {
		int A = S[i] - '0';
		rep(j, 4001) {
			if (dp[i][j]) {
				if (j + A > 0) {
					dp[i + 1][j + A - 1] += dp[i][j];
					dp[i + 1][j + A - 1] %= mod;
				}
				if (2 + i - j - A > 0) {
					dp[i + 1][j + A] += dp[i][j];
					dp[i + 1][j + A] %= mod;
				}
			}
		}
	}
	for(int i = N; i < 2 * N; i++) {
		rep(j, 4001) {
			if (dp[i][j]) {
				if (j > 0) {
					dp[i + 1][j - 1] += dp[i][j];
					dp[i + 1][j - 1] %= mod;
				}
				if (2 * N - i - j > 0) {
					dp[i + 1][j] += dp[i][j];
					dp[i + 1][j] %= mod;
				}
			}
		}
	}
	
	co(dp[2 * N][0]);

	Would you please return 0;
}

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

int M = 150000, N = 10;

int GetRandom(int min,int max){
	return min + (int)(rand()*(max-min+1.0)/(1.0+RAND_MAX));
}

int main(){
    // 入力
    int D;
    cin >> D;   // D = 365
    ll c[26];
    for(int i=0;i<26;i++)
        cin >> c[i];
    ll s[D][26];
    for(int i=0;i<D;i++)
        for(int j=0;j<26;j++)
            cin >> s[i][j];
    // 初期解t[D]
    int t[D];
    /*
    for(int i=0;i<D;i++)
        cin >> t[i];
    */
    for(int i=0;i<D;i++){
        //t[i] = GetRandom(1,26);   // 1<=, <=26
        t[i] = i%26 + 1;
        //cout << t[i] << endl; 
    }
    // クエリ
    // cin >> M;
    int d[M][N], q[M][N];
    /*
    for(int i=0;i<M;i++)
        cin >> d[i] >> q[i];
    */
    for(int i=0;i<M;i++){
        for(int j=0;j<N;j++){
            d[i][j] = GetRandom(1,D);   // 1<=, <=365
            q[i][j] = GetRandom(1,26);   // 1<=, <=26
            //cout << d[i][j] << ' ' << q[i][j] << endl; 
        }
    }

    // 処理部
    ll v_best = LLONG_MIN;
    for(int query=0;query<M;query++){
        int last[26] = {}, q_[N];
        // コンテスト種別の変更（N個）
        for(int i=0;i<N;i++){
            q_[i] = t[d[query][i]-1];
            t[d[query][i]-1] = q[query][i];
        }
        // D日分
        ll v = 0;
        for(int i=1;i<=D;i++){
            // 満足度の増加分
            v += s[i-1][t[i-1]-1];
            last[t[i-1]-1] = i;
            // 満足度の低下分（コンテスト26種分）
            for(int j=0;j<26;j++)
                v -= c[j]*(i - last[j]);
        }
        // cout << v << endl;
        if(v < v_best){
            for(int i=0;i<N;i++){
                t[d[query][i]-1] = q_[i];
            }
        }else{
            v_best = v;
        }
    }

    // 答え出力
    for(int i=0;i<D;i++)
        cout << t[i] << endl;
    //cout << v_best << endl;

}


Measured memory_bytes: 15400