akhauriyash/Code-Regression huggingface dataset:
def abc068_b():
    n = int(input())
    ans = 1
    count = 0

    for i in range(1, n + 1):
        num = i
        tmp_count = 0
        while num % 2 == 0:
            tmp_count += 1
            num /= 2
        if tmp_count > count:
            ans = i
            count = tmp_count

    print(ans)


abc068_b()

Measured memory_bytes: 3060
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

arr = LIST()
if (not arr[0] % 2) or (not arr[1] % 2) or (not arr[2] % 2):
    print(0)
else:
    arr.sort()
    print(arr[0] * arr[1])

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------



void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>x;
	FOR(i,x) cout<<"ACL";
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
using namespace std;


int main(){
  int a, p;
  cin >> a >> p;
  cout << ((a * 3) + p )/ 2 << endl;

}


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

int main(){
    int N;
    int max = 1;
    int count = 1;
    int j;

    cin >> N;

    vector<string> S(N);
    vector<int> appeared(N);
    vector<string> mode;

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

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

    appeared[0] = count;
    for(int i = 1; i < N; i++){
        if(S[i - 1] == S[i]){
            count++;
            appeared[i] = count;
        }
        else{
            count = 1;
            appeared[i] = count;
        }

    }

    for(int i = 0; i < N; i++){
        if(max < appeared[i]){
            max = appeared[i];
        }
    }

    for(int i = 0; i < N; i++){
        if(appeared[i] == max){
            mode.push_back(S[i]);
        }
    }

    for(vector<string>::iterator pv = mode.begin(); pv != mode.end(); ++pv){
        cout << *pv << endl;
    }

    return 0;
}

Measured memory_bytes: 18548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[7][7],vis[7][7];
map<ll,int>kk;
int main(){
    ll n,m,x,y;
    kk.clear();
    memset(vis,0,sizeof(vis));
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            cin>>a[i][j];
        }
    }
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x;kk[x]=1;
    }
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            if(kk[a[i][j]]) vis[i][j]=1;
        }
    }
    int fa=0,l,r;
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            vis[i][4]+=vis[i][j];
        vis[4][j]+=vis[i][j];
        if(vis[4][j]==3||vis[i][4]==3){
            fa=1;
        }
        }
    }
    if(vis[1][1]+vis[2][2]+vis[3][3]==3||vis[1][3]+vis[2][2]+vis[3][1]==3) fa=1;
    if(fa){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string S = "";
    REP(i, N){
    	ll x;
    	cin >> x;
    	S += char(x);
    }

    vector<ll> res;
    REP(i, N){
    	ll ind = -1;
    	REP(j, S.size()){
    		if(S[j] == j+1) ind = max(ind, (ll)j);
    	}
    	if(ind == -1){
    		cout << -1 << endl;
    		return 0;
    	}else{
    		res.push_back(ind+1);
    		S.erase(ind, 1);
    	}
    }
    REP(i, N){
    	cout << res[N-i-1] << endl;
    }
    return 0;
}

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

int main()
{
	float n,k,a[100000],t=1,l,r;
	cin>>n>>k;
	for(int i=1;i<=n;++i)
	{
		cin>>a[i];
		if(a[i]<1)	t=i;
	}
	l=ceil((t-1)/(k-1));
	r=ceil((n-t)/(k-1));
	cout<<l+r;

}

Measured memory_bytes: 640
//
//  main.cpp
//  usaco
//
//  Created by 김현수 on 2020/08/30.
//  Copyright © 2020 김현수. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    if(a==b)
    {
        printf("%d", a+b);
    }
    else if(a>b)
    {
        printf("%d", 2*a-1);
    }
    else if(a<b)
    {
        printf("%d", 2*b-1);
    }
}


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

int main(){
	int n;
	scanf("%d",&n);
	vector <int> value(n);
	for(int i=0;i<n;i++) scanf("%d",&value[i]);
	vector <int> Xor(n+1,0);
	vector <lint> Plus(n+1,0LL);
	for(int i=0;i<n;i++){
		Xor[i+1]=Xor[i]^value[i];
		Plus[i+1]=Plus[i]+value[i];
	}
	lint result=0;
	for(int start=0;start<n;start++){
		int low=start,high=n-1;
		while(low<high){
			int mid=low+(high-low+1)/2;
			int sum1=Xor[mid+1]^Xor[start];
			int sum2=Plus[mid+1]-Plus[start];
			if(sum1==sum2) low=mid;
			else high=mid-1;
		}
		result+=low-start+1;
	}
	printf("%lld\n",result);
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pob pop_back
#define MP make_pair
#define VI vector<int>
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5;
const ll MOD=1000000007;
const ll INF=(ll)1e18;

int main(){
	IOS();
	ll n,m;
	cin>>n>>m;
	ll c;cin>>c;
	if(n+m>=c) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
class Line:
    def __init__(self, a, b):
        self.a = a
        self.b = b


N, M = map(int, input().split())
lines = []
for _ in range(M):
    a, b = map(int, input().split())
    lines.append(Line(a, b))
second_islands = []
m = {}
for line in lines:
    m.setdefault(line.a, {})
    m[line.a][line.b] = 1
for line in lines:
    if line.a == 1:
        second_islands.append(line.b)

can_reach = False
for island in second_islands:
    if island in m:
        if N in m[island]:
            can_reach = True
            break
if (can_reach):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 90496
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vii;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main()
{
	int n;
	cin >> n;
	
	vii t(n);

	rep(i, n) cin >> t[i].second >> t[i].first;

	sort(ASC(t));

	int time = 0;

	rep(i, n)
	{
		time += t[i].second;
		if (time > t[i].first)
		{
			ANS("No");
			return 0;
		}
	}
	ANS("Yes");
}

Measured memory_bytes: 1792
berb = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
        'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

S = list(input())

for i in range(len(S)):
    S[i] = berb.index(S[i])

S_d = [-1]
S_0 = len(S)
k = 0

while True:
    if k == 26:
        if len(S) == 0:
            print(-1)
            break
        else:
            S_d.append(S.pop(-1))
            k = 0
    elif k in S or k <= S_d[-1]:
        k += 1
    else:
        S.append(k)
        for j in range(len(S)):
            S[j] = berb[S[j]]

        print(''.join(S))
        break

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
	
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a>b){
			System.out.println("a > b");
		}
		else if(a<b){
			System.out.println("a < b");
		}	
		else if(a==b){
			System.out.println("a == b");
		}
	}
	
	public static void main(String[]args){
		Main obj =new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int x;
  cin >> x;

  for (int i = x; i < 5000000; i++) {
    for (int j = 2; j <= i; j++) {
      if (i % j != 0 && i != j) {
        continue;
      } else if (i % j == 0 && i != j) {
        break;
      }
      if (i == j) {
        cout << i << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define int long long
#define EPS (1e-10)
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int t[10000], a[10000];
signed main() {
	int n; scanf("%lld", &n);
	int ans = 1;
	int T = 0, A = 0;
	rep(i, n) {
		scanf("%lld%lld", &t[i], &a[i]);
		int k = t[i] + a[i];
		int j;
		for (j = max(ans/k,max(T/t[i],A/a[i])); k*j < ans || ((k*j) / (t[i] + a[i]))*t[i] < T || ((k*j) / (t[i] + a[i]))*a[i] < A; j++);
		T = (k*j / (t[i] + a[i]))*t[i];
		A = (k*j / (t[i] + a[i]))*a[i];
		ans = k*j;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include <cstdio>
#include <array>
#include <utility>

template <unsigned int N> struct shuumai{
    unsigned int minPrime[N + 1];
    unsigned int Next[N + 1];
    unsigned int Primes[N + 1];
    unsigned int size_;

    constexpr shuumai(void): minPrime(), Primes(), Next(), size_(0U){
        minPrime[0] = 1; minPrime[1] = 1;
        for(int even = 2, odd = 3; odd <= N; even += 2, odd += 2){
            minPrime[even] = 2;
            minPrime[odd] = odd;
        }
        if(!(N & 1)) minPrime[N] = 2;
        Primes[size_++] = 2;

        for(int x = 3; x <= N; x += 2){
            if(minPrime[x] == x) Primes[size_++] = x;
            for(int y = 0; y < size_ and Primes[y] <= minPrime[x] and x * Primes[y] <= N; ++y)
                    minPrime[x * Primes[y]] = Primes[y];
        }
        for(int x = 2; x <= N; ++x) Next[x] = x / minPrime[x];
    }
    // 範囲for文用の begin() と end()
    const unsigned int *begin(void) const noexcept{ return Primes; }
    const unsigned int *end(void) const noexcept{ return Primes + size_;}
    const unsigned int size(void) const {return this.size_;}
};

using uint = unsigned int;
constexpr uint N = 1e6;
constexpr uint mod = 1e9 + 7;
constexpr uint M = mod - 2;
constexpr shuumai<N> P;
std::array<uint, N + 1> Count;

// aの逆元を求める関数
const unsigned int inverse(unsigned int a) noexcept {
    unsigned int b = mod;
             int u = 1,   v = 0;
    while (b) {
        unsigned int t = a / b; 
        std::swap(a -= t * b, b);
        std::swap(u -= t * v, v);
    }
    if(u < 0) u += mod;
    return u;
}

// a^nを返す関数
const uint power(uint a, uint n)noexcept{
    unsigned long long res = 1, waiting = a;
    while(n){ 
        if(n & 1) { res *= waiting; res %= mod; }
        waiting *= waiting; waiting %= mod; 
        n >>= 1;
    }
    return res;
}

uint fastRead(void) {
    char c;
    while(true){
        c = getchar_unlocked();
        if('0' <= c) break;
    }
    uint res = c - '0';
	while(true){
        c = getchar_unlocked();
        if(c < '0') break;
        res = 10 * res + (c - '0');
    }
    return res;
}


int main(void){
    uint n = fastRead();
    uint inv_sum = 0;
    for(uint _ = 0; _ < n; ++_){
        uint a = fastRead();
        inv_sum += power(a, M); if(inv_sum >= mod) inv_sum -= mod;
        while(a - 1U){
            uint fac = P.minPrime[a];
            uint cnt = 1; a = P.Next[a];
            while(fac == P.minPrime[a]) a = P.Next[a], cnt++;
            if(Count[fac] < cnt) Count[fac] = cnt; 
        }
    }

    unsigned long long int lcm = 1;
    for(unsigned int x : P) if(Count[x]) (lcm *= power(x, Count[x])) %= mod;
    unsigned int res = lcm * inv_sum % mod;
    
    printf("%u\n", res);
    return 0;
}


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

using namespace std;

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

  int ans = 0;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }

  cout << ans << endl;
}

Measured memory_bytes: 764
// 同じ長さが4本以上あったらその長さで正方形
// 別々の長さの2本以上の組があったら長方形（正方形を除く
// 面積が最大なので当然でかい辺を使う 正方形があるかもしれんので戦わせる
// 注意力コンテストじゃん 無駄に6WAくらいはやした
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	T := make(map[int]int)
	for i := 0; i < N; i++ {
		var V int
		fmt.Scan(&V)
		T[V]++
	}

	sayhooookei := 0
	chyohoookeis := []int{}
	for k, v := range T {
		if v >= 4 {
			sayhooookei = max(sayhooookei, k)
		} else if v >= 2 {
			chyohoookeis = append(chyohoookeis, k)
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(chyohoookeis)))
	if len(chyohoookeis) >= 2 {
		chohokei1 := chyohoookeis[0] * chyohoookeis[1]
		chohokei2 := chyohoookeis[0] * sayhooookei
		fmt.Println(max(chohokei2, max(sayhooookei*sayhooookei, chohokei1)))
	} else if len(chyohoookeis) == 1 {
		chohooofoooowoooooo := chyohoookeis[0] * sayhooookei
		fmt.Println(max(chohooofoooowoooooo, sayhooookei*sayhooookei))
	} else {
		fmt.Println(sayhooookei * sayhooookei)
	}
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


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

int main() {
  int a, b;
  cin >> a >> b;
  string s ;
  cin >> s;
  bool ans = true ;
  for ( int i=0 ; i<a ; i++){
    if (s.at(i)=='-'){
      ans = false ;
      continue ;
    }
  }
    if ( s.at(a) != '-'){
      ans = false ;
    }
     for ( int i=a+1 ; i<a+1+b ; i++){
    if (s.at(i)=='-'){
      ans = false ;
    }
     }
      cout << ( ans ? "Yes" : "No")   << endl;
    
}

Measured memory_bytes: 3612
def su(s, i):
    global n, g
    if i == n:
        g.append(s)
    else:
        su(s + '1', i+1)
        su(s + '0', i+1)


n, m, x = map(int, input().split())
a = [[] for i in range(n)]
c = [0] * n
for i in range(n):
    s = list(map(int, input().split()))
    c[i] = s[0]
    a[i]= list(s[1:])
cost = 10**7
g = []
su('', 0)
for i in g:
    s = [0]*m
    h = 0
    for j in range(n):
        if i[j] == '1':
            h += c[j]
            for k in range(m):
                s[k] += a[j][k]
    f = True
    for k in range(m):
        if s[k] < x:
            f = False
    if f:
        cost = min(cost, h)
if cost == 10**7:
    print("-1")
else:
    print(cost)
    

Measured memory_bytes: 9260
/*
Author:loceaner
*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const int A = 1e6 + 11;
const int B = 1e6 + 11;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

inline int read() {
	char c = getchar();
	int x = 0, f = 1;
	for ( ; !isdigit(c); c = getchar()) if (c == '-') f = -1;
	for ( ; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
	return x * f;
}

int n, a[A], ans = 0;
char s[A];

int main() {
	int n = read();
	int left = 1, right = n;
	scanf("%s", s + 1);
	for (int i = 1; i <= n; i++) if(s[i] == 'W') a[i] = 1;
	int temp;
	while(left < right) { 
		while (left < right && a[left] == 0) left++;
		while (left < right && a[right] == 1) right--;
		if (left < right) {
			temp = a[left];
			a[left] = a[right];
			a[right] = temp;
			ans++;
		}
	}
  cout << ans << '\n';
}


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

using ll = long long;
#define MOD 10e9 + 7;
const ll INF = 1e18L + 5;


int main() {
    ll n, W; cin >> n >> W;
    vector<ll> w(n), v(n);
    for(ll i = 0; i < n; ++i) {
        cin >> w[i] >> v[i];
    }

    int sumValue = 0;
    for (int x : v) {
    	sumValue += x;
    }


    vector<ll> dp(sumValue + 1, INF);
    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        for (int j = sumValue - v[i]; j >= 0; j--) {
        	dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
        }
    }

    for (int i = sumValue; i >= 0; i--) {
    	if (dp[i] <= W){
    		cout << i << "\n";
    		break;
    	}
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 100002;
const int mo = 1e9 + 7;

int n, h[maxn], f[maxn];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> h[i];

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

    cout << f[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("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>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int T[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
    speed
    int k;
    cin>>k;
    cout<<T[k-1];
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <climits>

using namespace std;

typedef long long LL;

const LL Maxn = 100010;

LL A[Maxn]; char ch[Maxn]; LL N;

LL Sum[Maxn];
LL Add[Maxn];


int main()
{
  scanf("%lld",&N); scanf("%lld",&A[0]); ch[0]='+';
  for(LL i=1;i<N;i++)
  {
    char c=getchar(); while(c!='+' && c !='-') c=getchar();
    ch[i]=c; scanf("%lld",&A[i]);
  }

  for(LL i=0;i<N;i++) Add[i]=Add[i-1]+A[i];
  for(LL i=0;i<N;i++) Sum[i]=Sum[i-1]+A[i]*((ch[i]=='+') ? 1 : -1);

  LL nx=N; LL ans=Sum[N-1];

  for(LL i=N-1;i>=0;i--) if(ch[i]=='-')
  {
    if(nx!=N) ans=max(ans,Sum[i-1]-(Add[nx-1]-Add[i-1])+(Add[N-1]-Add[nx-1]));
    nx=i;
  }
  return printf("%lld\n",ans),0;
}

Measured memory_bytes: 2688
#include <stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a>b) {
      printf("a > b\n");
    } else if (a<b) {
      printf("a < b\n");
    } else {
      printf("a == b\n");
    } 
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  char str1[101],str2[101];
  string str;
  cin>>n;
  cin>>str1>>str2;

  for(int i=0;i<n;i++){
    str+=str1[i];
    str+=str2[i];
  }
  cout<<str<<endl;
  return 0;
}


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

int main() {
	int N;
	int K;
	int r;

	r = 1;
	cin >> N >> K;
	for (int i = 0; i < N; i++)
	{
		if (r * 2 <= r + K)	
			r *= 2;
		else
			r += K;
	}
	cout << r << endl;
}


Measured memory_bytes: 256
S = input()
stepr = ["R", "U", "D"]
stepl = ["L", "U", "D"]
rstep = all([S[i] in stepr for i in range(0,len(S),2)])
lstep = all([S[i] in stepl for i in range(1,len(S),2)])
if rstep and lstep:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <queue>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	queue<ll> que;
	for(int i=1;i<10;i++)que.push(i);
	while(--n){
		ll cur = que.front(),last = cur%10;
		que.pop();	
		if(last)que.push(cur*10+last-1);
		que.push(cur*10+last);
		if(last!=9)que.push(cur*10+last+1);
	}
	cout<<que.front();
}


Measured memory_bytes: 1792
//Author: kaiyu
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<int,int>
#define tt ll t;cin >> t;while(t--)
#define int3(x,y,z) ll x,y,z;cin >> x >> y >> z;
#define int2(x,y) ll x,y;cin >> x >>y;
#define int1(x) ll x;cin>>x;
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}

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


bool cmp(pair<string,int>p1,pair<string,int>p2) {
    return p1.ss > p2.ss;
}

int32_t main()
{
    fio
    int n;
    cin >> n;
    map<string,int>kk;
    for (int i = 0; i <n ; ++i) {
        string x;
        cin >> x;
        kk[x]++;
    }
    cout << kk.size() << endl;

    return 0;

};




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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 3e3 + 5;

ll dp[MAXN][MAXN];

int cnt[MAXN];
int nxt[MAXN];

char c[MAXN];

void solve(){
	int n, m;
	scanf("%d%d%s", &n, &m, &c[1]);
	REPN(i, 1, n){
		nxt[i] = i;
		cnt[i] = cnt[i - 1] + (c[i] == '1');
	}
	REP(i, 0, m){
		int l, r;
		scanf("%d%d", &l, &r);
		nxt[l] = max(nxt[l], r);
	}
	REPN(i, 2, n){
		nxt[i] = max(nxt[i], nxt[i - 1]);
	}
	
	dp[0][0] = 1;
	REP(i, 0, n){
		REPN(j, 0, i){
			if (j < cnt[nxt[i + 1]]){
				dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;
			}
			if (i - j < nxt[i + 1] - cnt[nxt[i + 1]]){
				dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
			}
		}
	}
	printf("%lld\n", dp[n][cnt[n]]);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

using namespace std;

#define mod 1000000007
#define sz(c)  (int) c.size()
#define all(c) c.begin(), c.end()
#define tr(container,it) for(__typeof(container.begin()) it = container.begin();it != container.end(); it++)
#define present(s,x) s.find(x) != s.end()
#define cpresent(c,x) find(all(c),x) != c.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,a,b) for(int i=a; i<b;i++)
#define ini(n) scanf("%d",&n)
#define opn printf("\n")

 
#define TRACE
 
#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
#else
 
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)    
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif 

typedef pair<int,int> pi;
typedef vector<pi> vp;
typedef vector<vp> vvp;
typedef vector<int> vi;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector< vi > vvi;
typedef priority_queue<int> pq;
typedef priority_queue<int, vi , greater<int> >minpq;
typedef priority_queue<pi,vp,greater<pi> > mpq;


int main(){
	//ios_base::sync_with_stdio(false);cin.tie(NULL);
	string a,b;
	cin>>a>>b;
	string c = a+b;
	int x = stoi(c);
	for(int i=1;i*i<=x;i++){
		if(i*i==x){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

	

	



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

int main()
{
    int n, k;
    std::cin >> n >> k;

    std::string s;
    std::cin >> s;

    std::vector<int> pos;

    pos.push_back(0);
    for (int i = 0; i < s.length() - 1; i++) {
        if (s[i] != s[i + 1]) {
            pos.push_back(i + 1);
        }
    }
    pos.push_back(n);

    int ans = 0;
    for (int i = 0; i < pos.size() - 1; i++) {
        int end_pos_idx;
        if (s[pos[i]] == '1') {
            end_pos_idx = i + 2 * k + 1;
        } else {
            end_pos_idx = i + 2 * k;
        }

        if (end_pos_idx >= pos.size()) {
            end_pos_idx = pos.size() - 1;
        }

        ans = std::max(ans, pos[end_pos_idx] - pos[i]);
    }

    std::cout << ans << std::endl;
}


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

int main(){
    string s;
    cin >> s;
    int count=0;
    if(s[0]=='1')count++;
    if(s[1]=='1')count++;
    if(s[2]=='1')count++;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>



int main(){
    int n;
    scanf("%d",&n);
    int a[n+1][n+1];
    int i,j;
    for(i=1;i<=n;i++)for(j=1;j<=n;j++)a[i][j]=0;
    for(i=1;i<=n;i++){
        int q,k;
        scanf("%d %d",&q,&k);
        for(j=1;j<=k;j++) {
            int p;
            scanf("%d",&p);
            a[q][p]=1;
        }
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=n-1;j++)printf("%d ",a[i][j]);
        printf("%d",a[i][n]);
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 636
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main() {

  ll a,b,n;
  cin >> a >> b >> n;

  ll d;
  if(n >= b)
  {
    d = n / b;
    d = d * b - 1;
  }
  else
  {
    d = n;
  }

  ll a1 = (a * d) / b;
  ll a2 = d / b;
  a2 = a2 * a;

  ll ans = a1 - a2;

  cout << ans << endl;
  

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

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

  int hour = 0;
  int minutes = 0;
  hour = C - A;
  minutes = D - B;

  int goukei = 0;
  hour = hour * 60;
  
  goukei = (hour + minutes) - E;

  cout << goukei << endl;
}


Measured memory_bytes: 3568
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]


N, M = map(int, input().split())

yp = [(0, 0, 0)]*M
for i in range(M):
    P, Y = map(int, input().split())
    yp[i] = (Y, P, i)

pre = [0]*(N+1)
ans = [0]*M

yp.sort()
for (y, p, i) in yp:
    pre[p] += 1
    right = str(pre[p])
    left = str(p)

    ans[i] = "0"*(6-len(left)) + left + "0"*(6-len(right)) + right

for i in range(M):
    print(ans[i])



Measured memory_bytes: 29796
N, H = map(int, input().split())

A = []
B = []
a_max = 0
for _ in range(N):
    a, b = map(int, input().split())
    a_max = max(a, a_max)
    A.append(a)
    B.append(b)

B = sorted(B, reverse=True)

ans = 0
f = 0

for i in B:
    if i < a_max:
        continue
    ans += 1
    H -= i
    if H <= 0:
        f = 1
        break

if f:
    print(ans)
else:
    if H%a_max == 0:
        print(ans + H//a_max)
    else:
        print(ans + H//a_max+1)

Measured memory_bytes: 12116
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
bool u[305][305],p[305][305];
int dp[305];

int main(){
  int N;
  while(cin>>N,N){
    memset(p,0,sizeof(p));
    memset(u,0,sizeof(u));
    std::vector<int> v(N);
    for(int i=0;i<N;i++)cin>>v[i];
    queue<P> que;
    for(int i=1;i<N;i++)if(abs(v[i-1]-v[i])<2){p[i-1][i]=1;que.push(P(i-1,i));}
    while(que.size()){
      int l=que.front().first;int r=que.front().second;que.pop();
      if(u[l][r])continue;
      u[l][r]=1;
      if(l-1>=0&&r+1<N&&abs(v[l-1]-v[r+1])<2){p[l-1][r+1]=1;que.push(P(l-1,r+1));}
      for(int i=r+2;i<N;i++)if(p[r+1][i]){p[l][i]=1;que.push(P(l,i));}
      for(int i=0;i<l-1;i++)if(p[i][l-1]){p[i][r]=1;que.push(P(i,r));}
    }
    memset(dp,0,sizeof(dp));
    for(int i=0;i<N;i++)dp[i]=p[0][i]*(i+1);
    for(int i=0;i<N;i++)for(int j=1;i+j<N;j++)dp[i+j]=max(dp[i+j],dp[i]+p[i+1][i+j]*j);
    cout<<dp[N-1]<<endl;
  }
}



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

int output(int arr[], int n)
{
    for (int i=0; i<n; ++i) {
        if (i > 0) cout << " ";
        cout << arr[i];
    }
    cout << endl;
}

void sort(int arr[], int n)
{
    int j, v;
    for (int i=1; i<n; ++i) {
        j = i - 1;
        v = arr[i];
        while (j>=0 && arr[j] > v) {
            arr[j+1] = arr[j];
            j--;
        }
        arr[j+1] = v;
        output(arr, n);
    }
}

int main()
{
    int n, j, v;
    int arr[110];
    cin >> n;
    
    for (int i=0; i<n; ++i) cin >> arr[i];
    
    output(arr, n);
    sort(arr, n);
    
    return 0;
}


Measured memory_bytes: 3100
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
#define repi(i, n, iv) for (int i = iv; i < n; i++)
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

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

    ll N;
    cin >> N;

    ll d = N;
    int digits = 0;
    for (int i = 1; i < 40; i++)
    {
        if (d <= 0)
            break;
        ll D = pow(26, i);
        d -= D;
        digits = i;
    }

    for (int i = 1; i < digits; i++)
    {
        N -= pow(26, i);
    }

    N--;

    string s;
    for (int i = 0; i < digits; i++)
    {
        int r = N % 26;
        N /= 26;
        s += static_cast<char>(97 + r);
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}


Measured memory_bytes: 3508
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  string s;
  cin >> s;

  if(s.length() == 1) {
    cout << 0 << endl;
    return 0;
  }

  ll ansA = 0;
  REP(i, s.length()) {
    if(i % 2 == 0 && s[i] == '0') {
      ansA++;
    } else if(i % 2 != 0 && s[i] == '1') {
      ansA++;
    }
  }

  ll ansB = 0;
  REP(i, s.length()) {
    if(i % 2 == 0 && s[i] == '1') {
      ansB++;
    } else if(i % 2 != 0 && s[i] == '0') {
      ansB++;
    }
  }

  cout << min(ansA, ansB) << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,ans,sum;
string s;
int main(){
	cin>>n>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='I')ans++;
		if(s[i]=='D')ans--;
		sum=max(sum,ans);
	}
	cout<<sum;
	return 0;
}

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

vector<int> k(100), p(100);
vector<vector<int>> s(100, vector<int>(100));
ll sum = 0;

void dfs(int now,vector<int> sw,int f){
        if(now!=1){
                if(f==1){
                        sw[now - 1] = 1;
                }
                else{
                        sw[now - 1] = 0;
                }
        }
        bool ok=true;
        if(now==n+1){
                for(int i=0;i<m;i++){
                        int count = 0;
                        for(int j=0;j<k[i];j++){
                                if(sw[s[j][i]]==1){
                                        count++;
                                }
                        }
                        if(p[i]!=(count%2)){
                                return;
                        }
                }
                
                sum++;
                return;
        }

        dfs(now+1, sw,0);
        dfs(now+1, sw,1);
}

int main(){
        cin >> n >> m;
        vector<int> swt(n+1,0);

        rep(i,0,m){
                cin >> k[i];
                rep(j,0,k[i]){
                        cin >> s[j][i];
                }
        }
        rep(i,0,m){
                cin >> p[i];

        }
        dfs(1, swt,0);

        cout << sum << endl;

        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,T,ans=1e9,c,t;
    scanf("%d%d",&n,&T);
    for (int i=0; i<n; i++){
        scanf("%d%d",&c,&t);
        if (t<=T && ans>c){
            ans=c;
        }
    }
    if (ans==1e9){
        printf("TLE\n");
    } else {
        printf("%d\n",ans);
    }
	return 0 ;
}

Measured memory_bytes: 128
//#include<bits/stdc++.h>
#include<queue>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<string.h>
#include<cmath>
#include<vector>
#include<map>
#define E (2.71828182)
#define PI (3.1415926535898)
#define	max(a,b)	((a)>(b)?(a):(b))
#define	min(a,b)	((a)>(b)?(b):(a))
#define	mem(a,b)	memset(a,b,sizeof(a))
#define	_max(a,b,c)	(max(a,b)>c?max(a,b):c)
#define mod	1000000007
#include<set>
#define gc getchar
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const long long  MAX_V = 5005, INF = 2147483647, MOD = 100000007;
#include <iostream>
using namespace std;

int n;
ull a[56], sum;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];	
	}	
	while (1)
	{
		ull b[55] = {0};
		ull maxn = n - 1;
		ull temp = 0;
		for (int i = 0; i < n; i++)
		{
				if (a[i] > maxn)
				{
					b[i] = a[i] / n;
					temp += b[i];
					a[i] %= n;
				}
		}
		if (!temp) break;
		for (int i = 0; i < n; i++)
		{
			if (b[i])
			{
				a[i] += temp - b[i];
			}
			else
			{
				a[i] += temp;
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		sum -= a[i];
	}
	cout << sum << endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
//DEBUG
#define DEBUG false
#define debugf if (DEBUG) printf
//MATH
#define MAXN 200309
#define MAXM 900009
#define ALFA 256
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define EPS 1e−9
#define PI 3.141592653589793238462643383279502884
//LOOP
#define FOR(x,n) 	for(int x =0; (x)<int(n); (x)++)
#define FOR1(x,n) for(int x=1; (x)<=int(n); (x)++)
#define REP(x,n) 	for(int x=int (n)−1; (x) >=0; (x)−−)
#define REP1(x,n) for(int x=(n ); (x) >0; (x)−−)
//DATA STRUCTERES
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair
#define sz(x)	int(x.size())
#define all(x) x.begin(), x.end()
#define mset(x, y) memset(&x ,(y), sizeof(x))
//INPUT AND OUTPUT
#define in(x) scanf("%d", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define out(x) printf("%d\n", x)
#define out2(x, y) printf("%d %d\n", x, y)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int uint;
typedef vector<int> vi;
typedef pair<int , int> ii;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll a;
	cin >> a;
	cout << a + a*a + a*a*a <<endl;
	
	
	}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[n];
    int ans = 0;
    for(int i = 0;i < n;i++){
      a[i] = sc.nextInt();
      ans += a[i];
    }
    if(ans < h){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

int main() {
    FAST;

    int x, n, i, t, d = 1e9, ans = -1;
    cin >> x >> n;

    vector<int> v(n);
    for (i = 0; i < n; ++i) cin >> v[i];
    sort(v.begin(), v.end());

    for (i = 105; i >= -5; --i) {
        if (!binary_search(v.begin(), v.end(), i)) {
            t = abs(x-i);
            if (d >= t) {
                d = t;
                ans = i;
            }
        }
    }

    cout << ans;

    return 0;
}


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

const int nm = 1e5;
int n, m, p[nm], r[nm], a[nm], ans = 0;
vector<int> g[nm];

int root(int v) {
	if (r[v] == v)
		return v;
	return root(r[v]);
}
void unite(int x, int y) {
	int rx = root(x), ry = root(y);
	if (rx == ry)
		return;
	if (a[ry] > a[rx])
		swap(rx, ry);
	r[ry] = rx;
	a[rx] += a[ry] + 1;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		r[i] = i;
		cin >> p[i];
		p[i]--;
	}
	for (int i = 0, x, y; i < m; i++) {
		cin >> x >> y;
		unite(x - 1, y - 1);
	}
	for (int i = 0; i < n; i++)
		if (root(p[i]) == root(i))
			ans++;
	cout << ans << endl;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N;
  string S; cin>>N>>S;
  int ans=0;
  int x=0;
  rep(i,0,N){
    if(S[i]=='I')
      x++;
    else
      x--;
    ans=max(ans,x);
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

int main() {
  int n; cin >> n;
  vector<double> v(n);
  for(int i=0; i< n;++i) cin >> v[i];
  sort(all(v));
  double out = (v[1] + v[0])/2.0d;
  for(int i=2;i<n;++i){
    out = (out + v[i])/2.0d;
  }
  cout << setprecision(12) << out << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int w,h,n; cin >> w >> h >> n;
	int ans=0;
	int x,y; cin >> x >> y;
	for(int i=0;i<n-1;i++){
		int xx,yy; cin >> xx >> yy;
		if(xx>=x&&yy>=y){
			ans+=max(xx-x,yy-y);
		}
		else if(xx<=x&&yy<=y){
			ans+=max(x-xx,y-yy);
		}
		else{
			ans+=abs(x-xx)+abs(y-yy);
		}
		x=xx; y=yy;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3156
#include <algorithm>
#include <iostream>

int main(int argc, char *argv[]) {
  int n;
  std::cin >> n;
  long long a[1001];
  for (int i = 0; i < n; ++i)
    std::cin >> a[i];
  int q;
  std::cin >> q;

  for (int i = 0; i < q; ++i) {
    int com, b, e;
    std::cin >> com >> b >> e;
    if (com == 0)
      std::cout << *std::min_element(a + b, a + e) << std::endl;
    else
      std::cout << *std::max_element(a + b, a + e) << std::endl;
  }
}



Measured memory_bytes: 3112
#include <stdio.h>

int main()
{
        int N;
        int A[100];

        double out;
        double tmp;

        scanf("%d", &N);
        for (int i = 0; i < N; i++) scanf("%d", &A[i]);

        tmp = (double)A[0];
        tmp = 1/tmp;

        for (int i = 1; i < N; i++) {
                double tmp1;
                tmp1 = 1/(double)A[i];
                tmp += tmp1;
        }

        out = 1/tmp;

        printf("%lf\n", out);

        return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
const int mod = (int)1e9 + 7;
void solve()
{
    int n;cin >> n;
    if(n<=2) {
        cout << 0 << '\n';
        return ;
    }

    vector<int> dp(n+1);
    dp[0] = 0;
    dp[0] = 1;
    dp[1] = -1;
    dp[2] = -1;

    for(int i=3;i<=dp.size() - 1;++i)
    {
        int count = 0;
        for(int k=3;k<=i;++k)
        {
            if(dp[i-k]!=-1)
            {
                count = (count%mod + dp[i-k]%mod)%mod;
            }
        }   

        dp[i] = count;
    }

    cout << dp[n] << '\n';
    
}
 
signed main()
{
     int test_cases;test_cases=1;
     //cin >> test_cases;
     while(test_cases --> 0) solve();
}

Measured memory_bytes: 3628
N,X,Y=map(int,input().split())
A=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    A[m]+=1
for k in range(1,N):
  print(A[k])

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i < n;i++){
        cin >> a.at(i);
        b.at(i)=a.at(i);
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n;i++){
        if(b.at(i)<a.at(n-1)){
            cout << a.at(n - 1) << endl;
        }
        else{
            cout << a.at(n - 2) << endl;
        }
    }
}

Measured memory_bytes: 3200