akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <stdlib.h>
using namespace std;

long long int N = 1000000007;


long long int gcd(long long int a, long long int b){
  long long int h = max(a,b);
  long long int l = min(a,b);

  while(l != 0){
    long long int tmp = h % l ;
    h = l;
    l = tmp;
  }
  return h;
}


int main()
{
  int n;  cin >> n;
  long long int ans;
  cin >> ans;
  if(n==1){
    cout << ans << endl;
    return 0;
  }

  long long int tmp;
  long long int div;
  for(int i=1;i<n;i++){
    cin >> tmp;
    div = gcd(ans,tmp);
    ans = ( ans / div ) * tmp;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(vec) (vec).begin(), (vec).end()
#define SUM(...) accumulate(ALL(__VA_ARGS__),0LL)
#define DSUM(...) accumulate(ALL(__VA_ARGS__),0.0)
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 便利関数
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> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

// 出力
void print() { std::cout << '\n'; }
template <class T>void print(const T &x) {std::cout << x <<'\n';}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}

void solve(std::string S){
    map<string, int> week;
    week.insert(make_pair("MON", 0));
    week.insert(make_pair("TUE", 1));
    week.insert(make_pair("WED", 2));
    week.insert(make_pair("THU", 3));
    week.insert(make_pair("FRI", 4));
    week.insert(make_pair("SAT", 5));
    week.insert(make_pair("SUN", -1));
    print(6 - week[S]);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
int main(){
  cin >> n;
  int sn = 0;
  int t = n;
  while(n > 0){
    sn += n % 10;
    n /= 10;
    }
  if(t % sn == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
  }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt(), result = 1;

        for(int i = 0; i < n; i++) {
            if(2 * result > k + result) {
                result += k;
            } else {
                result *= 2;
            }
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 22100
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 200005;

void task(){
	int n,k; cin >>n >> k;
	vll a(n+2);
	for(int i = 0; i<n; i++){
		cin >> a[i];
	}
    for(int i = 0; i<n-k;i++){
    	if(a[k+i]>a[i])cout << "Yes"<<endl;
    	else cout <<"No" << endl;
    }
}

int main(){
        _
        #ifdef OJ
        freopen("inputf.in", "r", stdin);
        freopen("outputf.in", "w", stdout);
        #endif

        int T = 1; //cin >> T;
        while(T--){
            task();
        }
        
return 0;
}




Measured memory_bytes: 4776
#include <stdio.h>
int main(void){
    long int n, l1, l2, l3, i;
    
    scanf("%ld",&n);
    
    l1=2;
    l2=1;
    for(i=0;i<n-1;i++){
        l3=l2;
        l2=l1+l3;
        l1=l3;
    }
    printf("%ld\n",l2);
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
 
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
 
const int MAX = 1000000;
const int MOD = 1000000007;
 
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
 
int main(){
  string s;
  cin >> s;
  int n = s.size();
  rep(i, 0, 26){
    char p = i+'a';
    bool flag = true;
    rep(j, 0, n){
      if(s[j]==p)flag = false;
    }
    if(flag){
      cout << p << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 3768
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

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

int dp[10][10];

void solve() {
  int r, c;
  cin >> r >> c;
  for(int i = 0; i < 10; i++) for(int j = 0; j < 10; j++) cin >> dp[i][j];
  for(int i = 0; i < 10; i++) for(int j = 0; j < 10; j++) for(int k = 0; k < 10; k++) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
  for(int i = 0; i < 10; i++) for(int j = 0; j < 10; j++) for(int k = 0; k < 10; k++) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
  for(int i = 0; i < 10; i++) for(int j = 0; j < 10; j++) for(int k = 0; k < 10; k++) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
  int ret = 0;
  int t;
  for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) {
    cin >> t;
    if(t >= 0) ret += dp[t][1];
  }
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF LONG_LONG_MAX
using namespace std;

inline vector<int> doit(vector<int> vec){
    vec.push_back(100000);
    vector<int> ans;
    int cnt=0;
    rep(i,vec.size()-1){
        cnt++;
        if(vec.at(i)!=vec.at(i+1)){
            ans.push_back(cnt);
            cnt=0;
        }
    }
    return ans;
}
signed main(){
    int n; cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a.at(i);
    vector<int> aa=doit(a);
    int ans=0;
    rep(i,aa.size()){
        ans+=aa.at(i)/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+100;
ll a[maxn],b[maxn];
struct node {
    ll a,b;
}p[maxn],s2[maxn];
int cmp(node i,node j)
{
    return j.a*i.b+j.a<i.a*j.b+i.a;
}
ll dp[maxn][35],s1[maxn];
int main()
{
    ll n,T,i,tim,cost,mid,top1,top2,ans,ans2,num,l,r,j,t;
  // freopen("text.in","r",stdin);
    scanf("%lld%lld",&n,&T);
    for (i=1;i<=n;i++) {
        scanf("%lld%lld",&p[i].a,&p[i].b);
    }
//    n2=0;
    top1=0; top2=0;
    sort(p+1,p+n+1,cmp);
    for (i=1;i<=n;i++) {
        if (p[i].a==0) {
            s1[++top1]=p[i].b;
        }else {
            s2[++top2]=p[i];
        }
    }
    ///top2 里面的是 a>=1 的部分
    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;
    for (i=1;i<=top2;i++) {
        for (j=0;j<=30;j++) {
            dp[i][j]=dp[i-1][j];
        //}
        if (j>=1&&dp[i-1][j-1]!=-1) {
           // cout<<"i="<<i<<" "<<j<<endl;
            t=dp[i-1][j-1]+1;
            num=t*p[i].a+p[i].b;
            if (dp[i][j]==-1) {
                dp[i][j]=num+t;
                if (dp[i][j]>T) {
                    dp[i][j]=-1;
                }
            }else {
                dp[i][j]=min(dp[i][j],t+num);
            }
        }

        }
    }
   // cout<<dp[1][1]<<endl;
    sort(s1+1,s1+top1+1);
    s1[0]=0;
    for (i=1;i<=top1;i++) {
        s1[i]=s1[i-1]+s1[i];
    }
    ans=0;
   // cout<<top1<<" "<<top2<<endl;
    for (i=0;i<=30;i++) {
        num=dp[top2][i];
        if (num==-1) continue ;
       // cout<<num<<" "<<i<<endl;
        l=0; r=top1; ans2=0;
        while (l<=r) {
            mid=(l+r)/2;
            if (s1[mid]+mid<=T-num) {
                ans2=mid;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        ans=max(ans,ans2+i);
    }
    cout<<ans<<endl;
    return 0;
}


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

#define what_is(x) cout << #x << " is " << x << endl;
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
// #define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 9223372036854775805
#define ninf -9223372036854775802
#define M 1000000007
#define eps 1e-9
#define MAX 10
#define N 500001
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX];
ll fact[MAX];

const long long INF64 = 1e18;
ll vpow(ll a,ll b,ll p){
    if(b==0)
        return 1;
    if(b==1)
            return a;
    ll temp=vpow(a,b/2,p);
    temp*=temp;
    temp%=p;
    if(b%2==0)
        return temp;
    temp=temp*a;
    temp%=p;
    return temp;
}

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


ll inverseMod(ll a,ll b,ll p){
    if(b==0)
        return 1;
    ll temp=vpow(b,p-2,p);
    ll ans=temp*a;
    ans%=p;
    return ans;
}
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}
ll max(ll a, ll b)
{
    return a>b?a:b;
}

void factorial(){
    fact[0]=1;
    fact[1]=1;
    rep(i,2,MAX){
        fact[i]=(fact[i-1]*i);
        // fact[i]%=M;
    }
}
ll rand(ll a,ll b){
    return a+rand()%(b-a+1);
}

void solve(ll ttt){
    ll n,x,t;
    cin>>n>>x>>t;
    if(n%x==0)
        cout<<(n/x)*t<<endl;
    else
        cout<<((n/x)+1)*t<<endl;
    return ;

}
int main(){
    io;
    // sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    //
    //freopen("input1.txt","r",stdin);
    // freopen("output1.txt","w",stdout);
#endif
    ll t=1;
     //cin>>t;
    fix(12);
    rep(q,1,t+1){
         //cout<<"Case #"<<q<<": ";
         solve(q);
        //solve2();
    }
    return 0;

}




Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#include <cmath>
#include <queue>
#include <stack>

using namespace std;

#define LL long long

LL n, q;
vector<LL> v, w;
vector<LL> f;
vector<LL> qv;
vector<LL> l;
LL maxL = 0;

void input() {
	scanf("%lld", &n);
	v = vector<LL>(n);
	w = vector<LL>(n);
	for (LL i = 0; i < n; ++i) {
		scanf("%lld%lld", &v[i], &w[i]);
	}
	scanf("%lld", &q);
	qv = vector<LL>(q);
	l = vector<LL>(q);
	for (LL i = 0; i < q; ++i) {
		scanf("%lld", &qv[i]);
		scanf("%lld", &l[i]);
		qv[i] -= 1;
		maxL = max(maxL, l[i]);
	}
}
vector<vector<LL> > vf;
vector<LL> depth;
LL maxDepth = 8;

LL getPar(LL x) {
	return (x - 1) / 2;
}
void prepare() {
	LL cur = 0;
	depth.clear();
	vf.clear();
	depth = vector<LL>(n);
	depth[0] = 0;
	for (LL i = 1; i < n; ++i) {
		LL par = getPar(i);
		depth[i] = depth[par] + 1;
	}

	vf.push_back(vector<LL>(maxL + 1, 0));
	for (LL i = w[0]; i <= maxL; ++i) {
		vf[0][i] = v[0];
	}
	cur += 1;
	while (cur < n && depth[cur] <= maxDepth) {
		LL par = (cur - 1) / 2;
		vf.push_back(vector<LL>(maxL + 1, 0));
		for (LL i = 0; i < maxL; ++i) {
			vf[cur][i] = vf[par][i];
		}
		for (LL i = maxL; i >= w[cur]; --i) {
			vf[cur][i] = max(vf[par][i], vf[par][i - w[cur]] + v[cur]);
		}
		cur += 1;
	}
}

LL query(LL qv, LL l) {
	if (depth[qv] <= maxDepth) {
		return vf[qv][l];
	} else {
		LL par = getPar(qv);
		if (l < w[qv]) {
			return query(par, l);
		} else {
			return max(query(par, l), query(par, l - w[qv]) + v[qv]);
		}
	}
}

void work() {
	for (LL i = 0; i < q; ++i) {
		printf("%lld\n", query(qv[i], l[i]));
	}
}

int main() {
	input();
	prepare();
	work();
	return 0;
}

Measured memory_bytes: 411672
// C - Stones

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int B[200001];

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

	string S;
	cin >> S;

	for (int i=0; i<N; i++) {
		B[i+1] = B[i] + (S[i] == '#' ? 1 : 0);
	}

	int ans = INF;

	for (int i=0; i<=N; i++) {
		int b = B[i];
		int w = (N - i) - (B[N] - B[i]);
		//cout << b + w << endl; // **** debug ****
		ans = min(ans, b + w);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4508
/*
 * atcoder/abc113/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/* Mod */
#define MOD 1000000007
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
ostream & operator << (ostream & out, mint const & v) {
  out << v.x;
  return out;
}



/*
 * 縦h, 横wの地点から移動できるマスは、(h+1, w-1), (h+1, w), (h+1, w+1)の3通り.
 * それぞれ移動できる場合の縦h+1における橋の配置方法は、w-1の橋の起点に隣接しないように約2^W
 * 初期値は、初期位置として(0, 0)が1通り. h=0で他のwはありえないので0通り.
 *
 * 橋の配置方法について、(h+1, w)の場合, その前後においてはいけない.
 * あとはそこに置く場合と置かない場合の2^W
 */
int H, W, K;
mint dp[110][10] = {0};

bool nth(ll S, int n) {
  return (S>>n)&1;
}

void print() {
  loop(h,0,H+1) {
    loop(w,0,W) {
      cout << dp[h][w] << " ";
    }
    cout << endl;
  }
}

void solve() {
  cin >> H >> W >> K;
  dp[0][0] = 1;

  loop(h,0,H) {
    loop(k,0,W) {
      for (ll S=0; S<(1<<(W-1)); S++) {
        bool overlap = false;
        loop(i,0,W-2) overlap |= nth(S, i) and nth(S, i+1);
        if (overlap) continue;

        /* 座標とインデックスを混同しないように: 横軸kは座標kとk+1をつなぐ. */

        if (nth(S, k)) dp[h+1][k+1] += dp[h][k]; // 横軸kが存在する <=> kからk+1に移動可能
        else if (k - 1 >= 0 and nth(S, k-1)) dp[h+1][k-1] += dp[h][k]; // 横軸k-1が存在する <=> kからk-1に移動可能
        else dp[h+1][k] += dp[h][k]; // 横軸kもk-1も存在しない <=> 真下に移動可能
      }
    }
  }

  // print();
  cout << dp[H][K-1] << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A = [0] + A  + [0]
cost = [abs(A[i+1] - A[i]) for i in range(N+1)]
cost_sum = sum(cost)
for i in range(N):
  ans = cost_sum - cost[i] - cost[i+1]
  ans += abs(A[i]-A[i+2])
  print(ans)

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
 */
int n, a, b, c;
int l[8];

int main()
{
  cin >> n >> a >> b >> c;

  rep(i, n){
    cin >> l[i];
  }

  int ans = inf;
  rep(i, 1<<(2*n)){
    int x = 0, y = 0, z = 0;
    int tmp = 0;
    rep(j, 8){
      int t = i;
      rep(k, j){
        t /= 4; 
      }
      t %= 4;
      
      if(t == 1){
        if(x) tmp += 10;
        x += l[j];
      }else if(t == 2){
        if(y) tmp += 10;
        y += l[j];
      }else if(t == 3){
        if(z) tmp += 10;
        z += l[j];
      }
    }

    if(x == 0 or y == 0 or z == 0) continue;

    tmp += abs(a-x);
    tmp += abs(b-y);
    tmp += abs(c-z);

    ans = min(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


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


int main() {
#ifndef ONLINE_JUDGE
//	freopen("inp.txt", "r", stdin);		freopen("outp.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);

	ll n;	cin >> n;
	ll final = (n / 500) * 1000;
	ll ans = n % 500;
	cout << final + (ans / 5) * 5 << endl;
	


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int coun[200010];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		a++;
		coun[a]++;
		coun[a-1]++;
		coun[a+1]++;
	}
	int mx = 0;
	for (int i = 0; i < 200000; i++) mx = max(mx, coun[i]);
	printf("%d\n", mx);
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, m;
	cin >> n >> m;
	
	vector<ll> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	vector< pair<ll, int> > p(m);
	for(int i = 0; i < m; ++i) {
		int b, c;
		cin >> b >> c;
		p[i] = make_pair(c, b);
	}
	
	sort(a.begin(), a.end());
	sort(p.begin(), p.end());
	
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		if( p.empty() || p.back().first <= a[i] ) {
			ans += a[i];
		} else {
			ans += p.back().first;
			p.back().second--;
			
			if( p.back().second == 0 ) p.pop_back();
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007

using namespace std;


int main(int argc, char* argv[])
{
    const char str0[]="CODEFESTIVAL2016";
    char str[20]={0};

    scanf("%s", str);

    long cnt=0;
    long i;
    for(i=0; i<16; i++) {
        if(str0[i]!=str[i]) cnt++;
    }
    printf("%ld\n", cnt);

    return 0;
}


Measured memory_bytes: 128
n = $stdin.gets.to_i
a_org = $stdin.gets.split.map(&:to_i)

a = a_org.sort
# p a

threshold_a = a[n/2 - 1]
threshold_b = a[n/2]


# p [threshold_a, threshold_b]

n.times do |i|
  # puts i
  if a_org[i] <= threshold_a
    puts threshold_b
  else
    puts threshold_a
  end  
end

Measured memory_bytes: 23396
#include<iostream>

using namespace std;

int main(){
  int a;
  int b;
  int c;
  int X;
  int count=0;
  
  cin >> a >> b >>c >> X;
  
  for(int i=0; i<=a; i++){
    for(int j=0; j<=b; j++){
      for(int l=0; l<=c; l++){
        int total = 500*i + 100*j + 50*l;
        if(total==X) count +=1;
      }
    }
  }
  
  cout << count << endl;
  return 0;
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int a, b;

int main()
{
	gii(a, b);
	if (a <= 0 && b >= 0) puts("Zero");
	else
	{
		if (a > 0) puts("Positive");
		else
		{
			if ((b - a + 1) & 1) puts("Negative");
			else puts("Positive");
		}
	} 
}



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

int main()
{
	char cline[256];
	std::cin.getline(cline, sizeof(cline));
	
	std::string str{ cline };
	std::transform( str.cbegin(), str.cend(), str.begin(), ::toupper);

	std::cout << str << std::endl;

	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
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; }
const long long INF = 1LL << 60;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

ll dp[10010][3];

int main(){
    ll n, k;
    cin >> n >> k;
    ll cnt = 0;
    if(k%2==0){
        cnt+=((n+k/2)/k)*((n+k/2)/k)*((n+k/2)/k);
        cnt += (n / k) * (n / k) * (n / k);
    }
    else{
        cnt += (n / k) * (n / k) * (n / k);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 384
<?php
fscanf(STDIN,"%d %d",$L,$R);

//1組目を初期値にする
$result = (($L%2019)*(($L+1)%2019))%2019;

//1組目を除いて総当り
for($i=$L;$i<=$R-1;$i++){
  if($result === 0){
    break;
  }
  for($j=$i+1;$j<=$R;$j++){
    if($result === 0){
      break;
    }
    //最小値更新
    if($result > (($i%2019)*($j%2019))%2019){
      $result = (($i%2019)*($j%2019))%2019;
    }
  }
}
echo $result;



Measured memory_bytes: 3700
local n = io.read("*n")
local c, s, f = {}, {}, {}
for i = 1, n - 1 do
  c[i], s[i], f[i] = io.read("*n", "*n", "*n")
end
local mma = math.max
for i = 1, n - 1 do
  local cur = 0
  for j = i, n - 1 do
    cur = mma(s[j], ((cur + f[j] - 1) // f[j]) * f[j])
    cur = cur + c[j]
  end
  print(cur)
end
print(0)


Measured memory_bytes: 2820
import java.util.*;

public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int q = input.nextInt();
		String a;
		String b;
		for(int i=0; i<q; i++) {
			 a = input.next();
			 b = input.next();
		     System.out.println(getLcs(a,b));
		}
	}
		public static int getLcs(String a, String b) {
		int l1 = a.length();
		int l2 = b.length();
		int[][] lcs = new int [a.length()+1][b.length()+1];
		for(int i=1; i<=l1; i++) {
			for(int j=1; j<=l2; j++) {
				if(a.charAt(i-1) == b.charAt(j-1)) {
 				 	lcs[i][j] = 1 + lcs[i-1][j-1];} 
				else {
					lcs[i][j] = Math.max(lcs[i][j-1], lcs[i-1][j]);
				}
			}
		}
		return lcs[l1][l2];
	}	
}




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

int main(){

    string s;
    string t="abcdefghijklmnopqrstuvwxyz";

    cin >> s;
    bool a;

    for(int i=0;i<26;i++){
        a=true;
        for(ll j=0;j<s.size();j++){
            if(s[j]=='a'+i){
                a=false;
                break;
            }
        }
        if(a){
            cout << t[i] << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}

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

int main()
{
	int h, w;
	int s[50][50];
	char t;

	cin >> h >> w;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> t;
			if (t == '#')
				s[i][j] = 1;
			else if (t == '.')
				s[i][j] = 0;
		}
	}

	bool f = 0;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == 1) {
				if (i > 0 && s[i - 1][j] == 0) {
					if (i < h - 1 && s[i + 1][j] == 0) {
						if (j > 0 && s[i][j - 1] == 0) {
							if (j < w - 1 && s[i][j + 1] == 0) {
								f = 1;
								break;
							}
						}
					}
				}
			}
		}
		if (f)
			break;
	}

	if (f)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

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

int main(){
    int a,b;
    cin >> a >>b;
    cout << lcm(a,b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

int main() {
  int n; cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];

  int ans = 0;
  REP(i, n)REP(j, n){
    if(i == j) continue;
    ans = max(ans, abs(a[i]-a[j]));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/rope>

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    char ch;
    cin>>ch;

    if(ch>='A' && ch<='Z')
     cout<<"A"<<endl;
    else
     cout<<"a";

     return 0;
}



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

#define debug_input freopen("stdin.in", "r", stdin)
#define debug_output freopen("stdout.out", "w", stdout)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORALL(i, n) for(int i = 0; i < n; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define SORT(a) sort(a.begin(), a.end())
#define REV(a) reverse(a.begin(), a.end())
#define NP(a) next_permutation(a.begin(), a.end())
#define ALL(a) a.begin, a.end()
#define mp make_pair
#define pb push_back
#define endl "\n"
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n;
	int cnt = 0;
	int a, b;
	int maxi = 0;

	cin >> n;
	while(n--) {
		cin >> a >> b;
		if(a == b) cnt++;
		else {
			maxi = max(maxi, cnt);
			cnt = 0;
		}
	} 
	maxi = max(maxi, cnt);
	
	if(maxi >= 3) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

#define p(x) cout << x << endl
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define range(i, begin, end) for(int i = begin; i < (int)(end + 1); i++)
#define all(x) (x).begin(), (x).end()

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

    vector<int> ps(n);
    rep(i, n) { cin >> ps[i]; }

    int count = 0;
    rep(i, n) {
        if(ps[i] != i + 1) {
            count++;
        }
    }

    if(count <= 2) {
        p("YES");
    } else {
        p("NO");
    }

    return 0;
}


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

const int N = 201000;

int chosen[N];

namespace MF {
  struct Edge {
    int v, flow, ne;
  }e[N << 3];

  int fi[N], tot, S, T, V, cur[N], dis[N], q[N];

  void Init(int s, int t, int v) {
    S = s; T = t; V = v;
    tot = 1;
    for(int i = 0; i < V; i++) {
      fi[i] = 0;
    }
  }

  void Add(int x, int y, int w) {
    e[++tot] = {y, w, fi[x]};
    fi[x] = tot;
    e[++tot] = {x, 0, fi[y]};
    fi[y] = tot;
  }
  
  bool Bfs(void) {
    for(int i = 0; i < V; i++) {
      dis[i] = 0;
    }
    int h = 1, t = 0;
    q[++t] = S;
    dis[S] = 1;
    while(h <= t) {
      int x = q[h++];
      for(int i = fi[x]; i; i = e[i].ne) {
	if(e[i].flow && !dis[e[i].v]) {
	  dis[e[i].v] = dis[x] + 1;
	  q[++t] = e[i].v;
	}
      }
    }
    return dis[T];
  }

  int Dfs(int x, int f) {
    if(x == T) {
      return f;
    }
    int used = 0;
    for(int &i = cur[x]; i; i = e[i].ne) {
      if(e[i].flow && dis[e[i].v] == dis[x] + 1) {
	int t = Dfs(e[i].v, min(f - used, e[i].flow));
	used += t;
	e[i].flow -= t;
	e[i ^ 1].flow += t;
	if(used == f) {
	  return used;
	}
      }
    }
    dis[x] = -1;
    return used;
  }

  int Solve(void) {
    int ans = 0;
    while(Bfs()) {
      for(int i = 0; i < V; i++) {
	cur[i] = fi[i];
      }
      ans += Dfs(S, 1e9);
    }
    for(int i = 1; i < (V >> 1); i++) {
      for(int j = fi[i]; j; j = e[j].ne) {
	if(!e[j].flow) {
	  ::chosen[i] = e[j].v - (V >> 1) + 1;
	}
      }
    }
    return ans;
  }
}

int n, q[N], full[N];
pair<int, int> ans[N];
vector<int> in[N];

int main(void) {
  scanf("%d", &n);
  MF::Init(0, n * 2 - 1, n << 1);
  for(int i = 1, k; i < n; i++) {
    scanf("%d", &k);
    for(int j = 0, x; j < k; j++) {
      scanf("%d", &x);
      x--;
      if(x) {
	MF::Add(i, x + n - 1, 1);
      }
      in[x].push_back(i);
    }
  }
  for(int i = 1; i < n; i++) {
    MF::Add(MF::S, i, 1);
    MF::Add(i + n - 1, MF::T, 1);
  }
  if(MF::Solve() < n - 1) {
    return puts("-1"), 0;
  }
  int h = 1, t = 0;
  q[++t] = 0;
  while(h <= t) {
    int x = q[h++];
    for(int y : in[x]) {
      if(full[y]) {
	continue;
      }
      full[y] = 1;
      q[++t] = chosen[y];
      ans[y] = {x, chosen[y]};
    }
  }
  if(t < n) {
    puts("-1");
  } else {
    for(int i = 1; i < n; i++) {
      printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
    }
  }
  return 0;
}


Measured memory_bytes: 25856
object Main extends App {
    val n = scala.io.StdIn.readLine().toInt
    var result = 0.toDouble
    for {i <- 1 to n} {
      val Array(x,u) = scala.io.StdIn.readLine().split("\\s")
      if (u == "JPY") {
        result += x.toDouble
      } else {
        result += x.toDouble * 380000
      }
    }
    println(result)
}

Measured memory_bytes: 25300
A,B,C,X = map(int,[input() for i in range(4)])

ans = 0

for i in range(A+1):
    for j in range (B+1):
        for k in range(C+1):
            if i *500 + j * 100 + k * 50 == X:
                ans = ans + 1
print(ans)


Measured memory_bytes: 9084
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

string b = "aeiou";

int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < 5; i++)
	{
		if (s[0] == b[i])
		{
			cout << "vowel" << endl;
			return 0;
		}
	}
	cout << "consonant" << endl;
	return 0;
}

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

int main(){

    int N;
    cin >> N;
    int ans = 0;
    int mx = 0;
    int a;
    for(int i = 0; i < N; i++)
    {
        cin >> a;
        ans += a;
        if (mx < a) {
            mx = a;
        }
    }
    ans -= mx/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
h0, a0, d0, s0 = gets.split.map &:to_i

total = 0
arr = []
n.times {
	h, a, d, s = gets.split.map &:to_i
	if a0 - d <= 0
		if a - d0 <= 0
			next
		else
			puts -1
			exit
		end
	end
	arr << [[a - d0, 0].max, (h.to_f/(a0 - d)).ceil]
	total -= [a - d0, 0].max if s < s0
}
arr.sort_by!{|d, c| -d.to_f / c}

turn = 0
arr.each{|d, c|
	total += d * (turn += c)
}

puts h0 > total ? total : -1

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

using namespace std;

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

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

    bool ok = false;
    if(s[0] == '9' || s[1] == '9'){
        ok = true;
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long L = scan.nextLong();
		long R = scan.nextLong();
		long min = Long.MAX_VALUE;

		for(long i=L;i<R;i++) {
			for(long j=L+1;j<=R;j++) {

			long re = (i*j)%2019;
			if(re < min) {
				min = re;
			}else if(re == 0) {
				System.out.println(0);
				return;
			}
			}
		}

		System.out.println(min);
		scan.close();

	}

}


Measured memory_bytes: 27088
#include<iostream>
#include<string>
#include<stdio.h>
#include<cstdio>
#include<math.h>
using namespace std;
int main(){
    int a,o;
    while(cin>>a){
        o=a%39;
        if(o==0){
            cout<<"3C39"<<endl;
        }
        else{
        cout<<"3C";
            printf("%02d",o);
            cout<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3192
#include <stdio.h>

int main(){
int i,n,gou=1;
int f,v,t,r,q,s;
int a[6];
char moji[10]={'\0'};

while(1){
scanf("%d",&n);
if(n==0)break;
a[0]=1;
a[1]=2;
a[2]=6;
a[3]=5;
a[4]=4;
a[5]=3;
gou=1;
for(i=0;i<n;i++){
scanf("%s",moji);
if(moji[0]=='N'){
f=a[0];
v=a[1];
t=a[2];
r=a[3];
q=a[4];
s=a[5];
a[0]=v;
a[1]=t;
a[2]=r;
a[3]=f;
a[4]=q;
a[5]=s;
gou+=a[0];
}
else if(moji[0]=='E'){
f=a[0];
v=a[1];
t=a[2];
r=a[3];
q=a[4];
s=a[5];
a[0]=q;
a[1]=v;
a[2]=s;
a[3]=r;
a[4]=t;
a[5]=f;
gou+=a[0];
}
else if(moji[0]=='W'){
f=a[0];
v=a[1];
t=a[2];
r=a[3];
q=a[4];
s=a[5];
a[0]=s;
a[1]=v;
a[2]=q;
a[3]=r;
a[4]=f;
a[5]=t;
gou+=a[0];
}
else if(moji[0]=='S'){
f=a[0];
v=a[1];
t=a[2];
r=a[3];
q=a[4];
s=a[5];
a[0]=r;
a[1]=f;
a[2]=v;
a[3]=t;
a[4]=q;
a[5]=s;
gou+=a[0];
}
else if(moji[0]=='R'){
f=a[0];
v=a[1];
t=a[2];
r=a[3];
q=a[4];
s=a[5];
a[0]=f;
a[1]=s;
a[2]=t;
a[3]=q;
a[4]=v;
a[5]=r;
gou+=a[0];
}
else if(moji[0]=='L'){
f=a[0];
v=a[1];
t=a[2];
r=a[3];
q=a[4];
s=a[5];
a[0]=f;
a[1]=q;
a[2]=t;
a[3]=s;
a[4]=r;
a[5]=v;
gou+=a[0];
}
}
printf("%d\n",gou);
}

return 0;
}

Measured memory_bytes: 604
n = int(input())
lst = list(input())
cnt = 0
Num = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            s = [str(i),str(j),str(k)]
            Num.append(s)

for num in Num:
    flag1 = False
    flag2 = False
    memo1 = 0
    memo2 = 0
    for x in range(n-2):
        if num[0] == lst[x]:
            flag1 = True
            memo1 = x
            break
    if flag1:
        for y in range(memo1+1,n-1):
            if num[1] == lst[y]:
                flag2 = True
                memo2 = y
                break
        if flag2:
            for z in range(memo2+1,n):
                if num[2] == lst[z]:
                    cnt += 1
                    break
print(cnt)

Measured memory_bytes: 75364
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main(){
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}


Measured memory_bytes: 3568
import math

n, a, b = map(int, input().split())
h = [int(input()) for _ in range(n)]

def is_ok(x):
    c = 0
    for i in range(n):
        t = h[i] - b * x
        if t <= 0:
            continue
        c += math.ceil(t / (a - b))
    return c <= x

ng = 0
ok = 10 ** 9
while abs(ok - ng) > 1:
    mi = (ok + ng) // 2
    if is_ok(mi):
        ok = mi
    else:
        ng = mi

print(ok)


Measured memory_bytes: 50648
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		long c = 0;
		c = b / x - a / x;
		if(a % x == 0){
				c++;
		}
		System.out.println(c);
	}
}

Measured memory_bytes: 23252
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define min(a,b) ((a)<(b) ? (a) : (b))

int main(void){
  int h,n,i,j;
  int a[200001],b[200001];
  int dp[200001];
  
  scanf("%d %d",&h,&n);
  rep(i,n) scanf("%d %d",&a[i],&b[i]);
  
  rep(i,h) dp[i+1] = 1<<30;
  rep(i,n){
    rep(j,h){
      dp[min(j+a[i],h)] = min(dp[min(j+a[i],h)],dp[j]+b[i]);
    }
  }
  printf("%d",dp[h]);
  return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define rep1(i, n) for(int i = 1; i <= (int) n; i++)
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) {
        cin >> h[i];
    }
    vector<int> dp(n, INT_MAX); // コストは差の絶対値なので1e5以上になりうる
    dp[0] = 0;
    rep(i,n) {
        rep1(j,min(n-i-1,k)) {
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 4028
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    s=input()
    si=Counter(list(s))
    if len(si.keys())!=2 or si[s[0]]!=2:
        print("No")
    else:
        print('Yes')





if __name__ == "__main__":
    main()

Measured memory_bytes: 77016
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  int A, B, X;
  cin >> A >> B >> X;
  if(A <= X && X <= A+B) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>

#include <string>
#include <bits/stdc++.h>

#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
using namespace  std;

int main()
{
    string k;
    int n;
    cin >> n;
    cin >> k;
    int l = k.size();
    string s = k.substr(0, n);
    if(l > n) {
        cout << s.append("...");    }
    else {
        cout << k;
    }



}

































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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  int a[N];
  int f,t,odd;
  f=t=odd=0;
  rep(i,N){
    cin >> a[i];
    if(a[i]%4==0)f++;
    else if(a[i]%2==0)t++;
    else odd++;
  }
  if(f+1<odd) cout << "No" << endl;
  else if(f+1==odd && t>0) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  return 0;
    

}


Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include <iomanip>

int main() {
	int n,k;
	long double sum = 0;
	std::cin >> n>>k;


	for (int i = 0; i < n; i++) {
		int m = i+1;
		long double count=0;
		long double ans;
		long double cv = 1;
		while (k > m) {
			cv *= 0.5;
			//count=count+1.0;
			m *= 2;
		}

		//std::cout << count << std::endl;

		//std::cout << std::pow(0.5, count) << std::endl;

		ans = cv/n;

		//std::cout << ans << std::endl;

		sum += ans;
	}

	std::cout << std::fixed;
	
	std::cout << std::setprecision(10) << sum << std::endl;

	//std::cout << sum << std::endl;
	return 0;

}

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

int main()
{
  long long  sum=0;
     long long n;
  cin>>n;
  for(long long i=1;i<=n;i++)
     if(i%3!=0 && i%5!=0)
          sum += i;
  cout<<sum<<endl;
  return 0;
}


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

        #define ll long long
        #define pb push_back
        #define printV(v) for(int i=0;i<(int)v.size();i++){cout << v[i]<< " ";} cout << endl
        #define printRev(v) for(int i=(int)v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
        #define sortV(v) sort(v.begin(),v.end())
        #define revV(v) reverse(v.begin(),v.end())
    

        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,p,q,y;
        string str = "";
        ll mod = 1e9 + 7;

       
        
        void solve(){
            cin >> x >> k >> d;
            x = abs(x);
            if(x == 0){
                if(k%2 == 0){
                    cout << "0\n";
                }else cout << d << endl;
            }else{
                
                ll moves = x/d;
                if(moves > k){
                    cout << x - k*d << endl;
                    return;
                }
                k -= moves;
                x = x - moves*d;
                ll answer = x;
                if(k%2 == 1){
                    answer = abs(x-d);
                }
                cout << answer << endl;

                   

            }

        }



        int main(){
            ios_base::sync_with_stdio(false);

            

          

            int cases = 1;
            //cin >> cases;

            while(cases--) solve();
            return 0;

        }

Measured memory_bytes: 3656
X, N = map(int, input().split())
line = list(map(int, input().split()))
notLine = [i for i in range(-100, 201) if i not in line]
left = -1
right = len(notLine)
while abs(right - left) > 1:
    middle = (right + left) // 2
    if notLine[middle] >= X:
        right = middle
    else:
        left = middle
#print(notLine[left], notLine[right])
if X - notLine[left] <= notLine[right] - X:
    print(notLine[left])
else:
    print(notLine[right])


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

int main() {
  int base;
  int org;
  int sum = 0;
  int mod;
  
  cin >> base;

  org = base;
  
  while(true)
  {
    mod = base % 10;
    sum += mod;
    base = (base - mod) / 10;
    if (base == 0)
    {
      break;
    }
  }

  if (org % sum > 0)
  {
    cout << "No" << endl;
  }
  else
  {
    cout << "Yes" << endl;
  } 
}



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

int main() {
    int n;
    cin >> n;
    vector<long long> a(n + 1), b(n);
    for (int i = 0; i < n + 1; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (b[i] > a[i]) {
            ans += a[i];
            b[i] -= a[i];
        }
        else {
            ans += b[i];
            b[i] = 0;
        }

        if (b[i] == 0) continue;

        if (b[i] > a[i + 1]) {
            ans += a[i + 1];
            a[i + 1] = 0;
        }
        else {
            ans += b[i];
            a[i + 1] -= b[i];
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792