akhauriyash/Code-Regression huggingface dataset:
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
# row = [int(input().rstrip()) for _ in range(n)]

def resolve():
    import sys
    input = sys.stdin.readline

    x, y = [int(x) for x in input().rstrip().split(" ")]

    # 2 ** ?
    count = 1
    num = x
    while num * 2 <= y:
        count += 1
        num *= 2
    print(count)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 61716
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vb = vector<bool>;
using qi = queue<int>;
using Graph = vector<vector<int>>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)

const int inf = 100000000;
const int maxn = 15;
int dist[maxn][maxn];
int dp[1<<maxn][maxn];
int n, m;

int dfs(int s, int v) {
    if (dp[s][v] >= 0) {
        return dp[s][v];
    }

    if (s == (1 << n)-1 && v == 0) {
        dp[s][v] = 0;
        return 0;
    }

    int ans = inf;
    REP(u, n) {
        if (!(s >> u & 1) && dist[v][u] < inf) {
            ans = min(ans, dfs(s | 1 << u, u) + dist[v][u]);
        }
    }

    dp[s][v] = ans;
    return ans;
}

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

    REP(i, maxn) {
        REP(j, maxn) {
            dist[i][j] = inf;
        }
    }
    REP(i, 1 << maxn) {
        REP(j, maxn) {
            dp[i][j] = -1;
        }
    }

    cin >> n >> m;
    REP(i, m) {
        int s, t, d; cin >> s >> t >> d;
        dist[s][t] = d;
    }
    
    int ans = dfs(0, 0);
    cout << (ans == inf ? -1 : ans) << "\n";
}


Measured memory_bytes: 5148
import qualified Data.IntMap as M

main = do
 li <- getLine
 let [n,m] = map read $ words li
 co <- getContents
 let abs = map (l2p . map read . words) $ lines co
 let ans = compute n m abs
 putStrLn "Yes"
 sequence_ $ map print ans

l2p [a,b] = (a,b)

{-
1番から始めて、距離1で行ける部屋をマークしていくだけに見える。
loop as bm cnt
- as 次に調べるべき部屋番号リスト
- bm 既に判っている部屋の答え 2..n が完成したら終わり
- cnt 残りの部屋数 0になったら終わり
-}

compute :: Int -> Int -> [(Int,Int)] -> [Int]
compute n m abs = tail $ M.elems ans
  where
    gr = M.fromListWith (++) [p | (a,b) <- abs, p <- [(a,[b]),(b,[a])]]
    ans = loop [1] (M.singleton 1 1) (n-1)
    loop _ bm 0 = bm
    loop as bm cnt = loop (M.keys bmd) (bm `M.union` bmd) (cnt - M.size bmd)
      where
        bmd = M.fromList [(b, a) | a <- as, b <- gr M.! a, M.notMember b bm]


Measured memory_bytes: 107172
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define PQS priority_queue <int, vector<int>, greater<int> > 
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 3e3 + 5;

int dp[N][N][4], val[N][N], n, m;

int go(int i, int j, int k) {
  if(i == n && j == m) return 0;
  int &x = dp[i][j][k];
  if(x != -1) return x;
  if(k < 3 && j < m) {
    x = max(x, val[i][j+1] + go(i, j+1, k+1));
  }
  if(i < n) {
    x = max(x, val[i+1][j] + go(i+1, j, 1));
  }
  if(j < m) {
    x = max(x, go(i, j+1, k));
  }
  if(i < n) {
    x = max(x, go(i+1, j, 0));
  }
  return x;
}

void solve() {
  memset(dp,-1,sizeof(dp));
  int k;
  cin >> n >> m >> k;
  
  for(int i = 1; i <= k; i++) {
    int x, y, z; cin >> x >> y >> z;
    val[x][y] = z;
  }

  int ans = val[1][1] + go(1,1,1);
  memset(dp,-1,sizeof(dp));
  int ans1 = go(1,1,0);
  ans = max(ans, ans1);
  cout << ans << '\n';  
}

/*
  * overflow, array bounds
  * do smth instead of nothing and stay organized
*/
signed main() {   
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
  #endif
   int t = 1;  //cin >> t;
   for(int i = 1; i <= t; i++) {
   //  cout << "Case #" << i << ": ";
     solve();
  }
}    

/*

*/

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

const int INF = 1 << 30;

int main(){
	int n, a;
	scanf("%d%d", &n, &a);
	int ans = -INF;
	int buy = a;
	for(int i = 1; i < n; i++) {
		scanf("%d", &a);
		ans = max(ans, a-buy);
		buy = min(buy, a);
	}
	printf("%d\n", ans);
}



Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
#define INF 1<<28
#define MAX_V 500
struct edge {
  int to,cap,rev;
  edge(){}
  edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
};

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,int cap){
  G[from].push_back(edge(to,cap,G[to].size()));
  G[to].push_back(edge(from,0,G[from].size()-1));
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s]=0;
  que.push(s);
  while(!que.empty()){
    int v=que.front();que.pop();
    for(int i=0;i<(int)G[v].size();i++){
      edge &e = G[v][i];
      if(e.cap>0&&level[e.to]<0){
	level[e.to]=level[v]+1;
	que.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v==t) return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t, int lim){
  int flow=0;
  for(;;){
    bfs(s);
    if(level[t]<0) return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,lim))>0){
      flow+=f;
      lim-=f;
    }
  }
}

int max_flow(int s,int t){
  return max_flow(s,t,INF);
}

int main(){
  int V,E;cin>>V>>E;
  for(int i=0,u,v,c;i<E;i++) cin>>u>>v>>c,add_edge(u,v,c);
  cout<<max_flow(0,V-1)<<endl;
  return 0;
}

Measured memory_bytes: 3176
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
typedef long long ll;
int a[maxn];
struct node{
	int b,c;
}p[maxn];
bool cmp(node a,node b){
	return a.c>b.c;
}
int main(){
	int n,m;
	ll sum=0;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),sum+=a[i];
	for(int i=1;i<=m;i++)scanf("%d%d",&p[i].b,&p[i].c);
	sort(a+1,a+n+1);
	sort(p+1,p+m+1,cmp);
	int pos=0;
	for(int i=1;i<=m;i++){
		if(pos==n){
			break;
		}
		int last=p[i].b+pos;
		last=min(n,last);
		for(int j=pos+1;j<=last;j++){
			if(a[j]>p[i].c){
				printf("%lld\n",sum);
				return 0;
			}
			sum-=a[j];
			sum+=p[i].c;
		}
		pos=last;
	}
	printf("%lld\n",sum);
}


Measured memory_bytes: 1408
# frozen_string_literal: true

N, M = gets.chomp.split(' ').map(&:to_i)

# frozen_string_literal: true

# 優先度付きQueue　挿入、削除共に logN 時間で可能！！そのため、logN * M 時間で解ける。
class MaxHeap
  attr_reader :targets

  def initialize(array)
    @targets = {}
    @length = array.length
    @length.times { |i| @targets[i + 1] = array[i] }
  end

  def max_heap(i)
    l = 2 * i
    r = 2 * i + 1

    largest = if l <= @length && @targets[l] > @targets[i]
                l
              else
                i
              end
    largest = r if r <= @length && @targets[r] > @targets[largest]

    return if largest == i

    @targets[i], @targets[largest] = @targets[largest], @targets[i]
    max_heap(largest)
  end

  def build_max_heap
    (@targets.length / 2).downto(1) do |i|
      max_heap(i)
    end
  end

  # 下からつけてどんどん上に
  def insert(val)
    @length += 1
    @targets[@length] = val

    h = @length
    while h > 1 && @targets[h / 2] < @targets[h]
      @targets[h / 2], @targets[h] = @targets[h], @targets[h / 2]
      h /= 2
    end
  end

  def extra_max
    return 0 if @targets[1].nil?

    max = @targets[1]
    @targets[1] = @targets[@length]
    @targets.delete(@length)
    @length -= 1
    max_heap(1)

    max
  end
end

bites = Array.new(M) { [] }
N.times do
  a, b = gets.chomp.split(' ').map(&:to_i)
  next if a > M

  bites[a - 1].push(b)
end

heap = MaxHeap.new([])
cnt = 0
bites.each do |bite|
  bite.each { |b| heap.insert(b) }
  cnt += heap.extra_max
end

puts cnt


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

using namespace std;

int main(int argc, char* argv[])
{
  int N; cin >> N;
  
  vector<int> H(N);
  cin >> H[0];
  if (H[0] > 1) {
    H[0]--;
  }

  bool ans = true;
  for (int i = 1; i < N; i++) {
    cin >> H[i];
    if (H[i-1] < H[i]) {
      H[i]--;
    }
    if (H[i-1] > H[i]) {
      ans = false;
      break;
    }
  }

  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

    ll k, q;cin >> k >> q;
    vector<ll> v(k);REP(i, k)cin >> v[i];

    REP(s_e_i_c_a, q){
        ll n, x, m;cin >> n >> x >> m;n--;
        ll sum = x % m;
        REP(i, min(k, n)){
            ll now = v[i] % m;
            sum += now * ((n / k) + (i < (n % k)));
        }
        ll ans = n - (sum / m);
        REP(i, min(k, n)){
            if(v[i] % m != 0)continue;
            //cout << "! " << v[i] << endl;
            ans -= ((n / k) + (i < (n % k)));
        }
        cout << ans << endl;
    }

	return 0;
}


Measured memory_bytes: 384
/*


               BASIC TEMPLATES


*/
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")

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

//#
//#  #
//#   #
//#    #
//#   # #
//#  #   ###
//#
#define ll long long
#define pb push_back
#define emb emplace_back
#define ff first
#define ss second
#define FAST cin.tie(0); ios_base::sync_with_stdio (false)
#define pii pair<int,int>
#define TEN6 1000000
#define TEN5 100000
#define TEN4 10000
#define TEN9 1000000000
#define ipv pair<ll,vector<ll> >
#define pll pair<ll,ll>
#define CASE(x) "Case "<<x<<": "
#define _endl "\n"


#define for_r(i,st,lim) for(ll i=st-1;i>=lim;i--)
#define fRead(x) freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)
#define all_set(arr,val) memset(arr,val,sizeof(arr))
#define all(x) x.begin(),x.end()
#define for_(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//lower_bound returns an iterator pointing to the first element in the range [first,last) which has a value not less than ‘val’.

//upper_bound returns an iterator pointing to the first element in the range [first,last) which has a value greater than ‘val’.
using namespace __gnu_pbds;
#define ordered_set tree<ll , null_type,less<ll  >, rb_tree_tag,tree_order_statistics_node_update>

#define MOD 998244353 ///////<<<<<<<<<<<<<<<<<<=====MOD value change here!!!!!
#define INF 5e18
#define what_is(x) cerr << #x << " is " << x << endl;

ll BMod(ll B,ll P,ll M)
{
    ll R=1;
    B=B%M;
    while(P)
    {
        if(P&1)
            R=(R*B)%M;
        P >>= 1;
        B=(B*B)%M;
    }
    return R;
}

ll invMOD(ll num,ll M)
{
    return BMod(num,M-2,M);
}


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

}



ll lcm(ll a,ll b)
{
    return a*b / gcd(a,b);
}
ll my_abs(ll x)
{
    if(x<0)x*=-1;
    return x;
}
int main()
{
    //
    // FAST;
    ll n,k;
    cin>>n;
    ll A[n+10];
    ll B[n+10];
    ll C[n+10];
    for_(i,0,n)
    {
        cin>>A[i]>>B[i]>>C[i];
    }
    ll dp[n+10][3];
    all_set(dp,0);
    dp[n-1][0]=A[n-1];
    dp[n-1][1]=B[n-1];
    dp[n-1][2]=C[n-1];
    for_(i,n-1,0)
    {
        dp[i][0]=A[i]+max(dp[i+1][1],dp[i+1][2]);
        dp[i][1]=B[i]+max(dp[i+1][2],dp[i+1][0]);
        dp[i][2]=C[i]+max(dp[i+1][0],dp[i+1][1]);
    }
    cout<<max({dp[0][0],dp[0][1],dp[0][2]})<<_endl;


}

















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

int main(){
  char b;
  cin >> b;
  char A = 'A';
  char C = 'C';
  char G = 'G';
  char T = 'T';
  if(b == A){
    cout << T << endl;
  }
  else if(b == C){
    cout << G << endl;
  }
  else if(b == G){
    cout << C << endl;
  }
  else{
    cout << A << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define sl set<ll>
#define vs vector<string>
#define vl vector<ll>
#define vi vector<int>
#define vpl vector<pair<ll,ll>>
#define pb push_back
#define PI 3.14159265358979323846
#define ll long long
#define ld long double
#define endl "\n"
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repp(i,a,b) for (ll i = (a); i >= (b); i--)
#define rop(i,a,b)  for(ll i=(a); i>(b); i--)
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define tt long long t; cin>>t; while(t--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const int maxn=1e5+100;


int main()
{
ll n,d;
cin>>n>>d;
ll cnt=0;
d=d*d;

while(n--)
{
    ll a,b;
    cin>>a>>b;
    ll  z,x;
    z=(a*a);
    x=(b*b);
    ll k=z+x;
    //g=sqrt(k);
   
    if(k<=d)cnt++;

}
cout<<cnt;
}

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

int main(){
    int N;
    long long A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    long long min=A,max=A;

    for(int i=2;i<=N-1;i++){
        if((min+C)-(max-C)>1){
            if(B>=(min+max)/2){
                min=min+C;
                max=max+D;
            }else{
                min=min-D;
                max=max-C;
            }
        }else{
            min=min-D;
            max=max+D;
        }
    }
    if((max>B+D && min<=B+D)||(max<=B+D && max>=B+C)||(max<B+C && max>B-C && min<=B-C)||(max<=B-C && max>=B-D))
        cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func scanStrings(n int) []string {
	sl := make([]string, n)
	for i := range sl {
		sl[i] = scanString()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

type dataType struct {
	N int
	S string
	P int
}

type dataTypeList []dataType

func (d dataTypeList) Len() int {
	return len(d)
}

func (d dataTypeList) Less(i, j int) bool {
	if d[i].S < d[j].S {
		return true
	} else if d[i].S == d[j].S && d[i].P > d[j].P {
		return true
	}
	return false
}

func (d dataTypeList) Swap(i, j int) {
	d[i], d[j] = d[j], d[i]
}

func main() {
	N := scanInt()
	data := dataTypeList{}
	for i := 0; i < N; i++ {
		S, P := scanString(), scanInt()
		data = append(data, dataType{N: i + 1, S: S, P: P})
	}
	sort.Sort(data)

	for _, v := range data {
		fmt.Println(v.N)
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#include<vector>
#define ll long long
using namespace std;

int main(){
	int n,x1,x2,y1,y2,t1,t2,flag=1;
	cin>>n;
	x1=y1=t1=0;
	for (int i=1;i<=n;i++){
		cin>>t2>>x2>>y2;
		int d=abs(x1-x2)+abs(y1-y2);
		if (t2-t1 < d){
			flag=0;
		}else{
			int t=t2-t1;
			if ((t&1)^(d&1)) flag=0;
			//cout<<t<<" "<<d<<" "<<((t&1)^(d&1))<<endl; 
		}
		x1=x2;
		y1=y2;
		t1=t2;
	}
	if (flag) cout<<"Yes";
	else cout<<"No";
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;



int main(void) {
  string s;
  cin >> s;
  ll N=s.size();
  s+='#';
  ll i;
  vector<pair<ll, char>> v;
  
  for(i=0; i<N; i++) {
    ll t=1;
    while(i<N && s[i]==s[i+1]) {
      i++;
      t++;
    }
    v.push_back({t, s[i]});
  }
  
  
  ll ans=0;
  ll L=v.size();
  v.push_back({0, '#'});
  for(i=0; i<L; i++) {
    if(v[i].second=='>') {
      ll t=v[i].first;
      ans+=t*(t+1)/2;
    }else if(v[i].second=='<') {
      ll t=v[i].first;
      ll u=v[i+1].first;
      ans+=t*(t+1)/2+u*(u+1)/2-min(t, u);
      i++;
    }
    
  }
  
  pt(ans);
}






Measured memory_bytes: 6392
#include<iostream>
using namespace std;
int main()
{
    int a1,a2,a3,a;

    cin>>a1>>a2>>a3;

    if(a1>0&&a1<14&&a2>0&&a2<14&&a3>0&&a3<14)
    {
        a=a1+a2+a3;
        if(a<22)
            cout<<"win"<<endl;
        else
            cout<<"bust"<<endl;
    }

    return 0;
}


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

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

    std::cout << ((a + b + c >= 22)? "bust":"win") << std::endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (; sc.hasNextInt();) {
			int[] a = new int[4];
			int[] b = new int[4];
			for (int i = 0; i < 4; i++) {
				a[i] = sc.nextInt();
			}
			for (int i = 0; i < 4; i++) {
				b[i] = sc.nextInt();
			}
			int hit = 0;
			int blow = 0;
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					if (a[i] == b[j]) {
						if (i == j) {
							hit++;
						} else {
							blow++;
						}
					}
				}
			}
			System.out.println(hit + " "+ blow );
		}
	}

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

	}
}

Measured memory_bytes: 12000
#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	int mode=0;
	long long int x;
	for(int i=0;i<n;i++){
		scanf("%lld",&x);
		if(x%2==1)mode=1;
	}
	if(mode==1)printf("first\n");
	else printf("second\n");
	return 0;
}

Measured memory_bytes: 128
a, b, k = list(map(int, input().split()))
al, bl = [], []
if a == b:
    print(a)
else:   
    for i in range(min(b-a,k)):
        al.append(a+i)
        bl.append(b-i)
        ans = list(set(al) | set(bl))
    ans.sort()
    for i in ans:
        print(i)

Measured memory_bytes: 9052
n = int(input())
a = n // 4
res = 0
for i in range(a+1):
  N = 4*i
  if (n-N) % 7 == 0:
    res += 1

b = n//7    
for i in range(b+1):
  M = 7*i
  if (n-M) % 7 == 0:
    res += 1  
    
if res == 0 or n == 0:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define N 100500
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
const ll m = 1e9 + 7;
int n;
ll memo[N][5];
vector <int> adj[N];

ll mul(ll a , ll b) {
    return ((a % m) * (b % m)) % m;
}

ll add(ll a , ll b) {
    return ((a % m) + (b % m)) % m;
}

ll dp(int u , int color , int par) {
    ll &sol = memo[u][color];
    if (sol != -1) return sol;
    ll product = 1;
    for (int v : adj[u]) {
        if (v == par) continue;
        if (color == 0) {
            product = mul(product , add(dp(v , 0 , u) , dp(v , 1 , u)));
        } else {
            product = mul(product , dp(v , 0 , u));
        }
    }
    return sol = product;
}

int main() {
    scanf("%d" , &n);
    for (int i = 1 ; i < n ; i++) {
        int u,v; scanf("%d%d" , &u , &v);
        adj[u].pb(v);
        adj[v].pb(u);
    }
    memset (memo , -1 , sizeof memo);
    printf("%lld\n" , add(dp(1 , 0 , 1) , dp(1 , 1 , 1)));
}


Measured memory_bytes: 18048
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  int N,W; cin >> N >> W;
  v<int> value(N+1),weight(N+1);
  vv<int> dp(110,v<int>(10010,0));
  for(int i=1;i<=N;i++){
    cin >> value[i] >> weight[i];
  }
  for(int i=1;i<=N;i++) rep(w,10001){
    if(w-weight[i]<0) dp[i][w]=dp[i-1][w];
    else{
      dp[i][w]=max(dp[i-1][w],dp[i][w-weight[i]]+value[i]);
    }
  }
  cout << dp[N][W] << endl;
  return 0;
}



Measured memory_bytes: 11620
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

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

    ll ans = 0;
    for(int i = 1; i < n; i++){
        if(a[i-1] > a[i]){
            ans += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int a, b;
  cin >> a >> b;
  cout << ((a*b)%2 == 0 ? "Even" : "Odd") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    ll ok=0,ng=200002,mid=(ok+ng)/2;
    while(mid!=ok){
        ll sum=0;
        for(int i=0;i<n;i++){
            sum+=n-(lower_bound(a,a+n,mid-a[i])-a);
        }
        ((sum>=m)?ok:ng)=mid;
        mid=(ok+ng)/2;
    }
    ll s[n+1];
    s[0]=0;
    for(int i=0;i<n;i++){
        s[i+1]=s[i]+a[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ll num=(upper_bound(a,a+n,ok-a[i])-a);
        ans+=s[n]-s[num];
        ans+=(n-num)*a[i];
        m-=(n-num);
    }
    cout << ans+(ok*m)<<endl;

    return 0;
}


Measured memory_bytes: 1792
import queue
while True:
    n,k=map(int,input().split())
    if n==0:break
    a=queue.deque(int(input()) for _ in range(k))
    m=b=sum(a)
    for i in range(n-k):
        c=a.popleft()
        d=int(input())
        a.append(d)
        b+=d-c
        m=max(b,m)        
    print(m)


Measured memory_bytes: 8948
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <list>
#define pie 3.141592653589793
#define si(a) scanf("%d",&a)
#define ss(a) scanf("%s",a)
#define sl(a) scanf("%lld",&a)
#define pi(a) printf("%d",a)
#define pl(a) printf("%lld",a)
#define ps(a) printf("%s",a)
#define ll long long
using namespace std;
int main()
{
  ll n;
  sl(n);
  double k = (sqrt(n));
  ll p = floor(k);
  if(p*p==n)
    printf("%lld\n",n);
  else{
    p= p*p;
    printf("%lld\n",p);
  }
  return 0;
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let s = read_as_string();

    if let Some(x) = s.find("C"){
        if let Some(y) = s.rfind("F"){
            if x < y{
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

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

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

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

template <typename T>
T gcd(T a, T b) {
  if(b == 0) return a;
  else return gcd(b,a%b);
}



int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

// struct UnionFind {
//   vector<int> par;

//   UnionFind(int n) {
//     par.resize(n,-1); 
//   }

//   int root(int x) {
//     if(par[x] < 0) return x;
//     else return par[x] = root(par[x]);
//   }

//   bool issame(int x, int y) {
//     return root(x) == root(y);
//   }

//   bool merge(int x, int y) {
//     x = root(x); y = root(y);
//     if(x == y) return false;
//     if(par[x] > par[y]) swap(x,y);
//     par[x] += par[y];
//     par[y] = x;
//     return true;
//   }
  
//   int size(int x) {
//     return -par[root(x)];
//   }
// };
int a[200010];
ll first = 0;
ll cycle = 0;
ll st = 0;
vector<ll> seen(200010,-1);
ll ans = -1;
ll N,K;


void dfs(int v,ll cost) {
  if(cost == K) {
    
    ans = v;
    return;
  } 
  if(seen[v] >= 0) {
    cycle = cost - seen[v];
    first = v;
    st = cost;
    return;
  }
  else {
    int next = a[v];
    seen[v] = cost;
    dfs(next, cost+1);
  }
}



int main() {
  cin >> N >> K;
  rep(i,N){
    int b;cin >> b;
    a[i+1] = b ;
  }
  dfs(1,0);
  // rep(i,N) {
  //   cout << seen[i+1] <<  endl;
  // }

  
  
  if(ans != -1){
    cout << ans << endl;
    return 0;
  } 
  ll d = (K-st) % cycle;
  ll pre = first;
  ll next;
  while(d > 0) {
    d--;
    next = a[pre];
    pre = next;
  }
  cout << pre << endl;
  
  
}














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


int main(){
  int n,i,num;
  cin >> n;
  vector<int> p(n);
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  num=0;
  for(i=0;i<n;i++){
    if(p[i]!=i+1){
      num++;
    }
  }
  if(num<=2){
    cout << "YES" << endl;

  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int n;
    string s;
    cin>>n>>s;
    
    int div;
    int i;
    vector<int> counter(n);
    
    for(i=0; i<n; i++){
        counter[i]=0;
    }
    
    string all ="abcdefghijklmnopqrstuvwxyz";
    
    for(div=0; div<n; div++){
        string sa = s.substr(0,div);
        string sb = s.substr(div, n-div);
        for(i=0; i<26; i++){
            if(sa.find(all[i])!=string::npos and sb.find(all[i])!=string::npos){
                counter[div]++;
            }
        }
    }
    int max=0;
    for(div=0; div<n; div++){
        if(max<counter[div]){
            max=counter[div];
        }
    }
    cout<<max<<endl;
    
    return 0;
}


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

int main()
{
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if(x < 0 || y < 0) cout << "No" << endl;
  else if(W-x>=r && H-y>=r) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 3120
import java.util.*;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] inputs = sc.nextLine().split("[\\s]+");
        int A = Integer.parseInt(inputs[0]);
        int B = Integer.parseInt(inputs[1]);
        String answer = ":(";
        if(A <= 8 && B <= 8) {
          //true
          System.out.println("Yay!");
        } else {
          System.out.println(":(");
        }

    }
}


Measured memory_bytes: 22996
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    double sum=0;
    for (int i = 0; i < n; i++) {
        sum += 1.0/a[i];
    }
    cout << 1.0/sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>

using namespace std;



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

	vector<string> s(50);

	for (int i = 0; i < h; i++) {
		cin >> s.at(i);
	}

	vector<int> x{ 1, 0, -1, 1, 0, -1, 1, -1 };
	vector<int> y{ 1, 1, 1, -1, -1, -1, 0, 0 };

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s.at(i).at(j) == '#') continue;

			int dx;
			int dy;
			int num = 0;
			for (int k = 0; k < 8; k++) {
				dx = x.at(k);
				dy = y.at(k);


				int a = i + dx;
				int b = j + dy;

				if (a >= h || a < 0) continue;
				if (b >= w || b < 0) continue;
				if (s.at(a).at(b) == '#') ++num;
			}
			s.at(i).at(j) = num + '0';
		}
	}

	for (int i = 0; i < h; i++) {
		cout << s.at(i) << endl;
	}

	return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>

#define N 100000
int head[N], tail[N * 2], dat[N * 2], k;
int deg[N];
int stk[N], sp;
int cycle[N];

void insert(int u, int v) {
  dat[k] = v;
  tail[k] = head[u];
  head[u] = k++;
}

int main() {
  int n;
  scanf("%d", &n);
  memset(head, -1, sizeof(head));
  for (int i = 0; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    insert(u, v);
    insert(v, u);
    deg[u]++;
    deg[v]++;
  }
  for (int i = 0; i < n; i++) {
    if (deg[i] == 1) {
      stk[sp++] = i;
    }
  }
  while (sp > 0) {
    int u = stk[--sp];
    cycle[u] = true;
    for (int i = head[u]; i != -1; i = tail[i]) {
      int v = dat[i];
      if (--deg[v] == 1) {
        stk[sp++] = v;
      }
    }
  }
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    printf("%d\n", !cycle[u] && !cycle[v] ? 2 : 1);
  }
}


Measured memory_bytes: 5492
/* kadai4_3
   Saikyo_Kazune
*/
#include <stdio.h>
int snow_depth(int west_height_seen,int east_height_seen){
    //西側の塔の本来の高さを格納する変数 int west_heightを宣言
    int west_height=0;
    //雪の上に見えている東側の塔の高さから西側の等の高さを引いた数がnのとき、西側の塔本来のたかさが0からn-1までの和であるから
    for(int i=0;i<(east_height_seen-west_height_seen);i++){
        west_height+=i;
    }
    //西側の塔の本来の高さから雪上に見える高さを引いたものが雪の深さ
    return west_height-west_height_seen;
}
int main(void){
   
   //int型　雪上に見えている等の高さを格納する変数を宣言
   int west_height_seen,east_height_seen;
   //標準入力から受け取り
   scanf("%d %d",&west_height_seen,&east_height_seen);
   //関数により雪の深さを求めて出力
   printf("%d\n", snow_depth(west_height_seen,east_height_seen));
   return 0;
}

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

using namespace std;

typedef vector<int> V;

int main() {
    int s;
    cin >> s;
    V a = V(1000001);
    for (int i = 1; i < 1000001; i++) {
        if (i == 1) {
            a[i] = s;
        } else if (a[i - 1] % 2 == 0) {
            a[i] = a[i - 1] / 2;
        } else {
            a[i] = a[i - 1] * 3 + 1;
        }
        for (int j = 1; j < i; j++) {
            if (a[i] == a[j]) {
                cout << i << "\n";
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=1e5+10;
struct node
{
	int x,i;
	bool operator < (const node &o) const
	{
		return x<o.x||(x==o.x&&i<o.i);
	}
}nd[maxn];
int n;
LL ans[maxn];
int main()
{
	cin>>n;
	for (int i=1;i<=n;i++) scanf("%d",&nd[i].x),nd[i].i=i;
	sort(nd+1,nd+n+1);
	nd[0].x=nd[0].i=0;
	int curi=nd[n].i,num=0;
	LL sum=0;
	for (int i=n;i>=0
	;i--)
	    if (curi>nd[i].i)
	    {
	    	ans[curi]=sum-(LL)num*nd[i].x;
	    	curi=nd[i].i;
			num++;
			sum=(LL)num*nd[i].x;
		}
		else
		{
			num++;
			sum+=nd[i].x;
		}
	for (int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#include <string.h>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15


int main(){

 string s;
 cin>>s;

 int a=0,b=0;

 for(int i=0;i<s.length();i++){
    if(i%2 == 0){
        if(s[i] == '0')
            a++;
    }else {

       if(s[i] == '1')
        a++;

      }
 }

  for(int i=0;i<s.length();i++){
    if(i%2 == 0){
        if(s[i] == '1')
            b++;
    }else if(i%2 == 1){

      if(s[i] == '0')
        b++;
       }
 }

  cout<<min(a,b)<<endl;

return 0;
}

Measured memory_bytes: 3732
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-18
inline ll read()
{
    ll tmp=0; char c=getchar(),f=1;
    for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
    for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0';
    return tmp*f;
}
using namespace std;
struct edge{
	int to,flow,nxt;
}e[20010];
int fir[210],lev[210];
int q[20010];
int a[110],b[110],c[110],d[110];
int n,nn,tot=0;
void add(int x,int y,int flow)
{
	e[tot].to=y; e[tot].flow=flow; e[tot].nxt=fir[x]; fir[x]=tot++;
	e[tot].to=x; e[tot].flow=0; e[tot].nxt=fir[y]; fir[y]=tot++;
}
int flow(int now,int mn)
{
	if(now==nn)return mn;
	for(int i=fir[now];~i;i=e[i].nxt)
		if(lev[e[i].to]==lev[now]+1&&e[i].flow){
			int tmp=flow(e[i].to,min(mn,e[i].flow));
			e[i].flow-=tmp; e[i^1].flow+=tmp;
			if(tmp)return tmp;
		}
	return 0;
}
int main()
{
	int i,j;
	n=read(); nn=2*n+1;
	for(i=0;i<=nn;i++)fir[i]=-1;
	for(i=1;i<=n;i++)a[i]=read(),b[i]=read();
	for(i=1;i<=n;i++)c[i]=read(),d[i]=read();
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			if(a[i]<c[j]&&b[i]<d[j])add(i,j+n,1);
	for(i=1;i<=n;i++)add(0,i,1),add(i+n,nn,1);
	int ans=0;
	while(1){
		for(i=0;i<=nn;i++)lev[i]=0;
		int h=1,t=1; q[1]=0; lev[0]=1;
			while(h<=t){
			for(i=fir[q[h]];~i;i=e[i].nxt)
				if(!lev[e[i].to]&&e[i].flow){
					q[++t]=e[i].to; lev[e[i].to]=lev[q[h]]+1;
				}
			++h;
		}
		if(!lev[nn])break;
		int tmp=flow(0,inf);
		while(tmp){
			ans+=tmp;
			tmp=flow(0,inf);
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    String c = sc.next();
    if(a.charAt(a.length() - 1) == b.charAt(0)&&b.charAt(b.length() - 1) == c.charAt(0)){
      System.out.println("YES");
    }
    else System.out.println("NO");
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int N;
	cin>>N;
	vector<int> S(N);
	rep(i,0,N) cin>>S[i];
	
	ll res=0;
	rep(d,1,N-1) {
		ll sum=0;
		for (int k=1; k*d<N-1; k++) {
			sum+=S[k*d]+S[N-1-k*d];
			int A=N-1-k*d;
			if (A<=d || (A%d==0 && k>=A/d)) continue;
			res=max(res,sum);
		}
	}

	cout<<res<<"\n";
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{

	public static void main(String[] args) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inputA = br.readLine().split(" ");
		String[] inputB = br.readLine().split(" ");

		if (sumScore(inputA) > sumScore(inputB))
			System.out.println(sumScore(inputA));
		else
			System.out.println(sumScore(inputB));
	}

	private static int sumScore(String[] score)
	{
		int sum = 0;
		for (int i = 0; i < score.length; ++i)
		{
			sum += Integer.parseInt(score[i]);
		}
		return sum;
	}
}

Measured memory_bytes: 24432
#include<stdio.h>

int main() {
  char S[4];
  scanf("%s", S);

  int flag = 0;
  if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) flag = 1;
  if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) flag = 1;
  if(S[0] == S[3] && S[1] == S[2] && S[0] != S[1]) flag = 1;

  if(flag == 1) printf("Yes\n");
  else          printf("No\n");

  return 0;
}


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

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


Measured memory_bytes: 3588
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,i;
    cin>>n;
    string a[n];
    map<string,ll>mp;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        mp[a[i]]++;
    }
    ll maxi=mp[a[0]];
    for(auto it:mp)
    {
        //cout<<it.first<<" "<<it.second<<endl;
        if(it.second>maxi)
        {
            maxi=it.second;
        }
        
    }
    //cout<<maxi<<endl;
    for(auto it:mp)
    {
        if(it.second==maxi)
        cout<<it.first<<endl;
    }
}



Measured memory_bytes: 25500
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int l;
string s;
int main()
{
	cin>>s;
	l=s.size();
	for (register int i=0;i<l;i++)
	{
		if (s[i]=='C')
		{
			for (register int j=i+1;j<l;j++)
			{
				if (s[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
			}	
		} 
	}
    cout<<"No";
	return 0;
}


Measured memory_bytes: 256
/*
 * 	Roses are red
 * 		Violets are blue
 * 			I cried
 * 				And so did you
 */
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifndef rd
#define endl '\n'
#endif
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=1e9;
const int mod=998244353;
//const int mod=1000000007;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> oset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
auto clk=clock();
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

const int N=1e4+5;
int a[N];
int sieve[10006];
void solve() {
	vi primes;
	for(int i=2; i<=10005; i++)
		if(sieve[i]==0) {
			primes.pb(i);
			for(int j=i*i; j<=10005; j+=i)
				sieve[j]=1;
		}
	int n;
	cin>>n;
	ll sum=0,sum2=0;
	int obvious=0;
	for(int i=n; i>=0; i--) {
		cin>>a[i];
		sum+=a[i];
		if(i&1)
			sum2-=a[i];
		else
			sum2+=a[i];
		obvious=__gcd(obvious,abs(a[i]));
	}
	vi ans;
	for(int i:primes) {
		fill(sieve,sieve+10005,0);
		for(int j=0; j<=n; j++) {
			sieve[j%(i-1)]+=a[j];
		}
		bool valid=1;
		for(int j=0; j<=10004; j++) {
			if(sieve[j]%i!=0) {
				valid=0;
			}
		}
		if(valid)
			ans.pb(i);
	}
	for(int i=2; i*i<=obvious; i++) {
		if(obvious%i==0) {
			ans.pb(i);
			obvious/=i;
			while(obvious%i==0) {
				obvious/=i;
			}
		}
	}
	if(obvious>1) {
		ans.pb(obvious);
	}
	sort(all(ans));
	ans.resize(unique(all(ans))-ans.begin());
	for(int i:ans)
		if(a[0]%i==0&&sum%i==0&&sum2%i==0)
			cout<<i<<endl;
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#define ll long long
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int maxn=20000050; 

char s[maxn];
int cnt[maxn],n,p; 

int main()
{
	cin>>n>>p;
	ll ans=0;
	scanf("%s",s);
	if(p==2||p==5)
	  {
	  	  for(int i=0;i<n;++i)
	  	    if((s[i]-'0')%p==0)
	  	      ans+=i+1;
	  }
	else 
	  {
		  ll t=1,res=0;
		  for(int i=n-1;i>=0;--i)
		    {
		    	cnt[res]++;
		    	res=(res+(s[i]-'0')*t)%p;
		    	t=t*10%p;
		    	ans+=cnt[res];
		    }
	  }  
	printf("%lld\n",ans);
	return 0;  
}


Measured memory_bytes: 3980
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = n/2;
		if(n % 2 == 1) {
			ans++;
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 35608
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7,MAX = 1e6+5;
const ll INF = 1e18+5;

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;

	vi dp(n+1),pp(n+1);
	for(int i=0;i<n;i++)
	{
		dp[i+1] = dp[i] + (s[i]=='W');
	}
	if(s[n-1]=='R') pp[n] = 1;

	for(int i=n-2;i>=0;i--)
	{
		pp[i+1] = pp[i+2] + (s[i]=='R');
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		ans += (s[i]=='R');
	}
	ans = min(ans,n-ans);

	for(int i=1;i<n;i++)
	{
		ans = min(ans, abs(pp[i+1]-dp[i])+min(dp[i],pp[i+1]));
	}
	cout<<ans<<endl;
}	

Measured memory_bytes: 5252
def get_num(n, x):
    ans = 0
    for n3 in range(min(n, x), (x + 2) / 3, -1):
        for n2 in range(n3 - 1, (x - n3 + 1) / 2 - 1, -1):
            for n1 in range(n2 - 1, 0, -1):
                s = n1 + n2 + n3
                if s < x:
                    break
                elif s == x:
                    ans += 1
                    break
    return ans


while True:
    [n, x] = [int(m) for m in raw_input().split()]
    if [n, x] == [0, 0]:
        break
    if x == 0:
        print(0)
    else:
        print(get_num(n, x))

Measured memory_bytes: 6428