akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<assert.h>
#define RI register int
#define CI const int&
using namespace std;
const int N=205,M=100005,INF=1e9;
int n,m,a[N][N],fr[N*N],to[N*N],b[N][N],c[N][N],p[N]; vector <int> eg[N][N];
class Network_Flow
{
	private:
		struct edge
		{
			int to,nxt,v;
		}e[M]; int head[N],cur[N],s,t,cnt,dep[N],q[N];
		inline void addedge(CI x,CI y)
		{
			e[++cnt]=(edge){y,head[x],1}; head[x]=cnt;
			e[++cnt]=(edge){x,head[y],0}; head[y]=cnt;
		}
		#define to e[i].to
		inline bool BFS(CI s,CI t)
		{
			RI H=0,T=1; memset(dep,-1,t+1<<2); dep[q[1]=s]=0;
			while (H<T)
			{
				int now=q[++H]; for (RI i=head[now];i;i=e[i].nxt)
				if (e[i].v&&!~dep[to]) dep[to]=dep[now]+1,q[++T]=to;
			}
			return ~dep[t];
		}
		inline int DFS(CI now,CI t,int dis)
		{
			if (now==t) return dis; int ret=0;
			for (RI& i=cur[now];i&&dis;i=e[i].nxt)
			if (e[i].v&&dep[to]==dep[now]+1)
			{
				int dist=DFS(to,t,min(e[i].v,dis));
				dis-=dist; ret+=dist; e[i].v-=dist; e[i^1].v+=dist;
			}
			if (!ret) dep[now]=0; return ret;
		}
		#undef to
	public:
		inline void init(void)
		{
			RI i,j; memset(head,0,(t=(n<<1|1))+1<<2); cnt=1;
			for (i=1;i<=n;++i) addedge(s,i),addedge(n+i,t);
			for (i=1;i<=n;++i) for (j=1;j<=n;++j)
			if (!eg[i][j].empty()) addedge(i,n+j);
		}
		inline void Dinic(void)
		{
			int ret=0; while (BFS(s,t))	memcpy(cur,head,t+1<<2),ret+=DFS(s,t,INF);
			assert(ret==n); for (RI i=1,j;i<=n;++i)
			for (j=head[i];j;j=e[j].nxt) if (e[j].to!=s&&!e[j].v) p[i]=e[j].to-n;
		}
}NF;
int main()
{
	RI i,j,k; for (scanf("%d%d",&n,&m),i=1;i<=n;++i)
	for (j=1;j<=m;++j) scanf("%d",&a[i][j]),fr[a[i][j]]=i;
	for (i=1;i<=n;++i) for (j=1;j<=m;++j) to[(i-1)*m+j]=i;
	for (i=1;i<=n*m;++i) eg[fr[i]][to[i]].push_back(i);
	for (k=1;k<=m;++k) for (NF.init(),NF.Dinic(),i=1;i<=n;++i)
	b[i][k]=c[p[i]][k]=eg[i][p[i]].back(),eg[i][p[i]].pop_back();
	for (i=1;i<=n;++i) for (j=1;j<=m;++j) printf("%d%c",b[i][j]," \n"[j==m]);
	for (i=1;i<=n;++i) for (j=1;j<=m;++j) printf("%d%c",c[i][j]," \n"[j==m]);
	return 0;
}

Measured memory_bytes: 2176
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <functional>
using namespace std;

int main()
{
	int a, b;
	char op;
	while(cin >> a >> op >> b)
	{
		if (op == '?')
		{
			break;
		}

		switch (op)
		{
			case '+':
				cout << a + b << endl;
				break;

			case '-':
				cout << a - b << endl;
				break;

			case '*':
				cout << a * b << endl;
				break;
		
			case '/':
				cout << a / b << endl;
				break;

			default:
				break;
		}
	}
}

Measured memory_bytes: 1160
import java.util.Scanner;

fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	val ans = mutableListOf<String>()
	while (true) {
		val n = scanner.nextInt()
		if (n==0) break
		val map = mutableMapOf<Char, Int>()
		var max = Pair('-', 0)
		var second = 0
		var win: Pair<Char, Int>? = null
		for (i in 1..n) {
			val c = scanner.next().toCharArray()[0]
			map[c] = map.getOrElse(c){0} + 1
			if (map[c]!! > max.second) max = Pair(c, map[c]!!)
			else if (map[c]!! > second) second = map[c]!!
			val r = n-i
			if (max.second > second+r) {
				win = Pair(max.first, i)
				repeat(r) {scanner.next()}
				break
			}
		}
		if (win!=null) ans.add("${win.first} ${win.second}")
		else ans.add("TIE")
	}
	ans.forEach { println(it) }
}


Measured memory_bytes: 48016
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let k = get!();
    let x = get!();
    
    for i in x-(k-1) .. x+k {
        if i>x-(k-1) {
            print!(" ");
        }
        print!("{}", i);
    }
    println!();
    
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector < int > st;
int prime[1100001];
void seive(){
	for(int i = 2 ; i * i <= 1100000 ; i++){
		if(!prime[i]){
			//cout << i << endl;
			for(int j = i * i ; j <= 1100000 ; j += i){
				prime[j] = 1;
			}
		}
	}
	for(int i = 2 ; i <= 200000 ; i++)
	{
		if(!prime[i])
			st.push_back(i);
	}
}
int main(){	
	ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	    int n;
	    cin >> n;
	    seive();
	    /*for(auto it : st)
	    	cout << it << endl;*/
	    int x = *lower_bound(st.begin() , st.end() , n);
	    cout << x << endl;
	    return 0;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

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

    int a = 0, b = 0;

    for(int i = 1; i <= n; i++){
        if(i % k == 0)
            a++;
        if(i % k == k / 2)
            b++;
    }

    if(k % 2)
        cout << 1ll * a * a * a << '\n';
    else
        cout << 1ll * a * a * a + 1ll * b * b * b << '\n';
    return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  long A[N+1] = {0}, ans = 0;
  rep(i, 0, N) cin >> A[i];
  rep(i, 0, N-1) {
    long b;
    cin >> b;
 
    if (0 < b && 0 < A[i]) {
      long cnt = min(b, A[i]);
      b -= cnt;
      A[i] -= cnt;
      ans += cnt;
    }
 
    if (0 < b && 0 < A[i+1]) {
      long cnt = min(b, A[i+1]);
      b -= cnt;
      A[i+1] -= cnt;
      ans += cnt;
    }
  }
 
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
if n%1000 == 0:
    print(0)
else:
    print(1000 - n%1000)

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

using namespace std;

#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define F(i,x,n,y) for(i=x;i<n;i+=y)
#define fi(i,x,n) for(i=x;i<n;++i)
#define f(n) for(int i=0;i<n;++i)
#define fr(i,x,n) for(i=x;i>=n;--i)
#define endl '\n'

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int ans=-n;
    f(n){
        int x;cin>>x;
        ans+=x;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 998244353;

void add(ll& a, ll b) { a = (a+b) % MOD; }
void mul(ll& a, ll b) { a = (a*b) % MOD; }

int main() {
    int N, A[300];
    cin >> N;
    int sm = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sm += A[i];
    }

    const int MX = 300 * 300;
    static ll dp[301][MX + 301], sub[301][MX + 301];
    dp[0][0] = 1;
    sub[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= MX; j++) {
            add(dp[i + 1][j + A[i]], dp[i][j]);
            add(dp[i + 1][j], 2 * dp[i][j]);
            add(sub[i + 1][j + A[i]], sub[i][j]);
            add(sub[i + 1][j], sub[i][j]);
        }
    }

    ll ng = 0;
    for (int j = (sm + 1) / 2; j <= MX; j++) add(ng, dp[N][j]);
    if (sm % 2 == 0) add(ng, MOD - sub[N][sm / 2]);
    mul(ng, 3);

    ll ans = 1;
    for (int i = 0; i < N; i++) mul(ans, 3);
    add(ans, MOD - ng);

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

Measured memory_bytes: 424192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  ll s;
  cin >> s;
  vi a;
  a.pb(s);
  bool z = true;
  ll count = 1;
  while (z){
    if(a[count-1]%2==0){
      a.pb(a[count - 1] / 2);
    }
    else{
      a.pb(a[count - 1] * 3 + 1);
    }
    count++;
    rep(i, sz(a)-1){
      if(a[i]==a[count-1]){
        z = false;
      }
    }
  }
  print(count);
}

Measured memory_bytes: 256
import collections

def calc(n):
  cnt_2=0
  cnt_5=0
  while n%2==0:
    cnt_2+=1
    n//=2
  while n%5==0:
    cnt_5+=1
    n//=5
  if cnt_2>18:
    cnt_2=18
  if cnt_5>18:
    cnt_5=18
  return [cnt_2,cnt_5]

n=int(input())
dic=collections.defaultdict(int)
ans=0
for _ in range(n):
  tmp=input()
  if '.' in tmp:
    pos=tmp.index('.')
    d=len(tmp)-(pos+1)
    tmp=tmp[:pos]+tmp[pos+1:]
  else:
    d=0
  tmp=int(tmp)
  cnt_2,cnt_5=calc(tmp)
  dic[(cnt_2,cnt_5,d)]+=1
  if 2*d<=min(cnt_2*2,cnt_5*2):
    ans-=1
for a1,b1,d1 in dic.keys():
  for a2,b2,d2 in dic.keys():
    if min(a1+a2,b1+b2)>=d1+d2:
      ans+=dic[(a1,b1,d1)]*dic[(a2,b2,d2)]
print(ans//2)

Measured memory_bytes: 77536
// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
//#define _GLIBCXX_DEBUG//only for debugging
/*BISMILLAH UR RAHMAN*/ 
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<fixed<<setprecision(10);
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define debug(x) std::cerr << #x << ": " << (x) << '\n';
#define sz(x) int(x.size())
#define INF INT_MAX;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
double startTime;
double getCurrentTime()
{return ((double)clock() - startTime) / CLOCKS_PER_SEC;}
typedef long long int ll;
typedef pair<int,int> ii;
int mod=int(1e9+7);
char arr[1010][1010];
int cnt[1010][1010];
int dp(int m,int n)
{
  if(m<=0||n<=0)return 0;
  if(arr[m-1][n-1]=='#')return 0;
  if(cnt[m][n]!=-1)return cnt[m][n];
  if((m==1&&n==2)||(n==1&&m==2)) return cnt[m][n]=1;
  int ans;
  if(m-1>0&&n-1>0)
  ans=(dp(m-1,n)%mod+dp(m,n-1)%mod)%mod;
  else
  {
    if(m-1>0)
      ans=dp(m-1,n)%mod;
    else
      ans=dp(m,n-1)%mod;
  }

  return cnt[m][n]=ans;
}
int main()
{  
  fast
  startTime = (double)clock();
  int h,w;
  cin>>h>>w;
  for(int i=0;i<h;++i)
    for(int j=0;j<w;++j)
      cin>>arr[i][j]; 
    memset(cnt,-1,sizeof(cnt));
    
    cout<<dp(h,w)%mod<<endl;
    //cout<<getCurrentTime()<<endl;

}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a , b ;
    cin >> a >> b ;
    map<char , vector<int> >mp;
    for(int i = 0 ; i < a.length() ; i++){
        mp[a[i]].push_back(i);
    }
    int mini = 10000 ;
    for(int i = 0 ; i < b.length() ;i++){
        if(mp[b[i]].size()>0){
            for(int j = 0 ; j < mp[b[i]].size();j++){
                int in = mp[b[i]][j];
                if(in-i>=0 && (in + b.length()-i-1)<a.length() ){
                    int ans = 0 ;
                    string c = a , d = b ;
                    int p = in - i;
                    for(int k = 0 ; k < b.length() ; k++){
                       // cout << d[k] << " " << c[in] << endl;
                        if(d[k]!=c[p++]){
                            //cout << d[k] << " " << c[k+in-1] << endl;
                            ans++;
                            //d[k] = c[k+in-2];
                        }
                    }
                    //cout << ans << endl;
                    if(ans<mini){
                            mini = ans;
                    }
                }
            }
        }
    }
    if(mini!=10000)
        cout << mini << endl;
    else
        cout << b.length() << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <string>
#define ll long long
using namespace std;

struct date {
    int year;
    int month;
    int day;
};
date Date(void)
{
    date returndate;
    char trash;
    cin >> returndate.year >> trash >> returndate.month >> trash >> returndate.day;
    return  returndate;
}
date setDate (int y, int m, int d)
{
    date returndate;
    returndate.year=y;returndate.month=m,returndate.day=d;
    return returndate;
}
bool isLate(date sample,date reference)
{
    if (sample.year>reference.year) return true;
    else if (sample.year<reference.year) return false;
    else if (sample.month>reference.month) return true;
    else if (sample.month<reference.month) return false;
    else if (sample.day>reference.day) return true;
    else return false;
}
int main ()
{
    date d = Date();
    date pivot = setDate(2019,4,30);
    if (isLate(d,pivot)){
        cout << "TBD";
    }
    else {
        cout << "Heisei";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	ll n,k;cin>>n>>k;
	string s,t;cin>>s>>t;
	ll ans = __gcd(n,k);
	ans = (n*k)/ans;
	map<ll,char> res;
	rep(i,n){
		res[i*(ans/n)]=s[i];
	}
	rep(i,k){
		if(res.find(i*(ans/k))!=res.end()&&res[i*(ans/k)]!=t[i]){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 6144
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), A = cin.getIntArray(N);
    const f = (v) => {
        let n = 0;
        while (v > 0) {
            if (v % 2) return n;
            v /= 2;
            n++;
        }
        return n;
    }
    let ans = A.reduce((ac, v) => ac + f(v), 0);
    console.log(ans);
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0;this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(void) {
    int r;

    if(scanf("%d", &r) == 1);

    if (r < 1200) {
        printf("ABC");
    } else if (r < 2800) {
        printf("ARC");
    } else {
        printf("AGC");
    }
    
    
    return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(1000000)

n,u,v=map(int,input().split())
Graph=[]
for i in range(n):
    Graph.append([])
for i in range(n-1): #隣接頂点の登録
    a,b=map(int,input().split())
    Graph[a-1].append(b-1)
    Graph[b-1].append(a-1)

def dfs(s,b=-1): #深さ優先探索(子,親(初期値は-1))
    for i in Graph[s]: #隣接点に対して
        if i!=b: #親と一緒じゃないとき
            depth[i]=depth[s]+1 #深さを登録
            dfs(i,s) #親子を更新して再探索

depth=[0]*n
dfs(u-1)
dT=depth

depth=[0]*n
dfs(v-1)
dA=depth

dArrest=0
for i in range(n):
    if dA[i]>dT[i]: #Tが先に着ける点のうち
        dArrest=max(dArrest,dA[i]) #一番Aから遠い点
print(dArrest-1)

Measured memory_bytes: 117036
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    double a,b;
    cin>>a>>b;
    cout<<(int)ceil((a+b)/2)<<endl;
}

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

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    string ans = "None";
    char tmp = 'a' - 1;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] - tmp > 1) {
            ans = tmp + 1;
            cout << ans << endl;
            return 0;
        }
        tmp = s[i];
    }
    if(s.back() != 'z') ans = s.back() + 1;
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

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

    int len = s.length();

    long long ans = 0;
    for (int i = 0; i < (1 << (len - 1)); i++) {
        long long t = 0, tt = 0;
        for (int j = 0; j < len; j++) {
            t *= 10;
            t += s[j] - '0';
            if (i >> j & 1 or j == len - 1) {
                tt += t;
                t = 0;
            }
        }
        ans += tt;
    }

    cout << ans << endl;

    return 0;
}


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

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
#define MOD 1000000007

using namespace std;

using ll = long long;
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

typedef stack<ll> llStack;
typedef queue<ll> llQueue;
typedef vector<ll> llVector;
typedef list<ll> llList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  string S, T;
  cin >> S >> T;
  
  string ans = "Yes";
  if(S.size() != T.size()-1){
    ans = "No";
  }
  for(int i=0;i<S.size();i++){
    if(S[i] != T[i]){
      ans = "No";
    }
  }
  
  
  cout << ans << endl;
}


Measured memory_bytes: 3632
a, b, c = list(map(int, input().split()))
k = int(input())
while k != 0:
    if b <= a:
        b *= 2
    elif c <= b:
        c *= 2
    else:
        break
    k -= 1
if (b > a) and (c > b):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 8968
#include <stdio.h>

int main(void){
	int num;
	double m, l;
	int where = 0;
	
	while(1){
		if(scanf("%d,%lf,%lf", &num, &m, &l) != EOF){
			if(25 <= (m / (l * l))){
				where = 1;
				printf("%d\n", num);
			}
		}else{
			if(!where) printf("????????????\n");
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 628
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	if n < 1000 {
		fmt.Println("ABC")
	} else {
		fmt.Println("ABD")
	}
}


Measured memory_bytes: 640
import java.io.*;
import java.util.StringTokenizer;

class FlyingJenny {
	int a[] = {4,1,4,1,2,1,2,1};
	int b[] = {0,0,0,0,0,0,0,0};
	int c[] = {0,0,0,0,0,0,0,0};
	int ans[] = {-1,0,0,0,0,0,0,0};
	int s;

	FlyingJenny(String d) {
		s = 0;
		StringTokenizer st = new StringTokenizer(d);
		for (int i=0;i<8;i++) {
			b[i] = Integer.parseInt(st.nextToken());
			s += b[i];
		}
	}

	void Solve() {
		int sum = s;
		for (int i=0;i<8;i++) {
			int dif;
			int m = 0;
			for (int j=0;j<8;j++) {
				c[j] = a[(i+j)%8]; 
				dif = c[j]-b[j];
				if (dif<0) m -= dif;
			}
			if (m<sum) {
				sum = m;
				for (int j=0;j<8;j++) ans[j] = c[j];
			} else if (m==sum) {
				if (ans[0]==-1||Compare(c,ans)) {
					for (int j=0;j<8;j++) ans[j] = c[j];
				}
			}
		}
		boolean First = true;
		for (int i=0;i<8;i++) {
			if (First) {
				First = false;
				System.out.print(ans[i]);
			}
			else System.out.print(" "+ans[i]);
		}
		System.out.println("");
	}

	boolean Compare(int a1[],int a2[]) {
		for (int i=0;i<8;i++) {
			if (a1[i]==a2[i]) continue;
			else if (a1[i]<a2[i]) return true;
			else if (a1[i]>a2[i]) return false;
		}
		return true;
	}
}

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while ((buf = br.readLine())!=null) {
				FlyingJenny f = new FlyingJenny(buf);
				f.Solve();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 17960
def calc(start, end, n):
    if start % 2 == 1:
        n += 1
        start += 1
    if end % 2 == 1:
        n += 1
        end -= 1

    if start != end:
        n += calc(start/2, end/2, 0)

    return n

for i in range(input()):
    line = [int(x) for x in raw_input().split(" ")]
    print calc(line[0], line[1], 0)

Measured memory_bytes: 6444
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  int box, swp;
  cin >> box >> swp;
  vector<bool> red(box, false);
  vector<int> cnt(box, 1);
  red[0] = true;
  while (swp--) {
    int left, right;
    cin >> left >> right;
    left--;
    right--;
    red[right] = red[right] || red[left];
    cnt[right]++;
    cnt[left]--;
    if (cnt[left] == 0) {
      red[left] = false;
    }
  }
  int sum = 0;
  for (bool b : red) {
    if (b) {
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 640
c = [list(map(int, input().split())) for i in range(3)]
ans = False

for i in range(101):
    b = [c[0][0]-i, c[0][1]-i, c[0][2]-i]
    a = [i, c[1][0]-b[0], c[2][0]-b[0]]
    flag = False
    for j in range(3):
        for k in range(3):
            if c[j][k] != a[j] + b[k]:
                flag = True
                break
            if j == 2 and k == 2:
                ans = True
        if flag:
            break

if ans:
    print('Yes')
else:
    print('No')

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

#define mp make_pair
#define sz(x) (int)((x).size())
#define all(x) (x).begin(),(x).end()
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define eb emplace_back

typedef pair< int, int > pii;
typedef pair< long long, long long > pll;
typedef long long ll;
typedef unsigned long long ull;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< ll > vll;
typedef vector< vll > vvll;
typedef vector< pii > vpii;
typedef vector< vpii > vvpii;
typedef vector< pll > vpll;
typedef long double ld;
typedef vector< ld > vld;
typedef unsigned int uint;
 
template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    const bool operator<(const M& o) const {return v < o.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
 
using Mint = ModInt<(int)1e9 + 7>;
 
int main() { 
    #ifdef BLAT
        freopen("stdin", "r", stdin);
        freopen("stderr", "w", stderr);
    #endif
 
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    srand(time(NULL));
    
    ll n;
    cin >> n;

    int ans = 0;


    for(int i = 2; 1ll*i*i <= n; ++i) {
        int e = 0;
        while(n % i == 0) {
            n /= i;
            ++ e;
        }

        for(int j = 1; j <= e; ++j) {
            e -= j;
            ++ans;
        }
    }

    if(n != 1) ++ans;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n = int(input())
    A = [int(input()) for _ in range(n)]

    ans = 0
    button = 1
    for i in range(n):
        button = A[button-1]
        ans += 1
        if button == 2:
            print(ans)
            return
    print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 79888
using System;

namespace AizuOnLine_Lesson
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            int[] A = new int[N];
            

            int x = 0;
            foreach (string data in Console.ReadLine().Split(' '))
            {
                A[x++] = Convert.ToInt32(data);
            }

            for (int i = 0; i <= N - 1; i++)
            {
                int v = A[i];
                int j = i - 1;
                while (j >= 0 && A[j] > v)
                {
                    A[j + 1] = A[j];
                    j--;
                    A[j + 1] = v;
                }

                string[] strA = Array.ConvertAll(A, (int value) => { return value.ToString(); });
                Console.WriteLine(string.Join(" ", strA));
            }
        }
    }
}

Measured memory_bytes: 5848
import java.util.*;

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

        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) H[i] = sc.nextInt();

        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] - 1 > H[i]) {
                System.out.println("No");
                return;
            } else if (H[i - 1] - 1 == H[i]) {
                H[i - 1] -= 1;
            }
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 49056
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(int argc, char const* argv[])
{
		int ABCD;
		cin >> ABCD;

		for(int i = 0; i < 1 << 3; i++){
				int sum = ABCD/1000;
				int num = ABCD%1000;
				string res = to_string((int)(ABCD/1000));
				for (int j = 0; j < 3; j++) {
						if (i & (1 << j)) {
								sum += (int)(num/pow(10, 2-j));
								res += ("+" + to_string((int)(num/pow(10, 2-j))));
						}
						else{
								sum -= (int)(num/pow(10, 2-j));
								res += ("-" + to_string((int)(num/pow(10, 2-j))));

						}
						num = num % (int)pow(10, 2-j);
				}
				if (sum == 7) {
						cout << res << "=7" << endl;
						break;
				}
		}
		return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INFTY 1300000
typedef long long int ll;
const int MOD=1000000007;
using Graph = vector<vector<int>>;
using ipair = pair<ll,ll>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
#define rep(i,n) for (int i = 0; i < (n); ++i)
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 n,m,x;cin>>n>>m>>x;
  vector<int> c(n);
  int a[n][m];
  rep(i,n){
    cin>>c[i];
    rep(j,m)cin>>a[i][j];
  } 
  ll ans = INFTY;
  //cout<<ans<<endl;
  int flag = 0;
  for (int bit = 0; bit < (1<<n); ++bit)
  {
    //cout<<bit<<endl;
    vector<ll> sum(m,0);
    ll yen = 0;
    rep(i,n){
      if(bit & (1<<i)){
        rep(j,m)sum[j] += a[i][j];
        yen += c[i];
      }
    }
    int ok=1;
    rep(i,m){
      if(sum[i]<x){
        ok = 0;
        break;
      }
    }
    //cout<<yen<<endl;
    if(ok) {
      ans = min(ans,yen);
      
      flag = 1;
    }
  }
  if(flag){
  cout<<ans;
  }
  else cout<<-1;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define all_of(v) (v).begin(), (v).end()
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define fi first
#define se second
const int MAXN = 200005;
//const LL INF = (LL) 1e9 + 8763;
//const LL MOD = (LL) 1e9 + 7;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct Pair {
	int x, y, id;
	bool operator < (const Pair &p) const {
		return x < p.x;
	}
};

int n, ans[MAXN];
Pair ps[MAXN];

// Default max, add
struct Segment_tree {
	static const int RANGE = MAXN; // here
	struct Node {
		LL minv, maxv, add;
		Node() {
			minv = maxv = add = 0;
		}
	} t[4*RANGE];
	
	// Assume add = 0 when unite.
	Node unite(const Node &a, const Node &b) {
		Node res;
		res.maxv = max(a.maxv, b.maxv); // here
		res.minv = min(a.minv, b.minv); // here
		return res;
	}
	void apply(LL x, Node &d, int l, int r) {
//		d.val += x; // here
//		d.add += x;
	}
	
	void pull(int idx) {
		t[idx] = unite(t[idx << 1], t[idx << 1 | 1]);
	}
	void push(int l, int r, int idx) {
		if (t[idx].add != 0) { // here
			int m = (l + r) >> 1;
			apply(t[idx].add, t[idx << 1], l, m);
			apply(t[idx].add, t[idx << 1 | 1], m + 1, r);
			t[idx].add = 0;
		}
	}
	
	void init(Pair *arr, int l, int r, int idx) {
		if (l == r) {
			t[idx] = Node();
			t[idx].maxv = arr[l].y;
			t[idx].minv = arr[l].y;
			return;
		}
		int m = (l + r) >> 1;
		init(arr, l, m, idx << 1);
		init(arr, m + 1, r, idx << 1 | 1);
		pull(idx);
	}	
	Node query(int ql, int qr, int l, int r, int idx) {
		if (ql <= l && r <= qr) {
			return t[idx];
		}
		LL m = (l + r) >> 1;
		push(l, r, idx);
		if (qr <= m) {
			return query(ql, qr, l, m, idx << 1);
		}
		if (ql > m) {
			return query(ql, qr, m + 1, r, idx << 1 | 1);
		}
		return unite(query(ql, qr, l, m, idx << 1), query(ql, qr, m + 1, r, idx << 1 | 1));
	}
	void update(int ql, int qr, LL v, int l, int r, int idx) {
		if (ql <= l && r <= qr) {
			apply(v, t[idx], l, r);
			return;
		}
		int m = (l + r) >> 1;
		push(l, r, idx);
		if (ql <= m) {
			update(ql, qr, v, l, m, idx << 1);
		}
		if (qr > m) {
			update(ql, qr, v, m + 1, r, idx << 1 | 1);
		}
		pull(idx);
	}
} tree;

bool converge(int l, int r) {
//	cout << "Q " << l << ' ' << r << endl;
	int ok = 1;
	if (l != 1) {
		ok &= tree.query(1, l - 1, 1, n, 1).minv > tree.query(l, r, 1, n, 1).maxv;
	}
	if (r != n) {
		ok &= tree.query(l, r, 1, n, 1).minv > tree.query(r + 1, n, 1, n, 1).maxv;
	}
	return ok;
}

void solve() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x, y;
		cin >> x >> y;
		ps[i] = {x, y, i};
	}
	sort(ps + 1, ps + 1 + n);
	tree.init(ps, 1, n, 1);
	
	int l = 1;
	while (l <= n) {
		int r = l;
		while (r < n && !converge(l, r)) {
			r++;
		}
//		cout << "Get " << l << ' ' << r << '\n';
		for (int i = l; i <= r; i++) {
			ans[ps[i].id] = r - l + 1;
		}
		l = r + 1;
	}
	
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << '\n';
	}
}

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

	int tc = 1;
//	cin >> tc;
	for (int i = 1; i <= tc; i++) {
		solve();
	}

	return 0;
} 

Measured memory_bytes: 25564
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 7;
int main(){
    ll a, b, k;
    cin >> a >> b >> k;
    if(a >= k){
        a = a-k;
        k = 0;
    }
    else{
        k-=a;
        a = 0;
    }
    if(b>=k){
        b-=k;
        k = 0;
    }
    else{
        b = 0;
        k-=b;
    }
    cout << a << " " << b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[500009],t[500009],r=0;
void mergesort(int lo,int hi){
if(lo==hi) return;
int mid =(lo+hi)/2;
mergesort(lo,mid);
mergesort(mid+1,hi);
int i,j,k;
i=lo;
j=mid+1;
for(k=lo;k<=hi;k++){
if(i==mid+1) t[k]=a[j++];
else if(j==hi+1)  t[k]=a[i++];
else if(a[i]<a[j]) t[k]=a[i++];
else t[k]=a[j++];
r++;
}
for(k=lo;k<=hi;k++){
a[k]=t[k];
}
}
int main()
{
int m,n,i,j,s=0,t=0,te;
cin>>n;
for(i=0;i<n;i++) cin>>a[i];
mergesort(0,n-1);
for(i=0;i<n-1;i++) cout<<a[i]<<" ";
cout<<a[n-1]<<endl;
cout<<r;
cout<<endl;
return 0;
}

Measured memory_bytes: 7016
#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: 2600
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

vii G(100001, vi());
vll W(100001, vl());

int vColor[100001];
int visited[100001];

void dfs(int v, int color, int par=-1){
    vColor[v] = color;
    for(int i=0; i<G[v].size(); i++){
        int child = G[v][i];
        int weight = W[v][i];
        if(child == par) continue;
        if(weight % 2 == 0){
            dfs(child, color, v);
        } else {
            dfs(child, !color, v);
        }
    }
}


int main(){
    int N; cin >> N;
    rep(i, 0, 100001) vColor[i] = -1;
    rep(i, 0, N-1){
        int u, v;
        ll w;
        cin >> u >> v >> w;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
        W[u].push_back(w);
        W[v].push_back(w);
    }
    dfs(0, 0);
    rep(i, 0, N){
        cout << vColor[i] << endl; 
    }
    return 0;
}




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

using namespace std;

int main(void) {

    int N;
    cin >> N;

    int d[N];
    for(int i = 0; i < N; i++)
        cin >> d[i];

    sort(d, d + N);

    int ans = 0;
    for(int i = 1; i <= 100000; i++){
        int mid = lower_bound(d, d + N, i) - d;
        if(mid == N / 2)
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
// Fri May  1 19:19:10 IST 2020                 
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)        for(int ii = a ; ii < b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long    
#define MOD                998244353
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"  
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             (x).begin(),(x).end() 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
#define tough_nut          numeric_limits<int64>::min()
using namespace std ;     
using namespace __gnu_pbds;
 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5; 
const int INF = 2e9;
int tests()
{      
    int  ok = 1;
    int A,B,C,D;
    cin >> A >> B >>C >> D ;
    while(true){
        if(ok){
            C = max(C-B,0);
        }
        else{
            A = max(A-D,0);
        }
        ok =1-ok;
        if(!A)
            return cout << "No\n",0;
        if(!C)
            return cout << "Yes\n",0;

    }
    return 0;
}   
int32_t main(){
    I__O ;          
    //  #ifndef ONLINE_JUDGE 
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout); 
    // #endif
    int cases = 1 ; 
    // cin >> cases ; 
    for(int i = 1 ;i  <= cases ; i++ ){   
    // cout << "Case #" << i << ": ";
      tests(); 
    }
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0 ; 
}
 
// -Wall -Wextra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

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

int main(){
  int64_t N, M;
  cin >> N >> M;
  vector<int64_t> A(M);
  int64_t ans = N;
  for(int64_t i=0; i<M; i++){
    cin >> A.at(i);
    ans -= A.at(i);
  }
  if(ans<0) cout << "-1" << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int n,m,s=1e9,a;
main(){
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>a;
    s=min(s,a);
    m-=a;
  }
  cout<<n+m/s<<endl;
  return 0;
}

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

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, x, m;
    cin >> n >> x >> m;
    vector<int> a;
    a.pb(x);
    map<int, int> mp;
    mp[x] = 0;
    int ans = x;
    int idx_found = -1;
    for (int i = 1; i <= m; i++) {
        int y = a.back() * a.back();
        y %= m;
        if (mp.count(y)) {
            idx_found = mp[y];
            break;
        }
        a.pb(y);
        ans += y;
        mp[y] = i;
        if (a.size() == n) {
            return cout << ans, 0;
        }

    }
    int n_left = n - a.size();
    int sum_of_cycle = 0;
    for (int i = idx_found; i < a.size(); i++) {
        sum_of_cycle += a[i];
    }
    int cycle_size = a.size() - idx_found;
    int add = (n_left/cycle_size) * sum_of_cycle;
    int rem = n_left % cycle_size;
    ans += add;
    for (int i = idx_found; i < idx_found + rem; i++) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
	int n, t;
	int h1, m1, h2, m2;
	string SStation, EStation;

	vector< pair<string, int> > stay(20);
	int ans = 0;

	cin >> n >> t;
	scanf("%d:%d", &h1, &m1);
	cin >> SStation;

	for(int i=0; i < n-1; i++){
		scanf("%d:%d", &h1, &m1);
		cin >> SStation;

		scanf("%d:%d", &h2, &m2);
		cin >> EStation;

		m1 += h1*60;
		m2 += h2*60;
		if(t <= m2-m1){
			stay[ans].first = SStation;
			stay[ans].second = m2-m1;
			ans++;
		}
	}
	scanf("%d:%d", &h1, &m1);
	cin >> SStation;

	cout << ans << endl;
	for(int i=0; i < ans; i++){
		cout << stay[i].first << " " << stay[i].second << endl;
	}
}

Measured memory_bytes: 1264
#include <iostream>

int main()
{
    int h,w;

    while(1)
    {
        std::cin >> h >> w;

        if (h == 0 && w == 0) break;

        for(int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (i == 0 || i == h - 1 || j == 0 || j == w - 1)
                {
                    std::cout << "#";
                }
                else
                {
                    std::cout << ".";
                }
            }

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

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


Measured memory_bytes: 3072
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n, W;
	scanf("%d%d", &n, &W);
	vector<int> w(n), v(n);
	for (int i = 0; i < n; ++i)
		scanf("%d%d", &w[i], &v[i]);
	vector<vector<int> > dp(n + 1, vector<int>(n * 1000 + 1));
	fill(dp[n].begin() + 1, dp[n].end(), W + 1);
	for (int i = n - 1; i >= 0; --i)
		for (int j = 0; j <= n * 1000; ++j) {
			dp[i][j] = min(dp[i + 1][j], dp[i + 1][max(0, j - v[i])] + w[i]);
			if (dp[i][j] > W)
				dp[i][j] = W + 1;
		}
	int res = 1000 * n;
	while (dp[0][res] > W)
		--res;
	printf("%d\n", res);
	return 0;
}

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

int main() {
  string a, b;
  cin >> a >> b;
  
  if (a.size() == b.size()) {
    if (a > b) {
      cout << "GREATER" << endl;
    }
    else if (a < b) {
      cout << "LESS" << endl;
    }
    else {
      cout << "EQUAL" << endl;
    }
  }
  else if (a.size() > b.size()) {
    cout << "GREATER" << endl;
  }
  else {
    cout << "LESS" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){//float?????????double???
int i,j,h,w,a;
a=1;

while(a==1){
scanf("%d %d",&h,&w);
if(h==0&&w==0){
	break;
}
for(i=1;i<=h;i++){
	 for(j=1;j<=w;j++){
		if((j+i)%2==1) printf(".");
		else printf("#");
	}
	printf("\n");
}
printf("\n");
}
return 0;
}

Measured memory_bytes: 1808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a <= 9 && b <= 9) {
			System.out.println(a*b);
		} else {
			System.out.println(-1);
		}
		

	}

}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int l, r, d;
  cin >> l >> r >> d;
  cout << r / d - (l - 1) / d << endl;
  return 0;
}

Measured memory_bytes: 3548
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;
const int N=5e4+10;
int n,K;
char s[N];
struct _SA{
    #define For(i,a,b) for(int i=a;i<=b;i++)
    #define Rof(i,a,b) for(int i=a;i>=b;i--)
    int sa[N],rk[N],c[N],x[N],ht[N],m;
    void init(){
        m=300;
        For(i,1,m)c[i]=0;
        For(i,1,n)sa[i]=rk[i]=ht[i]=0;
    }
    void getsa(){
        For(i,1,n)++c[rk[i]=s[i]];
        For(i,1,m)c[i]+=c[i-1];Rof(i,n,1)sa[c[rk[i]]--]=i;
        for(int k=1;k<=n;k<<=1){
            int p=0;For(i,n-k+1,n)x[++p]=i;
            For(i,1,n)if(sa[i]>k)x[++p]=sa[i]-k;
            For(i,1,m)c[i]=0;For(i,1,n)++c[rk[i]];
            For(i,1,m)c[i]+=c[i-1];
            Rof(i,n,1)sa[c[rk[x[i]]]--]=x[i],x[i]=0;
            swap(rk,x);rk[sa[1]]=1,p=1;
            For(i,2,n)rk[sa[i]]=(x[sa[i]]==x[sa[i-1]]&&x[sa[i]+k]==x[sa[i-1]+k])?p:++p;
            if(p==n)break;m=p;
        }
    }
    void getht(){
        For(i,1,n)rk[sa[i]]=i;int k=0;
        For(i,1,n){
            k=k?k-1:0;int j=sa[rk[i]-1];
            while(s[i+k]==s[j+k]&&i+k<=n&&j+k<=n)k++;
            ht[rk[i]]=k;
        }
        ht[0]=0;
    }
}SA;
bool check(int len){
    int mi=SA.sa[1],mx=SA.sa[1];
    for(int i=2;i<=n;i++){
        if(SA.ht[i]<len)mi=mx=SA.sa[i];
        else{
            mi=min(mi,min(SA.sa[i-1],SA.sa[i]));
            mx=max(mx,max(SA.sa[i-1],SA.sa[i]));
            if(mx-mi>=len)return 1;
        }
    }
    return 0;
}
int main()
{
    scanf("%d",&n);
    scanf("%s",s+1);
    SA.init();SA.getsa();SA.getht();
    //for(int i=1;i<=n;i++)cout<<SA.sa[i]<<" ";cout<<endl;
    int l=1,r=n,ans=0;
    while(l<=r){
        int mid=(l+r)/2;
        if(check(mid)){
            ans=mid;l=mid+1;
        }else{
            r=mid-1;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    string s1, s2, s3;

    cin >> s1 >> s2 >> s3;

    s1 = s1[0]-0x20;
    s2 = s2[0]-0x20;
    s3 = s3[0]-0x20;

    cout << s1[0] << s2[0] << s3[0] << endl;

    return 0;
}

Measured memory_bytes: 256